mirror of
https://github.com/jiangrui1994/CloudSaver.git
synced 2026-04-08 05:50:07 +08:00
Refactoring the backend
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user