chore: update package versions and add user config sync API

- Bump version to 4.8.0 and update dependencies in package.json
- Implement user config sync API for cross-device settings persistence
- Add resolution badge auto-hide hook for improved user experience
- Create useConfigSync hook to manage user settings synchronization with the server
This commit is contained in:
kuekhaoyang
2026-03-18 12:44:05 +08:00
parent 54c1d353d7
commit 3564ce1ede
27 changed files with 721 additions and 215 deletions
+12
View File
@@ -1,6 +1,16 @@
import { Video } from '@/lib/types';
import { getSourceName } from '@/lib/utils/source-names';
import { calculateRelevanceScore, hasMinimumMatch } from '@/lib/utils/search';
import { settingsStore } from '@/lib/store/settings-store';
/**
* Check if a video's category matches any blocked keyword.
*/
function isCategoryBlocked(video: any, blockedCategories: string[]): boolean {
if (blockedCategories.length === 0) return false;
const typeName = (video.type_name || video.vod_class || '').toLowerCase();
return blockedCategories.some(cat => typeName.includes(cat.toLowerCase()));
}
interface StreamHandlerParams {
reader: ReadableStreamDefaultReader<Uint8Array>;
@@ -43,6 +53,7 @@ export async function processSearchStream({
try {
resetTimeout(); // Start initial timeout
const blockedCategories = settingsStore.getSettings().blockedCategories;
while (true) {
const { done, value } = await reader.read();
@@ -64,6 +75,7 @@ export async function processSearchStream({
} else if (data.type === 'videos') {
const newVideos: Video[] = data.videos
.filter((video: any) => hasMinimumMatch(video.vod_name, currentQuery))
.filter((video: any) => !isCategoryBlocked(video, blockedCategories))
.map((video: any) => ({
...video,
sourceName: video.sourceDisplayName || getSourceName(video.source),