chore: update Angular cache and TypeScript build info files
This commit is contained in:
@@ -208,6 +208,9 @@ export class WatchComponent implements OnDestroy, AfterViewInit {
|
||||
private providerSel = signal<string>('');
|
||||
provider = computed(() => this.providerSel() || this.instances.selectedProvider());
|
||||
private twitchChannel = signal<string | null>(null);
|
||||
// Backend-provided embed URL for providers that need it (e.g., Rumble)
|
||||
private rumbleEmbed = signal<string | null>(null);
|
||||
|
||||
embedUrl = computed<SafeResourceUrl | null>(() => {
|
||||
const id = this.videoId();
|
||||
const p = this.provider();
|
||||
@@ -261,8 +264,11 @@ export class WatchComponent implements OnDestroy, AfterViewInit {
|
||||
return this.sanitizer.bypassSecurityTrustResourceUrl(u);
|
||||
}
|
||||
if (p === 'rumble') {
|
||||
// Best-effort: Rumble embed path may vary depending on the id format
|
||||
const u = `https://rumble.com/embed/${encodeURIComponent(id)}/?autoplay=2&muted=1`;
|
||||
// Prefer backend-provided embed URL (includes required pub/query params)
|
||||
const fromBackend = this.rumbleEmbed();
|
||||
const u = fromBackend && /^https?:\/\//i.test(fromBackend)
|
||||
? fromBackend
|
||||
: `https://rumble.com/embed/${encodeURIComponent(id)}/?autoplay=2&muted=1`;
|
||||
return this.sanitizer.bypassSecurityTrustResourceUrl(u);
|
||||
}
|
||||
} catch {}
|
||||
@@ -348,6 +354,8 @@ export class WatchComponent implements OnDestroy, AfterViewInit {
|
||||
loadVideo(id: string) {
|
||||
console.log('[Watch] Loading video', { id });
|
||||
this.loading.set(true);
|
||||
// Clear any previous Rumble embed URL to avoid stale iframes during fast navigation
|
||||
this.rumbleEmbed.set(null);
|
||||
// Prepare placeholder from router state if available for richer UI
|
||||
const stateVideo = (history.state && (history.state as any).video) as Video | undefined;
|
||||
this.video.set({
|
||||
@@ -385,13 +393,28 @@ export class WatchComponent implements OnDestroy, AfterViewInit {
|
||||
const provider = this.provider();
|
||||
if (provider === 'rumble') {
|
||||
// Validate and enrich Rumble video via backend scraping (may also normalize id)
|
||||
this.http.get<any>(`/api/rumble/video/${encodeURIComponent(id)}`).subscribe({
|
||||
next: (data) => {
|
||||
const handle = (data: any) => {
|
||||
const newId = (data && (data.videoId || data.id)) ? String(data.videoId || data.id) : id;
|
||||
// If route changed while request was in-flight, ignore this response
|
||||
const current = this.videoId();
|
||||
if (current && current !== id && current !== newId) {
|
||||
console.warn('[Watch] Ignoring out-of-date Rumble response', { requested: id, newId, current });
|
||||
return;
|
||||
}
|
||||
// Update id if backend provided a more accurate one
|
||||
if (newId && newId !== id) {
|
||||
if (newId && newId !== current) {
|
||||
this.videoId.set(newId);
|
||||
}
|
||||
// Store backend-provided embed url if present, but only if it matches the expected id
|
||||
try {
|
||||
const eurl = (data && data.embedUrl) ? String(data.embedUrl) : '';
|
||||
const match = /\/embed\/([A-Za-z0-9]+)/.exec(eurl || '');
|
||||
if (eurl && match && match[1] && (match[1] === newId.replace(/^v/, 'v'))) {
|
||||
this.rumbleEmbed.set(eurl);
|
||||
} else {
|
||||
this.rumbleEmbed.set(null);
|
||||
}
|
||||
} catch { this.rumbleEmbed.set(null); }
|
||||
// Merge enriched fields
|
||||
this.video.update(v => v ? {
|
||||
...v,
|
||||
@@ -434,11 +457,19 @@ export class WatchComponent implements OnDestroy, AfterViewInit {
|
||||
error: () => {}
|
||||
});
|
||||
} catch {}
|
||||
},
|
||||
};
|
||||
this.http.get<any>(`/api/rumble/video/${encodeURIComponent(id)}`).subscribe({
|
||||
next: handle,
|
||||
error: () => {
|
||||
// Even if details fail, try to display embed with the original id
|
||||
this.loading.set(false);
|
||||
this.loadRelatedSuggestions();
|
||||
// Fallback to dev proxy alias if /api is not available in dev
|
||||
this.http.get<any>(`/proxy/api/rumble/video/${encodeURIComponent(id)}`).subscribe({
|
||||
next: handle,
|
||||
error: () => {
|
||||
// Even if details fail, try to display embed with the original id
|
||||
this.loading.set(false);
|
||||
this.loadRelatedSuggestions();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user