uugamebooster & luci-app-uugamebooster: (#6217)

* uugamebooster: rebuild startup service
* luci-app-uugamebooster: use standerd terms
* luci-app-uugamebooster: use inter-startup funcion
* luci-app-uugamebooster: fix typo
This commit is contained in:
ZhenYu 2021-01-19 23:42:00 +08:00 committed by GitHub
parent 3fedff6615
commit f60d3ea9c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 107 additions and 106 deletions

View File

@ -10,8 +10,8 @@ LUCI_DEPENDS:=+uugamebooster
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-uugamebooster
PKG_VERSION:=1.0
PKG_RELEASE:=3
PKG_RELEASE:=5
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,15 @@
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/uugamebooster"), ("UU Game Booster"),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

View File

@ -1,15 +0,0 @@
module("luci.controller.uuplugin",package.seeall)
function index()
if not nixio.fs.access("/etc/config/uuplugin") then return end
entry({"admin", "services", "uuplugin"}, cbi("uuplugin/uuplugin"), ("UU GameAcc"),99).dependent=true
entry({"admin","services","uuplugin","status"},call("act_status")).leaf=true
end
function act_status()
local e={}
e.running=luci.sys.call("pgrep -f uuplugin >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@ -0,0 +1,24 @@
require("luci.util")
mp = Map("uugamebooster", translate("UU Game Booster"))
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
function o.write(self, section, value)
if value == "1" then
luci.sys.call("/etc/init.d/uugamebooster start >/dev/null && /etc/init.d/uugamebooster enable >/dev/null")
else
luci.sys.call("/etc/init.d/uugamebooster stop >/dev/null && /etc/init.d/uugamebooster disable >/dev/null")
end
return Flag.write(self, section, value)
end
return mp

View File

@ -1,15 +0,0 @@
require("luci.util")
mp = Map("uuplugin", translate("UU Game Accelerator"))
mp.description = translate("A Paid Game Acceleration service")
mp:section(SimpleSection).template = "uuplugin/uuplugin_status"
s = mp:section(TypedSection, "uuplugin")
s.anonymous=true
s.addremove=false
o = s:option(Flag, "enabled", translate("Enable"))
o.default = 0
o.optional = false
return mp

View File

@ -0,0 +1,21 @@
<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 Game Booster <%:RUNNING%></font></b></em>';
} else {
tb.innerHTML = '<em><b><font color=red>UU Game Booster <%: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>

View File

@ -1,21 +0,0 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[uuplugin]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('uuplugin_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="uuplugin_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,9 @@
msgid "Enable"
msgstr "启用"
msgid "UU Game Booster"
msgstr "网易UU网游加速器"
msgid "A Paid Game Acceleration service"
msgstr "一个富家子弟用的游戏加速器"

View File

@ -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 "一个富家子弟用的的游戏加速器"

View File

@ -0,0 +1,4 @@
config uugamebooster 'uugamebooster'
option enabled '0'

View File

@ -1,4 +0,0 @@
config uuplugin 'uuplugin'
option enabled '0'

View File

@ -1,23 +0,0 @@
#!/bin/sh /etc/rc.common
START=99
STOP=10
USE_PROCD=1
NAME="uugamebooster"
UU_BIN="/usr/share/uugamebooster/uuplugin"
UU_CONF="/usr/share/uugamebooster/uu.conf"
UU_LOGFILE="/tmp/uugamebooster.log"
start_service() {
config_load uuplugin
local enable
config_get_bool enable uuplugin enabled
if [ "$enable" -eq 1 ]; then
procd_open_instance
procd_set_param command $UU_BIN $UU_CONF >$UU_LOGFILE 2>&1
procd_set_param respawn
procd_close_instance
fi
}

View File

@ -0,0 +1,11 @@
#!/bin/sh
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

View File

@ -1,11 +0,0 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@uuplugin[-1]
add ucitrack uuplugin
set ucitrack.@uuplugin[-1].init=uuplugin
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@ -13,7 +13,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=uugamebooster
PKG_VERSION:=v2.7.2
PKG_RELEASE:=5
PKG_RELEASE:=6
include $(INCLUDE_DIR)/package.mk
@ -70,8 +70,8 @@ define Build/Compile
endef
define Package/$(PKG_NAME)/install
# $(INSTALL_DIR) $(1)/etc/init.d
# $(INSTALL_BIN) ./files/uugamebooster.init $(1)/etc/init.d/uuplugin
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/uugamebooster.init $(1)/etc/init.d/uugamebooster
$(INSTALL_DIR) $(1)/usr/share/$(PKG_NAME)
$(INSTALL_BIN) $(UNTAR_DIR)/uuplugin $(1)/usr/share/$(PKG_NAME)/uuplugin

View File

@ -0,0 +1,18 @@
#!/bin/sh /etc/rc.common
START=99
STOP=10
USE_PROCD=1
NAME="uugamebooster"
UU_BIN="/usr/share/uugamebooster/uuplugin"
UU_CONF="/usr/share/uugamebooster/uu.conf"
UU_LOGFILE="/tmp/uugamebooster.log"
start_service() {
procd_open_instance
procd_set_param command $UU_BIN $UU_CONF >$UU_LOGFILE 2>&1
procd_set_param respawn
procd_close_instance
}