Просмотр исходного кода

gui: Add advance config port mapping to gui (fixes #4824) (#7017)

Rahmi Pruitt 5 лет назад
Родитель
Сommit
2f6a25a56f

+ 8 - 0
gui/default/index.html

@@ -802,6 +802,14 @@
                         <th><span class="fas fa-fw fa-folder"></span>&nbsp;<span translate>Folders</span></th>
                         <td class="text-right" ng-attr-title="{{deviceFolders(deviceCfg).map(folderLabel).join(', ')}}">{{deviceFolders(deviceCfg).map(folderLabel).join(", ")}}</td>
                       </tr>
+                      <tr ng-if="deviceCfg.remoteGUIPort > 0">
+                        <th><span class="fas fa-fw fa-desktop"></span>&nbsp;<span translate>Remote GUI</span></th>
+                        <td class="text-right" ng-attr-title="Port {{deviceCfg.remoteGUIPort}}">
+                          <!-- Apply RFC6874 encoding for IPv6 link-local zone identifier -->
+                          <a ng-if="idToRemoteGUI[deviceCfg.deviceID]" href="{{idToRemoteGUI[deviceCfg.deviceID].replace('%', '%25')}}">{{idToRemoteGUI[deviceCfg.deviceID]}}</a>
+                          <span ng-if="!idToRemoteGUI[deviceCfg.deviceID]">Unreachable</span>
+                        </td>
+                      </tr>
                     </tbody>
                   </table>
                 </div>

+ 80 - 0
gui/default/syncthing/core/syncthingController.js

@@ -24,6 +24,9 @@ angular.module('syncthing.core')
         $scope.config = {};
         $scope.configInSync = true;
         $scope.connections = {};
+        $scope.idToRemoteGUI = {};
+        $scope.remoteGUICache = {};
+        $scope.showRemoteGUI = true;
         $scope.errors = [];
         $scope.model = {};
         $scope.myID = '';
@@ -61,6 +64,10 @@ angular.module('syncthing.core')
             $scope.metricRates = (window.localStorage["metricRates"] == "true");
         } catch (exception) { }
 
+        if ("showRemoteGUI" in window.localStorage) {
+            $scope.showRemoteGUI = (window.localStorage["showRemoteGUI"] == "true");
+        }
+
         $scope.folderDefaults = {
             devices: [],
             type: "sendreceive",
@@ -375,6 +382,7 @@ angular.module('syncthing.core')
             $scope.config.options._globalAnnounceServersStr = $scope.config.options.globalAnnounceServers.join(', ');
             $scope.config.options._urAcceptedStr = "" + $scope.config.options.urAccepted;
 
+            $scope.config.gui["showRemoteGUI"] = $scope.showRemoteGUI;
             $scope.devices = deviceMap($scope.config.devices);
             for (var id in $scope.devices) {
                 $scope.completion[id] = {
@@ -517,6 +525,16 @@ angular.module('syncthing.core')
             console.log("recalcCompletion", device, $scope.completion[device]);
         }
 
+        function replaceAddressPort(address, newPort) {
+            var lastColonIndex = address.length;
+            for (var index = 0; index < address.length; index++) {
+                if (address[index] === ":") {
+                    lastColonIndex = index;
+                }
+            }
+            return address.substr(0, lastColonIndex) + ":" + newPort.toString();
+        }
+
         function refreshCompletion(device, folder) {
             if (device === $scope.myID) {
                 return;
@@ -563,9 +581,50 @@ angular.module('syncthing.core')
                 }
                 $scope.connections = data;
                 console.log("refreshConnections", data);
+
+                refreshRemoteGUI(data);
             }).error($scope.emitHTTPError);
         }
 
