Procházet zdrojové kódy

auto update script executed

Toby Chui před 1 rokem
rodič
revize
393d560ae3
2 změnil soubory, kde provedl 88 přidání a 79 odebrání
  1. 6 4
      mod/tcpprox/tcpprox.go
  2. 82 75
      web/components/tcpprox.html

+ 6 - 4
mod/tcpprox/tcpprox.go

@@ -132,10 +132,12 @@ func (m *Manager) EditConfig(configUUID string, newName string, newPortA string,
 		foundConfig.Timeout = newTimeout
 	}
 
-	err = foundConfig.ValidateConfigs()
-	if err != nil {
-		return err
-	}
+	/*
+		err = foundConfig.ValidateConfigs()
+		if err != nil {
+			return err
+		}
+	*/
 
 	m.SaveConfigToDatabase()
 

+ 82 - 75
web/components/tcpprox.html

@@ -41,81 +41,21 @@
             </div>
             <button id="addTcpProxyButton" class="ui basic button" type="submit"><i class="ui blue add icon"></i> Create</button>  
             <button id="editTcpProxyButton" class="ui basic button" onclick="confirmEditTCPProxyConfig(event);"><i class="ui blue save icon"></i> Update</button>  
-            <table class="ui celled padded table">
-                <thead>
-                  <tr><th class="single line">Mode</th>
-                  <th>Public-IP</th>
-                  <th>Concurrent Access</th>
-                  <th>Flow Diagram</th>
-                </tr></thead>
-                <tbody>
-                  <tr>
-                    <td>
-                      <h3 class="ui center aligned header">Listen</h3>
-                    </td>
-                    <td class="single line">
-                        Server: <i class="ui green check icon"></i><br>
-                        A: <i class="ui remove icon"></i><br>
-                        B: <i class="ui remove icon"></i><br>
-                    </td>
-                    <td>
-                        <i class="ui red times icon"></i>
-                    </td>
-                    <td>Port A (e.g. 8080) <i class="arrow right icon"></i> Server<br>
-                        Port B (e.g. 8081) <i class="arrow right icon"></i> Server<br>
-                        <small>Server will act as a bridge to proxy traffic between Port A and B</small>
-                    </td>
-                  </tr>
-                  <tr>
-                    <td>
-                      <h3 class="ui center aligned header">Transport</h3>
-                    </td>
-                    <td class="single line">
-                        Server: <i class="ui green check icon"></i><br>
-                        A: <i class="ui remove icon"></i><br>
-                        B: <i class="ui green check icon"></i> (or same LAN)<br>
-                    </td>
-                    <td>
-                        <i class="ui green check icon"></i>
-                    </td>
-                    <td>Port A (e.g. 25565) <i class="arrow right icon"></i> Server<br>
-                        Server <i class="arrow right icon"></i> Port B (e.g. 192.168.0.2:25565)<br>
-                        <small>Traffic from Port A will be forward to Port B's (IP if provided and) Port</small>
-                    </td>
-                  </tr>
-                  <tr>
-                    <td>
-                      <h3 class="ui center aligned header">Starter</h3>
-                    </td>
-                    <td class="single line">
-                        Server: <i class="ui times icon"></i><br>
-                        A: <i class="ui green check icon"></i><br>
-                        B: <i class="ui green check icon"></i><br>
-                    </td>
-                    <td>
-                        <i class="ui red times icon"></i>
-                    </td>
-                    <td>Server <i class="arrow right icon"></i> Port A (e.g. remote.local.:8080) <br>
-                        Server <i class="arrow right icon"></i> Port B (e.g. recv.local.:8081) <br>
-                        <small>Port A and B will be actively bridged</small>
-                    </td>
-                  </tr>
-                </tbody>
-              </table>
+            
             
         </form>
         <div class="ui divider"></div>
     </div>
     <div class="ui basic segment">
-        <div style="overflow-x: auto;">
-            <h3>TCP Proxy Configs</h3>
-            <p>A list of TCP proxy configs created on this host. To enable them, use the toggle button on the right.</p>
-            <table id="proxyTable" class="ui basic celled unstackable table">
+        <h3>TCP Proxy Configs</h3>
+        <p>A list of TCP proxy configs created on this host. To enable them, use the toggle button on the right.</p>
+        <div style="overflow-x: auto; min-height: 400px;">
+            <table id="proxyTable" class="ui celled unstackable table">
                 <thead>
                     <tr>
                         <th>Name</th>
-                        <th>PortA</th>
-                        <th>PortB</th>
+                        <th>Port/Addr A</th>
+                        <th>Port/Addr B</th>
                         <th>Mode</th>
                         <th>Timeout (s)</th>
                         <th>Actions</th>
@@ -127,6 +67,72 @@
             </table>
         </div>
     </div>
