From dc32f2759948b747e4be2ebc723e75f2bc8fd8e5 Mon Sep 17 00:00:00 2001 From: Necip Date: Sat, 19 Aug 2023 15:34:22 +0300 Subject: [PATCH] fix: delete node function --- README.md | 2 +- src-tauri/src/cosmos.rs | 2 +- src-tauri/src/main.rs | 48 +++++++++++++++---- src/app.html | 2 +- src/node-page.js | 10 ++-- ...eate-validator.html => add-validator.html} | 9 +++- 6 files changed, 56 insertions(+), 17 deletions(-) rename src/page-content/{create-validator.html => add-validator.html} (95%) diff --git a/README.md b/README.md index e2ac70f..1c00769 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ After the node is installed and synced with the latest block, you can recover an ### Validator Operations -You can perform operations such as "Validator List, Create Validator, Edit Validator, Withdraw Rewards, Delegate, Redelegate, Vote, Unjail, Send Token, Wallets, Logs" of your Node from the Validator Operations section. +You can perform operations such as "Validator List, Add Validator, Edit Validator, Withdraw Rewards, Delegate, Redelegate, Vote, Unjail, Send Token, Wallets, Logs" of your Node from the Validator Operations section. You can easily update your node with the latest binary versions, participate in network proposals, unjail your node if necessary, send tokens, delegate(stake) tokens to your node or other validators, redelegate tokens, and manage your wallets securely. Klein empowers you to perform all the necessary tasks and operations on your node without complex command-line interactions. It's a convenient and efficient solution for managing and maximizing the potential of your blockchain node. ![](/docs/images/image5.png) diff --git a/src-tauri/src/cosmos.rs b/src-tauri/src/cosmos.rs index e33a938..7fb9102 100644 --- a/src-tauri/src/cosmos.rs +++ b/src-tauri/src/cosmos.rs @@ -104,7 +104,7 @@ fn delete_node(mut GLOBAL_STRUCT:Option) { channel .exec(&format!( - "bash -c -l \"sudo systemctl stop $EXECUTE; sudo systemctl disable $EXECUTE; sudo rm -rf /etc/systemd/system/$EXECUTE* $(which $EXECUTE) $HOME/$SYSTEM_FOLDER* $HOME/$SYSTEM_FILE* $HOME/$EXECUTE*; sed -i '/EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /PATH/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d' ~/.bash_profile; source .bash_profile; unset EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE PATH REPO MONIKER SNAPSHOT_URL WALLET_NAME\"" + "bash -c -l \"sudo systemctl stop $EXECUTE; sudo systemctl disable $EXECUTE; sudo rm -rf /etc/systemd/system/$EXECUTE* $(which $EXECUTE) $HOME/$SYSTEM_FOLDER* $HOME/$EXECUTE*; sed -i '/EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /PATH/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d' ~/.bash_profile; source .bash_profile; unset EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE PATH REPO MONIKER SNAPSHOT_URL WALLET_NAME\"" )) .unwrap(); let mut s = String::new(); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c7ec00c..befbbf0 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -252,19 +252,51 @@ fn delete_node(exception: String) -> Result<(), String> { .channel_session() .map_err(|e| e.to_string())?; let command = match exception.as_str() { - "celestia-light" => format!( - r#"bash -c -l "sudo systemctl stop $EXECUTE; sudo systemctl disable $EXECUTE; + "celestia-light" => format!(r#"bash -c -l " + sudo systemctl stop $EXECUTE; + sudo systemctl disable $EXECUTE; pkill -f $EXECUTE; - sudo rm -rf .celestia-app .celestia-light-blockspacerace-0 /etc/systemd/system/$EXECUTE* $(which celestia) $(which celestia-appd) $SYSTEM_FOLDER* $HOME/$SYSTEM_FOLDER* $HOME/$SYSTEM_FILE* $HOME/$EXECUTE*; + sudo rm -rf .celestia-app .celestia-light-blockspacerace-0; + sudo rm -rf $(which celestia); + sudo rm -rf $(which celestia-appd); + if [ -d "/etc/systemd/system/$EXECUTE*" ]; then + sudo rm -rf "/etc/systemd/system/${{EXECUTE}}"*; + fi + if [ -d "$HOME/$SYSTEM_FOLDER" ]; then + sudo rm -rf "$HOME/$SYSTEM_FOLDER"*; + fi + if [ -d "$HOME/$PROJECT_FOLDER" ]; then + sudo rm -rf "$HOME/$PROJECT_FOLDER"*; + fi + if [ -d "$HOME/$EXECUTE" ]; then + sudo rm -rf "$HOME/$EXECUTE"*; + fi + sudo rm -rf /usr/local/go /root/go; sed -i '/MAIN_WALLET_NAME/d; /MAIN_WALLET_ADDRESS/d; /NODE_PROPERLY_INSTALLED/d; /EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d' ~/.bash_profile; source ~/.bash_profile; unset NODE_PROPERLY_INSTALLED EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE REPO MONIKER SNAPSHOT_URL WALLET_NAME""# ), - _ => format!( - r#"bash -c -l "sudo systemctl stop $EXECUTE; sudo systemctl disable $EXECUTE; + _ => format!(r#"bash -c -l ' + sudo systemctl stop $EXECUTE; + sudo systemctl disable $EXECUTE; pkill -f $EXECUTE; - sudo rm -rf /etc/systemd/system/$EXECUTE* $(which $EXECUTE) $HOME/$SYSTEM_FILE* $HOME/$EXECUTE* $SYSTEM_FOLDER* $HOME/$SYSTEM_FOLDER*; - sed -i '/MAIN_WALLET_NAME/d; /MAIN_WALLET_ADDRESS/d; /NODE_PROPERLY_INSTALLED/d; /EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d' ~/.bash_profile; source ~/.bash_profile; - unset NODE_PROPERLY_INSTALLED EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE REPO MONIKER SNAPSHOT_URL WALLET_NAME""# + if [ -d "/etc/systemd/system/$EXECUTE" ]; then + sudo rm -rf "/etc/systemd/system/${{EXECUTE}}"*; + fi + if [ -d "$(which $EXECUTE)" ]; then + sudo rm -rf "$(which $EXECUTE)"*; + fi + if [ -d "$HOME/$SYSTEM_FOLDER" ]; then + sudo rm -rf "$HOME/$SYSTEM_FOLDER"*; + fi + if [ -d "$HOME/$PROJECT_FOLDER" ]; then + sudo rm -rf "$HOME/$PROJECT_FOLDER"*; + fi + if [ -d "$HOME/$EXECUTE" ]; then + sudo rm -rf "$HOME/$EXECUTE"*; + fi + sudo rm -rf /usr/local/go /root/go; + sed -i "/MAIN_WALLET_NAME/d; /MAIN_WALLET_ADDRESS/d; /NODE_PROPERLY_INSTALLED/d; /EXECUTE/d; /CHAIN_ID/d; /PORT/d; /DENOM/d; /SEEDS/d; /PEERS/d; /VERSION/d; /SYSTEM_FOLDER/d; /PROJECT_FOLDER/d; /GO_VERSION/d; /GENESIS_FILE/d; /ADDRBOOK/d; /MIN_GAS/d; /SEED_MODE/d; /REPO/d; /MONIKER/d; /SNAPSHOT_URL/d; /WALLET_NAME/d" ~/.bash_profile; source ~/.bash_profile; + unset NODE_PROPERLY_INSTALLED EXECUTE CHAIN_ID PORT DENOM SEEDS PEERS VERSION SYSTEM_FOLDER PROJECT_FOLDER GO_VERSION GENESIS_FILE ADDRBOOK MIN_GAS SEED_MODE REPO MONIKER SNAPSHOT_URL WALLET_NAME'"# ), }; channel.exec(&command).map_err(|e| e.to_string())?; diff --git a/src/app.html b/src/app.html index 0c3c83f..d8b691e 100644 --- a/src/app.html +++ b/src/app.html @@ -354,7 +354,7 @@