Browse Source

OCB_URL is now stored in config.py. This will be useful later

deadtom 1 tháng trước cách đây
mục cha
commit
d5408b68b6
2 tập tin đã thay đổi với 25 bổ sung5 xóa
  1. 8 1
      install.sh
  2. 17 4
      upgrade.sh

+ 8 - 1
install.sh

@@ -77,11 +77,18 @@ update_config() {  # Generate key for SECRET_KEY
         echo "Set OWNCAST_URL successfully."
         rm "$bak_file"  # Remove the .bak file if the update was successful
     else
-        echo "Failed to set ACCESS_ID."
+        echo "Failed to set OWNCAST_URL."
         exit 1  # Exit the script with a non-zero status
     fi
 
     read -p "Enter the external URL your OwnchatBot will be using, with \"https://\": " OCB_URL
+    if sed -i.bak "s|OCB_URL = ''|OCB_URL = '$OCB_URL'|" "instance/config.py"; then
+        echo "Set OCB_URL successfully."
+        rm "$bak_file"  # Remove the .bak file if the update was successful
+    else
+        echo "Failed to set OCB_URL."
+        exit 1  # Exit the script with a non-zero status
+    fi
 }
 
 read -p "This app includes an option to integrate Kofi donations and membership rewards into your stream. If you use this feature, you acknowledge that you alone are responsible for backing up and securing the OwnchatBot folder, so as not to lose any data related to rewards your viewiers earned by spending money on Kofi. The developer(s) of OwnchatBot assume no responsibility for any loss of such data. Do you agree to these terms? Type \"yes\" or \"no\": " agreement  # Prompt the user to accept the agreement

+ 17 - 4
upgrade.sh

@@ -12,10 +12,23 @@ install_module() {
     pip install -e . || { echo "Failed to install/upgrade module"; exit 1; }  # Install/upgrade modules
 }
 
-mv instance/alerts instance/assets
+update_config() {
+    local bak_file="instance/config.py.bak"
 
-activate_venv
-install_module
-deactivate
+    read -p "Enter the external URL your OwnchatBot uses, with \"https://\": " OCB_URL
+    
+    if [[ -n "$OCB_URL" ]]; then  # Check if OCB_URL is not empty
+        echo "OCB_URL = '$OCB_URL'" >> instance/config.py  # Append the line to config.py
+        echo "Set OCB_URL successfully."
+        # Optionally create a backup of the original config.py
+        cp instance/config.py "$bak_file"  # Replace this with your backup file variable
+        rm "$bak_file"  # Remove the .bak file if the update was successful
+    else
+        echo "Failed to set OCB_URL. Please provide a valid URL."
+        exit 1  # Exit the script with a non-zero status
+    fi
+}
+
+update_config
 
 echo -e "Your OwnchatBot configuration has been upgraded. Happy streaming!"