196 lines
4.4 KiB
TypeScript
196 lines
4.4 KiB
TypeScript
export interface Env {
|
||||
|
|
DB: D1Database;
|
|||
|
|
/** RSS 订阅数据(rss-robot 合并进来,KV 与 D1 共存于同一 Worker) */
|
|||
|
|
RSS_KV: KVNamespace;
|
|||
|
|
UPLOADS?: R2Bucket;
|
|||
|
|
ASSETS?: Fetcher;
|
|||
|
|
|
|||
|
|
// ---- RSS 订阅(rss-robot-cf 合并进来的 vars/secrets)----
|
|||
|
|
FEEDS_URL?: string;
|
|||
|
|
SCF_PROXY_URL?: string;
|
|||
|
|
FEISHU_WEBHOOK_URL?: string;
|
|||
|
|
SITE_TOKEN?: string;
|
|||
|
|
WECHAT_APPID?: string;
|
|||
|
|
WECHAT_APPSECRET?: string;
|
|||
|
|
DEEPSEEK_API_KEY?: string;
|
|||
|
|
|
|||
|
|
SITE_DEFAULT: string;
|
|||
|
|
SITE_URL: string;
|
|||
|
|
/** 站内公开 API 基址,如 https://api.200181.xyz(拼绝对 favicon 地址用) */
|
|||
|
|
PUBLIC_API_BASE?: string;
|
|||
|
|
ADMIN_NAME: string;
|
|||
|
|
ADMIN_EMAIL: string;
|
|||
|
|
ADMIN_PASSWORD: string;
|
|||
|
|
TOKEN_SECRET: string;
|
|||
|
|
ALLOWED_ORIGINS: string;
|
|||
|
|
ITEMS_PER_PAGE: string;
|
|||
|
|
PENDING_DEFAULT: string;
|
|||
|
|
IMG_UPLOAD_ENABLED?: string;
|
|||
|
|
|
|||
|
|
// ---- 邮件通知(可选,走 Resend 的 HTTP API;Workers 没有 TCP,发不了 SMTP)
|
|||
|
|
// 两个都走 `wrangler secret put`,不要写进 wrangler.toml 的 [vars]
|
|||
|
|
RESEND_API_KEY?: string;
|
|||
|
|
MAIL_FROM?: string; // 形如 `artalk <noreply@200181.xyz>`,域名要先在 Resend 验证过
|
|||
|
|
/**
|
|||
|
|
* 发件人显示名。可选;留空就用 MAIL_FROM 里那段名字。
|
|||
|
|
* 对应旧 artalk.yml 的 `email.send_name`。
|
|||
|
|
*/
|
|||
|
|
MAIL_FROM_NAME?: string;
|
|||
|
|
/**
|
|||
|
|
* 管理员通知的收件地址。
|
|||
|
|
* **不要**复用 ADMIN_EMAIL —— 那个是后台登录标识,改成真实邮箱会影响登录。
|
|||
|
|
* 不配这一项就只发「回复提醒」,不发管理员通知。
|
|||
|
|
*/
|
|||
|
|
MAIL_ADMIN?: string;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ---------------------------------------------------------------- 数据库实体
|
|||
|
|
|
|||
|
|
export interface SiteRow {
|
|||
|
|
id: number;
|
|||
|
|
name: string;
|
|||
|
|
urls: string;
|
|||
|
|
created_at: number;
|
|||
|
|
updated_at: number;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface PageRow {
|
|||
|
|
id: number;
|
|||
|
|
key: string;
|
|||
|
|
site_name: string;
|
|||
|
|
title: string;
|
|||
|
|
admin_only: number;
|
|||
|
|
pv: number;
|
|||
|
|
vote_up: number;
|
|||
|
|
vote_down: number;
|
|||
|
|
accessible_url: string;
|
|||
|
|
created_at: number;
|
|||
|
|
updated_at: number;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface UserRow {
|
|||
|
|
id: number;
|
|||
|
|
name: string;
|
|||
|
|
email: string;
|
|||
|
|
link: string;
|
|||
|
|
password: string;
|
|||
|
|
badge_name: string;
|
|||
|
|
badge_color: string;
|
|||
|
|
title_name: string;
|
|||
|
|
last_ip: string;
|
|||
|
|
last_ua: string;
|
|||
|
|
is_admin: number;
|
|||
|
|
receive_email: number;
|
|||
|
|
is_in_conf: number;
|
|||
|
|
token_valid_from: number;
|
|||
|
|
created_at: number;
|
|||
|
|
updated_at: number;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface CommentRow {
|
|||
|
|
id: number;
|
|||
|
|
content: string;
|
|||
|
|
page_key: string;
|
|||
|
|
site_name: string;
|
|||
|
|
user_id: number;
|
|||
|
|
rid: number;
|
|||
|
|
root_id: number;
|
|||
|
|
is_collapsed: number;
|
|||
|
|
is_pending: number;
|
|||
|
|
is_pinned: number;
|
|||
|
|
is_verified: number;
|
|||
|
|
vote_up: number;
|
|||
|
|
vote_down: number;
|
|||
|
|
ua: string;
|
|||
|
|
ip: string;
|
|||
|
|
ip_region: string;
|
|||
|
|
created_at: number;
|
|||
|
|
updated_at: number;
|
|||
|
|
deleted_at: number;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// ------------------------------------------------------- API 输出(与 Artalk 对齐)
|
|||
|
|
|
|||
|
|
export interface CookedComment {
|
|||
|
|
id: number;
|
|||
|
|
content: string;
|
|||
|
|
content_marked: string;
|
|||
|
|
user_id: number;
|
|||
|
|
nick: string;
|
|||
|
|
email_encrypted: string;
|
|||
|
|
link: string;
|
|||
|
|
ua: string;
|
|||
|
|
date: string;
|
|||
|
|
is_collapsed: boolean;
|
|||
|
|
is_pending: boolean;
|
|||
|
|
is_pinned: boolean;
|
|||
|
|
is_allow_reply: boolean;
|
|||
|
|
is_verified: boolean;
|
|||
|
|
rid: number;
|
|||
|
|
badge_name: string;
|
|||
|
|
badge_color: string;
|
|||
|
|
/** 头衔徽章(金色,管理员手动设置,优先级仅次于系统徽章) */
|
|||
|
|
title_name?: string;
|
|||
|
|
/** 评论等级(九品官阶)——独立于官方 badge 槽,按全站真实评论数由后端计算 */
|
|||
|
|
rank_name?: string;
|
|||
|
|
rank_title?: string;
|
|||
|
|
rank_count?: number;
|
|||
|
|
rank_color?: string;
|
|||
|
|
rank_bg?: string;
|
|||
|
|
ip_region?: string;
|
|||
|
|
visible: boolean;
|
|||
|
|
vote_up: number;
|
|||
|
|
vote_down: number;
|
|||
|
|
page_key: string;
|
|||
|
|
page_url: string;
|
|||
|
|
site_name: string;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface CookedPage {
|
|||
|
|
id: number;
|
|||
|
|
admin_only: boolean;
|
|||
|
|
key: string;
|
|||
|
|
url: string;
|
|||
|
|
title: string;
|
|||
|
|
site_name: string;
|
|||
|
|
vote_up: number;
|
|||
|
|
vote_down: number;
|
|||
|
|
pv: number;
|
|||
|
|
date: string;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface CookedUser {
|
|||
|
|
id: number;
|
|||
|
|
name: string;
|
|||
|
|
email: string;
|
|||
|
|
link: string;
|
|||
|
|
badge_name: string;
|
|||
|
|
badge_color: string;
|
|||
|
|
title_name?: string;
|
|||
|
|
is_admin: boolean;
|
|||
|
|
receive_email: boolean;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface CookedSite {
|
|||
|
|
id: number;
|
|||
|
|
name: string;
|
|||
|
|
urls: string[];
|
|||
|
|
urls_raw: string;
|
|||
|
|
first_url: string;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface CookedNotify {
|
|||
|
|
id: number;
|
|||
|
|
user_id: number;
|
|||
|
|
comment_id: number;
|
|||
|
|
is_read: boolean;
|
|||
|
|
is_emailed: boolean;
|
|||
|
|
read_link: string;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
export interface SessionUser {
|
|||
|
|
id: number;
|
|||
|
|
name: string;
|
|||
|
|
email: string;
|
|||
|
|
isAdmin: boolean;
|
|||
|
|
}
|