Jelajahi Sumber

auto update script executed

Toby Chui 1 tahun lalu
induk
melakukan
0b44333ba2
4 mengubah file dengan 90 tambahan dan 4 penghapusan
  1. 2 2
      main.go
  2. 7 2
      mod/acme/acme.go
  3. 75 0
      web/components/webserv.html
  4. 6 0
      web/index.html

+ 2 - 2
main.go

@@ -43,9 +43,9 @@ var acmeAutoRenewInterval = flag.Int("autorenew", 86400, "ACME auto TLS/SSL cert
 var enableHighSpeedGeoIPLookup = flag.Bool("fastgeoip", false, "Enable high speed geoip lookup, require 1GB extra memory (Not recommend for low end devices)")
 var (
 	name        = "Zoraxy"
-	version     = "2.6.6"
+	version     = "2.6.7"
 	nodeUUID    = "generic"
-	development = false //Set this to false to use embedded web fs
+	development = true //Set this to false to use embedded web fs
 	bootTime    = time.Now().Unix()
 
 	/*

+ 7 - 2
mod/acme/acme.go

@@ -303,18 +303,23 @@ func (a *ACMEHandler) HandleRenewCertificate(w http.ResponseWriter, r *http.Requ
 
 	ca, err := utils.PostPara(r, "ca")
 	if err != nil {
-		log.Println("CA not set. Using default")
+		log.Println("[INFO] CA not set. Using default")
 		ca, caUrl = "", ""
 	}
 
 	if ca == "custom" {
 		caUrl, err = utils.PostPara(r, "caURL")
 		if err != nil {
-			log.Println("Custom CA set but no URL provide, Using default")
+			log.Println("[INFO] Custom CA set but no URL provide, Using default")
 			ca, caUrl = "", ""
 		}
 	}
 
+	if ca == "" {
+		//default. Use Let's Encrypt
+		ca = "Let's Encrypt"
+	}
+
 	var skipTLS bool
 
 	if skipTLSString, err := utils.PostPara(r, "skipTLS"); err != nil {

+ 75 - 0
web/components/webserv.html

@@ -0,0 +1,75 @@
+<div class="standardContainer">
+    <div class="ui basic segment">
+        <h2>Static Web Server</h2>
+        <p>A simple static web server that serve html css and js files</p>
+    </div>
+    <div class="ui divider"></div>
+    <h3>Web Server Settings</h3>
+    <div class="ui form">
+        <div class="field">
+            <label>Document Root Folder</label>
+            <input id="webserv_docRoot" type="text" readonly="true">
+            <small>
+                The web server root folder can only be changed via startup flags of zoraxy for security reasons. 
+                See the -webserv flag for more details.
+            </small>
+        </div>
+        <div class="field">
+            <label>Port Number</label>
+            <input id="webserv_docRoot" type="number" step="1" min="0" max="65535" value="8081" onchange="updateWebServLinkExample(this.value);">
+            <small>Use <code>http://127.0.0.1:<span class="webserv_port">8081</span></code> in proxy rules to access the web server</small>
+        </div>
+        <div class="inline field">
+            <div class="ui toggle checkbox">
+                <input id="webserv_enable" type="checkbox" class="hidden">
+                <label>Enable Static Web Server</label>
+                <small>Enable static web server. Use %webserv% in proxy rules to enable </small>
+            </div>
+        </div>
+        <div class="inline field">
+            <div class="ui toggle checkbox">
+            <input id="webserv_enableDirList" type="checkbox" class="hidden">
+            <label>Enable Directory Listing</label>
+            </div>
+        </div>
+    </div>
+    <br>
+    <div class="ui message">
+        <div class="ui accordion webservhelp">
+            <div class="title">
+                <i class="dropdown icon"></i>
+                How to access the static web server?
+            </div>
+            <div class="content">
+                There are three ways to access the static web server. <br>
+                <div class="ui ordered list">
+                    <div class="item">
+                        If you are using Zoraxy as your gateway reverse proxy server, 
+                        you can add a new subdomain proxy rule that points to 
+                        <a>http://127.0.0.1:<span class="webserv_port">8081</span></a>
+                    </div>
+                    <div class="item">
+                        If you are using Zoraxy under another reverse proxy server, 
+                        add <a>http://127.0.0.1:<span class="webserv_port">8081</span></a> to the config of your upper layer reverse proxy server's config file. 
+                    </div>
+                    <div class="item">
+                        Directly access the web server via <a>http://{zoraxy_host_ip}:<span class="webserv_port">8081</span></a> (Not recommended)
+                    </div>
+                    <br>
+                </div>
+                
+            </div>
+        </div>
+    </div>
+    
+    <div class="ui divider"></div>
+
+
+    <script>
+        $(".webservhelp").accordion();
+
+        function updateWebServLinkExample(newport){
+            $(".webserv_port").text(newport);
+        }
+    </script>
+</div>

+ 6 - 0
web/index.html

@@ -69,6 +69,9 @@
                         <i class="simplistic exchange icon"></i> TCP Proxy
                     </a>
                     <div class="ui divider menudivider">Others</div>
+                    <a class="item" tag="webserv">
+                        <i class="simplistic globe icon"></i> Static Web Server
+                    </a>
                     <a class="item" tag="utm">
                         <i class="simplistic time icon"></i> Uptime Monitor
                     </a>
@@ -117,6 +120,9 @@
                 <!-- TCP Proxy -->
                 <div id="tcpprox" class="functiontab" target="tcpprox.html"></div>
 
+                <!-- Web Server -->
+                <div id="webserv" class="functiontab" target="webserv.html"></div>
+
                 <!-- Up Time Monitor -->
                 <div id="utm" class="functiontab" target="uptime.html"></div>