mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-07 03:46:07 +08:00
pushDeer支持自架版
This commit is contained in:
parent
8b8336d9d0
commit
6f185570d6
|
@ -41,6 +41,7 @@ export class ServerChanNotification extends NotificationBaseInfo {
|
|||
|
||||
export class PushDeerNotification extends NotificationBaseInfo {
|
||||
public pushDeerKey = '';
|
||||
public pushDeerUrl = '';
|
||||
}
|
||||
|
||||
export class ChatNotification extends NotificationBaseInfo {
|
||||
|
|
|
@ -123,8 +123,8 @@ export default class NotificationService {
|
|||
}
|
||||
|
||||
private async pushDeer() {
|
||||
const { pushDeerKey } = this.params;
|
||||
const url = `https://api2.pushdeer.com/message/push`;
|
||||
const { pushDeerKey, pushDeerUrl } = this.params;
|
||||
const url = pushDeerUrl || `https://api2.pushdeer.com/message/push`;
|
||||
const res: any = await got
|
||||
.post(url, {
|
||||
...this.gotOption,
|
||||
|
|
|
@ -38,6 +38,7 @@ let SCKEY = '';
|
|||
//此处填你申请的PushDeer KEY.
|
||||
//(环境变量名 DEER_KEY)
|
||||
let PUSHDEER_KEY = '';
|
||||
let PUSHDEER_URL = '';
|
||||
|
||||
// =======================================Synology Chat通知设置区域===========================================
|
||||
//此处填你申请的CHAT_URL与CHAT_TOKEN
|
||||
|
@ -151,6 +152,7 @@ if (process.env.PUSH_KEY) {
|
|||
|
||||
if (process.env.DEER_KEY) {
|
||||
PUSHDEER_KEY = process.env.DEER_KEY;
|
||||
PUSHDEER_URL = process.env.DEER_URL;
|
||||
}
|
||||
|
||||
if (process.env.CHAT_URL) {
|
||||
|
@ -413,7 +415,7 @@ function PushDeerNotify(text, desp) {
|
|||
// PushDeer 建议对消息内容进行 urlencode
|
||||
desp = encodeURI(desp);
|
||||
const options = {
|
||||
url: `https://api2.pushdeer.com/message/push`,
|
||||
url: PUSHDEER_URL || `https://api2.pushdeer.com/message/push`,
|
||||
body: `pushkey=${PUSHDEER_KEY}&text=${text}&desp=${desp}&type=markdown`,
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
|
|
|
@ -61,6 +61,7 @@ push_config = {
|
|||
'PUSH_KEY': '', # server 酱的 PUSH_KEY,兼容旧版与 Turbo 版
|
||||
|
||||
'DEER_KEY': '', # PushDeer 的 PUSHDEER_KEY
|
||||
'DEER_URL': '', # PushDeer 的 PUSHDEER_URL
|
||||
|
||||
'CHAT_URL': '', # synology chat url
|
||||
'CHAT_TOKEN': '', # synology chat token
|
||||
|
@ -280,6 +281,9 @@ def pushdeer(title: str, content: str) -> None:
|
|||
print("PushDeer 服务启动")
|
||||
data = {"text": title, "desp": content, "type": "markdown", "pushkey": push_config.get("DEER_KEY")}
|
||||
url = 'https://api2.pushdeer.com/message/push'
|
||||
if push_config.get("DEER_URL"):
|
||||
url = push_config.get("DEER_URL")
|
||||
|
||||
response = requests.post(url, data=data).json()
|
||||
|
||||
if len(response.get("content").get("result")) > 0:
|
||||
|
|
|
@ -252,6 +252,7 @@ update_qinglong() {
|
|||
if [ "$githubStatus" == "" ]; then
|
||||
mirror="gitee"
|
||||
fi
|
||||
echo -e "\n使用 ${mirror} 源更新...\n"
|
||||
export isFirstStartServer=false
|
||||
|
||||
local all_branch=$(git branch -a)
|
||||
|
|
|
@ -31,7 +31,7 @@ import CheckUpdate from './checkUpdate';
|
|||
import About from './about';
|
||||
import { useOutletContext } from '@umijs/max';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import './index.less'
|
||||
import './index.less';
|
||||
|
||||
const { Text } = Typography;
|
||||
const optionsWithDisabled = [
|
||||
|
@ -80,10 +80,15 @@ const Setting = () => {
|
|||
dataIndex: 'scopes',
|
||||
key: 'scopes',
|
||||
align: 'center' as const,
|
||||
width: '40%',
|
||||
render: (text: string, record: any) => {
|
||||
return record.scopes.map((scope: any) => {
|
||||
return <Tag key={scope}>{(config.scopesMap as any)[scope]}</Tag>;
|
||||
});
|
||||
return (
|
||||
<div style={{ textAlign: 'left' }}>
|
||||
{record.scopes.map((scope: any) => {
|
||||
return <Tag key={scope}>{(config.scopesMap as any)[scope]}</Tag>;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -137,6 +137,10 @@ export default {
|
|||
tip: 'PushDeer的Key,https://github.com/easychen/pushdeer',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: 'pushDeerUrl',
|
||||
tip: 'PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push',
|
||||
},
|
||||
],
|
||||
bark: [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user