+        function refreshRemoteGUI(connections) {
+            if (!$scope.showRemoteGUI) {
+                $scope.idToRemoteGUI = {}
+                return
+            }
+            var newCache = {};
+            for (var id in connections) {
+                if (!(id in $scope.devices)) {
+                    // Avoid errors when called before first updateLocalConfig()
+                    continue;
+                }
+                var port = $scope.devices[id].remoteGUIPort;
+                if (port <= 0
+                    || !connections[id].address
+                    || connections[id].type.includes("relay")) {
+                    // Relay connections never work as desired here, nor incomplete addresses
+                    $scope.idToRemoteGUI[id] = "";
+                    continue;
+                }
+                var newAddress = "http://" + replaceAddressPort(connections[id].address, port);
+                if (!(newAddress in $scope.remoteGUICache)) {
+                    // No cached result, trigger a new port probing asynchronously
+                    $scope.probeRemoteGUIAddress(id, newAddress);
+                } else {
+                    newCache[newAddress] = $scope.remoteGUICache[newAddress];
+                    // Copy cached probing result in the corner case of duplicate GUI
+                    // addresses for different devices.  Which is useless, but
+                    // possible when behind the same NAT router.
+                    if (newCache[newAddress]) {
+                        $scope.idToRemoteGUI[id] = newAddress;
+                    } else {
+                        $scope.idToRemoteGUI[id] = "";
+                    }
+                }
+            }
+            // Replace the cache to discard stale addresses
+            $scope.remoteGUICache = newCache;
+        }
+
         function refreshErrors() {
             $http.get(urlbase + '/system/error').success(function (data) {
                 $scope.errors = data.errors;
@@ -584,6 +643,22 @@ angular.module('syncthing.core')
             }).error($scope.emitHTTPError);
         }
 
