mirror of
https://github.com/kenzok8/small-package
synced 2025-01-05 11:36:47 +08:00
update 2024-10-25 23:28:01
This commit is contained in:
parent
c16c869793
commit
656b03e6a2
22
luci-app-gecoosac/Makefile
Normal file
22
luci-app-gecoosac/Makefile
Normal file
@ -0,0 +1,22 @@
|
||||
# Copyright (C) 2016 Openwrt.org
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-gecoosac
|
||||
PKG_VERSION:=1.0.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
LUCI_TITLE:=LuCI Support for gecoosac
|
||||
LUCI_DEPENDS:=+luci-compat
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/gecoosac
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
8
luci-app-gecoosac/README.md
Normal file
8
luci-app-gecoosac/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Akimio521/luci-app-gecoosac
|
||||
**集客 AC For OpenWRT**
|
||||
|
||||
在 OpenWRT 中提供集客 AC 控制器
|
||||
|
||||
来源:[Openwrt插件-集客AC控制器,附Luci源码 | 恩山论坛](https://www.right.com.cn/forum/forum.php?mod=viewthread&tid=8379292)
|
||||
|
||||
**本仓库仅供学习,不提供任何商业用途,若有侵权,请联系我删除**
|
21
luci-app-gecoosac/luasrc/controller/gecoosac.lua
Normal file
21
luci-app-gecoosac/luasrc/controller/gecoosac.lua
Normal file
@ -0,0 +1,21 @@
|
||||
module("luci.controller.gecoosac", package.seeall)
|
||||
local uci=require"luci.model.uci".cursor()
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/gecoosac") then
|
||||
return
|
||||
end
|
||||
entry({"admin", "services"}, firstchild(), _("services") , 45).dependent = false
|
||||
local page
|
||||
page = entry({"admin", "services", "gecoosac"}, cbi("gecoosac"), _("集客AC控制器"), 100)
|
||||
page.dependent = true
|
||||
entry({"admin","services","gecoosac","status"},call("act_status")).leaf=true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e={}
|
||||
local binpath=uci:get("gecoosac","config","program_path")
|
||||
e.running=luci.sys.call("pgrep "..binpath.." >/dev/null")==0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
38
luci-app-gecoosac/luasrc/model/cbi/gecoosac.lua
Normal file
38
luci-app-gecoosac/luasrc/model/cbi/gecoosac.lua
Normal file
@ -0,0 +1,38 @@
|
||||
m = Map("gecoosac", translate("集客AC控制器"), translate("用于统一批量管理集客AP的程序。"))
|
||||
|
||||
m:section(SimpleSection).template = "gecoosac/gecoosac_status"
|
||||
|
||||
s = m:section(TypedSection, "gecoosac")
|
||||
s.addremove = false
|
||||
s.anonymous = true
|
||||
|
||||
enable = s:option(Flag, "enabled", translate("启用"))
|
||||
enable.rmempty = false
|
||||
|
||||
o = s:option(Value, "program_path", translate("程序路径"))
|
||||
o.placeholder = "/usr/bin/gecoosac"
|
||||
o.default = "/usr/bin/gecoosac"
|
||||
o.description = translate("可执行文件路径,权限为0755")
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "port", translate("监听端口"))
|
||||
o.placeholder = 60650
|
||||
o.default = 60650
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "upload_dir", translate("上传目录"))
|
||||
o.placeholder = "/etc/gecoosac/upload/"
|
||||
o.default = "/etc/gecoosac/upload/"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "db_dir", translate("数据库目录"))
|
||||
o.placeholder = "/etc/gecoosac/"
|
||||
o.default = "/etc/gecoosac/"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Flag, "log", translate("启用日志"))
|
||||
o.default = 1
|
||||
o.rmempty = false
|
||||
|
||||
return m
|
28
luci-app-gecoosac/luasrc/view/gecoosac/gecoosac_status.htm
Normal file
28
luci-app-gecoosac/luasrc/view/gecoosac/gecoosac_status.htm
Normal file
@ -0,0 +1,28 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(1, '<%=url([[admin]], [[services]], [[gecoosac]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('gecoosac_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<font color=green>集客AC控制器 <%:运行中%></font><input class="cbi-button mar-10" type="button" value="<%:打开管理界面%>" onclick="openClient();" />';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<font color=red>集客AC控制器 <%:未运行%></font>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
function openClient() {
|
||||
var clientPort = window.document.getElementById("cbid.gecoosac.config.port").value
|
||||
var url = window.location.protocol + "//" + window.location.hostname + ":" + clientPort;
|
||||
window.open(url);
|
||||
};
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="gecoosac_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
9
luci-app-gecoosac/root/etc/config/gecoosac
Normal file
9
luci-app-gecoosac/root/etc/config/gecoosac
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
config gecoosac 'config'
|
||||
option enabled '0'
|
||||
option program_path '/usr/bin/gecoosac'
|
||||
option port '60650'
|
||||
option upload_dir '/etc/gecoosac/upload/'
|
||||
option db_dir '/etc/gecoosac/'
|
||||
option log '0'
|
||||
|
54
luci-app-gecoosac/root/etc/init.d/gecoosac
Normal file
54
luci-app-gecoosac/root/etc/init.d/gecoosac
Normal file
@ -0,0 +1,54 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2021 ImmortalWrt
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/procd.sh
|
||||
|
||||
USE_PROCD=1
|
||||
|
||||
START=90
|
||||
STOP=10
|
||||
|
||||
init_conf() {
|
||||
config_load "gecoosac"
|
||||
config_get "program_path" "config" "program_path" "/usr/bin/gecoosac"
|
||||
config_get "db_dir" "config" "db_dir" "/etc/gecoosac/"
|
||||
config_get "upload_dir" "config" "upload_dir" "/etc/gecoosac/upload/"
|
||||
config_get "enabled" "config" "enabled" "0"
|
||||
config_get "port" "config" "port" "60650"
|
||||
config_get "log" "config" "log" "0"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
init_conf
|
||||
[ "${enabled}" == "1" ] || return 0
|
||||
procd_open_instance gecoosac
|
||||
|
||||
procd_set_param command $program_path
|
||||
procd_append_param command -f "${upload_dir}"
|
||||
procd_append_param command -p "${port}"
|
||||
procd_append_param command -debug "0"
|
||||
procd_append_param command -dbpath "${db_dir}"
|
||||
procd_append_param command -token "1"
|
||||
procd_append_param command -lang "zh"
|
||||
procd_set_param env GIN_MODE=release
|
||||
procd_set_param pidfile /var/run/gecoosac.pid
|
||||
procd_set_param stdout $log
|
||||
procd_set_param stderr $log
|
||||
procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5}
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service(){
|
||||
init_conf
|
||||
}
|
||||
|
||||
reload_service()
|
||||
{
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "gecoosac"
|
||||
}
|
11
luci-app-gecoosac/root/etc/uci-defaults/luci-gecoosac
Normal file
11
luci-app-gecoosac/root/etc/uci-defaults/luci-gecoosac
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@gecoosac[-1]
|
||||
add ucitrack gecoosac
|
||||
set ucitrack.@gecoosac[-1].init=gecoosac
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"luci-app-gecoosac": {
|
||||
"description": "Grant UCI access for luci-app-gecoosac",
|
||||
"read": {
|
||||
"uci": [ "gecoosac" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "gecoosac" ]
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user