Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ The worker serves the frontend's static assets from `web/dist/` via the `ASSETS`
- `lunar.ts` — Chinese lunar calendar support (1900–2100)
- `currency.ts` — multi-currency / exchange rate conversion

**Notification services** (`worker/src/services/notify/`): Each channel (Telegram, Webhook, Email, Bark, Gotify, ServerChan, PushPlus, NotifyX, WeChatBot) is a separate file. `index.ts` fans out to all enabled channels, with optional per-item channel filtering via the `channels` parameter.
**Notification services** (`worker/src/services/notify/`): Each channel (Telegram, Webhook, Email, Bark, Gotify, NotifyX, WeChatBot) is a separate file. `index.ts` fans out to all enabled channels, with optional per-item channel filtering via the `channels` parameter.

**Scheduler** (`worker/src/services/scheduler.ts`): Runs hourly via Cloudflare Cron Trigger (`0 * * * *`). For each active user it:

Expand Down
2 changes: 1 addition & 1 deletion README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A smart notification management system that helps you track expiry dates and exp
- **Auto-renewal** — Expired subscriptions are automatically renewed with payment history recorded
- **Payment History** — Record every payment, multi-currency with real-time exchange rates
- **Dashboard** — Monthly/yearly expense stats, expiry alerts, category analysis
- **10 Notification Channels** — Telegram, Webhook, WeChat Work, Email, Bark, Gotify, ServerChan, PushPlus, NotifyX, Slack
- **8 Notification Channels** — Telegram, Webhook, WeChat Work, Email, Bark, Gotify, NotifyX, Slack
- **Channel Management** — Dedicated page to enable and configure notification channels
- **Per-Item Channel Selection** — Each notification item can specify which channels to use; defaults to all enabled channels if unset
- **Scheduled Reminders** — Hourly auto-check with global notification hours and per-item override
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
- **自动续费** — 过期订阅自动续期并记录支付历史
- **支付历史** — 记录每笔支付,支持多币种与实时汇率转换
- **仪表盘** — 月度/年度支出统计、到期预警、分类分析
- **10 个通知渠道** — Telegram、Webhook、企业微信、邮件、Bark、Gotify、Server酱、PushPlus、NotifyX、Slack
- **8 个通知渠道** — Telegram、Webhook、企业微信、邮件、Bark、Gotify、NotifyX、Slack
- **渠道管理** — 独立页面统一管理通知渠道的启用与配置
- **按项选择渠道** — 每个通知项可单独指定使用哪些渠道,未指定则默认使用所有已启用渠道
- **定时提醒** — 每小时自动检查并发送到期提醒,支持全局时段配置和每项独立覆盖
Expand Down
2 changes: 0 additions & 2 deletions web/src/lib/channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ export const CHANNELS = [
{ id: "email", label: "Email" },
{ id: "bark", label: "Bark" },
{ id: "gotify", label: "Gotify" },
{ id: "serverchan", label: "ServerChan" },
{ id: "pushplus", label: "PushPlus" },
{ id: "notifyx", label: "NotifyX" },
{ id: "slack", label: "Slack" },
] as const;
5 changes: 0 additions & 5 deletions web/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@
"email": "Email",
"bark": "Bark",
"gotify": "Gotify",
"serverchan": "ServerChan",
"pushplus": "PushPlus",
"notifyx": "NotifyX",
"slack": "Slack",
"botToken": "Bot Token",
Expand All @@ -361,11 +359,8 @@
"server": "Server",
"serverUrl": "Server URL",
"appToken": "App Token",
"sendKey": "SendKey",
"apiKey": "API Key",
"token": "Token",
"topic": "Topic (optional)",
"channelName": "Channel (optional)",
"selectChannels": "Select Notification Channels",
"allChannels": "All enabled channels",
"selectedChannels": "{{count}} channels selected",
Expand Down
5 changes: 0 additions & 5 deletions web/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,6 @@
"email": "邮件",
"bark": "Bark",
"gotify": "Gotify",
"serverchan": "Server酱",
"pushplus": "PushPlus",
"notifyx": "NotifyX",
"slack": "Slack",
"botToken": "机器人令牌",
Expand All @@ -361,11 +359,8 @@
"server": "服务器",
"serverUrl": "服务器 URL",
"appToken": "应用令牌",
"sendKey": "SendKey",
"apiKey": "API 密钥",
"token": "令牌",
"topic": "主题(可选)",
"channelName": "频道(可选)",
"selectChannels": "选择通知渠道",
"allChannels": "所有已启用的渠道",
"selectedChannels": "已选择 {{count}} 个渠道",
Expand Down
14 changes: 0 additions & 14 deletions web/src/pages/channels/ChannelPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,6 @@ const CHANNELS: ChannelDef[] = [
{ key: "app_token", label: "App Token", type: "password" },
],
},
{
id: "serverchan",
label: "ServerChan",
fields: [{ key: "sendkey", label: "SendKey", type: "text" }],
},
{
id: "pushplus",
label: "PushPlus",
fields: [
{ key: "token", label: "Token", type: "text" },
{ key: "topic", label: "Topic (optional)", type: "text" },
{ key: "channel", label: "Channel (optional)", type: "text" },
],
},
{
id: "notifyx",
label: "NotifyX",
Expand Down
2 changes: 0 additions & 2 deletions worker/src/db/queries/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export async function upsertNotificationConfig(
"email_config",
"bark_config",
"gotify_config",
"serverchan_config",
"pushplus_config",
"notifyx_config",
"slack_config",
"notification_hours",
Expand Down
2 changes: 0 additions & 2 deletions worker/src/db/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ CREATE TABLE IF NOT EXISTS {prefix}notification_configs (
email_config TEXT NOT NULL DEFAULT '{}',
bark_config TEXT NOT NULL DEFAULT '{}',
gotify_config TEXT NOT NULL DEFAULT '{}',
serverchan_config TEXT NOT NULL DEFAULT '{}',
pushplus_config TEXT NOT NULL DEFAULT '{}',
notifyx_config TEXT NOT NULL DEFAULT '{}',
slack_config TEXT NOT NULL DEFAULT '{}',
notification_hours TEXT NOT NULL DEFAULT '[]',
Expand Down
35 changes: 33 additions & 2 deletions worker/src/lib/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,39 @@ async function runMigrations(db: D1Database, prefix: string): Promise<void> {
console.error("Migration failed for notification_configs table:", err);
}

// Migration: drop retired channels (serverchan/pushplus) from enabled_channels.
// Their sender code is gone, so a stale ID would make every push fail with
// "Unknown channel" and write a notification_history row. Idempotent: the
// second run finds nothing to strip and performs no UPDATE.
try {
const rows = await db
.prepare(
`SELECT user_id, enabled_channels FROM ${prefix}notification_configs`,
)
.all<{ user_id: string; enabled_channels: string }>();
for (const row of rows.results) {
let channels: unknown;
try {
channels = JSON.parse(row.enabled_channels || "[]");
} catch {
continue;
}
if (!Array.isArray(channels)) continue;
const filtered = channels.filter(
(ch) => ch !== "serverchan" && ch !== "pushplus",
);
if (filtered.length === channels.length) continue;
await db
.prepare(
`UPDATE ${prefix}notification_configs SET enabled_channels = ? WHERE user_id = ?`,
)
.bind(JSON.stringify(filtered), row.user_id)
.run();
}
} catch (err) {
console.error("Migration failed to drop retired channels:", err);
}

// Migration: items table columns (type/use_lunar -> calendar_mode, lunar_expiry_date).
// Uses ALTER TABLE instead of recreating the table: DROP TABLE would cascade-delete payment_history.
try {
Expand Down Expand Up @@ -214,8 +247,6 @@ CREATE TABLE IF NOT EXISTS {prefix}notification_configs (
email_config TEXT NOT NULL DEFAULT '{}',
bark_config TEXT NOT NULL DEFAULT '{}',
gotify_config TEXT NOT NULL DEFAULT '{}',
serverchan_config TEXT NOT NULL DEFAULT '{}',
pushplus_config TEXT NOT NULL DEFAULT '{}',
notifyx_config TEXT NOT NULL DEFAULT '{}',
slack_config TEXT NOT NULL DEFAULT '{}',
notification_hours TEXT NOT NULL DEFAULT '[]',
Expand Down
4 changes: 0 additions & 4 deletions worker/src/services/notify/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { sendWebhook } from "./webhook";
import { sendWechatBot } from "./wechatbot";
import { sendBark } from "./bark";
import { sendGotify } from "./gotify";
import { sendServerChan } from "./serverchan";
import { sendPushPlus } from "./pushplus";
import { sendNotifyX } from "./notifyx";
import { sendSlack } from "./slack";
import { sendNotifyEmail } from "./email-notify";
Expand Down Expand Up @@ -46,8 +44,6 @@ const CHANNEL_SENDERS: Record<
email: sendNotifyEmail,
bark: sendBark,
gotify: sendGotify,
serverchan: sendServerChan,
pushplus: sendPushPlus,
notifyx: sendNotifyX,
slack: sendSlack,
};
Expand Down
41 changes: 0 additions & 41 deletions worker/src/services/notify/pushplus.ts

This file was deleted.

36 changes: 0 additions & 36 deletions worker/src/services/notify/serverchan.ts

This file was deleted.

4 changes: 0 additions & 4 deletions worker/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ export interface NotificationConfig {
email_config: string;
bark_config: string;
gotify_config: string;
serverchan_config: string;
pushplus_config: string;
notifyx_config: string;
slack_config: string;
notification_hours: string;
Expand Down Expand Up @@ -131,8 +129,6 @@ export const VALID_CHANNELS: string[] = [
"email",
"bark",
"gotify",
"serverchan",
"pushplus",
"notifyx",
"slack",
];
Loading
Loading