增加剧集屏蔽功能
This commit is contained in:
@@ -1833,3 +1833,49 @@ export async function saveDanmakuFilterConfig(
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 集数过滤配置相关 API ----------------
|
||||
|
||||
/**
|
||||
* 获取集数过滤配置(纯 localStorage 存储)
|
||||
*/
|
||||
export async function getEpisodeFilterConfig(): Promise<EpisodeFilterConfig | null> {
|
||||
if (typeof window === 'undefined') {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const raw = localStorage.getItem('moontv_episode_filter_config');
|
||||
if (!raw) return null;
|
||||
return JSON.parse(raw) as EpisodeFilterConfig;
|
||||
} catch (err) {
|
||||
console.error('读取集数过滤配置失败:', err);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存集数过滤配置(纯 localStorage 存储)
|
||||
*/
|
||||
export async function saveEpisodeFilterConfig(
|
||||
config: EpisodeFilterConfig
|
||||
): Promise<void> {
|
||||
if (typeof window === 'undefined') {
|
||||
console.warn('无法在服务端保存集数过滤配置');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
localStorage.setItem('moontv_episode_filter_config', JSON.stringify(config));
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('episodeFilterConfigUpdated', {
|
||||
detail: config,
|
||||
})
|
||||
);
|
||||
} catch (err) {
|
||||
console.error('保存集数过滤配置失败:', err);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user