feat(notifications): default body template → Server酱 JSON (title/desp) (#108)
- Change DEFAULT_BODY_TEMPLATE from plaintext to Server酱-style JSON - Add JSON-safe escaping in renderTemplate for backslashes and quotes - Update frontend DEFAULT_TEMPLATE to match backend - Add tests for JSON escaping behavior Fixes #106 (targets dev branch)
This commit is contained in:
3 files changed
+36
-7
No files matched your search
@@ -16,7 +16,10 @@ import { cn } from '@/lib/utils';
|
||||
import type { NotificationChannel, NotificationsConfig } from '@/types';
|
||||
import { NotificationChannelDialog } from './notification-channel-dialog';
|
||||
|
||||
const DEFAULT_TEMPLATE = '{nickname}({uin}) {event} @ {time}';
|
||||
const DEFAULT_TEMPLATE = `{
|
||||
"title": "账号状态通知:{event}",
|
||||
"desp": "您的账号状态发生了改变。\\n\\n**昵称**:{nickname}\\n**QQ号**:{uin}\\n**当前状态**:{event}\\n**时间**:{time}"
|
||||
}`;
|
||||
|
||||
/** A fresh channel with a non-colliding default id. */
|
||||
function blankChannel(existing: NotificationChannel[]): NotificationChannel {
|
||||
|
||||
Reference in new issue
Block a user