浏览代码

fix: update generate.sh to use server.jsonc (#228)

Replace server.json with server.jsonc in generate.sh to fix errors like
'sed: can't read server.json: No such file or directory' when running
'./generate.sh -m'. This aligns with the file rename in commit #199.
Also remove trailing spaces automatically cleaned by editor.

Closes #227
y9938 5 月之前
父节点
当前提交
68bc308422
共有 1 个文件被更改,包括 20 次插入20 次删除
  1. 20 20
      All-in-One-fallbacks-Nginx/generate.sh

+ 20 - 20
All-in-One-fallbacks-Nginx/generate.sh

@@ -45,15 +45,15 @@ Help()
     echo "Please read the contents of this file and change all the required fields."
     echo "Please read the contents of this file and change all the required fields."
     echo "*************************************************************************"
     echo "*************************************************************************"
     echo "*************************************************************************"
     echo "*************************************************************************"
-    echo 
-    echo 
+    echo
+    echo
     echo "Commands"
     echo "Commands"
     echo
     echo
     echo "m     Make and store the configs in result.txt."
     echo "m     Make and store the configs in result.txt."
     echo "r     Revert all the changes."
     echo "r     Revert all the changes."
     echo "q     Print the qr codes of configs in terminal. Run this after running with -m."
     echo "q     Print the qr codes of configs in terminal. Run this after running with -m."
     echo "b     Print one base64 link for all configs in terminal.  Run this after running with -m."
     echo "b     Print one base64 link for all configs in terminal.  Run this after running with -m."
-    echo 
+    echo
     echo
     echo
     echo "Usage: "
     echo "Usage: "
     echo
     echo
@@ -63,7 +63,7 @@ Help()
 
 
 Revert()
 Revert()
 {
 {
-    git restore client.configs/* server.json nginx.conf
+    git restore client.configs/* server.jsonc nginx.conf
 }
 }
 
 
 Make()
 Make()
@@ -71,28 +71,28 @@ Make()
     #################################
     #################################
     #         main domain           #
     #         main domain           #
     #################################
     #################################
-    sed -i "s/$fake_domain_crt_path/$main_domain_crt/g" server.json client.configs/* nginx.conf
-    sed -i "s/$fake_domain_key_path/$main_domain_key/g" server.json client.configs/* nginx.conf
-    sed -i "s/$fake_domain/$main_domain/g" server.json client.configs/* nginx.conf
-    
+    sed -i "s/$fake_domain_crt_path/$main_domain_crt/g" server.jsonc client.configs/* nginx.conf
+    sed -i "s/$fake_domain_key_path/$main_domain_key/g" server.jsonc client.configs/* nginx.conf
+    sed -i "s/$fake_domain/$main_domain/g" server.jsonc client.configs/* nginx.conf
+
     #################################
     #################################
     #       behind cdn domain       #
     #       behind cdn domain       #
     #################################
     #################################
     if [ "$cdn_domain" == "" ]; then
     if [ "$cdn_domain" == "" ]; then
         echo "No domain behind cdn set. Removing related fields."
         echo "No domain behind cdn set. Removing related fields."
-        sed -i "146 s/.$//" server.json
-        sed -i "147,152d" server.json
+        sed -i "146 s/.$//" server.jsonc
+        sed -i "147,152d" server.jsonc
     fi
     fi
-    
-    sed -i "s/$fake_cdn_domain_crt_path/$cdn_domain_crt/g" server.json client.configs/* nginx.conf
-    sed -i "s/$fake_cdn_domain_key_path/$cdn_domain_key/g" server.json client.configs/* nginx.conf
-    sed -i "s/$fake_cdn_domain/$cdn_domain/g" server.json client.configs/* nginx.conf
+
+    sed -i "s/$fake_cdn_domain_crt_path/$cdn_domain_crt/g" server.jsonc client.configs/* nginx.conf
+    sed -i "s/$fake_cdn_domain_key_path/$cdn_domain_key/g" server.jsonc client.configs/* nginx.conf
+    sed -i "s/$fake_cdn_domain/$cdn_domain/g" server.jsonc client.configs/* nginx.conf
 
 
     #################################
     #################################
     #          uuid/pass            #
     #          uuid/pass            #
     #################################
     #################################
-    sed -i "s/$fakeid/$myid/g" server.json client.configs/* nginx.conf
-    sed -i "s/$fakepass/$mypass/g" server.json client.configs/* nginx.conf
+    sed -i "s/$fakeid/$myid/g" server.jsonc client.configs/* nginx.conf
+    sed -i "s/$fakepass/$mypass/g" server.jsonc client.configs/* nginx.conf
 
 
     #################################
     #################################
     #           configs             #
     #           configs             #
@@ -125,19 +125,19 @@ Printqr()
 {
 {
     while read line; do
     while read line; do
         export t=`echo $line | cut -c -2`
         export t=`echo $line | cut -c -2`
-        if [ "$t" == "vm" ]; then  
+        if [ "$t" == "vm" ]; then
             echo $line | cut -c 9- | base64 -d | grep "\"ps\":" | sed -n -e 's/"ps": "//p' | sed -n -e 's/",//p' | sed -n -e 's/ *//p'
             echo $line | cut -c 9- | base64 -d | grep "\"ps\":" | sed -n -e 's/"ps": "//p' | sed -n -e 's/",//p' | sed -n -e 's/ *//p'
             curl qrcode.show -d $line
             curl qrcode.show -d $line
         else
         else
             echo $line | sed -n -e 's/^.*#//p'
             echo $line | sed -n -e 's/^.*#//p'
             curl qrcode.show -d $line
             curl qrcode.show -d $line
-        fi 
+        fi
     done < result.txt
     done < result.txt
 }
 }
 
 
 while getopts "mrqb" option; do
 while getopts "mrqb" option; do
     case $option in
     case $option in
-        r) 
+        r)
             Revert
             Revert
             exit;;
             exit;;
         m)
         m)
@@ -150,7 +150,7 @@ while getopts "mrqb" option; do
             Printqr
             Printqr
             exit;;
             exit;;
 
 
-        \?) 
+        \?)
             Help
             Help
             exit;;
             exit;;
     esac
     esac