+        $scope.probeRemoteGUIAddress = function (deviceId, address) {
+            // Strip off possible IPv6 link-local zone identifier, as Angular chokes on it
+            // with an (ugly, unjustified) console error message.
+            var urlAddress = address.replace(/%[a-zA-Z0-9_\.\-]*\]/, ']');
+            $http({
+                method: "OPTIONS",
+                url: urlAddress,
+            }).success(function (data) {
+                $scope.remoteGUICache[address] = true;
+                $scope.idToRemoteGUI[deviceId] = address;
+            }).error(function (err) {
+                $scope.remoteGUICache[address] = false;
+                $scope.idToRemoteGUI[deviceId] = "";
+            });
+        }
+
         $scope.refreshNeed = function (page, perpage) {
             if (!$scope.neededFolder) {
                 return;
@@ -1242,6 +1317,11 @@ angular.module('syncthing.core')
         };
 
         $scope.saveConfig = function (callback) {
+            // set local storage feature and delete from post request
+            window.localStorage.setItem("showRemoteGUI", $scope.config.gui.showRemoteGUI ? "true" : "false");
+            $scope.showRemoteGUI = $scope.config.gui.showRemoteGUI;
+            delete $scope.config.gui.showRemoteGUI;
+
             var cfg = JSON.stringify($scope.config);
             var opts = {
                 headers: {

+ 8 - 0
gui/default/untrusted/index.html

@@ -814,6 +814,14 @@
                         <th><span class="fas fa-fw fa-folder"></span>&nbsp;<span translate>Folders</span></th>
                         <td class="text-right" ng-attr-title="{{deviceFolders(deviceCfg).map(folderLabel).join(', ')}}">{{deviceFolders(deviceCfg).map(folderLabel).join(", ")}}</td>
                       </tr>
+                      <tr ng-if="deviceCfg.remoteGUIPort > 0">
+			<th><span class="fas fa-fw fa-desktop"></span>&nbsp;<span translate>Remote GUI</span></th>
+			<td class="text-right" ng-attr-title="Port {{deviceCfg.remoteGUIPort}}">
+                          <!-- Apply RFC6874 encoding for IPv6 link-local zone identifier -->
+                          <a ng-if="idToRemoteGUI[deviceCfg.deviceID]" href="{{idToRemoteGUI[deviceCfg.deviceID].replace('%', '%25')}}">{{idToRemoteGUI[deviceCfg.deviceID]}}</a>
+                          <span ng-if="!idToRemoteGUI[deviceCfg.deviceID]">Unreachable</span>
+			</td>
+                      </tr>
                     </tbody>
                   </table>
                 </div>

+ 81 - 0
gui/default/untrusted/syncthing/core/syncthingController.js

@@ -24,6 +24,9 @@ angular.module('syncthing.core')
         $scope.config = {};
         $scope.configInSync = true;
         $scope.connections = {};
+        $scope.idToRemoteGUI = {};
+        $scope.remoteGUICache = {};
+        $scope.showRemoteGUI = true;
         $scope.errors = [];
         $scope.model = {};
         $scope.myID = '';
@@ -61,6 +64,10 @@ angular.module('syncthing.core')
             $scope.metricRates = (window.localStorage["metricRates"] == "true");
         } catch (exception) { }
 
+        if ("showRemoteGUI" in window.localStorage) {
+            $scope.showRemoteGUI = (window.localStorage["showRemoteGUI"] == "true");
+        }
+
         $scope.folderDefaults = {
             devices: [],
             type: "sendreceive",
@@ -375,6 +382,7 @@ angular.module('syncthing.core')
             $scope.config.options._globalAnnounceServersStr = $scope.config.options.globalAnnounceServers.join(', ');
             $scope.config.options._urAcceptedStr = "" + $scope.config.options.urAccepted;
 
+            $scope.config.gui["showRemoteGUI"] = $scope.showRemoteGUI;
             $scope.devices = deviceMap($scope.config.devices);
             for (var id in $scope.devices) {
                 $scope.completion[id] = {
@@ -517,6 +525,16 @@ angular.module('syncthing.core')
             console.log("recalcCompletion", device, $scope.completion[device]);
         }
 
+        function replaceAddressPort(address, newPort) {
+            var lastColonIndex = address.length;
+            for (var index = 0; index < address.length; index++) {
+                if (address[index] === ":") {
+                    lastColonIndex = index;
+                }
+            }
+            return address.substr(0, lastColonIndex) + ":" + newPort.toString();
+        }
+
         function refreshCompletion(device, folder) {
             if (device === $scope.myID) {
                 return;
@@ -563,9 +581,50 @@ angular.module('syncthing.core')
                 }
                 $scope.connections = data;
                 console.log("refreshConnections", data);
+
+                refreshRemoteGUI(data);
             }).error($scope.emitHTTPError);
         }
 
+        function refreshRemoteGUI(connections) {
+            if (!$scope.showRemoteGUI) {
+                $scope.idToRemoteGUI = {}
+                return
+            }
+            var newCache = {};
+            for (var id in connections) {
+                if (!(id in $scope.devices)) {
+                    // Avoid errors when called before first updateLocalConfig()
+                    continue;
+                }
+                var port = $scope.devices[id].remoteGUIPort;
+                if (port <= 0
+                    || !connections[id].address
+                    || connections[id].type.includes("relay")) {
+                    // Relay connections never work as desired here, nor incomplete addresses
+                    $scope.idToRemoteGUI[id] = "";
+                    continue;
+                }
+                var newAddress = "http://" + replaceAddressPort(connections[id].address, port);
+                if (!(newAddress in $scope.remoteGUICache)) {
+                    // No cached result, trigger a new port probing asynchronously
+                    $scope.probeRemoteGUIAddress(id, newAddress);
+                } else {
+                    newCache[newAddress] = $scope.remoteGUICache[newAddress];
+                    // Copy cached probing result in the corner case of duplicate GUI
+                    // addresses for different devices.  Which is useless, but
+                    // possible when behind the same NAT router.
+                    if (newCache[newAddress]) {
+                        $scope.idToRemoteGUI[id] = newAddress;
+                    } else {
+                        $scope.idToRemoteGUI[id] = "";
+                    }
+                }
+            }
+            // Replace the cache to discard stale addresses
+            $scope.remoteGUICache = newCache;
+        }
+
         function refreshErrors() {
             $http.get(urlbase + '/system/error').success(function (data) {
                 $scope.errors = data.errors;
@@ -584,6 +643,23 @@ angular.module('syncthing.core')
             }).error($scope.emitHTTPError);
         }
 
+        $scope.probeRemoteGUIAddress = function (deviceId, address) {
+            // Strip off possible IPv6 link-local zone identifier, as Angular chokes on it
+            // with an (ugly, unjustified) console error message.
+            var urlAddress = address.replace(/%[a-zA-Z0-9_\.\-]*\]/, ']');
+            console.log(urlAddress);
+            $http({
+                method: "OPTIONS",
+                url: urlAddress,
+            }).success(function (data) {
+                $scope.remoteGUICache[address] = true;
+                $scope.idToRemoteGUI[deviceId] = address;
+            }).error(function (err) {
+                $scope.remoteGUICache[address] = false;
+                $scope.idToRemoteGUI[deviceId] = "";
+            });
+        }
+
         $scope.refreshNeed = function (page, perpage) {
             if (!$scope.neededFolder) {
                 return;
@@ -1248,6 +1324,11 @@ angular.module('syncthing.core')
         };
 
         $scope.saveConfig = function (callback) {
+            // set local storage feature and delete from post request
+            window.localStorage.setItem("showRemoteGUI", $scope.config.gui.showRemoteGUI ? "true" : "false");
+            $scope.showRemoteGUI = $scope.config.gui.showRemoteGUI;
+            delete $scope.config.gui.showRemoteGUI;
+
             var cfg = JSON.stringify($scope.config);
             var opts = {
                 headers: {

+ 93 - 60
lib/config/deviceconfiguration.pb.go

@@ -43,6 +43,7 @@ type DeviceConfiguration struct {
 	PendingFolders           []ObservedFolder                                     `protobuf:"bytes,15,rep,name=pending_folders,json=pendingFolders,proto3" json:"pendingFolders" xml:"pendingFolder"`
 	MaxRequestKiB            int                                                  `protobuf:"varint,16,opt,name=max_request_kib,json=maxRequestKib,proto3,casttype=int" json:"maxRequestKiB" xml:"maxRequestKiB"`
 	Untrusted                bool                                                 `protobuf:"varint,17,opt,name=untrusted,proto3" json:"untrusted" xml:"untrusted"`
+	RemoteGUIPort            int                                                  `protobuf:"varint,18,opt,name=remote_gui_port,json=remoteGuiPort,proto3,casttype=int" json:"remoteGUIPort" xml:"remoteGUIPort"`
 }
 
 func (m *DeviceConfiguration) Reset()         { *m = DeviceConfiguration{} }
@@ -87,66 +88,69 @@ func init() {
 }
 
 var fileDescriptor_744b782bd13071dd = []byte{
-	// 930 bytes of a gzipped FileDescriptorProto
-	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x3d, 0x6f, 0xdb, 0x46,
-	0x00, 0x15, 0xeb, 0xc4, 0xb6, 0xce, 0x96, 0x65, 0xd3, 0x88, 0xc3, 0x18, 0x88, 0x8e, 0x60, 0x35,
-	0x28, 0x68, 0x2a, 0x17, 0x6e, 0x27, 0xa3, 0x2d, 0x50, 0x26, 0x28, 0x1a, 0x18, 0x4d, 0xda, 0xeb,
-	0xe6, 0x85, 0x25, 0x79, 0x67, 0xe5, 0x60, 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f, 0x95, 0x79, 0xdd, 0xb7, 0xcb, 0x2b, 0x96,
-	0x35, 0xf3, 0x6a, 0xb0, 0x81, 0x1a, 0x32, 0xf5, 0x77, 0x05, 0x74, 0x65, 0x63, 0x3f, 0x24, 0x24,
-	0x66, 0xd6, 0x19, 0x75, 0xb4, 0x6d, 0xd1, 0x59, 0x7c, 0xc9, 0x61, 0xe7, 0xeb, 0xbc, 0x0a, 0xc1,
-	0x1c, 0x53, 0x33, 0xe5, 0xb0, 0xe3, 0x55, 0x81, 0x32, 0xa4, 0x86, 0x2e, 0x8a, 0x4c, 0x2f, 0xfa,
-	0x0d, 0x79, 0x13, 0x78, 0x39, 0xef, 0xd7, 0x13, 0x50, 0x8d, 0x77, 0xd4, 0xcf, 0x41, 0x3b, 0xf1,
-	0x59, 0x94, 0xc4, 0x8c, 0x60, 0x6d, 0x47, 0x9c, 0x3b, 0x3d, 0x7f, 0x36, 0x4a, 0x30, 0xe3, 0xb0,
-	0x2b, 0x76, 0x50, 0x22, 0x06, 0x5a, 0xb2, 0xe6, 0xf1, 0xf9, 0xab, 0x5e, 0x6b, 0xfe, 0xaa, 0xd7,
-	0x3a, 0xbf, 0xec, 0x29, 0xf3, 0xcb, 0x9e, 0xf2, 0xdb, 0x55, 0xaf, 0xf5, 0xc7, 0x55, 0x4f, 0x99,
-	0x5f, 0xf5, 0x5a, 0xff, 0x5c, 0xf5, 0x5a, 0x27, 0x0f, 0xde, 0xe2, 0xdf, 0x41, 0x16, 0xef, 0xac,
-	0x8a, 0x7f, 0x89, 0x8f, 0xff, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x73, 0xb5, 0x15, 0x0d, 0x4f, 0x08,
-	0x00, 0x00,
+	// 980 bytes of a gzipped FileDescriptorProto
+	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x31, 0x6f, 0xdb, 0x46,
+	0x18, 0x15, 0xeb, 0xc4, 0xb6, 0x68, 0xc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 0xaf,
+	0xba, 0x8d, 0xf3, 0xcb, 0xae, 0x32, 0xbf, 0xec, 0x2a, 0xbf, 0x5c, 0x75, 0x1b, 0xbf, 0x5d, 0x75,
+	0x95, 0xf9, 0x55, 0xb7, 0xf1, 0xf7, 0x55, 0xb7, 0x71, 0xf2, 0xe0, 0x2d, 0xfe, 0xbb, 0xb2, 0xb1,
+	0x70, 0x56, 0xe5, 0x7f, 0xd8, 0x87, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x0e, 0x8a, 0x12,
+	0xed, 0x08, 0x00, 0x00,
 }
 
 func (m *DeviceConfiguration) Marshal() (dAtA []byte, err error) {
@@ -169,6 +173,13 @@ func (m *DeviceConfiguration) MarshalToSizedBuffer(dAtA []byte) (int, error) {
 	_ = i
 	var l int
 	_ = l
+	if m.RemoteGUIPort != 0 {
+		i = encodeVarintDeviceconfiguration(dAtA, i, uint64(m.RemoteGUIPort))
+		i--
+		dAtA[i] = 0x1
+		i--
+		dAtA[i] = 0x90
+	}
 	if m.Untrusted {
 		i--
 		if m.Untrusted {
@@ -406,6 +417,9 @@ func (m *DeviceConfiguration) ProtoSize() (n int) {
 	if m.Untrusted {
 		n += 3
 	}
+	if m.RemoteGUIPort != 0 {
+		n += 2 + sovDeviceconfiguration(uint64(m.RemoteGUIPort))
+	}
 	return n
 }
 
@@ -882,6 +896,25 @@ func (m *DeviceConfiguration) Unmarshal(dAtA []byte) error {
 				}
 			}
 			m.Untrusted = bool(v != 0)
+		case 18:
+			if wireType != 0 {
+				return fmt.Errorf("proto: wrong wireType = %d for field RemoteGUIPort", wireType)
+			}
+			m.RemoteGUIPort = 0
+			for shift := uint(0); ; shift += 7 {
+				if shift >= 64 {
+					return ErrIntOverflowDeviceconfiguration
+				}
+				if iNdEx >= l {
+					return io.ErrUnexpectedEOF
+				}
+				b := dAtA[iNdEx]
+				iNdEx++
+				m.RemoteGUIPort |= int(b&0x7F) << shift
+				if b < 0x80 {
+					break
+				}
+			}
 		default:
 			iNdEx = preIndex
 			skippy, err := skipDeviceconfiguration(dAtA[iNdEx:])

+ 1 - 0
proto/lib/config/deviceconfiguration.proto

@@ -25,4 +25,5 @@ message DeviceConfiguration {
     repeated ObservedFolder pending_folders            = 15;
     int32                   max_request_kib            = 16 [(ext.goname) = "MaxRequestKiB", (ext.xml) = "maxRequestKiB", (ext.json) = "maxRequestKiB"];
     bool                    untrusted                  = 17;
+    int32                   remote_gui_port            = 18 [(ext.goname) = "RemoteGUIPort", (ext.xml) = "remoteGUIPort", (ext.json) = "remoteGUIPort"];
 }