style: apply prettier across fork files
check:prettier was not part of my gate routine, so formatting drift accumulated across the session's touched files (and a few older ones). Run prettier --write to bring the repo back to 'All matched files use Prettier code style!'. Formatting only — no logic changes. tsc/tests/build all green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -122,7 +122,11 @@ export function tiktokIdFromOembed(data: {
|
||||
const pid = String(data.embed_product_id ?? '').match(/\d+/)?.[0];
|
||||
if (pid) return pid;
|
||||
if (typeof data.html === 'string') {
|
||||
return data.html.match(/data-video-id="(\d+)"/)?.[1] ?? data.html.match(/\/video\/(\d+)/)?.[1] ?? null;
|
||||
return (
|
||||
data.html.match(/data-video-id="(\d+)"/)?.[1] ??
|
||||
data.html.match(/\/video\/(\d+)/)?.[1] ??
|
||||
null
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -252,7 +256,10 @@ export function isSoundCloudTrack(url: string): boolean {
|
||||
// round-trip (soundcloud.com/oembed is CORS-enabled) to get the canonical URL.
|
||||
if (hostname.replace(/^www\./, '') !== 'soundcloud.com') return false;
|
||||
// /<artist>/<track|sets/set> — at least two segments, not a bare profile
|
||||
const parts = pathname.replace(/^\/+|\/+$/g, '').split('/').filter(Boolean);
|
||||
const parts = pathname
|
||||
.replace(/^\/+|\/+$/g, '')
|
||||
.split('/')
|
||||
.filter(Boolean);
|
||||
return parts.length >= 2;
|
||||
} catch {
|
||||
return false;
|
||||
@@ -304,7 +311,8 @@ export function getTidalEmbed(
|
||||
if (h !== 'tidal.com') return null;
|
||||
const p = u.pathname.replace(/^\/browse/, '');
|
||||
let m = p.match(/^\/track\/(\d+)/);
|
||||
if (m) return { kind: 'audio', embedUrl: `https://embed.tidal.com/tracks/${m[1]}`, height: 120 };
|
||||
if (m)
|
||||
return { kind: 'audio', embedUrl: `https://embed.tidal.com/tracks/${m[1]}`, height: 120 };
|
||||
m = p.match(/^\/album\/(\d+)/);
|
||||
if (m)
|
||||
// layout=gridify → full-width grid that fills the container (fixes the
|
||||
@@ -387,7 +395,10 @@ export function getKickChannel(url: string): string | null {
|
||||
try {
|
||||
const { hostname, pathname } = new URL(url);
|
||||
if (hostname.replace(/^www\./, '') !== 'kick.com') return null;
|
||||
const parts = pathname.replace(/^\/+|\/+$/g, '').split('/').filter(Boolean);
|
||||
const parts = pathname
|
||||
.replace(/^\/+|\/+$/g, '')
|
||||
.split('/')
|
||||
.filter(Boolean);
|
||||
return parts.length === 1 && /^[A-Za-z0-9_]+$/.test(parts[0]) ? parts[0] : null;
|
||||
} catch {
|
||||
return null;
|
||||
@@ -412,7 +423,11 @@ export function getBlueskyEmbed(url: string): string | null {
|
||||
|
||||
const enc = encodeURIComponent;
|
||||
|
||||
export function buildVideoEmbedUrl(provider: 'youtube' | 'vimeo', id: string, hash?: string): string {
|
||||
export function buildVideoEmbedUrl(
|
||||
provider: 'youtube' | 'vimeo',
|
||||
id: string,
|
||||
hash?: string,
|
||||
): string {
|
||||
if (provider === 'vimeo') {
|
||||
// dnt=1 = Do Not Track (no non-essential cookies); h={hash} required for unlisted.
|
||||
return `https://player.vimeo.com/video/${enc(id)}?autoplay=1&dnt=1${
|
||||
@@ -435,11 +450,19 @@ export function spotifyEmbedHeight(type: SpotifyType): number {
|
||||
export function parseMediaEmbed(url: string, host: string): MediaEmbed | null {
|
||||
const shortsId = getYoutubeShortsId(url);
|
||||
if (shortsId)
|
||||
return { provider: 'youtube', kind: 'portrait', embedUrl: buildVideoEmbedUrl('youtube', shortsId) };
|
||||
return {
|
||||
provider: 'youtube',
|
||||
kind: 'portrait',
|
||||
embedUrl: buildVideoEmbedUrl('youtube', shortsId),
|
||||
};
|
||||
|
||||
const ytId = getYouTubeVideoId(url);
|
||||
if (ytId)
|
||||
return { provider: 'youtube', kind: 'landscape', embedUrl: buildVideoEmbedUrl('youtube', ytId) };
|
||||
return {
|
||||
provider: 'youtube',
|
||||
kind: 'landscape',
|
||||
embedUrl: buildVideoEmbedUrl('youtube', ytId),
|
||||
};
|
||||
|
||||
const vimeo = getVimeoParts(url);
|
||||
if (vimeo)
|
||||
|
||||
Reference in New Issue
Block a user