diff --git a/package.json b/package.json index 0b6dbf7..db24a94 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "private": true, "type": "module", "scripts": { - "tauri": "tauri" + "tauri": "tauri", + "dev": "tauri dev" }, "devDependencies": { "@tauri-apps/cli": "^1.4.0" diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index befbbf0..41b02ef 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -604,22 +604,33 @@ fn validator_list() -> Result { } #[tauri::command(async)] -fn update_node(latest_version: String) -> Result<(), String> { +fn update_node(latest_version: String, exception: String) -> Result<(), String> { let my_boxed_session = unsafe { GLOBAL_STRUCT.as_ref() }.ok_or("There is no active session. Timed out.")?; let mut channel = my_boxed_session .open_session .channel_session() .map_err(|e| e.to_string())?; - let command = format!( - "bash -c -l 'systemctl stop $EXECUTE; - cd celestia-node; - git fetch --tags; - git checkout {latest_version}; - make build; - sudo make install; - systemctl restart $EXECUTE;'" - ); + let command = match exception.as_str() { + "celestia-full" => format!( + "bash -c -l 'systemctl stop $EXECUTE; + cd celestia-node; + git fetch --tags; + git checkout {latest_version}; + make build; + sudo make install; + systemctl restart $EXECUTE;'" + ), + _ => format!( + "bash -c -l 'systemctl stop $EXECUTE; + cd $PROJECT_FOLDER; + git fetch --tags; + git checkout {latest_version}; + make build; + sudo make install; + systemctl restart $EXECUTE;'" + ), + }; channel.exec(&command).map_err(|e| e.to_string())?; let mut s = String::new(); channel.read_to_string(&mut s).map_err(|e| e.to_string())?; diff --git a/src/config.js b/src/config.js index 14ae3c3..670718a 100644 --- a/src/config.js +++ b/src/config.js @@ -1,2 +1 @@ -GOOGLE_API; API_TOKEN; \ No newline at end of file diff --git a/src/node-page.js b/src/node-page.js index 2242b59..a425e77 100644 --- a/src/node-page.js +++ b/src/node-page.js @@ -414,7 +414,7 @@ const nodeOperationsSetup = async () => { updateNodeButton.addEventListener("click", async () => { node_action = "update"; document.body.classList.add("waiting"); - await tauri.invoke("update_node", { latestVersion: latest_tag }).catch(async (err) => { await handleTimeOut(err); }); + await tauri.invoke("update_node", { latestVersion: latest_tag, exception: exception }).catch(async (err) => { await handleTimeOut(err); }); }); deleteNodeButton.addEventListener("click", async () => { if (await dialog.ask("This action cannot be reverted. Are you sure?", { title: "Delete Node", type: "warning" })) {