OSDN Git Service

luci-app-v2raya: add basic luci support for v2rayA
authorTianling Shen <cnsztl@immortalwrt.org>
Tue, 6 Sep 2022 04:53:20 +0000 (12:53 +0800)
committerTianling Shen <cnsztl@immortalwrt.org>
Tue, 6 Sep 2022 04:53:20 +0000 (12:53 +0800)
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
.github/workflows/multi-arch-build.yml
luci-app-v2raya/Makefile [new file with mode: 0644]
luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js [new file with mode: 0644]
luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js [new file with mode: 0644]
luci-app-v2raya/po/templates/v2raya.pot [new file with mode: 0644]
luci-app-v2raya/po/zh_Hans/v2raya.po [new file with mode: 0644]
luci-app-v2raya/root/usr/share/rpcd/acl.d/luci-app-v2raya.json [new file with mode: 0644]
luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json [new file with mode: 0644]

index 9d49d05..365a6de 100644 (file)
@@ -79,7 +79,7 @@ jobs:
         env:
           ARCH: ${{ matrix.arch }}-openwrt-21.02
           FEEDNAME: v2raya_ci
-          PACKAGES: ca-certificates v2fly-geodata v2ray-core xray-core v2raya
+          PACKAGES: ca-certificates v2fly-geodata v2ray-core xray-core v2raya luci-app-v2raya
           NO_REFRESH_CHECK: 1
 
       - name: Generate metadata
