mirror of
https://github.com/kenzok8/openwrt-packages.git
synced 2025-11-01 08:18:52 +08:00
update 2023-04-29 08:24:51
This commit is contained in:
@ -1,23 +1,23 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-serverchan
|
||||
PKG_VERSION:=2.02.1
|
||||
PKG_RELEASE:=10
|
||||
|
||||
PKG_MAINTAINER:=tty228 <tty228@yeah.net>
|
||||
|
||||
LUCI_TITLE:=LuCI support for serverchan
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+iputils-arping +curl +jq
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/serverchan
|
||||
/usr/share/serverchan/api/diy.json
|
||||
/usr/share/serverchan/api/logo.jpg
|
||||
/usr/share/serverchan/api/ipv4.list
|
||||
/usr/share/serverchan/api/ipv6.list
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-serverchan
|
||||
PKG_VERSION:=2.02.0
|
||||
PKG_RELEASE:=9
|
||||
|
||||
PKG_MAINTAINER:=tty228 <tty228@yeah.net>
|
||||
|
||||
LUCI_TITLE:=LuCI support for serverchan
|
||||
LUCI_PKGARCH:=all
|
||||
LUCI_DEPENDS:=+iputils-arping +curl +jq
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/serverchan
|
||||
/usr/bin/serverchan/api/diy.json
|
||||
/usr/bin/serverchan/api/logo.jpg
|
||||
/usr/bin/serverchan/api/ipv4.list
|
||||
/usr/bin/serverchan/api/ipv6.list
|
||||
endef
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
||||
|
||||
@ -1,49 +1,49 @@
|
||||
# 简介
|
||||
- 用于 OpenWRT/LEDE 路由器上进行 微信/Telegram 推送的插件
|
||||
- 支持列表:
|
||||
- 微信推送/Server酱 https://sct.ftqq.com/
|
||||
- 企业微信/应用推送 https://work.weixin.qq.com/api/doc/90000/90135/90248
|
||||
- 微信推送/WxPusher https://wxpusher.zjiecode.com/docs
|
||||
- 微信推送/推送加 http://www.pushplus.plus/
|
||||
- Telegram/BotFather https://t.me/BotFather
|
||||
- 精力有限,如需要钉钉推送、飞书推送、Bark推送等请尝试 https://github.com/zzsj0928/luci-app-pushbot
|
||||
- **基于 x86 OpenWrt 19.07.8 制作,不同系统不同设备,请自行修改部分代码,无测试条件无法重现的 bug 不考虑修复**
|
||||
- 依赖 iputils-arping + curl + jq 命令,安装前请 `opkg update`,小内存路由谨慎安装
|
||||
- 使用主动探测设备连接的方式检测设备在线状态,以避免 Wi-Fi 休眠机制,主动探测较为耗时,**如遇设备休眠频繁,请自行调整超时设置**
|
||||
- 流量统计功能依赖 wrtbwmon ,自行选装或编译,该插件与 Routing/NAT 、Flow Offloading 冲突,开启无法获取流量,自行选择
|
||||
|
||||
#### 主要功能
|
||||
- 路由 IP/IPv6 变动推送
|
||||
- 设备别名
|
||||
- 设备上线推送
|
||||
- 设备离线推送及流量使用情况
|
||||
- CPU 负载、温度监视
|
||||
- 定时推送设备运行状态
|
||||
- MAC 白名单、黑名单、按接口检测设备
|
||||
- 免打扰
|
||||
- 无人值守任务
|
||||
|
||||
#### 已知问题
|
||||
- 直接关闭接口时,该接口的离线设备会忽略检测
|
||||
- 部分设备无法读取到设备名,脚本使用 `cat /tmp/dhcp.leases` 命令读取设备名,如果 DHCP 中不存在设备名,则无法读取设备名(如二级路由设备、静态IP设备),请使用设备名备注.
|
||||
- 基于X86 OpenWrt 19.07.8 制作,不同系统不同设备,可能会遇到各种问题
|
||||
- 潘多拉系统、或不支持 sh 的系统,请将脚本开头 `#!/bin/sh` 改为 `#!/bin/bash`,或手动安装 `sh`
|
||||
|
||||
# Download
|
||||
- [luci-app-serverchan](https://github.com/tty228/luci-app-serverchan/releases)
|
||||
- [wrtbwmon](https://github.com/brvphoenix/wrtbwmon)
|
||||
- [luci-app-wrtbwmon](https://github.com/brvphoenix/luci-app-wrtbwmon)
|
||||
- **L大版本直接编译 luci-app-wrtbwmon ,非原版 LuCI 如使用以上 wrtbwmon,请注意安装版本号**
|
||||
|
||||
#### PS
|
||||
- 新功能看情况开发,忙得头晕眼花
|
||||
- 欢迎各种代码提交
|
||||
- 提交bug时请尽量带上设备信息,日志与描述
|
||||
(如执行 `/usr/share/serverchan/serverchan` 后的提示、日志信息、/tmp/serverchan/ipAddress 文件信息、或尝试使用 sh -x /usr/share/serverchan/serverchan 查看详细运行信息 )
|
||||
- 三言两句恕我无能为力
|
||||
|
||||
# Donate
|
||||
如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。
|
||||
|
||||

|
||||
|
||||
# 简介
|
||||
- 用于 OpenWRT/LEDE 路由器上进行 微信/Telegram 推送的插件
|
||||
- 支持列表:
|
||||
- 微信推送/Server酱 https://sct.ftqq.com/
|
||||
- 企业微信/应用推送 https://work.weixin.qq.com/api/doc/90000/90135/90248
|
||||
- 微信推送/WxPusher https://wxpusher.zjiecode.com/docs
|
||||
- 微信推送/推送加 http://www.pushplus.plus/
|
||||
- Telegram/BotFather https://t.me/BotFather
|
||||
- 精力有限,如需要钉钉推送、飞书推送、Bark推送等请尝试 https://github.com/zzsj0928/luci-app-pushbot
|
||||
- **基于 x86 OpenWrt 19.07.8 制作,不同系统不同设备,请自行修改部分代码,无测试条件无法重现的 bug 不考虑修复**
|
||||
- 依赖 iputils-arping + curl + jq 命令,安装前请 `opkg update`,小内存路由谨慎安装
|
||||
- 使用主动探测设备连接的方式检测设备在线状态,以避免 Wi-Fi 休眠机制,主动探测较为耗时,**如遇设备休眠频繁,请自行调整超时设置**
|
||||
- 流量统计功能依赖 wrtbwmon ,自行选装或编译,该插件与 Routing/NAT 、Flow Offloading 冲突,开启无法获取流量,自行选择
|
||||
|
||||
#### 主要功能
|
||||
- 路由 IP/IPv6 变动推送
|
||||
- 设备别名
|
||||
- 设备上线推送
|
||||
- 设备离线推送及流量使用情况
|
||||
- CPU 负载、温度监视
|
||||
- 定时推送设备运行状态
|
||||
- MAC 白名单、黑名单、按接口检测设备
|
||||
- 免打扰
|
||||
- 无人值守任务
|
||||
|
||||
#### 已知问题
|
||||
- 直接关闭接口时,该接口的离线设备会忽略检测
|
||||
- 部分设备无法读取到设备名,脚本使用 `cat /tmp/dhcp.leases` 命令读取设备名,如果 DHCP 中不存在设备名,则无法读取设备名(如二级路由设备、静态IP设备),请使用设备名备注.
|
||||
- 基于X86 OpenWrt 19.07.8 制作,不同系统不同设备,可能会遇到各种问题
|
||||
- 潘多拉系统、或不支持 sh 的系统,请将脚本开头 `#!/bin/sh` 改为 `#!/bin/bash`,或手动安装 `sh`
|
||||
|
||||
# Download
|
||||
- [luci-app-serverchan](https://github.com/tty228/luci-app-serverchan/releases)
|
||||
- [wrtbwmon](https://github.com/brvphoenix/wrtbwmon)
|
||||
- [luci-app-wrtbwmon](https://github.com/brvphoenix/luci-app-wrtbwmon)
|
||||
- **L大版本直接编译 luci-app-wrtbwmon ,非原版 LuCI 如使用以上 wrtbwmon,请注意安装版本号**
|
||||
|
||||
#### PS
|
||||
- 新功能看情况开发,忙得头晕眼花
|
||||
- 欢迎各种代码提交
|
||||
- 提交bug时请尽量带上设备信息,日志与描述
|
||||
(如执行 `/usr/bin/serverchan/serverchan` 后的提示、日志信息、/tmp/serverchan/ipAddress 文件信息、或尝试使用 sh -x /usr/bin/serverchan/serverchan 查看详细运行信息 )
|
||||
- 三言两句恕我无能为力
|
||||
|
||||
# Donate
|
||||
如果你觉得此项目对你有帮助,请捐助我们,以使项目能持续发展,更加完善。
|
||||
|
||||

|
||||
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
module("luci.controller.serverchan", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/serverchan") then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "services", "serverchan"}, alias("admin", "services", "serverchan", "setting"), _("微信推送"), 30)
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-serverchan" }
|
||||
|
||||
entry({"admin", "services", "serverchan", "setting"}, cbi("serverchan/setting"), _("配置"), 40).leaf = true
|
||||
entry({"admin", "services", "serverchan", "advanced"}, cbi("serverchan/advanced"), _("高级设置"), 50).leaf = true
|
||||
entry({"admin", "services", "serverchan", "client"}, form("serverchan/client"), _("在线设备"), 80)
|
||||
entry({"admin", "services", "serverchan", "log"}, form("serverchan/log"), _("日志"), 99).leaf = true
|
||||
entry({"admin", "services", "serverchan", "get_log"}, call("get_log")).leaf = true
|
||||
entry({"admin", "services", "serverchan", "clear_log"}, call("clear_log")).leaf = true
|
||||
entry({"admin", "services", "serverchan", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("busybox ps|grep -v grep|grep -c serverchan >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function get_log()
|
||||
luci.http.write(luci.sys.exec("[ -f '/tmp/serverchan/serverchan.log' ] && cat /tmp/serverchan/serverchan.log"))
|
||||
end
|
||||
|
||||
function clear_log()
|
||||
luci.sys.call("echo '' > /tmp/serverchan/serverchan.log")
|
||||
end
|
||||
module("luci.controller.serverchan", package.seeall)
|
||||
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/serverchan") then
|
||||
return
|
||||
end
|
||||
|
||||
local page = entry({"admin", "services", "serverchan"}, alias("admin", "services", "serverchan", "setting"), _("微信推送"), 30)
|
||||
page.dependent = true
|
||||
page.acl_depends = { "luci-app-serverchan" }
|
||||
|
||||
entry({"admin", "services", "serverchan", "setting"}, cbi("serverchan/setting"), _("配置"), 40).leaf = true
|
||||
entry({"admin", "services", "serverchan", "advanced"}, cbi("serverchan/advanced"), _("高级设置"), 50).leaf = true
|
||||
entry({"admin", "services", "serverchan", "client"}, form("serverchan/client"), _("在线设备"), 80)
|
||||
entry({"admin", "services", "serverchan", "log"}, form("serverchan/log"), _("日志"), 99).leaf = true
|
||||
entry({"admin", "services", "serverchan", "get_log"}, call("get_log")).leaf = true
|
||||
entry({"admin", "services", "serverchan", "clear_log"}, call("clear_log")).leaf = true
|
||||
entry({"admin", "services", "serverchan", "status"}, call("act_status")).leaf = true
|
||||
end
|
||||
|
||||
function act_status()
|
||||
local e = {}
|
||||
e.running = luci.sys.call("busybox ps|grep -v grep|grep -c serverchan >/dev/null") == 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
function get_log()
|
||||
luci.http.write(luci.sys.exec("[ -f '/tmp/serverchan/serverchan.log' ] && cat /tmp/serverchan/serverchan.log"))
|
||||
end
|
||||
|
||||
function clear_log()
|
||||
luci.sys.call("echo '' > /tmp/serverchan/serverchan.log")
|
||||
end
|
||||
|
||||
@ -1,166 +1,166 @@
|
||||
local nt = require "luci.sys".net
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
m = Map("serverchan", translate("提示:"))
|
||||
m.description = translate("如果你不了解这些选项的含义,请不要修改这些选项")
|
||||
|
||||
s = m:section(TypedSection, "serverchan", "高级设置")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
a = s:option(Value, "up_timeout", translate('设备上线检测超时(s)'))
|
||||
a.default = "2"
|
||||
a.optional = false
|
||||
a.datatype = "uinteger"
|
||||
|
||||
a = s:option(Value, "down_timeout", translate('设备离线检测超时(s)'))
|
||||
a.default = "20"
|
||||
a.optional = false
|
||||
a.datatype = "uinteger"
|
||||
|
||||
a = s:option(Value, "timeout_retry_count", translate('离线检测次数'))
|
||||
a.default = "2"
|
||||
a.optional = false
|
||||
a.datatype = "uinteger"
|
||||
a.description = translate("若无二级路由设备,信号强度良好,可以减少以上数值<br/>因夜间 wifi 休眠较为玄学,遇到设备频繁推送断开,烦请自行调整参数<br/>..╮(╯_╰)╭..")
|
||||
|
||||
a = s:option(Value, "thread_num", translate('最大并发进程数'))
|
||||
a.default = "3"
|
||||
a.datatype = "uinteger"
|
||||
|
||||
a = s:option(Value, "soc_code", "自定义温度读取命令")
|
||||
a.rmempty = true
|
||||
a:value("", translate("默认"))
|
||||
a:value("pve", translate("PVE 虚拟机"))
|
||||
a.description = translate("自定义命令如需使用特殊符号,如引号、$、!等,则需要自行转义,并在保存后查看 /etc/config/serverchan 文件 soc_code 设置项是否保存正确<br/>可以使用 eval `echo $(uci get serverchan.serverchan.soc_code)` 命令查看命令输出及错误信息<br/>执行结果需为纯数字(可带小数),用于温度对比")
|
||||
|
||||
a = s:option(Value, "server_host", translate("宿主机地址"))
|
||||
a.rmempty = true
|
||||
a.default = "10.0.0.2"
|
||||
a.description = translate("")
|
||||
a:depends({soc_code = "pve"})
|
||||
|
||||
a = s:option(Value, "server_port", translate("宿主机 SSH 端口"))
|
||||
a.rmempty = true
|
||||
a.default = "22"
|
||||
a.description = translate("SSH 端口默认为 22,如有自定义,请填写自定义 SSH 端口<br/>请确认已经设置好密钥登陆,否则会引起脚本无法运行等错误!<br/>PVE 安装 sensors 命令自行百度<br/>密钥登陆例(自行修改地址与端口号):<br/>opkg update #更新列表<br/>opkg install openssh-client openssh-keygen #安装openssh客户端<br/>echo -e \"\\n\" | ssh-keygen -t rsa # 生成密钥文件(空密码)<br/>pve_host=`uci get serverchan.serverchan.server_host` || pve_host=\"10.0.0.3\" # 读取配置文件中的 pve 主机地址,如果不存在请自行填写 <br/>pve_port=`uci get serverchan.serverchan.server_port` || pve_host=\"22\" # 读取配置文件中的 pve 主机 ssh 端口号,,如果不存在请自行填写 <br/>ssh root@${pve_host} -p ${pve_port} \"tee -a ~/.ssh/id_rsa.pub\" < ~/.ssh/id_rsa.pub # 传送公钥到 PVE<br/>ssh root@${pve_host} -p ${pve_port} \"cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys\" # 写入公钥到 PVE<br/>ssh -i /root/.ssh/id_rsa root@${pve_host} -p ${pve_port} sensors # 使用私钥连接 PVE 测试温度命令<br/>刷机党自行将 /root/.ssh/ 加入备份列表,避免重复操作")
|
||||
a:depends({soc_code = "pve"})
|
||||
|
||||
a = s:option(Button, "soc", translate("测试温度命令"))
|
||||
a.inputtitle = translate("输出信息")
|
||||
a.write = function()
|
||||
luci.sys.call("/usr/share/serverchan/serverchan soc")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "serverchan", "advanced"))
|
||||
end
|
||||
|
||||
if nixio.fs.access("/tmp/serverchan/soc_tmp") then
|
||||
e = s:option(TextValue,"soc_tmp")
|
||||
e.rows = 2
|
||||
e.readonly = true
|
||||
e.cfgvalue = function()
|
||||
return luci.sys.exec("cat /tmp/serverchan/soc_tmp && rm -f /tmp/serverchan/soc_tmp")
|
||||
end
|
||||
end
|
||||
|
||||
a = s:option(Flag, "gateway_info_enable", translate("从光猫获取主机名等信息"))
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a.description = translate("适用于 OpenWrt 作为透明网关,无法获取设备主机名及完整的局域网设备列表时<br/>仅测试通过 HG5143F 天翼网关,不保证通用性")
|
||||
|
||||
a = s:option(Value, "gateway_host_url", translate('光猫登录地址 URL'))
|
||||
a.rmempty = true
|
||||
a.default = "http://192.168.1.1/cgi-bin/luci"
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_info_url", translate('设备列表 JSON URL'))
|
||||
a.rmempty = true
|
||||
a.default = "http://192.168.1.1/cgi-bin/luci/admin/allInfo"
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_logout_url", translate('光猫注销登录 URL'))
|
||||
a.rmempty = true
|
||||
a.default = "http://192.168.1.1/cgi-bin/luci/admin/logout"
|
||||
a.description = translate("使用 F12 控制台自行抓取")
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_username_id", translate('登录页面帐号输入框 ID'))
|
||||
a.rmempty = true
|
||||
a.default = "username"
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_password_id", translate('登录页面密码输入框 ID'))
|
||||
a.rmempty = true
|
||||
a.default = "psd"
|
||||
a.description = translate("浏览器右键-检查元素")
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_username", translate('光猫登录帐号'))
|
||||
a.rmempty = true
|
||||
a.default = "useradmin"
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_password", translate('光猫登录密码'))
|
||||
a.rmempty = true
|
||||
a.description = translate("使用普通账号即可,不需要超密")
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Flag, "err_enable", translate("无人值守任务"))
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a.description = translate("请确认脚本可以正常运行,否则可能造成频繁重启等错误!")
|
||||
|
||||
a = s:option(Flag, "err_sheep_enable", translate("仅在免打扰时段重拨"))
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a.description = translate("避免白天重拨 DDNS 域名等待解析,此功能不影响断网检测<br/>因夜间跑流量问题,该功能可能不稳定")
|
||||
a:depends({err_enable = "1"})
|
||||
|
||||
a = s:option(DynamicList, "err_device_aliases", translate("关注列表"))
|
||||
a.rmempty = true
|
||||
a.description = translate("只会在列表中设备都不在线时才会执行<br/>免打扰时段一小时后,关注设备五分钟低流量(约100kb/m)将视为离线")
|
||||
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a:depends({err_enable = "1"})
|
||||
|
||||
a = s:option(ListValue, "network_err_event", translate("网络断开时"))
|
||||
a.default = ""
|
||||
a:depends({err_enable = "1"})
|
||||
a:value("", translate("无操作"))
|
||||
a:value("1", translate("重启路由器"))
|
||||
a:value("2", translate("重新拨号"))
|
||||
a:value("3", translate("修改相关设置项,尝试自动修复网络"))
|
||||
a.description = translate("选项 1 选项 2 不会修改设置,并最多尝试 2 次。<br/>选项 3 会将设置项备份于 /usr/share/serverchan/configbak 目录,并在失败后还原。<br/>【!!无法保证兼容性!!】不熟悉系统设置项,不会救砖请勿使用")
|
||||
|
||||
a = s:option(ListValue, "system_time_event", translate("定时重启"))
|
||||
a.default = ""
|
||||
a:depends({err_enable = "1"})
|
||||
a:value("", translate("无操作"))
|
||||
a:value("1", translate("重启路由器"))
|
||||
a:value("2", translate("重新拨号"))
|
||||
|
||||
a = s:option(Value, "autoreboot_time", "系统运行时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype = "uinteger"
|
||||
a:depends({system_time_event = "1"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a = s:option(Value, "network_restart_time", "网络在线时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype = "uinteger"
|
||||
a:depends({system_time_event = "2"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a = s:option(Flag, "public_ip_event", translate("重拨尝试获取公网 IP"))
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a:depends({err_enable = "1"})
|
||||
a.description = translate("重拨时不会推送 IP 变动通知,并会导致你的域名无法及时更新 IP 地址<br/>请确认你可以通过重拨获取公网 IP,否则这不仅徒劳无功还会引起频繁断网<br/>移动等大内网你就别挣扎了!!")
|
||||
|
||||
a = s:option(Value, "public_ip_retry_count", "当天最大重试次数")
|
||||
a.rmempty = true
|
||||
a.default = "10"
|
||||
a.datatype = "uinteger"
|
||||
a:depends({public_ip_event = "1"})
|
||||
|
||||
return m
|
||||
local nt = require "luci.sys".net
|
||||
local fs = require "nixio.fs"
|
||||
|
||||
m = Map("serverchan", translate("提示:"))
|
||||
m.description = translate("如果你不了解这些选项的含义,请不要修改这些选项")
|
||||
|
||||
s = m:section(TypedSection, "serverchan", "高级设置")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
a = s:option(Value, "up_timeout", translate('设备上线检测超时(s)'))
|
||||
a.default = "2"
|
||||
a.optional = false
|
||||
a.datatype = "uinteger"
|
||||
|
||||
a = s:option(Value, "down_timeout", translate('设备离线检测超时(s)'))
|
||||
a.default = "20"
|
||||
a.optional = false
|
||||
a.datatype = "uinteger"
|
||||
|
||||
a = s:option(Value, "timeout_retry_count", translate('离线检测次数'))
|
||||
a.default = "2"
|
||||
a.optional = false
|
||||
a.datatype = "uinteger"
|
||||
a.description = translate("若无二级路由设备,信号强度良好,可以减少以上数值<br/>因夜间 wifi 休眠较为玄学,遇到设备频繁推送断开,烦请自行调整参数<br/>..╮(╯_╰)╭..")
|
||||
|
||||
a = s:option(Value, "thread_num", translate('最大并发进程数'))
|
||||
a.default = "3"
|
||||
a.datatype = "uinteger"
|
||||
|
||||
a = s:option(Value, "soc_code", "自定义温度读取命令")
|
||||
a.rmempty = true
|
||||
a:value("", translate("默认"))
|
||||
a:value("pve", translate("PVE 虚拟机"))
|
||||
a.description = translate("自定义命令如需使用特殊符号,如引号、$、!等,则需要自行转义,并在保存后查看 /etc/config/serverchan 文件 soc_code 设置项是否保存正确<br/>可以使用 eval `echo $(uci get serverchan.serverchan.soc_code)` 命令查看命令输出及错误信息<br/>执行结果需为纯数字(可带小数),用于温度对比")
|
||||
|
||||
a = s:option(Value, "server_host", translate("宿主机地址"))
|
||||
a.rmempty = true
|
||||
a.default = "10.0.0.2"
|
||||
a.description = translate("")
|
||||
a:depends({soc_code = "pve"})
|
||||
|
||||
a = s:option(Value, "server_port", translate("宿主机 SSH 端口"))
|
||||
a.rmempty = true
|
||||
a.default = "22"
|
||||
a.description = translate("SSH 端口默认为 22,如有自定义,请填写自定义 SSH 端口<br/>请确认已经设置好密钥登陆,否则会引起脚本无法运行等错误!<br/>PVE 安装 sensors 命令自行百度<br/>密钥登陆例(自行修改地址与端口号):<br/>opkg update #更新列表<br/>opkg install openssh-client openssh-keygen #安装openssh客户端<br/>echo -e \"\\n\" | ssh-keygen -t rsa # 生成密钥文件(空密码)<br/>pve_host=`uci get serverchan.serverchan.server_host` || pve_host=\"10.0.0.3\" # 读取配置文件中的 pve 主机地址,如果不存在请自行填写 <br/>pve_port=`uci get serverchan.serverchan.server_port` || pve_host=\"22\" # 读取配置文件中的 pve 主机 ssh 端口号,,如果不存在请自行填写 <br/>ssh root@${pve_host} -p ${pve_port} \"tee -a ~/.ssh/id_rsa.pub\" < ~/.ssh/id_rsa.pub # 传送公钥到 PVE<br/>ssh root@${pve_host} -p ${pve_port} \"cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys\" # 写入公钥到 PVE<br/>ssh -i /root/.ssh/id_rsa root@${pve_host} -p ${pve_port} sensors # 使用私钥连接 PVE 测试温度命令<br/>刷机党自行将 /root/.ssh/ 加入备份列表,避免重复操作")
|
||||
a:depends({soc_code = "pve"})
|
||||
|
||||
a = s:option(Button, "soc", translate("测试温度命令"))
|
||||
a.inputtitle = translate("输出信息")
|
||||
a.write = function()
|
||||
luci.sys.call("/usr/bin/serverchan/serverchan soc")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "serverchan", "advanced"))
|
||||
end
|
||||
|
||||
if nixio.fs.access("/tmp/serverchan/soc_tmp") then
|
||||
e = s:option(TextValue,"soc_tmp")
|
||||
e.rows = 2
|
||||
e.readonly = true
|
||||
e.cfgvalue = function()
|
||||
return luci.sys.exec("cat /tmp/serverchan/soc_tmp && rm -f /tmp/serverchan/soc_tmp")
|
||||
end
|
||||
end
|
||||
|
||||
a = s:option(Flag, "gateway_info_enable", translate("从光猫获取主机名等信息"))
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a.description = translate("适用于 OpenWrt 作为透明网关,无法获取设备主机名及完整的局域网设备列表时<br/>仅测试通过 HG5143F 天翼网关,不保证通用性")
|
||||
|
||||
a = s:option(Value, "gateway_host_url", translate('光猫登录地址 URL'))
|
||||
a.rmempty = true
|
||||
a.default = "http://192.168.1.1/cgi-bin/luci"
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_info_url", translate('设备列表 JSON URL'))
|
||||
a.rmempty = true
|
||||
a.default = "http://192.168.1.1/cgi-bin/luci/admin/allInfo"
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_logout_url", translate('光猫注销登录 URL'))
|
||||
a.rmempty = true
|
||||
a.default = "http://192.168.1.1/cgi-bin/luci/admin/logout"
|
||||
a.description = translate("使用 F12 控制台自行抓取")
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_username_id", translate('登录页面帐号输入框 ID'))
|
||||
a.rmempty = true
|
||||
a.default = "username"
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_password_id", translate('登录页面密码输入框 ID'))
|
||||
a.rmempty = true
|
||||
a.default = "psd"
|
||||
a.description = translate("浏览器右键-检查元素")
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_username", translate('光猫登录帐号'))
|
||||
a.rmempty = true
|
||||
a.default = "useradmin"
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Value, "gateway_password", translate('光猫登录密码'))
|
||||
a.rmempty = true
|
||||
a.description = translate("使用普通账号即可,不需要超密")
|
||||
a:depends({gateway_info_enable = "1"})
|
||||
|
||||
a = s:option(Flag, "err_enable", translate("无人值守任务"))
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a.description = translate("请确认脚本可以正常运行,否则可能造成频繁重启等错误!")
|
||||
|
||||
a = s:option(Flag, "err_sheep_enable", translate("仅在免打扰时段重拨"))
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a.description = translate("避免白天重拨 DDNS 域名等待解析,此功能不影响断网检测<br/>因夜间跑流量问题,该功能可能不稳定")
|
||||
a:depends({err_enable = "1"})
|
||||
|
||||
a = s:option(DynamicList, "err_device_aliases", translate("关注列表"))
|
||||
a.rmempty = true
|
||||
a.description = translate("只会在列表中设备都不在线时才会执行<br/>免打扰时段一小时后,关注设备五分钟低流量(约100kb/m)将视为离线")
|
||||
nt.mac_hints(function(mac, name) a :value(mac, "%s (%s)" %{ mac, name }) end)
|
||||
a:depends({err_enable = "1"})
|
||||
|
||||
a = s:option(ListValue, "network_err_event", translate("网络断开时"))
|
||||
a.default = ""
|
||||
a:depends({err_enable = "1"})
|
||||
a:value("", translate("无操作"))
|
||||
a:value("1", translate("重启路由器"))
|
||||
a:value("2", translate("重新拨号"))
|
||||
a:value("3", translate("修改相关设置项,尝试自动修复网络"))
|
||||
a.description = translate("选项 1 选项 2 不会修改设置,并最多尝试 2 次。<br/>选项 3 会将设置项备份于 /usr/bin/serverchan/configbak 目录,并在失败后还原。<br/>【!!无法保证兼容性!!】不熟悉系统设置项,不会救砖请勿使用")
|
||||
|
||||
a = s:option(ListValue, "system_time_event", translate("定时重启"))
|
||||
a.default = ""
|
||||
a:depends({err_enable = "1"})
|
||||
a:value("", translate("无操作"))
|
||||
a:value("1", translate("重启路由器"))
|
||||
a:value("2", translate("重新拨号"))
|
||||
|
||||
a = s:option(Value, "autoreboot_time", "系统运行时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype = "uinteger"
|
||||
a:depends({system_time_event = "1"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a = s:option(Value, "network_restart_time", "网络在线时间大于")
|
||||
a.rmempty = true
|
||||
a.default = "24"
|
||||
a.datatype = "uinteger"
|
||||
a:depends({system_time_event = "2"})
|
||||
a.description = translate("单位为小时")
|
||||
|
||||
a = s:option(Flag, "public_ip_event", translate("重拨尝试获取公网 IP"))
|
||||
a.default = 0
|
||||
a.rmempty = true
|
||||
a:depends({err_enable = "1"})
|
||||
a.description = translate("重拨时不会推送 IP 变动通知,并会导致你的域名无法及时更新 IP 地址<br/>请确认你可以通过重拨获取公网 IP,否则这不仅徒劳无功还会引起频繁断网<br/>移动等大内网你就别挣扎了!!")
|
||||
|
||||
a = s:option(Value, "public_ip_retry_count", "当天最大重试次数")
|
||||
a.rmempty = true
|
||||
a.default = "10"
|
||||
a.datatype = "uinteger"
|
||||
a:depends({public_ip_event = "1"})
|
||||
|
||||
return m
|
||||
|
||||
@ -1,34 +1,34 @@
|
||||
local o = require "luci.dispatcher"
|
||||
local fs = require "nixio.fs"
|
||||
local jsonc = require "luci.jsonc"
|
||||
local sys = require "luci.sys"
|
||||
|
||||
local sessions = {}
|
||||
local session_path = "/var/serverchan/client"
|
||||
if fs.access(session_path) then
|
||||
for filename in fs.dir(session_path) do
|
||||
local session_file = session_path .. "/" .. filename
|
||||
local file = io.open(session_file, "r")
|
||||
local t = jsonc.parse(file:read("*a"))
|
||||
if t then
|
||||
t.session_file = session_file
|
||||
sessions[#sessions + 1] = t
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
|
||||
f = SimpleForm("processes", translate(""))
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
|
||||
local client_count = sys.exec("cat /tmp/serverchan/ipAddress | wc -l")
|
||||
t = f:section(Table, sessions, translate("当前共 ".. client_count .. "台设备在线"))
|
||||
t:option(DummyValue, "name", translate("主机名"))
|
||||
t:option(DummyValue, "mac", translate("MAC"))
|
||||
t:option(DummyValue, "ip", translate("IP"))
|
||||
t:option(DummyValue, "usage", translate("总计流量"))
|
||||
t:option(DummyValue, "uptime", translate("在线时间"))
|
||||
|
||||
|
||||
return f
|
||||
local o = require "luci.dispatcher"
|
||||
local fs = require "nixio.fs"
|
||||
local jsonc = require "luci.jsonc"
|
||||
local sys = require "luci.sys"
|
||||
|
||||
local sessions = {}
|
||||
local session_path = "/var/serverchan/client"
|
||||
if fs.access(session_path) then
|
||||
for filename in fs.dir(session_path) do
|
||||
local session_file = session_path .. "/" .. filename
|
||||
local file = io.open(session_file, "r")
|
||||
local t = jsonc.parse(file:read("*a"))
|
||||
if t then
|
||||
t.session_file = session_file
|
||||
sessions[#sessions + 1] = t
|
||||
end
|
||||
file:close()
|
||||
end
|
||||
end
|
||||
|
||||
f = SimpleForm("processes", translate(""))
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
|
||||
local client_count = sys.exec("cat /tmp/serverchan/ipAddress | wc -l")
|
||||
t = f:section(Table, sessions, translate("当前共 ".. client_count .. "台设备在线"))
|
||||
t:option(DummyValue, "name", translate("主机名"))
|
||||
t:option(DummyValue, "mac", translate("MAC"))
|
||||
t:option(DummyValue, "ip", translate("IP"))
|
||||
t:option(DummyValue, "usage", translate("总计流量"))
|
||||
t:option(DummyValue, "uptime", translate("在线时间"))
|
||||
|
||||
|
||||
return f
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
f = SimpleForm("serverchan")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
f:append(Template("serverchan/serverchan_log"))
|
||||
|
||||
return f
|
||||
f = SimpleForm("serverchan")
|
||||
f.reset = false
|
||||
f.submit = false
|
||||
f:append(Template("serverchan/serverchan_log"))
|
||||
|
||||
return f
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,33 +1,33 @@
|
||||
<%
|
||||
local dsp = require "luci.dispatcher"
|
||||
-%>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function clearlog(btn) {
|
||||
XHR.get('<%=dsp.build_url("admin/services/serverchan/clear_log")%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = "";
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
XHR.poll(2, '<%=dsp.build_url("admin/services/serverchan/get_log")%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200 && document.getElementById("checkbox1").checked == true) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = x.responseText;
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<fieldset class="cbi-section" id="_log_fieldset">
|
||||
<input type="checkbox" id="checkbox1" style="vertical-align:middle;height: auto;"checked><%:自动刷新%></input>
|
||||
<input class="cbi-button cbi-input-remove" type="button" onclick="clearlog()" value="<%:清除日志%>" />
|
||||
<textarea id="log_textarea" class="cbi-input-textarea" style="width: 100%;margin-top: 10px;" data-update="change" rows="30" wrap="off" readonly="readonly"></textarea>
|
||||
</fieldset>
|
||||
<%
|
||||
local dsp = require "luci.dispatcher"
|
||||
-%>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
function clearlog(btn) {
|
||||
XHR.get('<%=dsp.build_url("admin/services/serverchan/clear_log")%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = "";
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
XHR.poll(2, '<%=dsp.build_url("admin/services/serverchan/get_log")%>', null,
|
||||
function(x, data) {
|
||||
if(x && x.status == 200 && document.getElementById("checkbox1").checked == true) {
|
||||
var log_textarea = document.getElementById('log_textarea');
|
||||
log_textarea.innerHTML = x.responseText;
|
||||
log_textarea.scrollTop = log_textarea.scrollHeight;
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<fieldset class="cbi-section" id="_log_fieldset">
|
||||
<input type="checkbox" id="checkbox1" style="vertical-align:middle;height: auto;"checked><%:自动刷新%></input>
|
||||
<input class="cbi-button cbi-input-remove" type="button" onclick="clearlog()" value="<%:清除日志%>" />
|
||||
<textarea id="log_textarea" class="cbi-input-textarea" style="width: 100%;margin-top: 10px;" data-update="change" rows="30" wrap="off" readonly="readonly"></textarea>
|
||||
</fieldset>
|
||||
|
||||
@ -1,22 +1,22 @@
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[serverchan]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('serverchan_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>serverchan <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>serverchan <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="serverchan_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[serverchan]], [[status]])%>', null,
|
||||
function(x, data) {
|
||||
var tb = document.getElementById('serverchan_status');
|
||||
if (data && tb) {
|
||||
if (data.running) {
|
||||
var links = '<em><b><font color=green>serverchan <%:RUNNING%></font></b></em>';
|
||||
tb.innerHTML = links;
|
||||
} else {
|
||||
tb.innerHTML = '<em><b><font color=red>serverchan <%:NOT RUNNING%></font></b></em>';
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
//]]>
|
||||
</script>
|
||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||
<fieldset class="cbi-section">
|
||||
<p id="serverchan_status">
|
||||
<em><%:Collecting data...%></em>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
|
||||
config serverchan 'serverchan'
|
||||
option serverchan_enable '0'
|
||||
option sleeptime '60'
|
||||
option serverchan_ipv6 '0'
|
||||
option serverchan_up '1'
|
||||
option serverchan_down '1'
|
||||
option cpuload_enable '1'
|
||||
option cpuload '2'
|
||||
option temperature_enable '0'
|
||||
|
||||
|
||||
config serverchan 'serverchan'
|
||||
option serverchan_enable '0'
|
||||
option sleeptime '60'
|
||||
option serverchan_ipv6 '0'
|
||||
option serverchan_up '1'
|
||||
option serverchan_down '1'
|
||||
option cpuload_enable '1'
|
||||
option cpuload '2'
|
||||
option temperature_enable '0'
|
||||
|
||||
|
||||
@ -1,26 +1,26 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
start() {
|
||||
state=`pgrep -f "/usr/share/serverchan/serverchan"`
|
||||
if [ ! -z "$state" ]; then
|
||||
restart
|
||||
else
|
||||
/usr/share/serverchan/serverchan &
|
||||
fi
|
||||
echo "serverchan is starting now ..."
|
||||
}
|
||||
|
||||
stop() {
|
||||
kill -9 `pgrep -f "/usr/share/serverchan/serverchan"` 2>/dev/null
|
||||
echo "serverchan exit ..."
|
||||
}
|
||||
|
||||
restart(){
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
echo "restarted."
|
||||
}
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
STOP=10
|
||||
|
||||
start() {
|
||||
state=`pgrep -f "/usr/bin/serverchan/serverchan"`
|
||||
if [ ! -z "$state" ]; then
|
||||
restart
|
||||
else
|
||||
/usr/bin/serverchan/serverchan &
|
||||
fi
|
||||
echo "serverchan is starting now ..."
|
||||
}
|
||||
|
||||
stop() {
|
||||
kill -9 `pgrep -f "/usr/bin/serverchan/serverchan"` 2>/dev/null
|
||||
echo "serverchan exit ..."
|
||||
}
|
||||
|
||||
restart(){
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
echo "restarted."
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@serverchan[-1]
|
||||
add ucitrack serverchan
|
||||
set ucitrack.@serverchan[-1].init=serverchan
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@serverchan[-1]
|
||||
add ucitrack serverchan
|
||||
set ucitrack.@serverchan[-1].init=serverchan
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -rf /tmp/luci-*
|
||||
exit 0
|
||||
|
||||
@ -1,40 +1,40 @@
|
||||
{
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
"_readme": "这是 自定义 api 文件,这里以 telegram 为例",
|
||||
"_readme": "特殊符号请使用斜杠转义,变量使用 ${var} 表示",
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
"_api": "【DIY 推送】",
|
||||
"_url": "api 地址",
|
||||
"_data": "生成的 json 文件路径,一般不需要改,如 api 不支持 json,请参考 serverchan 推送接口",
|
||||
"_content_type": "post 内容类型,这里为 json",
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
"_str_title_start": "标题粗体字开始符号",
|
||||
"_str_title_end": "标题粗体字结束符号",
|
||||
"_str_linefeed": "换行符号",
|
||||
"_str_splitline": "换行+分隔符",
|
||||
"_str_space": "空格",
|
||||
"_str_tab": "TAB(用在行首,生成文字区块)",
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
"_type":
|
||||
{
|
||||
"_readme": "type 对象因为需要转义变量,前后必须使用 斜杠+双引号 转义",
|
||||
"_readme": "参照上文说明,填写下文相关参数"
|
||||
},
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
|
||||
"url": "https://api.telegram.org/bot${tg_token}/sendMessage",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "<b>",
|
||||
"str_title_end": "</b>",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n----\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
"text":"\"${str_title_start}${1}${str_title_end}${str_splitline}${nowtime}${2}\"",
|
||||
"chat_id":"\"${chat_id}\"",
|
||||
"parse_mode":"\"HTML\""
|
||||
}
|
||||
}
|
||||
{
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
"_readme": "这是 自定义 api 文件,这里以 telegram 为例",
|
||||
"_readme": "特殊符号请使用斜杠转义,变量使用 ${var} 表示",
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
"_api": "【DIY 推送】",
|
||||
"_url": "api 地址",
|
||||
"_data": "生成的 json 文件路径,一般不需要改,如 api 不支持 json,请参考 serverchan 推送接口",
|
||||
"_content_type": "post 内容类型,这里为 json",
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
"_str_title_start": "标题粗体字开始符号",
|
||||
"_str_title_end": "标题粗体字结束符号",
|
||||
"_str_linefeed": "换行符号",
|
||||
"_str_splitline": "换行+分隔符",
|
||||
"_str_space": "空格",
|
||||
"_str_tab": "TAB(用在行首,生成文字区块)",
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
"_type":
|
||||
{
|
||||
"_readme": "type 对象因为需要转义变量,前后必须使用 斜杠+双引号 转义",
|
||||
"_readme": "参照上文说明,填写下文相关参数"
|
||||
},
|
||||
"_//": "-------------------------------------------------------------------------------",
|
||||
|
||||
"url": "https://api.telegram.org/bot${tg_token}/sendMessage",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "<b>",
|
||||
"str_title_end": "</b>",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n----\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
"text":"\"${str_title_start}${1}${str_title_end}${str_splitline}${nowtime}${2}\"",
|
||||
"chat_id":"\"${chat_id}\"",
|
||||
"parse_mode":"\"HTML\""
|
||||
}
|
||||
}
|
||||
@ -1 +1 @@
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
www.cip.cc
|
||||
ifcfg.cn
|
||||
ddns.oray.com/checkip
|
||||
www.net.cn/static/customercare/yourip.asp
|
||||
myip.ipip.net/s
|
||||
speed.neu.edu.cn/getIP.php
|
||||
www.uc.cn/ip
|
||||
ifcfg.cn
|
||||
ip.3322.net
|
||||
www.cip.cc
|
||||
ifcfg.cn
|
||||
ddns.oray.com/checkip
|
||||
www.net.cn/static/customercare/yourip.asp
|
||||
myip.ipip.net/s
|
||||
speed.neu.edu.cn/getIP.php
|
||||
www.uc.cn/ip
|
||||
ifcfg.cn
|
||||
ip.3322.net
|
||||
@ -1,5 +1,5 @@
|
||||
ip.sb
|
||||
ipv6.ddnspod.com
|
||||
api-ipv6.ip.sb/ip
|
||||
speed.neu6.edu.cn/getIP.php
|
||||
v6.myip.la/json
|
||||
ip.sb
|
||||
ipv6.ddnspod.com
|
||||
api-ipv6.ip.sb/ip
|
||||
speed.neu6.edu.cn/getIP.php
|
||||
v6.myip.la/json
|
||||
|
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 33 KiB |
@ -1,21 +1,21 @@
|
||||
{
|
||||
"_api": "这是 pushplus api 文件",
|
||||
"_api": "【pushplus】",
|
||||
|
||||
"url": "http://www.pushplus.plus/send",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "##### ",
|
||||
"str_title_end": "",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n----\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
"title": "\"${1}\"",
|
||||
"content": "\"${2}\"",
|
||||
"token": "\"${pushplus_token}\"",
|
||||
"template":"\"markdown\""
|
||||
}
|
||||
}
|
||||
{
|
||||
"_api": "这是 pushplus api 文件",
|
||||
"_api": "【pushplus】",
|
||||
|
||||
"url": "http://www.pushplus.plus/send",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "##### ",
|
||||
"str_title_end": "",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n----\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
"title": "\"${1}\"",
|
||||
"content": "\"${2}\"",
|
||||
"token": "\"${pushplus_token}\"",
|
||||
"template":"\"markdown\""
|
||||
}
|
||||
}
|
||||
@ -1,23 +1,23 @@
|
||||
{
|
||||
"_api": "这是企业微信 markdown 模板信息 api 文件",
|
||||
"_api": "【企业微信】",
|
||||
|
||||
"url": "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|jq '.access_token' | sed 's/\"//g')",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "#### ",
|
||||
"str_title_end": "",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": "> ",
|
||||
"type":
|
||||
{
|
||||
"touser": "\"${userid}\"",
|
||||
"msgtype": "\"markdown\"",
|
||||
"agentid": "\"${agentid}\"",
|
||||
"markdown": {
|
||||
"content": "\"${1}${str_linefeed}${nowtime}${2}\""
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"_api": "这是企业微信 markdown 模板信息 api 文件",
|
||||
"_api": "【企业微信】",
|
||||
|
||||
"url": "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|/usr/bin/jq '.access_token' | sed 's/\"//g')",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "#### ",
|
||||
"str_title_end": "",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": "> ",
|
||||
"type":
|
||||
{
|
||||
"touser": "\"${userid}\"",
|
||||
"msgtype": "\"markdown\"",
|
||||
"agentid": "\"${agentid}\"",
|
||||
"markdown": {
|
||||
"content": "\"${1}${str_linefeed}${nowtime}${2}\""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,33 +1,33 @@
|
||||
{
|
||||
"_api": "这是企业微信图文信息 api 文件",
|
||||
"_api": "【企业微信】",
|
||||
|
||||
"url": "\"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|jq '.access_token'|sed 's/\"//g')\"",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "<h3>",
|
||||
"str_title_end": "</h3>",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "<hr>",
|
||||
"str_space": " ",
|
||||
"str_tab": "<li>",
|
||||
"type":
|
||||
{
|
||||
"touser": "\"${userid}\"",
|
||||
"msgtype": "\"mpnews\"",
|
||||
"agentid": "\"${agentid}\"",
|
||||
"mpnews":{
|
||||
"articles":[
|
||||
{
|
||||
"title": "\"${nowtime}${str_linefeed}${1}\"",
|
||||
"thumb_media_id": "\"`curl \"https://qyapi.weixin.qq.com/cgi-bin/media/upload?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|jq '.access_token'|sed 's/\"//g')&type=image\" -F \"file=@${mediapath}\"|jq '.media_id'|sed 's/\"//g'`\"",
|
||||
"author": "\"\"",
|
||||
"content_source_url": "\"\"",
|
||||
"content": "\"${2}\"",
|
||||
"digest": "\"\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"safe":0
|
||||
}
|
||||
}
|
||||
{
|
||||
"_api": "这是企业微信图文信息 api 文件",
|
||||
"_api": "【企业微信】",
|
||||
|
||||
"url": "\"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|/usr/bin/jq '.access_token'|sed 's/\"//g')\"",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "<h3>",
|
||||
"str_title_end": "</h3>",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "<hr>",
|
||||
"str_space": " ",
|
||||
"str_tab": "<li>",
|
||||
"type":
|
||||
{
|
||||
"touser": "\"${userid}\"",
|
||||
"msgtype": "\"mpnews\"",
|
||||
"agentid": "\"${agentid}\"",
|
||||
"mpnews":{
|
||||
"articles":[
|
||||
{
|
||||
"title": "\"${nowtime}${str_linefeed}${1}\"",
|
||||
"thumb_media_id": "\"`curl \"https://qyapi.weixin.qq.com/cgi-bin/media/upload?access_token=$(curl -s \"https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpid}&corpsecret=${corpsecret}\"|/usr/bin/jq '.access_token'|sed 's/\"//g')&type=image\" -F \"file=@${mediapath}\"|/usr/bin/jq '.media_id'|sed 's/\"//g'`\"",
|
||||
"author": "\"\"",
|
||||
"content_source_url": "\"\"",
|
||||
"content": "\"${2}\"",
|
||||
"digest": "\"\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"safe":0
|
||||
}
|
||||
}
|
||||
@ -1,17 +1,17 @@
|
||||
{
|
||||
"_api": "这是 serverchan api 文件",
|
||||
"_api": "【serverchan】",
|
||||
|
||||
"url": "\"https://sctapi.ftqq.com/${sckey}.send\"",
|
||||
"data": "\"text=${1}&desp=${nowtime}${str_linefeed}${2}\"",
|
||||
"content_type": "Content-Type:application/x-www-form-urlencoded",
|
||||
"str_title_start": "#### ",
|
||||
"str_title_end": "",
|
||||
"str_linefeed": "%0D%0A%0D%0A",
|
||||
"str_splitline": "%0D%0A%0D%0A----%0D%0A%0D%0A",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
}
|
||||
}
|
||||
{
|
||||
"_api": "这是 serverchan api 文件",
|
||||
"_api": "【serverchan】",
|
||||
|
||||
"url": "\"https://sctapi.ftqq.com/${sckey}.send\"",
|
||||
"data": "\"text=${1}&desp=${nowtime}${str_linefeed}${2}\"",
|
||||
"content_type": "Content-Type:application/x-www-form-urlencoded",
|
||||
"str_title_start": "#### ",
|
||||
"str_title_end": "",
|
||||
"str_linefeed": "%0D%0A%0D%0A",
|
||||
"str_splitline": "%0D%0A%0D%0A----%0D%0A%0D%0A",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,20 +1,20 @@
|
||||
{
|
||||
"_api": "这是 telegram api 文件",
|
||||
"_api": "【telegram】",
|
||||
|
||||
"url": "https://api.telegram.org/bot${tg_token}/sendMessage",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "<b>",
|
||||
"str_title_end": "</b>",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n----\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
"text":"\"${str_title_start}${1}${str_title_end}${str_splitline}${nowtime}${2}\"",
|
||||
"chat_id":"\"${chat_id}\"",
|
||||
"parse_mode":"\"HTML\""
|
||||
}
|
||||
}
|
||||
{
|
||||
"_api": "这是 telegram api 文件",
|
||||
"_api": "【telegram】",
|
||||
|
||||
"url": "https://api.telegram.org/bot${tg_token}/sendMessage",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "<b>",
|
||||
"str_title_end": "</b>",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n----\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
"text":"\"${str_title_start}${1}${str_title_end}${str_splitline}${nowtime}${2}\"",
|
||||
"chat_id":"\"${chat_id}\"",
|
||||
"parse_mode":"\"HTML\""
|
||||
}
|
||||
}
|
||||
@ -1,23 +1,23 @@
|
||||
{
|
||||
"_api": "这是 wxpusher api 文件",
|
||||
"_api": "【wxpusher】",
|
||||
|
||||
"url": "http://wxpusher.zjiecode.com/api/send/message",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "#### ",
|
||||
"str_title_end": "",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n----\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
"summary":"\"${1}\"",
|
||||
"content":"\"${2}\"",
|
||||
"appToken":"\"${wxpusher_apptoken}\"",
|
||||
"topicIds":"[\"${wxpusher_topicIds}\"]",
|
||||
"uids":"[\"${wxpusher_uids}\"]",
|
||||
"contentType":3
|
||||
}
|
||||
}
|
||||
{
|
||||
"_api": "这是 wxpusher api 文件",
|
||||
"_api": "【wxpusher】",
|
||||
|
||||
"url": "http://wxpusher.zjiecode.com/api/send/message",
|
||||
"data": "@${tempjsonpath}",
|
||||
"content_type": "Content-Type: application/json",
|
||||
"str_title_start": "#### ",
|
||||
"str_title_end": "",
|
||||
"str_linefeed": "\\n",
|
||||
"str_splitline": "\\n----\\n",
|
||||
"str_space": " ",
|
||||
"str_tab": " ",
|
||||
"type":
|
||||
{
|
||||
"summary":"\"${1}\"",
|
||||
"content":"\"${2}\"",
|
||||
"appToken":"\"${wxpusher_apptoken}\"",
|
||||
"topicIds":"[\"${wxpusher_topicIds}\"]",
|
||||
"uids":"[\"${wxpusher_uids}\"]",
|
||||
"contentType":3
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,11 +1,11 @@
|
||||
{
|
||||
"luci-app-serverchan": {
|
||||
"description": "Grant UCI access for luci-app-serverchan",
|
||||
"read": {
|
||||
"uci": [ "serverchan" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "serverchan" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"luci-app-serverchan": {
|
||||
"description": "Grant UCI access for luci-app-serverchan",
|
||||
"read": {
|
||||
"uci": [ "serverchan" ]
|
||||
},
|
||||
"write": {
|
||||
"uci": [ "serverchan" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user