+    <div class="ui basic inverted segment" style="background-color: #414141; border-radius: 0.6em;">
+        <h3>Proxy Mode</h3>
+        <p>TCP Proxy support the following TCP sockets proxy modes</p>
+        <table class="ui celled padded inverted basic table">
+            <thead>
+              <tr><th class="single line">Mode</th>
+              <th>Public-IP</th>
+              <th>Concurrent Access</th>
+              <th>Flow Diagram</th>
+            </tr></thead>
+            <tbody>
+              <tr>
+                <td>
+                  <h4 class="ui center aligned inverted header">Transport</h4>
+                </td>
+                <td class="single line">
+                    Server: <i class="ui green check icon"></i><br>
+                    A: <i class="ui remove icon"></i><br>
+                    B: <i class="ui green check icon"></i> (or same LAN)<br>
+                </td>
+                <td>
+                    <i class="ui green check icon"></i>
+                </td>
+                <td>Port A (e.g. 25565) <i class="arrow right icon"></i> Server<br>
+                    Server <i class="arrow right icon"></i> Port B (e.g. 192.168.0.2:25565)<br>
+                    <small>Traffic from Port A will be forward to Port B's (IP if provided and) Port</small>
+                </td>
+              </tr>
+              <tr>
+                <td>
+                  <h4 class="ui center aligned inverted header">Listen</h4>
+                </td>
+                <td class="single line">
+                    Server: <i class="ui green check icon"></i><br>
+                    A: <i class="ui remove icon"></i><br>
+                    B: <i class="ui remove icon"></i><br>
+                </td>
+                <td>
+                    <i class="ui red times icon"></i>
+                </td>
+                <td>Port A (e.g. 8080) <i class="arrow right icon"></i> Server<br>
+                    Port B (e.g. 8081) <i class="arrow right icon"></i> Server<br>
+                    <small>Server will act as a bridge to proxy traffic between Port A and B</small>
+                </td>
+              </tr>
+              <tr>
+                <td>
+                  <h4 class="ui center aligned inverted header">Starter</h4>
+                </td>
+                <td class="single line">
+                    Server: <i class="ui times icon"></i><br>
+                    A: <i class="ui green check icon"></i><br>
+                    B: <i class="ui green check icon"></i><br>
+                </td>
+                <td>
+                    <i class="ui red times icon"></i>
+                </td>
+                <td>Server <i class="arrow right icon"></i> Port A (e.g. remote.local.:8080) <br>
+                    Server <i class="arrow right icon"></i> Port B (e.g. recv.local.:8081) <br>
+                    <small>Port A and B will be actively bridged</small>
+                </td>
+              </tr>
+            </tbody>
+          </table>
+        </div>
+    </div>
     <script>
         let editingTCPProxyConfigUUID = ""; //The current editing TCP Proxy config UUID
 
@@ -206,10 +212,10 @@
                
                 proxyConfigs.forEach(function(config) {
                     var runningLogo = '<i class="red circle icon"></i>';
-                    var startButton = `<button onclick="startTcpProx('${config.UUID}');" class="ui button" title="Start Proxy"><i class="play icon"></i></button>`;
+                    var startButton = `<button onclick="startTcpProx('${config.UUID}');" class="ui button" title="Start Proxy"><i class="play icon"></i> Start Proxy</button>`;
                     if (config.Running){
                         runningLogo = '<i class="green circle icon"></i>';
-                        startButton = `<button onclick="stopTcpProx('${config.UUID}');" class="ui button" title="Start Proxy"><i class="red stop icon"></i></button>`;
+                        startButton = `<button onclick="stopTcpProx('${config.UUID}');" class="ui button" title="Start Proxy"><i class="red stop icon"></i> Stop Proxy</button>`;
                     }
 
                     var modeText = "Unknown";
@@ -230,11 +236,11 @@
                     row.append($('<td>').text(modeText));
                     row.append($('<td>').text(config.Timeout));
                     row.append($('<td>').html(`
-                        <div class="ui basic icon buttons">
-                            <button class="ui button" onclick="validateProxyConfig('${config.UUID}', this);" title="Validate Config"><i class="teal question circle outline icon"></i></button>
+                        <div class="ui basic vertical fluid tiny buttons">
+                            <button class="ui button" onclick="validateProxyConfig('${config.UUID}', this);" title="Validate Config"><i class="teal question circle outline icon"></i> CXN Test</button>
                             ${startButton}
-                            <button onclick="editTCPProxyConfig('${config.UUID}');" class="ui button" title="Edit Config"><i class="edit icon"></i></button>
-                            <button onclick="deleteTCPProxyConfig('${config.UUID}');" class="ui red button" title="Delete Config"><i class="trash icon"></i></button>
+                            <button onclick="editTCPProxyConfig('${config.UUID}');" class="ui button" title="Edit Config"><i class="edit icon"></i> Edit </button>
+                            <button onclick="deleteTCPProxyConfig('${config.UUID}');" class="ui red basic button" title="Delete Config"><i class="trash icon"></i> Remove</button>
                         </div>
                     `));
                     tableBody.append(row);
@@ -261,10 +267,11 @@
                 data: {uuid: configUUID},
                 success: function(data){
                     if (data.error != undefined){
-                        $(btn).html(`<i class="red times icon"></i>`);
+                        let errormsg = data.error.charAt(0).toUpperCase() + data.error.slice(1);
+                        $(btn).html(`<i class="red times icon"></i> ${errormsg}`);
                         msgbox(data.error, false, 6000);
                     }else{
-                        $(btn).html(`<i class="green check icon"></i>`);
+                        $(btn).html(`<i class="green check icon"></i> Config Valid`);
                         msgbox("Config Check Passed");
                     }
                 }