Merge pull request #6021 from liudf0716/xfrpc
authorJo-Philipp Wich <jo@mein.io>
Fri, 14 Oct 2022 23:02:11 +0000 (01:02 +0200)
committerGitHub <noreply@github.com>
Fri, 14 Oct 2022 23:02:11 +0000 (01:02 +0200)
luci-app-xfrpc: add subdomain option

applications/luci-app-smartdns/root/usr/share/rpcd/acl.d/luci-app-smartdns.json
protocols/luci-proto-vti/Makefile [new file with mode: 0644]
protocols/luci-proto-vti/htdocs/luci-static/resources/protocol/vti.js [new file with mode: 0644]
themes/luci-theme-openwrt-2020/htdocs/luci-static/openwrt2020/logo.png

index 22cba757323caa07fc23b78e3a886ceeac9c1352..ef1e386b0de0c632f978d14d0f9552c55a1ba6e1 100644 (file)
@@ -3,9 +3,7 @@
                "description": "Grant access to LuCI app smartdns",
                "read": {
                        "file": {
-                               "/etc/smartdns/*": [ "read" ],
-                               "/usr/sbin/smartdns": [ "exec" ],
-                               "/etc/init.d/smartdns restart" : [ "exec" ]
+                               "/etc/smartdns/*": [ "read" ]
                        },
                        "ubus": {
                                "service": [ "list" ]
@@ -14,7 +12,8 @@
                },
                "write": {
                        "file": {
-                               "/etc/smartdns/*": [ "write" ]
+                               "/etc/smartdns/*": [ "write" ],
+                               "/etc/init.d/smartdns restart": [ "exec" ]
                        },
                        "uci": [ "smartdns" ]
                }
diff --git a/protocols/luci-proto-vti/Makefile b/protocols/luci-proto-vti/Makefile
new file mode 100644 (file)
index 0000000..6520eab
--- /dev/null
@@ -0,0 +1,14 @@
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=Support for VTI interfaces
+LUCI_DEPENDS:=+vti
+
+PKG_MAINTAINER:=Jaymin Patel <jem.patel@gmail.com>
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/protocols/luci-proto-vti/htdocs/luci-static/resources/protocol/vti.js b/protocols/luci-proto-vti/htdocs/luci-static/resources/protocol/vti.js
new file mode 100644 (file)
index 0000000..bbf0372
--- /dev/null
@@ -0,0 +1,72 @@
+'use strict';
+'require form';
+'require network';
+'require tools.widgets as widgets';
+
+network.registerPatternVirtual(/^vti-.+$/);
+
+return network.registerProtocol('vti', {
+       getI18n: function() {
+               return _('VTI');
+       },
+
+       getIfname: function() {
+               return this._ubus('l3_device') || 'vti-%s'.format(this.sid);
+       },
+
+       getOpkgPackage: function() {
+               return 'vti';
+       },
+
+       isFloating: function() {
+               return true;
+       },
+
+       isVirtual: function() {
+               return true;
+       },
+
+       getDevices: function() {
+               return null;
+       },
+
+       containsDevice: function(ifname) {
+               return (network.getIfnameOf(ifname) == this.getIfname());
+       },
+
+       renderFormOptions: function(s) {
+               var dev = this.getL3Device() || this.getDevice(), o;
+
+               o = s.taboption('general', form.Value, 'peeraddr', _("Remote IPv4 address or FQDN"), _("The IPv4 address or the fully-qualified domain name of the remote tunnel end."));
+               o.optional = false;
+               o.datatype = 'or(hostname,ip4addr("nomask"))';
+
+               o = s.taboption('general', form.Value, 'ipaddr', _("Local IPv4 address"), _("The local IPv4 address over which the tunnel is created (optional)."));
+               o.optional = true;
+               o.datatype = 'ip4addr("nomask")';
+               o.load = function(section_id) {
+                       return network.getWANNetworks().then(L.bind(function(nets) {
+                       if (nets.length)
+                               this.placeholder = nets[0].getIPAddr();
+                       return form.Value.prototype.load.apply(this, [section_id]);
+                       }, this));
+               };
+
+               o = s.taboption('general', form.Value, 'mtu', _('Override MTU'));
+               o.placeholder = dev ? (dev.getMTU() || '1280') : '1280';
+               o.datatype    = 'max(1500)';
+
+               o = s.taboption('general', widgets.NetworkSelect, 'tunlink', _("Bind interface"), _("Bind the tunnel to this interface (optional)."));
+               o.exclude = s.section;
+               o.nocreate = true;
+               o.optional = true;
+
+               o = s.taboption('general', form.Value, 'ikey', _("Incoming key"), _("Key for incoming packets (optional)."));
+               o.optional = true;
+               o.datatype = 'uinteger';
+
+               o = s.taboption('general', form.Value, 'okey', _("Outgoing key"), _("Key for outgoing packets (optional)."));
+               o.optional = true;
+               o.datatype = 'uinteger';
+       }
+});
index 6adf532b87bfd945326981d46330a02517d92395..182d7e35c538eab769c98e8bf437e943eb2fd2a7 100644 (file)
Binary files a/themes/luci-theme-openwrt-2020/htdocs/luci-static/openwrt2020/logo.png and b/themes/luci-theme-openwrt-2020/htdocs/luci-static/openwrt2020/logo.png differ