🎨 Sync 2022-02-08 20:33:09

This commit is contained in:
github-actions[bot] 2022-02-08 20:33:09 +08:00
parent a56f4a019b
commit c54696f095
5 changed files with 263 additions and 4 deletions

View File

@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-pushbot
PKG_VERSION:=3.55
PKG_RELEASE:=21
PKG_VERSION:=3.60
PKG_RELEASE:=1
PKG_MAINTAINER:=tty228 <tty228@yeah.net> zzsj0928

View File

@ -46,6 +46,7 @@ a:value("/usr/bin/pushbot/api/ent_wechat.json",translate("企业微信"))
a:value("/usr/bin/pushbot/api/feishu.json",translate("飞书"))
a:value("/usr/bin/pushbot/api/bark.json",translate("Bark"))
a:value("/usr/bin/pushbot/api/pushplus.json",translate("PushPlus"))
a:value("/usr/bin/pushbot/api/pushdeer.json",translate("PushDeer"))
a:value("/usr/bin/pushbot/api/diy.json",translate("自定义推送"))
a=s:taboption("basic", Value,"dd_webhook",translate('Webhook'), translate("钉钉机器人 Webhook").."只输入access_token=后面的即可<br>调用代码获取<a href='https://developers.dingtalk.com/document/robots/custom-robot-access' target='_blank'>点击这里</a><br><br>")
@ -84,6 +85,19 @@ a=s:taboption("basic", Value,"pp_topic",translate('PushPlus Topic'), translate("
a.rmempty = true
a:depends("pp_topic_enable","1")
a=s:taboption("basic", Value,"pushdeer_key",translate('PushDeer Key'), translate("PushDeer Key").."<br>调用代码获取<a href='http://www.pushdeer.com/' target='_blank'>点击这里</a><br><br>")
a.rmempty = true
a:depends("jsonpath","/usr/bin/pushbot/api/pushdeer.json")
a=s:taboption("basic", Flag,"pushdeer_srv_enable",translate("自建 PushDeer 服务器"))
a.default=0
a.rmempty = true
a:depends("jsonpath","/usr/bin/pushbot/api/pushdeer.json")
a=s:taboption("basic", Value,"pushdeer_srv",translate('PushDeer Server'), translate("PushDeer 自建服务器地址").."<br>如https://your.domain:port<br>具体自建服务器设定参见:<a href='http://www.pushdeer.com/selfhosted.html' target='_blank'>点击这里</a><br><br>")
a.rmempty = true
a:depends("pushdeer_srv_enable","1")
a=s:taboption("basic", Value,"fs_webhook",translate('WebHook'), translate("飞书 WebHook").."<br>调用代码获取<a href='https://www.feishu.cn/hc/zh-CN/articles/360024984973' target='_blank'>点击这里</a><br><br>")
a.rmempty = true
a:depends("jsonpath","/usr/bin/pushbot/api/feishu.json")

View File

@ -0,0 +1,31 @@
{
"_api": "这是 PushDeer推送 api 文件",
"_api": "【PushDeer推送】",
"url": "${pushdeer_srv}/message/push",
"data": "@${tempjsonpath}",
"content_type": "Content-Type:application/json",
"str_title_start": "**【",
"str_title_end": "】**",
"str_linefeed": "\\n\\n",
"str_splitline": "\\n\\n---\\n\\n",
"str_space": " ",
"str_tab": " ",
"table_tab": "┋",
"font_green": "",
"font_green2": "",
"font_red": "",
"font_blue": "",
"font_purple": "",
"font_end": "",
"font_end2": "",
"percentsym": "",
"boldstar": "**",
"type":
{
"pushkey": "\"${pushdeer_key}\"",
"type": "\"markdown\"",
"text": "\"${1}\"",
"desp": "\"${nowtime}${str_linefeed}${2}\""
}
}

View File

@ -18,7 +18,7 @@ function read_config(){
"pushbot_sheep" "starttime" "endtime" "pushbot_whitelist" "pushbot_blacklist" "pushbot_interface" "MAC_online_list" "MAC_offline_list" \
"up_timeout" "down_timeout" "timeout_retry_count" "thread_num" "soc_code" "pve_host" "pve_port"\
"err_enable" "err_sheep_enable" "err_device_aliases" "network_err_event" "system_time_event" "autoreboot_time" "network_restart_time" "public_ip_event" "public_ip_retry_count" \
"jsonpath" "dd_webhook" "we_webhook" "pp_token" "pp_channel" "pp_webhook" "pp_topic_enable" "pp_topic" "fs_webhook" "bark_srv_enable" "bark_srv" "bark_token" "bark_sound" "bark_icon" "bark_icon_enable" "bark_level"
"jsonpath" "dd_webhook" "we_webhook" "pp_token" "pp_channel" "pp_webhook" "pp_topic_enable" "pp_topic" "fs_webhook" "pushdeer_key" "pushdeer_srv_enable" "pushdeer_srv" "bark_srv_enable" "bark_srv" "bark_token" "bark_sound" "bark_icon" "bark_icon_enable" "bark_level"
for str_version in "wrtbwmon" "iputils-arping" "curl" "iw"; do
eval `echo ${str_version:0:2}"_version"`=`opkg list-installed|grep -w ^${str_version}|awk '{print $3}'` 2>/dev/null
@ -45,6 +45,7 @@ function read_config(){
[ -z "$down_timeout" ] || [ "$down_timeout" -eq "0" ] && down_timeout="20";down_timeout=`expr ${down_timeout} / 2 + 1`
[ -z "$timeout_retry_count" ] && timeout_retry_count="2";[ "$timeout_retry_count" -eq "0" ] && timeout_retry_count="1"
[ ! -z "$bark_token" ] && [ -z "$bark_srv" ] && bark_srv="https://api.day.app"
[ ! -z "$pushdeer_key" ] && [ -z "$pushdeer_srv" ] && pushdeer_srv="https://api2.pushdeer.com"
# 字符串读取
str_title_start=`/usr/bin/jq -r '.str_title_start' ${jsonpath}`
@ -85,7 +86,7 @@ function pushbot_init(){
[ ! -f "/usr/sbin/wrtbwmon" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】未安装 wrtbwmon ,流量统计不可用" >> ${logfile}
[ -z "$ip_version" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】无法获取依赖项 iputils-arping 版本号,请确认插件是否正常运行" >> ${logfile}
[ -z "$cu_version" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】无法获取依赖项 curl 版本号,请确认插件是否正常运行" >> ${logfile}
[ -z "${dd_webhook}${pp_token}${we_webhook}${fs_webhook}${bark_token}" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【】请填写正确的Token/Webhook " >> ${logfile} && return 1
[ -z "${dd_webhook}${pp_token}${we_webhook}${fs_webhook}${bark_token}${pushdeer_key}" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【】请填写正确的Token/Webhook " >> ${logfile} && return 1
local interfacelist=`getinterfacelist` && [ -z "$interfacelist" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】无法正确获取接口信息,请确认插件是否正常运行" >> ${logfile}
return 0
}

213
ucode/Makefile Normal file
View File

@ -0,0 +1,213 @@
#
# Copyright (C) 2020-2021 Jo-Philipp Wich <jo@mein.io>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ucode
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/jow-/ucode.git
PKG_SOURCE_DATE:=2022-02-07
PKG_SOURCE_VERSION:=11adf0c4ea91e63ec523849c2846fd07bf4348f5
PKG_MIRROR_HASH:=cd7639cb08ead23c1d659e293ec90fda733785ee5432c3a1d7d54df17e0f6d20
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
PKG_LICENSE:=ISC
PKG_ABI_VERSION:=20220120
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
CMAKE_OPTIONS += -DSOVERSION=$(PKG_ABI_VERSION)
define Package/ucode/default
SECTION:=utils
CATEGORY:=Utilities
TITLE:=ucode - Tiny scripting and templating language
endef
define Package/ucode
$(Package/ucode/default)
DEPENDS:=+libucode
endef
define Package/ucode/description
ucode is a tiny script interpreter featuring an ECMAScript oriented
script language and Jinja-inspired templating.
endef
define Package/libucode
$(Package/ucode/default)
TITLE+= - runtime library
ABI_VERSION:=$(PKG_ABI_VERSION)
DEPENDS:=+libjson-c
endef
define Package/libucode/description
The libucode package provides the shared runtime library for the ucode interpreter.
endef
define Package/ucode-mod-fs
$(Package/ucode/default)
TITLE+= (filesystem module)
DEPENDS:=ucode
endef
define Package/ucode-mod-fs/description
The filesystem plugin module allows interaction with the local file system.
endef
define Package/ucode-mod-math
$(Package/ucode/default)
TITLE+= (math module)
DEPENDS:=ucode
endef
define Package/ucode-mod-math/description
The math plugin provides access to various <math.h> procedures.
endef
define Package/ucode-mod-nl80211
$(Package/ucode/default)
TITLE+= (nl80211 module)
DEPENDS:=ucode +libnl-tiny
endef
define Package/ucode-mod-nl80211/description
The nl80211 plugin provides access to the Linux wireless 802.11 netlink API.
endef
define Package/ucode-mod-resolv
$(Package/ucode/default)
TITLE+= (resolv module)
DEPENDS:=ucode
endef
define Package/ucode-mod-resolv/description
The resolv plugin implements simple DNS resolving.
endef
define Package/ucode-mod-rtnl
$(Package/ucode/default)
TITLE+= (rtnl module)
DEPENDS:=ucode +libnl-tiny
endef
define Package/ucode-mod-rtnl/description
The rtnl plugin provides access to the Linux routing netlink API.
endef
define Package/ucode-mod-struct
$(Package/ucode/default)
TITLE+= (struct module)
DEPENDS:=ucode
endef
define Package/ucode-mod-struct/description
The struct plugin implemnts Python 3 compatible struct.pack/unpack functionality.
endef
define Package/ucode-mod-ubus
$(Package/ucode/default)
TITLE+= (ubus module)
DEPENDS:=ucode +libubus +libblobmsg-json
endef
define Package/ucode-mod-ubus/description
The ubus module allows ucode template scripts to enumerate and invoke ubus
procedures.
endef
define Package/ucode-mod-uci
$(Package/ucode/default)
TITLE+= (uci module)
DEPENDS:=ucode +libuci
endef
define Package/ucode-mod-uci/description
The uci module allows templates to read and modify uci configuration.
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/lib $(1)/usr/include/ucode
$(CP) $(PKG_INSTALL_DIR)/usr/include/ucode/*.h $(1)/usr/include/ucode/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libucode.so* $(1)/usr/lib/
endef
define Package/ucode/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ucode $(1)/usr/bin/ucode
endef
define Package/libucode/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libucode.so.* $(1)/usr/lib/
endef
define Package/ucode-mod-fs/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/fs.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-math/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/math.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-nl80211/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/nl80211.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-resolv/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/resolv.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-rtnl/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/rtnl.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-struct/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/struct.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-ubus/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/ubus.so $(1)/usr/lib/ucode/
endef
define Package/ucode-mod-uci/install
$(INSTALL_DIR) $(1)/usr/lib/ucode
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/ucode/uci.so $(1)/usr/lib/ucode/
endef
$(eval $(call BuildPackage,ucode))
$(eval $(call BuildPackage,libucode))
$(eval $(call BuildPackage,ucode-mod-fs))
$(eval $(call BuildPackage,ucode-mod-math))
$(eval $(call BuildPackage,ucode-mod-nl80211))
$(eval $(call BuildPackage,ucode-mod-resolv))
$(eval $(call BuildPackage,ucode-mod-rtnl))
$(eval $(call BuildPackage,ucode-mod-struct))
$(eval $(call BuildPackage,ucode-mod-ubus))
$(eval $(call BuildPackage,ucode-mod-uci))