perf: 新增server酱3通知

pull/265/head
xiaojunnuo 2024-12-03 10:32:47 +08:00
parent 393ea27fa4
commit 6aa487269c
17 changed files with 86 additions and 19 deletions

View File

@ -77,9 +77,7 @@ export default {
closeAll: pageStore.closeAll,
openedSort: pageStore.openedSort
};
console.log("opened", pageStore.getOpened);
const computeOpened = computed(() => {
console.log("opened", pageStore.getOpened);
return pageStore.getOpened;
});

View File

@ -23,7 +23,6 @@ defineOptions({
name: "FsUserInfo"
});
const userStore = useUserStore();
console.log("user", userStore);
const { t } = useI18n();
const router = useRouter();

View File

@ -10,11 +10,10 @@ export async function GetList(query: any) {
data: query
});
for (const item of list) {
if (item.pipeline) {
if (item.pipeline && typeof item.pipeline === "string") {
item.pipeline = JSON.parse(item.pipeline);
}
}
console.log("history", list);
return list;
}

View File

@ -321,7 +321,6 @@ export default defineComponent({
currentHistory.value = history;
pipeline.value = history.pipeline;
await loadCurrentHistoryDetail();
console.log("currentHistory:", currentHistory);
};
async function loadHistoryList(reload = false) {

View File

@ -73,8 +73,6 @@ export class HistoryController extends CrudController<HistoryService> {
buildQuery,
});
return this.ok(res);
}
@ -95,6 +93,14 @@ export class HistoryController extends CrudController<HistoryService> {
sort: { prop: 'id', asc: false },
buildQuery,
});
for (const item of listRet) {
if (!item.pipeline) {
continue;
}
const json = JSON.parse(item.pipeline);
delete json.stages;
item.pipeline = json;
}
return this.ok(listRet);
}

View File

@ -40,7 +40,7 @@ export class AnPushNotification extends BaseNotification {
},
data: {
title: body.title,
content: body.content + '[查看详情](' + body.url + ')',
content: body.content + '\n\n[查看详情](' + body.url + ')',
channel: this.channel,
},
};

View File

@ -49,7 +49,7 @@ export class BarkNotification extends BaseNotification {
}
const payload = {
body: body.content, // 使用传入的内容或默认内容
body: `${body.content}\n\n[查看详情](${body.url})`, // 使用传入的内容或默认内容
title: body.title, // 使用传入的标题或默认标题
};

View File

@ -57,7 +57,7 @@ export class DiscordNotification extends BaseNotification {
}
// 创建 Discord 消息体
let content = `${body.title}\n${body.content}\n[查看详情](${body.url})`;
let content = `${body.title}\n${body.content}\n\n[查看详情](${body.url})`;
if (this.mentionedList && this.mentionedList.length > 0) {
content += `\n${this.mentionedList.map(item => `<@${item}> `).join('')}`;
}

View File

@ -22,7 +22,7 @@ export class EmailNotification extends BaseNotification {
async send(body: NotificationBody) {
await this.ctx.emailService.send({
subject: body.title,
content: body.content + '\n[查看详情](' + body.url + ')',
content: body.content + '\n\n[查看详情](' + body.url + ')',
receivers: this.receivers,
});
}

View File

@ -3,6 +3,7 @@ export * from './email/index.js';
export * from './iyuu/index.js';
export * from './webhook/index.js';
export * from './serverchan/index.js';
export * from './serverchan3/index.js';
export * from './anpush/index.js';
export * from './telegram/index.js';
export * from './discord/index.js';

View File

@ -26,7 +26,7 @@ export class IyuuNotification extends BaseNotification {
method: 'POST',
data: {
text: body.title,
desp: body.content + '[查看详情](' + body.url + ')',
desp: body.content + '\n\n[查看详情](' + body.url + ')',
},
});

View File

@ -49,7 +49,7 @@ export class QywxNotification extends BaseNotification {
data: {
msgtype: 'markdown',
markdown: {
content: `# ${body.title}\n\n${body.content}\n[查看详情](${body.url})`,
content: `# ${body.title}\n\n${body.content}\n\n[查看详情](${body.url})`,
mentioned_list: this.mentionedList,
},
},

View File

@ -2,7 +2,7 @@ import { BaseNotification, IsNotification, NotificationBody, NotificationInput }
@IsNotification({
name: 'serverchan',
title: 'Server酱',
title: 'Server酱',
desc: 'https://sct.ftqq.com/',
needPlus: true,
})
@ -64,7 +64,7 @@ export class ServerChanNotification extends BaseNotification {
method: 'POST',
data: {
text: body.title,
desp: body.content + '[查看详情](' + body.url + ')',
desp: body.content + '\n\n[查看详情](' + body.url + ')',
},
skipSslVerify: this.skipSslVerify,
});

View File

@ -0,0 +1,65 @@
import { BaseNotification, IsNotification, NotificationBody, NotificationInput } from '@certd/pipeline';
@IsNotification({
name: 'serverchan3',
title: 'Server酱³',
desc: 'https://doc.sc3.ft07.com/serverchan3',
needPlus: true,
})
export class ServerChan3Notification extends BaseNotification {
@NotificationInput({
title: 'ApiURL',
component: {
placeholder: 'https://uid.push.ft07.com/send/sendKey.send',
},
required: true,
})
apiURL = '';
@NotificationInput({
title: '标签Tags',
component: {
name: 'a-select',
vModel: 'value',
mode: 'tags',
open: false,
},
helper: '支持多个,回车后填写下一个',
required: false,
})
tags: string[];
@NotificationInput({
title: 'short',
required: false,
})
short: string;
@NotificationInput({
title: '忽略证书校验',
value: false,
component: {
name: 'a-switch',
vModel: 'checked',
},
required: false,
})
skipSslVerify: boolean;
async send(body: NotificationBody) {
if (!this.apiURL) {
throw new Error('sendKey不能为空');
}
await this.http.request({
url: `${this.apiURL}`,
method: 'POST',
data: {
text: body.title,
desp: body.content + '\n\n[查看详情](' + body.url + ')',
tags: this.tags.join('|'),
short: this.short,
},
skipSslVerify: this.skipSslVerify,
});
}
}

View File

@ -47,7 +47,7 @@ export class SlackNotification extends BaseNotification {
url: this.webhook,
method: 'POST',
data: {
text: `${body.title}\n${body.content}\n[查看详情](${body.url})`,
text: `${body.title}\n${body.content}\n\n[查看详情](${body.url})`,
},
httpProxy: this.httpsProxy,
skipSslVerify: this.skipSslVerify,

View File

@ -64,7 +64,7 @@ export class TelegramNotification extends BaseNotification {
}
// 构建消息内容
const messageContent = `*${body.title}*\n\n${body.content}\n[查看详情](${body.url})`;
const messageContent = `*${body.title}*\n\n${body.content}\n\n[查看详情](${body.url})`;
// Telegram API URL
const url = `https://api.telegram.org/bot${this.botToken}/sendMessage`;

View File

@ -79,7 +79,7 @@ export class VoceChatNotification extends BaseNotification {
'x-api-key': this.apiKey,
'Content-Type': 'text/markdown',
},
data: `# ${body.title}\n\n${body.content}\n[查看详情](${body.url})`,
data: `# ${body.title}\n\n${body.content}\n\n[查看详情](${body.url})`,
skipSslVerify: this.skipSslVerify,
});
}