Refactoring the backend

This commit is contained in:
jiangrui
2025-03-10 18:33:47 +08:00
parent 755a424530
commit a78ea7e5bd
36 changed files with 974 additions and 474 deletions

View File

@@ -25,6 +25,18 @@ interface Config {
channels: Channel[];
};
cloudPatterns: CloudPatterns;
app: {
port: number;
env: string;
};
database: {
type: string;
path: string;
};
jwt: {
secret: string;
expiresIn: string;
};
}
// 从环境变量读取频道配置
@@ -56,13 +68,24 @@ const getTeleChannels = (): Channel[] => {
};
export const config: Config = {
app: {
port: parseInt(process.env.PORT || "8009"),
env: process.env.NODE_ENV || "development",
},
database: {
type: "sqlite",
path: "./data/database.sqlite",
},
jwt: {
secret: process.env.JWT_SECRET || "your-secret-key",
expiresIn: "6h",
},
jwtSecret: process.env.JWT_SECRET || "uV7Y$k92#LkF^q1b!",
telegram: {
baseUrl: process.env.TELEGRAM_BASE_URL || "https://t.me/s",
channels: getTeleChannels(),
},
cloudPatterns: {
baiduPan: /https?:\/\/(?:pan|yun)\.baidu\.com\/[^\s<>"]+/g,
tianyi: /https?:\/\/cloud\.189\.cn\/[^\s<>"]+/g,
@@ -70,6 +93,7 @@ export const config: Config = {
// pan115有两个域名 115.com 和 anxia.com 和 115cdn.com
pan115: /https?:\/\/(?:115|anxia|115cdn)\.com\/s\/[^\s<>"]+/g,
// 修改为匹配所有以123开头的域名
// eslint-disable-next-line no-useless-escape
pan123: /https?:\/\/(?:www\.)?123[^\/\s<>"]+\.com\/s\/[^\s<>"]+/g,
quark: /https?:\/\/pan\.quark\.cn\/[^\s<>"]+/g,
yidong: /https?:\/\/caiyun\.139\.com\/[^\s<>"]+/g,