mirror of
https://github.com/MoonTechLab/LunaTV.git
synced 2026-02-22 10:34:42 +08:00
110 lines
2.8 KiB
TypeScript
110 lines
2.8 KiB
TypeScript
import { AdminConfig } from './admin.types';
|
|
|
|
// 播放记录数据结构
|
|
export interface PlayRecord {
|
|
title: string;
|
|
source_name: string;
|
|
cover: string;
|
|
index: number; // 第几集
|
|
total_episodes: number; // 总集数
|
|
play_time: number; // 播放进度(秒)
|
|
total_time: number; // 总进度(秒)
|
|
save_time: number; // 记录保存时间(时间戳)
|
|
}
|
|
|
|
// 收藏数据结构
|
|
export interface Favorite {
|
|
source_name: string;
|
|
total_episodes: number; // 总集数
|
|
title: string;
|
|
cover: string;
|
|
save_time: number; // 记录保存时间(时间戳)
|
|
}
|
|
|
|
// 存储接口
|
|
export interface IStorage {
|
|
// 播放记录相关
|
|
getPlayRecord(userName: string, key: string): Promise<PlayRecord | null>;
|
|
setPlayRecord(
|
|
userName: string,
|
|
key: string,
|
|
record: PlayRecord
|
|
): Promise<void>;
|
|
getAllPlayRecords(userName: string): Promise<{ [key: string]: PlayRecord }>;
|
|
deletePlayRecord(userName: string, key: string): Promise<void>;
|
|
|
|
// 收藏相关
|
|
getFavorite(userName: string, key: string): Promise<Favorite | null>;
|
|
setFavorite(userName: string, key: string, favorite: Favorite): Promise<void>;
|
|
getAllFavorites(userName: string): Promise<{ [key: string]: Favorite }>;
|
|
deleteFavorite(userName: string, key: string): Promise<void>;
|
|
|
|
// 用户相关
|
|
registerUser(userName: string, password: string): Promise<void>;
|
|
verifyUser(userName: string, password: string): Promise<boolean>;
|
|
// 检查用户是否存在(无需密码)
|
|
checkUserExist(userName: string): Promise<boolean>;
|
|
|
|
// 搜索历史相关
|
|
getSearchHistory(userName: string): Promise<string[]>;
|
|
addSearchHistory(userName: string, keyword: string): Promise<void>;
|
|
deleteSearchHistory(userName: string, keyword?: string): Promise<void>;
|
|
|
|
// 用户列表
|
|
getAllUsers(): Promise<string[]>;
|
|
|
|
// 管理员配置相关
|
|
getAdminConfig(): Promise<AdminConfig | null>;
|
|
setAdminConfig(config: AdminConfig): Promise<void>;
|
|
}
|
|
|
|
// 视频详情数据结构
|
|
export interface VideoDetail {
|
|
code: number;
|
|
episodes: string[];
|
|
detailUrl: string;
|
|
videoInfo: {
|
|
title: string;
|
|
cover?: string;
|
|
desc?: string;
|
|
type?: string;
|
|
year?: string;
|
|
area?: string;
|
|
director?: string;
|
|
actor?: string;
|
|
remarks?: string;
|
|
source_name: string;
|
|
source: string;
|
|
id: string;
|
|
};
|
|
}
|
|
|
|
// 搜索结果数据结构
|
|
export interface SearchResult {
|
|
id: string;
|
|
title: string;
|
|
poster: string;
|
|
episodes: string[];
|
|
source: string;
|
|
source_name: string;
|
|
class?: string;
|
|
year: string;
|
|
desc?: string;
|
|
type_name?: string;
|
|
douban_id?: number;
|
|
}
|
|
|
|
// 豆瓣数据结构
|
|
export interface DoubanItem {
|
|
id: string;
|
|
title: string;
|
|
poster: string;
|
|
rate: string;
|
|
}
|
|
|
|
export interface DoubanResult {
|
|
code: number;
|
|
message: string;
|
|
list: DoubanItem[];
|
|
}
|