luci-proto-nebula: add nebula protocol support

Signed-off-by: Stan Grishin <stangri@melmac.ca>
This commit is contained in:
Stan Grishin 2022-10-14 12:02:56 +00:00
parent 7fb235cb88
commit d55913cfa4
2 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,17 @@
# Copyright 2021 Stan Grishin (stangri@melmac.ca)
# This is free software, licensed under the GNU General Public License v3.
include $(TOPDIR)/rules.mk
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
PKG_VERSION:=1.6.1-1
LUCI_TITLE:=Support for Nebula
LUCI_DESCRIPTION:=Provides Web UI for Nebula protocol/interface.
LUCI_DEPENDS:=+nebula +nebula-proto
LUCI_PKGARCH:=all
include ../../luci.mk
# call BuildPackage - OpenWrt buildroot signature

View file

@ -0,0 +1,50 @@
'use strict';
'require ui';
'require uci';
'require rpc';
'require form';
'require network';
return network.registerProtocol('nebula', {
getI18n: function () {
return _('Nebula Network');
},
getIfname: function () {
return this._ubus('l3_device') || this.sid;
},
getOpkgPackage: function () {
return 'nebula';
},
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 o;
o = s.taboption('general', form.Value, 'config_file', _('Config File'), _('Required. Path to the .yml config file for this interface.'));
o.rmempty = false;
},
deleteConfiguration: function () {
uci.sections('network', 'nebula_%s'.format(this.sid), function (s) {
uci.remove('network', s['.name']);
});
}
});