mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-27 10:31:38 +08:00
🎨 Sync 2026-04-18 23:44:18
This commit is contained in:
parent
4f4f9882d8
commit
292a6f3a2e
@ -1,18 +1,14 @@
|
||||
# Copyright (C) 2021 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
# 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
|
||||
|
||||
PKG_NAME:=luci-app-uugamebooster
|
||||
PKG_VERSION:=2.0
|
||||
PKG_RELEASE:=2
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
@ -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 = '<span style="color:%s"><strong>%s %s</strong></span>';
|
||||
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();
|
||||
}
|
||||
|
||||
});
|
||||
@ -1,17 +0,0 @@
|
||||
module("luci.controller.uugamebooster", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/uugamebooster") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "uugamebooster"}, cbi("uugamebooster"), ("UU GameAcc"), 99).dependent = true
|
||||
entry({"admin", "services", "uugamebooster", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("pgrep -f uugamebooster >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
@ -1,19 +0,0 @@
|
||||
require("luci.util")
|
||||
|
||||
mp = Map("uugamebooster")
|
||||
mp.title = translate("UU Game Accelerator")
|
||||
mp.description = translate("A Paid Game Acceleration service")
|
||||
|
||||
mp:section(SimpleSection).template = "uugamebooster/uugamebooster_status"
|
||||
|
||||
s = mp:section(TypedSection, "uugamebooster")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o = s:option(Flag, "enabled", translate("Enable"))
|
||||
o.default = 0
|
||||
o.optional = false
|
||||
|
||||
mp:section(SimpleSection).template = "uugamebooster/uugamebooster_qcode"
|
||||
|
||||
return mp
|
||||
@ -1,6 +0,0 @@
|
||||
|
||||
<fieldset class="cbi-section">
|
||||
<p id="uugamebooster_qcode">
|
||||
<img src="/uuios.png" height="300" /><img src="/uuandriod.png" height="300" />
|
||||
</p>
|
||||
</fieldset>
|
||||
@ -1,21 +0,0 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[uugamebooster]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('uugamebooster_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
tb.innerHTML = '<em><b><font color=green>UU GameAcc <%:RUNNING%></font></b></em>';
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>UU GameAcc <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="uugamebooster_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
23
luci-app-uugamebooster/po/templates/uugamebooster.pot
Normal file
23
luci-app-uugamebooster/po/templates/uugamebooster.pot
Normal file
@ -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 ""
|
||||
1
luci-app-uugamebooster/po/zh-cn
Symbolic link
1
luci-app-uugamebooster/po/zh-cn
Symbolic link
@ -0,0 +1 @@
|
||||
zh_Hans
|
||||
@ -1,12 +0,0 @@
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "UU GameAcc"
|
||||
msgstr "UU游戏加速器"
|
||||
|
||||
msgid "UU Game Accelerator"
|
||||
msgstr "UU游戏加速器"
|
||||
|
||||
msgid "A Paid Game Acceleration service"
|
||||
msgstr "一个富家子弟用的主机游戏加速器 (开启服务后,使用手机APP绑定路由器并指定加速主机)"
|
||||
@ -1 +0,0 @@
|
||||
zh-cn
|
||||
23
luci-app-uugamebooster/po/zh_Hans/uugamebooster.po
Normal file
23
luci-app-uugamebooster/po/zh_Hans/uugamebooster.po
Normal file
@ -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 "正在收集数据中..."
|
||||
@ -1,4 +0,0 @@
|
||||
|
||||
config uuplugin 'uuplugin'
|
||||
option enabled '0'
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2021 Tianling Shen <cnsztl@immortalwrt.org>
|
||||
|
||||
USE_PROCD=1
|
||||
START=99
|
||||
|
||||
CONF="uugamebooster"
|
||||
PROG="/usr/bin/uugamebooster"
|
||||
|
||||
UU_CONF="/usr/share/uugamebooster/uu.conf"
|
||||
|
||||
start_service() {
|
||||
config_load "$CONF"
|
||||
local enabled
|
||||
config_get_bool enabled "config" "enabled" "0"
|
||||
[ "$enabled" -eq "1" ] || return 1
|
||||
|
||||
procd_open_instance "$CONF"
|
||||
|
||||
procd_set_param command "$PROG" "$UU_CONF"
|
||||
|
||||
procd_set_param limits core="unlimited"
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "$CONF"
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
#!/bin/sh
|
||||
[ ! -f "/usr/share/ucitrack/luci-app-uugamebooster.json" ] && {
|
||||
cat > /usr/share/ucitrack/luci-app-uugamebooster.json << EEOF
|
||||
{
|
||||
"config": "uugamebooster",
|
||||
"init": "uugamebooster"
|
||||
}
|
||||
EEOF
|
||||
}
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@uugamebooster[-1]
|
||||
add ucitrack uugamebooster
|
||||
set ucitrack.@uugamebooster[-1].init=uugamebooster
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"admin/services/uugamebooster": {
|
||||
"title": "UU GameAcc",
|
||||
"action": {
|
||||
"type": "view",
|
||||
"path": "uugamebooster"
|
||||
},
|
||||
"depends": {
|
||||
"acl": [ "luci-app-uugamebooster" ],
|
||||
"uci": { "uugamebooster": true }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,10 +2,13 @@
|
||||
"luci-app-uugamebooster": {
|
||||
"description": "Grant UCI access for luci-app-uugamebooster",
|
||||
"read": {
|
||||
"uci": [ "uuplugin" ]
|
||||
"ubus": {
|
||||
"service": [ "list" ]
|
||||
},
|
||||
"uci": [ "uugamebooster" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "uuplugin" ]
|
||||
"uci": [ "uugamebooster" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 231 KiB |
BIN
luci-app-uugamebooster/root/www/uugamebooster/uuandroid.png
Normal file
BIN
luci-app-uugamebooster/root/www/uugamebooster/uuandroid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 75 KiB |
BIN
luci-app-uugamebooster/root/www/uugamebooster/uuios.png
Normal file
BIN
luci-app-uugamebooster/root/www/uugamebooster/uuios.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue
Block a user