summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-natmap
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-natmap')
-rw-r--r--applications/luci-app-natmap/Makefile13
-rw-r--r--applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js135
-rw-r--r--applications/luci-app-natmap/po/es/natmap.po97
-rw-r--r--applications/luci-app-natmap/po/pl/natmap.po93
-rw-r--r--applications/luci-app-natmap/po/templates/natmap.pot83
-rw-r--r--applications/luci-app-natmap/po/zh_Hans/natmap.po92
-rw-r--r--applications/luci-app-natmap/root/usr/share/luci/menu.d/luci-app-natmap.json12
-rw-r--r--applications/luci-app-natmap/root/usr/share/rpcd/acl.d/luci-app-natmap.json17
8 files changed, 542 insertions, 0 deletions
diff --git a/applications/luci-app-natmap/Makefile b/applications/luci-app-natmap/Makefile
new file mode 100644
index 0000000000..0d02dcac51
--- /dev/null
+++ b/applications/luci-app-natmap/Makefile
@@ -0,0 +1,13 @@
+# This is free software, licensed under the Apache License, Version 2.0
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=LuCI Support for natmap
+LUCI_DEPENDS:=+natmap
+
+PKG_LICENSE:=Apache-2.0
+PKG_MAINTAINER:=Richard Yu <yurichard3839@gmail.com>
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js b/applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js
new file mode 100644
index 0000000000..14dea3aa19
--- /dev/null
+++ b/applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js
@@ -0,0 +1,135 @@
+'use strict';
+'require form';
+'require fs';
+'require rpc';
+'require view';
+'require tools.widgets as widgets';
+
+var callServiceList = rpc.declare({
+ object: 'service',
+ method: 'list',
+ params: ['name'],
+ expect: { '': {} }
+});
+
+function getInstances() {
+ return L.resolveDefault(callServiceList('natmap'), {}).then(function(res) {
+ try {
+ return res.natmap.instances || {};
+ } catch (e) {}
+ return {};
+ });
+}
+
+function getStatus() {
+ return getInstances().then(function(instances) {
+ var promises = [];
+ var status = {};
+ for (var key in instances) {
+ var i = instances[key];
+ if (i.running && i.pid) {
+ var f = '/var/run/natmap/' + i.pid + '.json';
+ (function(k) {
+ promises.push(fs.read(f).then(function(res) {
+ status[k] = JSON.parse(res);
+ }).catch(function(e){}));
+ })(key);
+ }
+ }
+ return Promise.all(promises).then(function() { return status; });
+ });
+}
+
+return view.extend({
+ load: function() {
+ return getStatus();
+ },
+ render: function(status) {
+ var m, s, o;
+
+ m = new form.Map('natmap', _('NATMap'));
+ s = m.section(form.GridSection, 'natmap');
+ s.addremove = true;
+ s.anonymous = true;
+
+ o = s.option(form.Flag, 'enable', _('Enable'));
+ o.editable = true;
+ o.modalonly = false;
+
+ o = s.option(form.ListValue, 'udp_mode', _('Protocol'));
+ o.default = '1';
+ o.value('0', 'TCP');
+ o.value('1', 'UDP');
+ o.textvalue = function(section_id) {
+ var cval = this.cfgvalue(section_id);
+ var i = this.keylist.indexOf(cval);
+ return this.vallist[i];
+ };
+
+ o = s.option(form.ListValue, 'family', _('Restrict to address family'));
+ o.modalonly = true;
+ o.value('', _('IPv4 and IPv6'));
+ o.value('ipv4', _('IPv4 only'));
+ o.value('ipv6', _('IPv6 only'));
+
+ o = s.option(widgets.NetworkSelect, 'interface', _('Interface'));
+ o.modalonly = true;
+
+ o = s.option(form.Value, 'interval', _('Keep-alive interval'));
+ o.datatype = 'uinteger';
+ o.modalonly = true;
+
+ o = s.option(form.Value, 'stun_server', _('STUN server'));
+ o.datatype = 'host';
+ o.modalonly = true;
+ o.optional = false;
+ o.rmempty = false;
+
+ o = s.option(form.Value, 'http_server', _('HTTP server'), _('For TCP mode'));
+ o.datatype = 'host';
+ o.modalonly = true;
+ o.rmempty = false;
+
+ o = s.option(form.Value, 'port', _('Bind port'));
+ o.datatype = 'port';
+ o.rmempty = false;
+
+ o = s.option(form.Flag, '_forward_mode', _('Forward mode'));
+ o.modalonly = true;
+ o.ucioption = 'forward_target';
+ o.load = function(section_id) {
+ return this.super('load', section_id) ? '1' : '0';
+ };
+ o.write = function(section_id, formvalue) {};
+
+ o = s.option(form.Value, 'forward_target', _('Forward target'));
+ o.datatype = 'host';
+ o.modalonly = true;
+ o.depends('_forward_mode', '1');
+
+ o = s.option(form.Value, 'forward_port', _('Forward target port'));
+ o.datatype = 'port';
+ o.modalonly = true;
+ o.depends('_forward_mode', '1');
+
+ o = s.option(form.Value, 'notify_script', _('Notify script'));
+ o.datatype = 'file';
+ o.modalonly = true;
+
+ o = s.option(form.DummyValue, '_external_ip', _('External IP'));
+ o.modalonly = false;
+ o.textvalue = function(section_id) {
+ var s = status[section_id];
+ if (s) return s.ip;
+ };
+
+ o = s.option(form.DummyValue, '_external_port', _('External Port'));
+ o.modalonly = false;
+ o.textvalue = function(section_id) {
+ var s = status[section_id];
+ if (s) return s.port;
+ };
+
+ return m.render();
+ }
+});
diff --git a/applications/luci-app-natmap/po/es/natmap.po b/applications/luci-app-natmap/po/es/natmap.po
new file mode 100644
index 0000000000..4ffcf3c89f
--- /dev/null
+++ b/applications/luci-app-natmap/po/es/natmap.po
@@ -0,0 +1,97 @@
+msgid ""
+msgstr ""
+"PO-Revision-Date: 2022-12-28 19:33+0000\n"
+"Last-Translator: Franco Castillo <castillofrancodamian@gmail.com>\n"
+"Language-Team: Spanish <https://hosted.weblate.org/projects/openwrt/"
+"luciapplicationsnatmap/es/>\n"
+"Language: es\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+"X-Generator: Weblate 4.15.1-dev\n"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:93
+#, fuzzy
+msgid "Bind port"
+msgstr "Puerto de enlace"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:55
+msgid "Enable"
+msgstr "Activar"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:119
+msgid "External IP"
+msgstr "IP externa"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:126
+msgid "External Port"
+msgstr "Puerto externo"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:88
+msgid "For TCP mode"
+msgstr "Para el modo TCP"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:97
+msgid "Forward mode"
+msgstr "Modo de reenvío"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:105
+#, fuzzy
+msgid "Forward target"
+msgstr "Objetivo de reenvío"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:110
+#, fuzzy
+msgid "Forward target port"
+msgstr "Reenviar puerto de destino"
+
+#: applications/luci-app-natmap/root/usr/share/rpcd/acl.d/luci-app-natmap.json:3
+msgid "Grant access to LuCI app natmap"
+msgstr "Otorgar acceso a la aplicación LuCI natmap"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:88
+msgid "HTTP server"
+msgstr "Servidor HTTP"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:71
+msgid "IPv4 and IPv6"
+msgstr "IPv4 e IPv6"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:72
+msgid "IPv4 only"
+msgstr "Solo IPv4"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:73
+msgid "IPv6 only"
+msgstr "Solo IPv6"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:75
+msgid "Interface"
+msgstr "Interfaz"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:78
+#, fuzzy
+msgid "Keep-alive interval"
+msgstr "Intervalo de mantenimiento"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:50
+#: applications/luci-app-natmap/root/usr/share/luci/menu.d/luci-app-natmap.json:3
+msgid "NATMap"
+msgstr "NATMap"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:115
+msgid "Notify script"
+msgstr "Script de notificación"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:59
+msgid "Protocol"
+msgstr "Protocolo"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:69
+#, fuzzy
+msgid "Restrict to address family"
+msgstr "Restringir a la familia de direcciones"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:82
+msgid "STUN server"
+msgstr "Servidor STUN"
diff --git a/applications/luci-app-natmap/po/pl/natmap.po b/applications/luci-app-natmap/po/pl/natmap.po
new file mode 100644
index 0000000000..7a73f5c9d5
--- /dev/null
+++ b/applications/luci-app-natmap/po/pl/natmap.po
@@ -0,0 +1,93 @@
+msgid ""
+msgstr ""
+"PO-Revision-Date: 2022-12-28 11:28+0000\n"
+"Last-Translator: Matthaiks <kitynska@gmail.com>\n"
+"Language-Team: Polish <https://hosted.weblate.org/projects/openwrt/"
+"luciapplicationsnatmap/pl/>\n"
+"Language: pl\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2;\n"
+"X-Generator: Weblate 4.15.1-dev\n"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:93
+msgid "Bind port"
+msgstr "Zwiąż port"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:55
+msgid "Enable"
+msgstr "Włącz"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:119
+msgid "External IP"
+msgstr "Zewnętrzny adres IP"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:126
+msgid "External Port"
+msgstr "Port zewnętrzny"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:88
+msgid "For TCP mode"
+msgstr "Dla trybu TCP"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:97
+msgid "Forward mode"
+msgstr "Tryb przekazywania"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:105
+msgid "Forward target"
+msgstr "Cel przekazywania"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:110
+msgid "Forward target port"
+msgstr "Port celu przekazywania"
+
+#: applications/luci-app-natmap/root/usr/share/rpcd/acl.d/luci-app-natmap.json:3
+msgid "Grant access to LuCI app natmap"
+msgstr "Przyznaj dostęp do aplikacji LuCI natmap"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:88
+msgid "HTTP server"
+msgstr "Serwer HTTP"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:71
+msgid "IPv4 and IPv6"
+msgstr "IPv4 i IPv6"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:72
+msgid "IPv4 only"
+msgstr "Tylko IPv4"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:73
+msgid "IPv6 only"
+msgstr "Tylko IPv6"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:75
+msgid "Interface"
+msgstr "Interfejs"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:78
+msgid "Keep-alive interval"
+msgstr "Interwał utrzymywania aktywności"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:50
+#: applications/luci-app-natmap/root/usr/share/luci/menu.d/luci-app-natmap.json:3
+msgid "NATMap"
+msgstr "NATMap"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:115
+msgid "Notify script"
+msgstr "Skrypt powiadamiający"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:59
+msgid "Protocol"
+msgstr "Protokół"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:69
+msgid "Restrict to address family"
+msgstr "Ogranicz do rodziny adresów"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:82
+msgid "STUN server"
+msgstr "Serwer STUN"
diff --git a/applications/luci-app-natmap/po/templates/natmap.pot b/applications/luci-app-natmap/po/templates/natmap.pot
new file mode 100644
index 0000000000..4d8e848439
--- /dev/null
+++ b/applications/luci-app-natmap/po/templates/natmap.pot
@@ -0,0 +1,83 @@
+msgid ""
+msgstr "Content-Type: text/plain; charset=UTF-8"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:93
+msgid "Bind port"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:55
+msgid "Enable"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:119
+msgid "External IP"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:126
+msgid "External Port"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:88
+msgid "For TCP mode"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:97
+msgid "Forward mode"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:105
+msgid "Forward target"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:110
+msgid "Forward target port"
+msgstr ""
+
+#: applications/luci-app-natmap/root/usr/share/rpcd/acl.d/luci-app-natmap.json:3
+msgid "Grant access to LuCI app natmap"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:88
+msgid "HTTP server"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:71
+msgid "IPv4 and IPv6"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:72
+msgid "IPv4 only"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:73
+msgid "IPv6 only"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:75
+msgid "Interface"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:78
+msgid "Keep-alive interval"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:50
+#: applications/luci-app-natmap/root/usr/share/luci/menu.d/luci-app-natmap.json:3
+msgid "NATMap"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:115
+msgid "Notify script"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:59
+msgid "Protocol"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:69
+msgid "Restrict to address family"
+msgstr ""
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:82
+msgid "STUN server"
+msgstr ""
diff --git a/applications/luci-app-natmap/po/zh_Hans/natmap.po b/applications/luci-app-natmap/po/zh_Hans/natmap.po
new file mode 100644
index 0000000000..dccc7754e0
--- /dev/null
+++ b/applications/luci-app-natmap/po/zh_Hans/natmap.po
@@ -0,0 +1,92 @@
+msgid ""
+msgstr ""
+"PO-Revision-Date: 2022-12-28 19:33+0000\n"
+"Last-Translator: Eric <hamburger2048@users.noreply.hosted.weblate.org>\n"
+"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
+"openwrt/luciapplicationsnatmap/zh_Hans/>\n"
+"Language: zh_Hans\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0;\n"
+"X-Generator: Weblate 4.15.1-dev\n"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:93
+msgid "Bind port"
+msgstr "绑定端口"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:55
+msgid "Enable"
+msgstr "启用"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:119
+msgid "External IP"
+msgstr "外部 IP"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:126
+msgid "External Port"
+msgstr "外部端口"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:88
+msgid "For TCP mode"
+msgstr "用于 TCP 模式"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:97
+msgid "Forward mode"
+msgstr "转发模式"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:105
+msgid "Forward target"
+msgstr "转发目标"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:110
+msgid "Forward target port"
+msgstr "转发目标端口"
+
+#: applications/luci-app-natmap/root/usr/share/rpcd/acl.d/luci-app-natmap.json:3
+msgid "Grant access to LuCI app natmap"
+msgstr "授予访问 LuCI 应用 natmap 的权限"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:88
+msgid "HTTP server"
+msgstr "HTTP 服务器"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:71
+msgid "IPv4 and IPv6"
+msgstr "IPv4 和 IPv6"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:72
+msgid "IPv4 only"
+msgstr "仅 IPv4"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:73
+msgid "IPv6 only"
+msgstr "仅 IPv6"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:75
+msgid "Interface"
+msgstr "接口"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:78
+msgid "Keep-alive interval"
+msgstr "Keep-alive 间隔"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:50
+#: applications/luci-app-natmap/root/usr/share/luci/menu.d/luci-app-natmap.json:3
+msgid "NATMap"
+msgstr "NATMap"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:115
+msgid "Notify script"
+msgstr "通知脚本"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:59
+msgid "Protocol"
+msgstr "协议"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:69
+msgid "Restrict to address family"
+msgstr "地址族限制"
+
+#: applications/luci-app-natmap/htdocs/luci-static/resources/view/natmap.js:82
+msgid "STUN server"
+msgstr "STUN 服务器"
diff --git a/applications/luci-app-natmap/root/usr/share/luci/menu.d/luci-app-natmap.json b/applications/luci-app-natmap/root/usr/share/luci/menu.d/luci-app-natmap.json
new file mode 100644
index 0000000000..4513a11160
--- /dev/null
+++ b/applications/luci-app-natmap/root/usr/share/luci/menu.d/luci-app-natmap.json
@@ -0,0 +1,12 @@
+{
+ "admin/services/natmap": {
+ "title": "NATMap",
+ "action": {
+ "type": "view",
+ "path": "natmap"
+ },
+ "depends": {
+ "acl": [ "luci-app-natmap" ]
+ }
+ }
+}
diff --git a/applications/luci-app-natmap/root/usr/share/rpcd/acl.d/luci-app-natmap.json b/applications/luci-app-natmap/root/usr/share/rpcd/acl.d/luci-app-natmap.json
new file mode 100644
index 0000000000..ccaee88795
--- /dev/null
+++ b/applications/luci-app-natmap/root/usr/share/rpcd/acl.d/luci-app-natmap.json
@@ -0,0 +1,17 @@
+{
+ "luci-app-natmap": {
+ "description": "Grant access to LuCI app natmap",
+ "read": {
+ "file": {
+ "/var/run/natmap/*": [ "read" ]
+ },
+ "ubus": {
+ "service": [ "list" ]
+ },
+ "uci": ["natmap"]
+ },
+ "write": {
+ "uci": ["natmap"]
+ }
+ }
+}