diff --git a/applications/luci-app-uugamebooster/Makefile b/applications/luci-app-uugamebooster/Makefile new file mode 100644 index 0000000000..79637c3df8 --- /dev/null +++ b/applications/luci-app-uugamebooster/Makefile @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 +# + +include $(TOPDIR)/rules.mk + +PKG_LICENSE:=Apache-2.0 + +LUCI_TITLE:=LuCI support for UUgamebooster +LUCI_DEPENDS:=+uugamebooster +LUCI_PKGARCH:=all + +include ../../luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js b/applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js new file mode 100644 index 0000000000..de7e6be644 --- /dev/null +++ b/applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: Apache-2.0 + +'use strict'; +'require form'; +'require poll'; +'require rpc'; +'require uci'; +'require view'; + +const callServiceList = rpc.declare({ + object: 'service', + method: 'list', + params: ['name'], + expect: { '': {} } +}); + +function getServiceStatus() { + return L.resolveDefault(callServiceList('uugamebooster'), {}).then(function (res) { + var isRunning = false; + try { + isRunning = res['uugamebooster']['instances']['uugamebooster']['running']; + } catch (e) { } + return isRunning; + }); +} + +function renderStatus(isRunning) { + var spanTemp = '%s %s'; + var renderHTML; + if (isRunning) { + renderHTML = spanTemp.format('green', _('UU GameAcc'), _('RUNNING')) + } else { + renderHTML = spanTemp.format('red', _('UU GameAcc'), _('NOT RUNNING')); + } + + return renderHTML; +} + +return view.extend({ + load: function() { + return Promise.all([ + uci.load('uugamebooster') + ]); + }, + + render: function() { + let m, s, o; + + m = new form.Map('uugamebooster', _('UU Game Accelerator'), + _('A Paid Game Acceleration service')); + + 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); + }); + }); + + return E('div', { class: 'cbi-section', id: 'status_bar' }, [ + E('p', { id: 'service_status' }, _('Collecting data...')) + ]); + } + + s = m.section(form.NamedSection, 'config', 'uugamebooster'); + + o = s.option(form.Flag, 'enabled', _('Enable')); + o.default = o.disabled; + o.rmempty = false; + + s = m.section(form.TypedSection); + s.anonymous = true; + s.render = function () { + return E('div', {class: 'cbi-section'}, [ + E('p', [ + E('img', {src: '/uugamebooster/uuios.png', height: '300'}), + E('img', {src: '/uugamebooster/uuandroid.png', height: '300'}) + ]) + ]) + } + + return m.render(); + } + +}); diff --git a/applications/luci-app-uugamebooster/po/templates/uugamebooster.pot b/applications/luci-app-uugamebooster/po/templates/uugamebooster.pot new file mode 100644 index 0000000000..e328b81e5e --- /dev/null +++ b/applications/luci-app-uugamebooster/po/templates/uugamebooster.pot @@ -0,0 +1,23 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:70 +msgid "Enable" +msgstr "" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:32 +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:34 +msgid "UU GameAcc" +msgstr "" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:50 +msgid "UU Game Accelerator" +msgstr "" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:51 +msgid "A Paid Game Acceleration service" +msgstr "" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:64 +msgid "Collecting data..." +msgstr "" diff --git a/applications/luci-app-uugamebooster/po/zh_Hans/uugamebooster.po b/applications/luci-app-uugamebooster/po/zh_Hans/uugamebooster.po new file mode 100644 index 0000000000..f0df78aad4 --- /dev/null +++ b/applications/luci-app-uugamebooster/po/zh_Hans/uugamebooster.po @@ -0,0 +1,23 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:70 +msgid "Enable" +msgstr "启用" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:32 +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:34 +msgid "UU GameAcc" +msgstr "UU游戏加速器" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:50 +msgid "UU Game Accelerator" +msgstr "UU游戏加速器" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:51 +msgid "A Paid Game Acceleration service" +msgstr "一个付费主机游戏加速器 (开启服务后,使用手机APP绑定路由器并指定加速主机)" + +#: applications/luci-app-uugamebooster/htdocs/luci-static/resources/view/uugamebooster.js:64 +msgid "Collecting data..." +msgstr "正在收集数据中..." diff --git a/applications/luci-app-uugamebooster/root/usr/share/luci/menu.d/luci-app-uugamebooster.json b/applications/luci-app-uugamebooster/root/usr/share/luci/menu.d/luci-app-uugamebooster.json new file mode 100644 index 0000000000..e66370b96d --- /dev/null +++ b/applications/luci-app-uugamebooster/root/usr/share/luci/menu.d/luci-app-uugamebooster.json @@ -0,0 +1,13 @@ +{ + "admin/services/uugamebooster": { + "title": "UU GameAcc", + "action": { + "type": "view", + "path": "uugamebooster" + }, + "depends": { + "acl": [ "luci-app-uugamebooster" ], + "uci": { "uugamebooster": true } + } + } +} diff --git a/applications/luci-app-uugamebooster/root/usr/share/rpcd/acl.d/luci-app-uugamebooster.json b/applications/luci-app-uugamebooster/root/usr/share/rpcd/acl.d/luci-app-uugamebooster.json new file mode 100644 index 0000000000..11cbb55fa9 --- /dev/null +++ b/applications/luci-app-uugamebooster/root/usr/share/rpcd/acl.d/luci-app-uugamebooster.json @@ -0,0 +1,14 @@ +{ + "luci-app-uugamebooster": { + "description": "Grant UCI access for luci-app-uugamebooster", + "read": { + "ubus": { + "service": [ "list" ] + }, + "uci": [ "uugamebooster" ] + }, + "write": { + "uci": [ "uugamebooster" ] + } + } +} diff --git a/applications/luci-app-uugamebooster/root/www/uugamebooster/uuandroid.png b/applications/luci-app-uugamebooster/root/www/uugamebooster/uuandroid.png new file mode 100644 index 0000000000..279b9f7071 Binary files /dev/null and b/applications/luci-app-uugamebooster/root/www/uugamebooster/uuandroid.png differ diff --git a/applications/luci-app-uugamebooster/root/www/uugamebooster/uuios.png b/applications/luci-app-uugamebooster/root/www/uugamebooster/uuios.png new file mode 100644 index 0000000000..bce47ab984 Binary files /dev/null and b/applications/luci-app-uugamebooster/root/www/uugamebooster/uuios.png differ