Skip to content

Commit

Permalink
Merge pull request #31 from xylz0928/patch-1
Browse files Browse the repository at this point in the history
重新支持 Bark
现已恢复支持 Bark
且同时追加支持Bark的群组分类,群组名为【基本设置】-【本设备名称】
  • Loading branch information
zzsj0928 authored Sep 10, 2021
2 parents 7c98def + 4c19a16 commit 5e347e0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-pushbot
PKG_VERSION:=3.50
PKG_RELEASE:=6
PKG_VERSION:=3.55
PKG_RELEASE:=3

PKG_MAINTAINER:=tty228 zzsj0928

Expand Down
15 changes: 8 additions & 7 deletions root/usr/bin/pushbot/api/bark.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@
"_api": "这是Bark推送 post 模板信息 api 文件",
"_api": "【Bark推送】",

"url": "${bark_srv}/${bark_token}/${1}/${nowtime}${markdown_linefeed}${2}?isArchive=1",
"url": "",
"data": "@${tempjsonpath}",
"content_type": "Content-Type: application/json",
"content_type": "",
"str_title_start": "",
"str_title_end": "",
"str_linefeed": "\\n",
"str_splitline": "\\n\\n",
"str_space": " ",
"str_tab": " ",
"str_linefeed": "%0D%0A%0D%0A",
"str_splitline": "%0D%0A%0D%0A",
"str_space": "%20",
"str_tab": "%20",
"table_tab": "",
"font_green": "",
"font_red": "",
"font_blue": "",
"font_purple": "",
"font_end": "",
"font_end2": "",
"percentsym": "",
"percentsym": "25",
"boldstar": "",
"type":
{
"bark_text": "\"${bark_srv}/${bark_token}/${1}/${nowtime}${str_linefeed}${2}?group=${device_name}\""
}
}
8 changes: 6 additions & 2 deletions root/usr/bin/pushbot/pushbot
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function read_config(){
[ -z "$up_timeout" ] || [ "$up_timeout" -eq "0" ] && up_timeout="2"
[ -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_srv" ] && bark_srv="https://api.day.app"
[ ! -z "$bark_token" ] && [ -z "$bark_srv" ] && bark_srv="https://api.day.app"

# 字符串读取
str_title_start=`/usr/bin/jq -r '.str_title_start' ${jsonpath}`
Expand Down Expand Up @@ -102,7 +102,11 @@ function diy_send(){
[ $logrow -eq "0" ] && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】json 文件生成失败,请检查文件格式" >> ${logfile} && return 1
/usr/bin/jq -r '.[]' ${tempjsonpath}|grep "null" && echo "`date "+%Y-%m-%d %H:%M:%S"` 【!!!】参数变量生成失败,请检查设置项 `/usr/bin/jq -r '.' ${tempjsonpath}|grep "null"`" >> ${logfile}

curl -X POST -H "$content_type" -d "${data}" "${diyurl}"
if [ ! -z "$bark_token" ]; then
local bark_text=`/usr/bin/jq -r '.bark_text' ${tempjsonpath}` && local bark_text=`echo $bark_text|sed 's/ /%20/g'` && curl -s $bark_text
else
curl -X POST -H "$content_type" -d "${data}" "${diyurl}"
fi
}

# 下载设备MAC厂商信息
Expand Down

0 comments on commit 5e347e0

Please sign in to comment.