feat: v0.1.7 消息推送模块 - 多通道通知(飞书/Server酱/Bark/Telegram/Webhook)+ 转存/清理/Cookie推送事件 + 推送配置页面

This commit is contained in:
root
2026-05-15 23:59:55 +08:00
parent 1c7b750cda
commit e38adee8ff
9 changed files with 359 additions and 59 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "cloudsearch-frontend",
"version": "0.1.6",
"version": "0.1.7",
"private": true,
"type": "module",
"scripts": {

View File

@@ -490,7 +490,94 @@
</el-form-item>
</el-form>
</el-card>
<!-- 🔄 系统维护 --> <el-card id="section-sys-maintenance" v-show="!activeSection || activeSection === 'sys-maintenance'"> <template #header> <span>🔄 系统维护</span> </template> <el-form label-width="180px" label-position="left"> <el-form-item label="自动更新镜像"> <el-switch v-model="autoUpdateEnabled" active-text="启用" inactive-text="禁用" /> <div class="form-tip">启用后 CloudSearch 将自动检测并更新到最新镜像版本</div> <div class="form-tip" style="color: var(--(--el-color-warning,#e6a23c));"> 当前需手动在服务器执行docker-compose -f /opt/CloudSearch/docker-compose.yml pull && docker-compose -f /opt/CloudSearch/docker-compose.yml up -d </div> </el-form-item> </el-form> </el-card>
<!-- 📬 消息推送 -->
<el-card id="section-sys-notify" v-show="!activeSection || activeSection === 'sys-notify'">
<template #header>
<span>📬 消息推送</span>
</template>
<div class="strategy-section">
<el-divider content-position="left">推送通道配置</el-divider>
<!-- 飞书 -->
<el-form-item label="飞书 Webhook">
<el-input v-model="configs.feishu_webhook_url" placeholder="https://open.feishu.cn/open-apis/bot/v2/hook/xxx" style="max-width: 500px" />
<div class="form-tip">飞书机器人 Webhook URL配置后发送卡片消息到群聊</div>
<div class="form-tip" style="color: var(--el-color-primary); font-size: 12px; margin-top: 2px;">
优先从环境变量 FEISHU_WEBHOOK 读取其次读取此配置
</div>
</el-form-item>
<!-- Server酱 -->
<el-form-item label="Server酱 (微信)">
<el-input v-model="configs.serverchan_key" placeholder="SendKey" style="max-width: 300px" />
<div class="form-tip">通过 <a href="https://sct.ftqq.com" target="_blank" rel="noopener" style="color: var(--primary-color)">Server酱</a> 推送到微信只需填写 SendKey</div>
</el-form-item>
<!-- Bark -->
<el-form-item label="Bark (iOS)">
<el-input v-model="configs.bark_key" placeholder="xxxxxxxxxxxxxxxxxxxxxx" style="max-width: 300px" />
<div class="form-tip" style="margin-bottom: 4px;">通过 <a href="https://bark.day.app" target="_blank" rel="noopener" style="color: var(--primary-color)">Bark</a> 推送到 iOS 设备填写 API Key</div>
<div class="field-label-row">
<span class="field-label" style="font-size:12px; color:#909399;">自定义服务器</span>
<el-input v-model="configs.bark_server" placeholder="https://api.day.app" style="max-width: 280px" />
</div>
</el-form-item>
<!-- Telegram -->
<el-form-item label="Telegram">
<div style="display: flex; gap: 8px; align-items: center; width: 100%;">
<el-input v-model="configs.telegram_bot_token" placeholder="123456:ABC-DEF" style="max-width: 300px" />
<span style="font-size:12px; color:#909399;">Bot Token</span>
<el-input v-model="configs.telegram_chat_id" placeholder="@频道或 -100..." style="max-width: 200px" />
<span style="font-size:12px; color:#909399;">Chat ID</span>
</div>
<div class="form-tip">通过 TG Bot 推送消息需先创建 Bot 并获取 Token</div>
</el-form-item>
<!-- 自定义 Webhook -->
<el-form-item label="自定义 Webhook">
<el-input v-model="configs.webhook_url" placeholder="https://example.com/webhook" style="max-width: 500px" />
<div class="form-tip">POST JSON 到指定 URL格式{title, content, level, source: "CloudSearch"}</div>
</el-form-item>
<el-divider content-position="left">推送事件开关</el-divider>
<div class="strategy-grid" style="grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));">
<div class="grid-cell">
<div class="field-label-row">
<span class="field-label"> 转存成功</span>
<el-switch v-model="configs.notify_on_save_success" active-value="true" inactive-value="false" />
</div>
<div class="field-desc">转存成功时推送通知</div>
</div>
<div class="grid-cell">
<div class="field-label-row">
<span class="field-label"> 转存连续失败</span>
<el-switch v-model="configs.notify_on_save_fail" active-value="true" inactive-value="false" />
</div>
<div class="field-desc">连续失败 3 次后推送通知</div>
</div>
<div class="grid-cell">
<div class="field-label-row">
<span class="field-label"> Cookie 过期</span>
<el-switch v-model="configs.notify_on_cookie_expire" active-value="true" inactive-value="false" />
</div>
<div class="field-desc">Cookie 过期时推送提醒</div>
</div>
<div class="grid-cell">
<div class="field-label-row">
<span class="field-label">🧹 清理完成</span>
<el-switch v-model="configs.notify_on_cleanup" active-value="true" inactive-value="false" />
</div>
<div class="field-desc">每日自动清理完成时推送</div>
</div>
</div>
</div>
</el-card>
<!-- 🔄 系统维护 --> <el-card id="section-sys-maintenance" v-show="!activeSection || activeSection === 'sys-maintenance'"> <template #header> <span>🔄 系统维护</span> </template> <el-form label-width="180px" label-position="left"> <el-form-item label="自动更新镜像"> <el-switch v-model="autoUpdateEnabled" active-text="启用" inactive-text="禁用" /> <div class="form-tip">启用后 CloudSearch 将自动检测并更新到最新镜像版本</div> <div class="form-tip" style="color: var(--(--el-color-warning,#e6a23c));"> 当前需手动在服务器执行docker-compose -f /opt/CloudSearch/docker-compose.yml pull && docker-compose -f /opt/CloudSearch/docker-compose.yml up -d </div> </el-form-item> </el-form> </el-card>
<!-- 保存按钮 -->
<div class="save-bar">