Files
MoonTVPlus/src/lib/admin.types.ts

277 lines
10 KiB
TypeScript
Raw Normal View History

2025-08-12 21:50:58 +08:00
export interface AdminConfig {
2025-08-13 13:20:58 +08:00
ConfigSubscribtion: {
URL: string;
AutoUpdate: boolean;
LastCheck: string;
};
2025-08-13 00:30:31 +08:00
ConfigFile: string;
2025-08-12 21:50:58 +08:00
SiteConfig: {
SiteName: string;
Announcement: string;
SearchDownstreamMaxPage: number;
SiteInterfaceCacheTime: number;
DoubanProxyType: string;
DoubanProxy: string;
DoubanImageProxyType: string;
DoubanImageProxy: string;
DisableYellowFilter: boolean;
2025-08-17 17:32:42 +08:00
FluidSearch: boolean;
2025-12-02 01:00:42 +08:00
// 弹幕配置
DanmakuApiBase: string;
DanmakuApiToken: string;
2025-12-14 22:15:38 +08:00
// TMDB配置
TMDBApiKey?: string;
2025-12-20 22:11:34 +08:00
TMDBProxy?: string;
2026-01-17 18:04:58 +08:00
TMDBReverseProxy?: string;
2026-01-05 22:14:07 +08:00
BannerDataSource?: string; // 轮播图数据源TMDB、TX 或 Douban
2025-12-27 23:45:34 +08:00
RecommendationDataSource?: string; // 更多推荐数据源Douban、TMDB、Mixed、MixedSmart
2025-12-23 00:47:24 +08:00
// Pansou配置
PansouApiUrl?: string;
PansouUsername?: string;
PansouPassword?: string;
2026-01-23 14:28:35 +08:00
PansouKeywordBlocklist?: string;
// 评论功能开关
EnableComments: boolean;
2025-12-04 22:14:48 +08:00
// 自定义去广告代码
CustomAdFilterCode?: string;
CustomAdFilterVersion?: number; // 代码版本号(时间戳)
2025-12-13 13:03:46 +08:00
// 注册相关配置
EnableRegistration?: boolean; // 开启注册
RegistrationRequireTurnstile?: boolean; // 注册启用Cloudflare Turnstile
LoginRequireTurnstile?: boolean; // 登录启用Cloudflare Turnstile
TurnstileSiteKey?: string; // Cloudflare Turnstile Site Key
TurnstileSecretKey?: string; // Cloudflare Turnstile Secret Key
DefaultUserTags?: string[]; // 新注册用户的默认用户组
2026-01-12 21:06:45 +08:00
// 求片功能配置
EnableMovieRequest?: boolean; // 启用求片功能
MovieRequestCooldown?: number; // 求片冷却时间默认3600
2025-12-13 15:11:14 +08:00
// OIDC配置
EnableOIDCLogin?: boolean; // 启用OIDC登录
EnableOIDCRegistration?: boolean; // 启用OIDC注册
OIDCIssuer?: string; // OIDC Issuer URL (用于自动发现)
OIDCAuthorizationEndpoint?: string; // 授权端点
OIDCTokenEndpoint?: string; // Token端点
OIDCUserInfoEndpoint?: string; // 用户信息端点
OIDCClientId?: string; // OIDC Client ID
OIDCClientSecret?: string; // OIDC Client Secret
2025-12-13 17:36:57 +08:00
OIDCButtonText?: string; // OIDC登录按钮文字
2025-12-26 16:57:08 +08:00
OIDCMinTrustLevel?: number; // 最低信任等级仅LinuxDo网站有效为0时不判断
2025-08-12 21:50:58 +08:00
};
UserConfig: {
Users: {
username: string;
role: 'user' | 'admin' | 'owner';
banned?: boolean;
2025-08-21 13:05:46 +08:00
enabledApis?: string[]; // 优先级高于tags限制
tags?: string[]; // 多 tags 取并集限制
}[];
Tags?: {
name: string;
enabledApis: string[];
2025-08-12 21:50:58 +08:00
}[];
};
SourceConfig: {
key: string;
name: string;
api: string;
detail?: string;
from: 'config' | 'custom';
disabled?: boolean;
2025-12-28 21:01:49 +08:00
proxyMode?: boolean; // 代理模式开关启用后由服务器代理m3u8和ts分片
2026-01-28 18:21:08 +08:00
weight?: number; // 权重用于排序和优选评分默认0范围0-100
2025-08-12 21:50:58 +08:00
}[];
CustomCategories: {
name?: string;
type: 'movie' | 'tv';
query: string;
from: 'config' | 'custom';
disabled?: boolean;
}[];
2025-08-24 00:26:48 +08:00
LiveConfig?: {
key: string;
name: string;
url: string; // m3u 地址
ua?: string;
epg?: string; // 节目单
from: 'config' | 'custom';
channelNumber?: number;
disabled?: boolean;
}[];
2026-01-20 11:48:41 +08:00
WebLiveConfig?: {
key: string;
name: string;
platform: string; // 直播平台类型,如 'huya'
roomId: string; // 房间ID
from: 'config' | 'custom';
disabled?: boolean;
}[];
2026-01-21 00:16:42 +08:00
WebLiveEnabled?: boolean; // 网络直播功能总开关
2025-12-12 18:06:34 +08:00
ThemeConfig?: {
enableBuiltInTheme: boolean; // 是否启用内置主题
builtInTheme: string; // 内置主题名称
customCSS: string; // 自定义CSS
enableCache: boolean; // 是否启用浏览器缓存
cacheMinutes: number; // 缓存时间(分钟)
cacheVersion: number; // CSS版本号用于缓存控制
2025-12-28 12:12:11 +08:00
loginBackgroundImage?: string; // 登录界面背景图
registerBackgroundImage?: string; // 注册界面背景图
2026-02-21 02:13:50 +08:00
// 进度条图标配置
progressThumbType?: 'default' | 'preset' | 'custom'; // 图标类型
progressThumbPresetId?: string; // 预制图标ID
progressThumbCustomUrl?: string; // 自定义图标URL
2025-12-12 18:06:34 +08:00
};
2025-12-22 00:42:27 +08:00
OpenListConfig?: {
2025-12-22 23:08:03 +08:00
Enabled: boolean; // 是否启用私人影库功能
2025-12-22 00:42:27 +08:00
URL: string; // OpenList 服务器地址
2025-12-22 21:38:51 +08:00
Username: string; // 账号用于登录获取Token
Password: string; // 密码用于登录获取Token
2026-01-10 10:25:14 +08:00
RootPath?: string; // 旧字段:根目录路径(向后兼容,迁移后删除)
RootPaths?: string[]; // 新字段:多根目录路径列表
2025-12-28 14:55:35 +08:00
OfflineDownloadPath: string; // 离线下载目录,默认 "/"
2025-12-22 00:42:27 +08:00
LastRefreshTime?: number; // 上次刷新时间戳
ResourceCount?: number; // 资源数量
2025-12-22 22:28:54 +08:00
ScanInterval?: number; // 定时扫描间隔分钟0表示关闭最低60分钟
2026-01-01 20:57:44 +08:00
ScanMode?: 'torrent' | 'name' | 'hybrid'; // 扫描模式torrent=种子库匹配name=名字匹配hybrid=混合模式(默认)
2026-01-14 17:02:21 +08:00
DisableVideoPreview?: boolean; // 禁用预览视频,直接返回直连链接
2025-12-22 00:42:27 +08:00
};
2025-12-29 14:41:59 +08:00
AIConfig?: {
Enabled: boolean; // 是否启用AI问片功能
Provider: 'openai' | 'claude' | 'custom'; // AI服务提供商
// OpenAI配置
OpenAIApiKey?: string;
OpenAIBaseURL?: string; // 自定义API地址如Azure、国内代理等
OpenAIModel?: string; // 模型名称如gpt-4, gpt-3.5-turbo
// Claude配置
ClaudeApiKey?: string;
ClaudeModel?: string; // 模型名称如claude-3-opus-20240229
// 自定义配置兼容OpenAI格式的API
CustomApiKey?: string;
CustomBaseURL?: string;
CustomModel?: string;
// 决策模型配置
EnableDecisionModel: boolean; // 是否启用决策模型用AI判断是否需要联网/数据源)
DecisionProvider?: 'openai' | 'claude' | 'custom'; // 决策模型提供商
DecisionOpenAIApiKey?: string;
DecisionOpenAIBaseURL?: string;
DecisionOpenAIModel?: string;
DecisionClaudeApiKey?: string;
DecisionClaudeModel?: string;
DecisionCustomApiKey?: string;
DecisionCustomBaseURL?: string;
DecisionCustomModel?: string;
// 联网搜索配置
EnableWebSearch: boolean; // 是否启用联网搜索
WebSearchProvider?: 'tavily' | 'serper' | 'serpapi'; // 搜索服务提供商
TavilyApiKey?: string; // Tavily API密钥
SerperApiKey?: string; // Serper.dev API密钥
SerpApiKey?: string; // SerpAPI密钥
// 功能开关
EnableHomepageEntry: boolean; // 首页入口开关
EnableVideoCardEntry: boolean; // VideoCard入口开关
EnablePlayPageEntry: boolean; // 播放页入口开关
2025-12-29 15:12:40 +08:00
// 权限控制
AllowRegularUsers: boolean; // 是否允许普通用户使用AI问片关闭后仅站长和管理员可用
2025-12-29 14:41:59 +08:00
// 高级设置
Temperature?: number; // AI温度参数0-2默认0.7
MaxTokens?: number; // 最大回复token数默认1000
SystemPrompt?: string; // 自定义系统提示词
2026-01-13 21:39:15 +08:00
EnableStreaming?: boolean; // 是否启用流式响应默认true
2026-01-09 17:34:07 +08:00
// AI问片默认消息配置
DefaultMessageNoVideo?: string; // 无视频时的默认消息
DefaultMessageWithVideo?: string; // 有视频时的默认消息(支持 {title} 替换符)
2025-12-29 14:41:59 +08:00
};
2026-01-03 01:04:38 +08:00
EmbyConfig?: {
2026-01-08 00:14:07 +08:00
// 新格式:多源配置(推荐)
Sources?: Array<{
key: string; // 唯一标识,如 'emby1', 'emby2'
name: string; // 显示名称,如 '家庭Emby', '公司Emby'
enabled: boolean; // 是否启用
ServerURL: string; // Emby服务器地址
ApiKey?: string; // API Key推荐方式
Username?: string; // 用户名或使用API Key
Password?: string; // 密码
UserId?: string; // 用户ID登录后获取
AuthToken?: string; // 认证令牌(用户名密码登录后获取)
Libraries?: string[]; // 要显示的媒体库ID可选默认全部
LastSyncTime?: number; // 最后同步时间戳
ItemCount?: number; // 媒体项数量
isDefault?: boolean; // 是否为默认源(用于向后兼容)
2026-01-08 19:45:39 +08:00
// 高级流媒体选项
removeEmbyPrefix?: boolean; // 播放链接移除/emby前缀
appendMediaSourceId?: boolean; // 拼接MediaSourceId参数
transcodeMp4?: boolean; // 转码mp4
2026-01-09 22:34:29 +08:00
proxyPlay?: boolean; // 视频播放代理开关
2026-01-08 00:14:07 +08:00
}>;
// 旧格式:单源配置(向后兼容)
Enabled?: boolean;
ServerURL?: string;
ApiKey?: string;
Username?: string;
Password?: string;
UserId?: string;
AuthToken?: string;
Libraries?: string[];
LastSyncTime?: number;
ItemCount?: number;
2026-01-03 01:04:38 +08:00
};
2026-01-10 21:21:08 +08:00
XiaoyaConfig?: {
Enabled: boolean; // 是否启用
ServerURL: string; // Alist 服务器地址
Token?: string; // Token 认证(推荐)
Username?: string; // 用户名认证(备选)
Password?: string; // 密码认证(备选)
2026-01-14 17:02:21 +08:00
DisableVideoPreview?: boolean; // 禁用预览视频,直接返回直连链接
2026-01-10 21:21:08 +08:00
};
2026-01-16 16:11:31 +08:00
EmailConfig?: {
enabled: boolean; // 是否启用邮件通知
provider: 'smtp' | 'resend'; // 邮件发送方式
// SMTP配置
smtp?: {
host: string; // SMTP服务器地址
port: number; // SMTP端口25/465/587
secure: boolean; // 是否使用SSL/TLS
user: string; // SMTP用户名
password: string; // SMTP密码
from: string; // 发件人邮箱
};
// Resend配置
resend?: {
apiKey: string; // Resend API Key
from: string; // 发件人邮箱
};
};
2026-02-02 20:53:28 +08:00
MusicConfig?: {
// TuneHub音乐配置
TuneHubEnabled?: boolean; // 启用音乐功能
TuneHubBaseUrl?: string; // TuneHub API地址
TuneHubApiKey?: string; // TuneHub API Key
// OpenList缓存配置
OpenListCacheEnabled?: boolean; // 启用OpenList缓存
OpenListCacheURL?: string; // OpenList服务器地址
OpenListCacheUsername?: string; // OpenList用户名
OpenListCachePassword?: string; // OpenList密码
OpenListCachePath?: string; // OpenList缓存目录路径
2026-02-03 20:37:01 +08:00
OpenListCacheProxyEnabled?: boolean; // 启用缓存代理返回(默认开启)
2026-02-02 20:53:28 +08:00
};
2026-02-18 17:20:37 +08:00
AnimeSubscriptionConfig?: {
Enabled: boolean; // 是否启用追番功能
Subscriptions: Array<{
id: string;
title: string;
filterText: string;
source: 'acgrip' | 'mikan' | 'dmhy';
enabled: boolean;
lastCheckTime: number;
lastEpisode: number;
createdAt: number;
updatedAt: number;
createdBy: string;
}>;
};
2025-08-12 21:50:58 +08:00
}
export interface AdminConfigResult {
Role: 'owner' | 'admin';
Config: AdminConfig;
}