diff --git a/luci-app-v2raya/Makefile b/luci-app-v2raya/Makefile
new file mode 100644 (file)
index 0000000..5c53ea2
--- /dev/null
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-3.0-only
+#
+# Copyright (C) 2022 ImmortalWrt.org
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=LuCI support for v2rayA
+LUCI_DEPENDS:=+v2raya
+LUCI_PKGARCH:=all
+
+include $(TOPDIR)/feeds/luci/luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js b/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js
new file mode 100644 (file)
index 0000000..561ee40
--- /dev/null
@@ -0,0 +1,197 @@
+/* SPDX-License-Identifier: GPL-3.0-only
+ *
+ * Copyright (C) 2022 ImmortalWrt.org
+ */
+
+'use strict';
+'require form';
+'require fs';
+'require poll';
+'require rpc';
+'require uci';
+'require ui';
+'require validation';
+'require view';
+
+var callServiceList = rpc.declare({
+       object: 'service',
+       method: 'list',
+       params: ['name'],
+       expect: { '': {} }
+});
+
+function getServiceStatus() {
+       return L.resolveDefault(callServiceList('v2raya'), {}).then(function (res) {
+               var isRunning = false;
+               try {
+                       isRunning = res['v2raya']['instances']['v2raya']['running'];
+               } catch (e) { }
+               return isRunning;
+       });
+}
+
+function renderStatus(isRunning, port) {
+       var spanTemp = '<span style="color:%s"><strong>%s %s</strong></span>';
+       var renderHTML;
+       if (isRunning) {
+               var button = String.format('&nbsp;<a class="btn cbi-button" href="%s:%s" target="_blank" rel="noreferrer noopener">%s</a>',
+                       window.location.origin, port, _('Open Web Interface'));
+               renderHTML = spanTemp.format('green', _('v2rayA'), _('RUNNING')) + button;
+       } else {
+               renderHTML = spanTemp.format('red', _('v2rayA'), _('NOT RUNNING'));
+       }
+
+       return renderHTML;
+}
+
+function uploadCertificate(type, filename, ev) {
+       L.resolveDefault(fs.exec('/bin/mkdir', [ '-p', '/etc/v2raya/' ]));
+
+       return ui.uploadFile('/etc/v2raya/' + filename, ev.target)
+       .then(L.bind(function(btn, res) {
+               btn.firstChild.data = _('Checking %s...').format(type);
+
+               if (res.size <= 0) {
+                       ui.addNotification(null, E('p', _('The uploaded %s is empty.').format(type)));
+                       return fs.remove('/etc/v2raya/' + filename);
+               }
+
+               ui.addNotification(null, E('p', _('Your %s was successfully uploaded. Size: %sB.').format(type, res.size)));
+       }, this, ev.target))
+       .catch(function(e) { ui.addNotification(null, E('p', e.message)) })
+       .finally(L.bind(function(btn, input) {
+               btn.firstChild.data = _('Upload...');
+       }, this, ev.target));
+}
+
+return view.extend({
+       load: function() {
+               return Promise.all([
+                       uci.load('v2raya')
+               ]);
+       },
+
+       render: function(data) {
+               var m, s, o;
+               var webport = (uci.get(data[0], 'config', 'address') || '0.0.0.0:2017').split(':').slice(-1)[0];
+
+               m = new form.Map('v2raya', _('v2rayA'),
+                       _('v2rayA is a V2Ray Linux client supporting global transparent proxy, compatible with SS, SSR, Trojan(trojan-go), PingTunnel protocols.'));
+
+               s = m.section(form.TypedSection);
+               s.anonymous = true;
+               s.render = function () {
+                       poll.add(function () {
+                               return L.resolveDefault(getServiceStatus()).then(function (res) {
+                                       var view = document.getElementById('service_status');
+                                       view.innerHTML = renderStatus(res, webport);
+                               });
+                       });
+
+                       return E('div', { class: 'cbi-section', id: 'status_bar' }, [
+                                       E('p', { id: 'service_status' }, _('Collecting data...'))
+                       ]);
+               }
+
+               s = m.section(form.NamedSection, 'config', 'v2raya');
+
+               o = s.option(form.Flag, 'enabled', _('Enable'));
+               o.default = o.disabled;
+               o.rmempty = false;
+
+               o = s.option(form.Value, 'address', _('Listening address'));
+               o.default = '0.0.0.0:2017';
+               o.validate = function(section_id, value) {
+                       if (!section_id)
+                               return true;
+                       else if (!value)
+                               return _('Expecting: %s').format('non-empty value');
+
+                       var addr = value.split(':').slice(0, -1).join(':'),
+                           port = validation.parseInteger(value.split(':').slice(-1)[0]);
+
+                       if (!addr || !port || port < 0 || port > 65535)
+                               return _('Expecting: %s').format(_('valid address:port value'));
+                       else if (!validation.parseIPv4(addr)) {
+                               if (validation.parseIPv6(addr))
+                                       return _('IPv6 address should be used with [].')
+                               else if (addr.match(/\[(.+)\]/) && validation.parseIPv6(RegExp.$1))
+                                       return true;
+                               else
+                                       return _('Expecting: %s').format(_('valid address:port value'));
+                       }
+
+                       return true;
+               }
+
+               o = s.option(form.Value, 'config', _('Configuration directory'));
+               o.datatype = 'path';
+               o.default = '/etc/v2raya';
+               o.rmempty = false;
+
+               o = s.option(form.ListValue, 'ipv6_support', _('IPv6 support'),
+                       _('Make sure your IPv6 network works fine before you turn it on.'));
+               o.value('auto', _('Auto'));
+               o.value('on', _('On'));
+               o.value('off', _('Off'));
+               o.default = 'auto';
+               o.rmempty = false;
+
+               o = s.option(form.ListValue, 'log_level', _('Log level'));
+               o.value('trace', _('Trace'));
+               o.value('debug', _('Debug'));
+               o.value('info', _('Info'));
+               o.value('warn', _('Warn'));
+               o.value('error', _('Error'));
+               o.default = 'info';
+               o.rmempty = false;
+
+               o = s.option(form.Value, 'log_file', _('Log file path'));
+               o.datatype = 'path';
+               o.default = '/var/log/v2raya/v2raya.log';
+               o.rmempty = false;
+               /* Due to ACL rule, this value must retain default otherwise log page will be broken */
+               o.readonly = true;
+
+               o = s.option(form.Value, 'log_max_days', _('Max log retention period'),
+                       _('Maximum number of days to keep log files.'));
+               o.datatype = 'uinteger';
+               o.default = '3';
+               o.rmempty = false;
+
+               o = s.option(form.Flag, 'log_disable_color', _('Disable log color output'));
+               o.default = o.enabled;
+               o.rmempty = false;
+
+               o = s.option(form.Flag, 'log_disable_timestamp', _('Disable log timestamp'));
+               o.default = o.disabled;
+               o.rmempty = false;
+
+               o = s.option(form.Value, 'v2ray_bin', _('v2ray binary path'),
+                       _('Executable v2ray binary path. Auto-detect if put it empty (recommended).'));
+               o.datatype = 'path';
+
+               o = s.option(form.Value, 'v2ray_confdir', _('Extra config directory'),
+                       _('Additional v2ray config directory, files in it will be combined with config generated by v2rayA.'));
+               o.datatype = 'path';
+
+               o = s.option(form.Value, 'vless_grpc_inbound_cert_key', _('Certpath for gRPC inbound'),
+                       _('Specify the certification path instead of automatically generating a self-signed certificate.'));
+               o.value('', _('Automatically generate'));
+               o.value('/etc/v2raya/grpc_certificate.crt,/etc/v2raya/grpc_private.key');
+
+               o = s.option(form.Button, '_upload_cert', _('Upload certificate'));
+               o.inputstyle = 'action';
+               o.inputtitle = _('Upload...');
+               o.onclick = L.bind(uploadCertificate, this, _('certificate'), 'grpc_certificate.crt');
+               o.depends('vless_grpc_inbound_cert_key', '/etc/v2raya/grpc_certificate.crt,/etc/v2raya/grpc_private.key');
+
+               o = s.option(form.Button, '_upload_key', _('Upload privateKey'));
+               o.inputstyle = 'action';
+               o.inputtitle = _('Upload...');
+               o.onclick = L.bind(uploadCertificate, this, _('private key'), 'grpc_private.key');
+               o.depends('vless_grpc_inbound_cert_key', '/etc/v2raya/grpc_certificate.crt,/etc/v2raya/grpc_private.key');
+
+               return m.render();
+       }
+});
diff --git a/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js b/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js
new file mode 100644 (file)
index 0000000..ceaab04
--- /dev/null
@@ -0,0 +1,80 @@
+/* SPDX-License-Identifier: GPL-3.0-only
+ *
+ * Copyright (C) 2022 ImmortalWrt.org
+ */
+
+'use strict';
+'require dom';
+'require fs';
+'require poll';
+'require uci';
+'require view';
+
+return view.extend({
+       render: function() {
+               /* Thanks to luci-app-aria2 */
+               var css = '                                     \
+                       #log_textarea {                         \
+                               padding: 10px;                  \
+                               text-align: left;               \
+                       }                                       \
+                       #log_textarea pre {                     \
+                               padding: .5rem;                 \
+                               word-break: break-all;          \
+                               margin: 0;                      \
+                       }                                       \
+                       .description {                          \
+                               background-color: #33ccff;      \
+                       }';
+
+               var log_textarea = E('div', { 'id': 'log_textarea' },
+                       E('img', {
+                               'src': L.resource(['icons/loading.gif']),
+                               'alt': _('Loading...'),
+                               'style': 'vertical-align:middle'
+                       }, _('Collecting data...'))
+               );
+
+               var log_path = uci.get('v2raya', 'config', 'log_file') || '/var/log/v2raya/v2raya.log';
+
+               poll.add(L.bind(function() {
+                       return fs.read_direct(log_path, 'text')
+                       .then(function(res) {
+                               var log = E('pre', { 'wrap': 'pre' }, [
+                                       res.trim() || _('Log is clean.')
+                               ]);
+
+                               dom.content(log_textarea, log);
+                       }).catch(function(err) {
+                               var log;
+
+                               if (err.toString().includes('NotFoundError'))
+                                       log = E('pre', { 'wrap': 'pre' }, [
+                                               _('Log file does not exist.')
+                                       ]);
+                               else
+                                       log = E('pre', { 'wrap': 'pre' }, [
+                                               _('Unknown error: %s').format(err)
+                                       ]);
+
+                               dom.content(log_textarea, log);
+                       });
+               }));
+
+               return E([
+                       E('style', [ css ]),
+                       E('div', {'class': 'cbi-map'}, [
+                               E('div', {'class': 'cbi-section'}, [
+                                       log_textarea,
+                                       E('div', {'style': 'text-align:right'},
+                                       E('small', {}, _('Refresh every %s seconds.').format(L.env.pollinterval))
+                                       )
+                               ])
+                       ])
+               ]);
+       },
+
+       handleSaveApply: null,
+       handleSave: null,
+       handleReset: null
+});
diff --git a/luci-app-v2raya/po/templates/v2raya.pot b/luci-app-v2raya/po/templates/v2raya.pot
new file mode 100644 (file)
index 0000000..e80b7c5
--- /dev/null
@@ -0,0 +1,222 @@
+msgid ""
+msgstr "Content-Type: text/plain; charset=UTF-8"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:175
+msgid ""
+"Additional v2ray config directory, files in it will be combined with config "
+"generated by v2rayA."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:134
+msgid "Auto"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:180
+msgid "Automatically generate"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:178
+msgid "Certpath for gRPC inbound"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:52
+msgid "Checking %s..."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:92
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:35
+msgid "Collecting data..."
+msgstr ""
+
+#: applications/luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json:14
+msgid "Configuration"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:127
+msgid "Configuration directory"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:142
+msgid "Debug"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:162
+msgid "Disable log color output"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:166
+msgid "Disable log timestamp"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:98
+msgid "Enable"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:145
+msgid "Error"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:171
+msgid ""
+"Executable v2ray binary path. Auto-detect if put it empty (recommended)."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:108
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:114
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:121
+msgid "Expecting: %s"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:174
+msgid "Extra config directory"
+msgstr ""
+
+#: applications/luci-app-v2raya/root/usr/share/rpcd/acl.d/luci-app-v2raya.json:3
+msgid "Grant access to v2rayA configuration"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:117
+msgid "IPv6 address should be used with []."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:132
+msgid "IPv6 support"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:143
+msgid "Info"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:102
+msgid "Listening address"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:33
+msgid "Loading..."
+msgstr ""
+
+#: applications/luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json:22
+msgid "Log"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:53
+msgid "Log file does not exist."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:149
+msgid "Log file path"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:44
+msgid "Log is clean."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:140
+msgid "Log level"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:133
+msgid "Make sure your IPv6 network works fine before you turn it on."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:156
+msgid "Max log retention period"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:157
+msgid "Maximum number of days to keep log files."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:41
+msgid "NOT RUNNING"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:136
+msgid "Off"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:135
+msgid "On"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:38
+msgid "Open Web Interface"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:39
+msgid "RUNNING"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:70
+msgid "Refresh every %s seconds."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:179
+msgid ""
+"Specify the certification path instead of automatically generating a self-"
+"signed certificate."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:55
+msgid "The uploaded %s is empty."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:141
+msgid "Trace"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:57
+msgid "Unknown error: %s"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:183
+msgid "Upload certificate"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:189
+msgid "Upload privateKey"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:63
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:185
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:191
+msgid "Upload..."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:144
+msgid "Warn"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:59
+msgid "Your %s was successfully uploaded. Size: %sB."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:186
+msgid "certificate"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:192
+msgid "private key"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:170
+msgid "v2ray binary path"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:39
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:41
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:78
+#: applications/luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json:3
+msgid "v2rayA"
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:79
+msgid ""
+"v2rayA is a V2Ray Linux client supporting global transparent proxy, "
+"compatible with SS, SSR, Trojan(trojan-go), PingTunnel protocols."
+msgstr ""
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:114
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:121
+msgid "valid address:port value"
+msgstr ""
diff --git a/luci-app-v2raya/po/zh_Hans/v2raya.po b/luci-app-v2raya/po/zh_Hans/v2raya.po
new file mode 100644 (file)
index 0000000..469deff
--- /dev/null
@@ -0,0 +1,232 @@
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Project-Id-Version: PACKAGE VERSION\n"
+"Last-Translator: Automatically generated\n"
+"Language-Team: none\n"
+"Language: zh-Hans\n"
+"MIME-Version: 1.0\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:175
+msgid ""
+"Additional v2ray config directory, files in it will be combined with config "
+"generated by v2rayA."
+msgstr ""
+"附加 v2ray 配置目录,包含在其中的文件将被合并至 v2rayA 生成的配置文件中。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:134
+msgid "Auto"
+msgstr "自动"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:180
+msgid "Automatically generate"
+msgstr "自动生成"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:178
+msgid "Certpath for gRPC inbound"
+msgstr "gPRC 入站证书目录"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:52
+msgid "Checking %s..."
+msgstr "检查%s中..."
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:92
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:35
+msgid "Collecting data..."
+msgstr "收集数据中..."
+
+#: applications/luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json:14
+msgid "Configuration"
+msgstr "配置"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:127
+msgid "Configuration directory"
+msgstr "配置文件目录"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:142
+msgid "Debug"
+msgstr "调试"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:162
+msgid "Disable log color output"
+msgstr "禁用日志彩色输出"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:166
+msgid "Disable log timestamp"
+msgstr "禁用日志时间戳"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:98
+msgid "Enable"
+msgstr "启用"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:145
+msgid "Error"
+msgstr "错误"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:171
+msgid ""
+"Executable v2ray binary path. Auto-detect if put it empty (recommended)."
+msgstr "v2ray 可执行二进制文件目录。留空以自动检测(推荐)。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:108
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:114
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:121
+msgid "Expecting: %s"
+msgstr "请输入:%s"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:174
+msgid "Extra config directory"
+msgstr "附加配置目录"
+
+#: applications/luci-app-v2raya/root/usr/share/rpcd/acl.d/luci-app-v2raya.json:3
+msgid "Grant access to v2rayA configuration"
+msgstr "授予访问 v2rayA 配置的权限"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:117
+msgid "IPv6 address should be used with []."
+msgstr "IPv6 地址应与 [] 一起使用。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:132
+msgid "IPv6 support"
+msgstr "IPv6 支持"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:143
+msgid "Info"
+msgstr "信息"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:102
+msgid "Listening address"
+msgstr "监听地址"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:33
+msgid "Loading..."
+msgstr "加载中..."
+
+#: applications/luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json:22
+msgid "Log"
+msgstr "日志"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:53
+msgid "Log file does not exist."
+msgstr "日志文件不存在。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:149
+msgid "Log file path"
+msgstr "日志文件路径"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:44
+msgid "Log is clean."
+msgstr "日志为空。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:140
+msgid "Log level"
+msgstr "日志等级"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:133
+msgid "Make sure your IPv6 network works fine before you turn it on."
+msgstr "开启前,请确保您的 IPv6 网络工作正常。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:156
+msgid "Max log retention period"
+msgstr "最长日志保留时间"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:157
+msgid "Maximum number of days to keep log files."
+msgstr "保留日志文件的最长天数。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:41
+msgid "NOT RUNNING"
+msgstr "未运行"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:136
+msgid "Off"
+msgstr "关"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:135
+msgid "On"
+msgstr "开"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:38
+msgid "Open Web Interface"
+msgstr "打开 Web 界面"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:39
+msgid "RUNNING"
+msgstr "运行中"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:70
+msgid "Refresh every %s seconds."
+msgstr "每 %s 秒刷新。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:179
+msgid ""
+"Specify the certification path instead of automatically generating a self-"
+"signed certificate."
+msgstr "指定证书目录而不是自动生成自签证书。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:55
+msgid "The uploaded %s is empty."
+msgstr "上传的%s为空。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:141
+msgid "Trace"
+msgstr "跟踪"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/log.js:57
+msgid "Unknown error: %s"
+msgstr "未知错误:%s"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:183
+msgid "Upload certificate"
+msgstr "上传证书"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:189
+msgid "Upload privateKey"
+msgstr "上传私钥"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:63
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:185
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:191
+msgid "Upload..."
+msgstr "上传..."
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:144
+msgid "Warn"
+msgstr "警告"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:59
+msgid "Your %s was successfully uploaded. Size: %sB."
+msgstr "您的%s上传成功。大小:%sB。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:186
+msgid "certificate"
+msgstr "证书"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:192
+msgid "private key"
+msgstr "私钥"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:170
+msgid "v2ray binary path"
+msgstr "v2ray 二进制路径"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:39
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:41
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:78
+#: applications/luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json:3
+msgid "v2rayA"
+msgstr "v2rayA"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:79
+msgid ""
+"v2rayA is a V2Ray Linux client supporting global transparent proxy, "
+"compatible with SS, SSR, Trojan(trojan-go), PingTunnel protocols."
+msgstr ""
+"v2rayA 是一个易用而强大的,跨平台的 V2Ray 客户端,支持 SS、SSR、"
+"Trojan(trojan-go)、PingTunnel 协议。"
+
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:114
+#: applications/luci-app-v2raya/htdocs/luci-static/resources/view/v2raya/config.js:121
+msgid "valid address:port value"
+msgstr "有效 地址:端口 值"
diff --git a/luci-app-v2raya/root/usr/share/rpcd/acl.d/luci-app-v2raya.json b/luci-app-v2raya/root/usr/share/rpcd/acl.d/luci-app-v2raya.json
new file mode 100644 (file)
index 0000000..cfb1410
--- /dev/null
@@ -0,0 +1,22 @@
+{
+       "luci-app-v2raya": {
+               "description": "Grant access to v2rayA configuration",
+               "read": {
+                       "file": {
+                               "/bin/mkdir -p /etc/v2raya/": [ "exec" ],
+                               "/var/log/v2raya/v2raya.log": [ "read" ]
+                       },
+                       "ubus": {
+                               "service": [ "list" ]
+                       },
+                       "uci": [ "v2raya" ]
+               },
+               "write": {
+                       "file": {
+                               "/etc/v2raya/grpc_certificate.crt": [ "write" ],
+                               "/etc/v2raya/grpc_private.key": [ "write" ]
+                       },
+                       "uci": [ "v2raya" ]
+               }
+       }
+}
diff --git a/luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json b/luci-app-v2raya/root/usr/share/rpcd/luci/menu.d/luci-app-v2raya.json
new file mode 100644 (file)
index 0000000..c19548f
--- /dev/null
@@ -0,0 +1,29 @@
+{
+       "admin/services/v2raya": {
+               "title": "v2rayA",
+               "order": 90,
+               "action": {
+                       "type": "firstchild"
+               },
+               "depends": {
+                       "acl": [ "luci-app-v2raya" ],
+                       "uci": { "v2raya": true }
+               }
+       },
+       "admin/services/v2raya/config": {
+               "title": "Configuration",
+               "order": 10,
+               "action": {
+                       "type": "view",
+                       "path": "v2raya/config"
+               }
+       },
+       "admin/services/v2raya/log": {
+               "title": "Log",
+               "order": 20,
+               "action": {
+                       "type": "view",
+                       "path": "v2raya/log"
+               }
+       }
+}