chore: update Angular build cache and TypeScript definitions
This commit is contained in:
@@ -19,6 +19,7 @@ export interface WatchHistoryItem {
|
||||
duration_seconds: number;
|
||||
last_position_seconds: number;
|
||||
last_watched_at?: string;
|
||||
thumbnail?: string | null;
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
@@ -42,10 +43,10 @@ export class HistoryService {
|
||||
}
|
||||
|
||||
// --- Watch ---
|
||||
recordWatchStart(provider: string, videoId: string, title?: string | null, watchedAt?: string): Observable<WatchHistoryItem> {
|
||||
recordWatchStart(provider: string, videoId: string, title?: string | null, watchedAt?: string, thumbnail?: string | null): Observable<WatchHistoryItem> {
|
||||
return this.http.post<WatchHistoryItem>(
|
||||
'/proxy/api/user/history/watch',
|
||||
{ provider, videoId, title: title ?? null, watchedAt },
|
||||
{ provider, videoId, title: title ?? null, watchedAt, thumbnail: thumbnail ?? null },
|
||||
{ withCredentials: true }
|
||||
);
|
||||
}
|
||||
@@ -64,4 +65,35 @@ export class HistoryService {
|
||||
if (before) params.set('before', before);
|
||||
return this.http.get<WatchHistoryItem[]>(`/proxy/api/user/history/watch?${params.toString()}`, { withCredentials: true });
|
||||
}
|
||||
|
||||
// --- Delete single items ---
|
||||
deleteSearchItem(id: string): Observable<void> {
|
||||
return this.http.delete<void>(`/proxy/api/user/history/search/${encodeURIComponent(id)}`, { withCredentials: true });
|
||||
}
|
||||
|
||||
deleteWatchItem(id: string): Observable<void> {
|
||||
return this.http.delete<void>(`/proxy/api/user/history/watch/${encodeURIComponent(id)}`, { withCredentials: true });
|
||||
}
|
||||
|
||||
// Recherche dans l'historique des recherches
|
||||
searchInSearchHistory(query: string, limit = 100): Observable<SearchHistoryItem[]> {
|
||||
const params = new URLSearchParams();
|
||||
params.set('q', query);
|
||||
params.set('limit', String(limit));
|
||||
return this.http.get<SearchHistoryItem[]>(
|
||||
`/proxy/api/user/history/search?${params.toString()}`,
|
||||
{ withCredentials: true }
|
||||
);
|
||||
}
|
||||
|
||||
// Recherche dans l'historique de visionnage
|
||||
searchInWatchHistory(query: string, limit = 100): Observable<WatchHistoryItem[]> {
|
||||
const params = new URLSearchParams();
|
||||
params.set('q', query);
|
||||
params.set('limit', String(limit));
|
||||
return this.http.get<WatchHistoryItem[]>(
|
||||
`/proxy/api/user/history/watch?${params.toString()}`,
|
||||
{ withCredentials: true }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface LikedVideoItem {
|
||||
provider: string;
|
||||
video_id: string;
|
||||
title?: string;
|
||||
thumbnail?: string;
|
||||
last_watched_at?: string | null;
|
||||
}
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class LikesService {
|
||||
private http = inject(HttpClient);
|
||||
|
||||
private apiBase(): string {
|
||||
try {
|
||||
const port = window?.location?.port || '';
|
||||
return port && port !== '4000' ? '/proxy/api' : '/api';
|
||||
} catch {
|
||||
return '/api';
|
||||
}
|
||||
}
|
||||
|
||||
list(limit = 100, q?: string): Observable<LikedVideoItem[]> {
|
||||
let params = new HttpParams().set('limit', String(limit));
|
||||
if (typeof q === 'string' && q.trim().length > 0) params = params.set('q', q.trim());
|
||||
return this.http.get<LikedVideoItem[]>(`${this.apiBase()}/user/likes`, { params, withCredentials: true });
|
||||
}
|
||||
|
||||
like(provider: string, videoId: string): Observable<{ provider: string; video_id: string }> {
|
||||
return this.http.post<{ provider: string; video_id: string }>(
|
||||
`${this.apiBase()}/user/likes`,
|
||||
{ provider, videoId },
|
||||
{ withCredentials: true }
|
||||
);
|
||||
}
|
||||
|
||||
unlike(provider: string, videoId: string): Observable<{ removed: boolean }> {
|
||||
const params = new HttpParams().set('provider', provider).set('videoId', videoId);
|
||||
return this.http.delete<{ removed: boolean }>(`${this.apiBase()}/user/likes`, { params, withCredentials: true });
|
||||
}
|
||||
|
||||
isLiked(provider: string, videoId: string): Observable<{ liked: boolean }> {
|
||||
const params = new HttpParams().set('provider', provider).set('videoId', videoId);
|
||||
return this.http.get<{ liked: boolean }>(`${this.apiBase()}/user/likes/status`, { params, withCredentials: true });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user