From 868a5094f0a646f6251b6c972b82834f5dbdcdc6 Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Tue, 6 Oct 2026 22:36:10 +0200 Subject: [PATCH 01/10] Stripchat: add performer search to "Find a performer" Adds identity search and source discovery to the Stripchat plugin, so Stripchat can be used as a provider in the performer search dialog. - searchPeople looks up exact usernames: the text as typed, or for multi-word input the words joined with "", "_" and "-". Links and @names are accepted. - The lookup uses the public profile page through easyx-browser-fetch and reads window.__PRELOADED_STATE__. Stripchat blocks its JSON API for server requests (HTTP 403 plain, 418 with a Chrome fingerprint), but serves the profile page. - Only confirmed model accounts are returned, with avatar, gender, country and online status; offline models are found too. - discoverSources adds exactly the picked room as a source (external ID = profile URL, so a manually added source is not duplicated). Performers without a Stripchat reference get nothing: no name-based guessing. --- plugins/stripchat/index.ts | 135 ++++++++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 1 deletion(-) diff --git a/plugins/stripchat/index.ts b/plugins/stripchat/index.ts index 8b2faab..eb063eb 100644 --- a/plugins/stripchat/index.ts +++ b/plugins/stripchat/index.ts @@ -3,7 +3,7 @@ import { createLiveCamPlugin } from "../live-cam-plugin-factory.js"; import { accountSignal, cookieHeader, readAccountCookies } from "../account-cookies.js"; import { browserHtml } from "../browser-html-utils.js"; import { stripchatFavoriteCams, stripchatProfileLiveCams, stripchatStreamConfig } from "../live-cam-discovery.js"; -import type { CommandDownloadRequest, LiveCam, LiveCamFavoriteSnapshot, LiveStream, MediaCandidate, MediaSource, PluginContext } from "../../packages/plugin-sdk/index.js"; +import type { CommandDownloadRequest, LiveCam, LiveCamFavoriteSnapshot, LiveStream, MediaCandidate, MediaSource, PerformerRecord, PersonCandidate, PluginContext, SourceCandidate } from "../../packages/plugin-sdk/index.js"; const plugin = createLiveCamPlugin({ id: "org.easyx.stripchat", name: "Stripchat Live", prefix: "stripchat", homepage: "https://stripchat.com", @@ -389,4 +389,137 @@ plugin.testConnection = async (context) => { plugin.listFollowedLiveCams = stripchatFollowedSnapshot; plugin.setLiveCamFavorite = setStripchatFavorite; +/* + * Performer search ("Find a performer"). + * + * Stripchat has no public name search, so this looks up exact usernames: the text + * as typed and, for multi-word input, the words joined with nothing, "_" and "-" + * ("Jane Doe" -> JaneDoe, Jane_Doe, Jane-Doe). Every result is a model confirmed + * by its Stripchat profile page; the user reviews and picks one. Picking it stores the Stripchat username + * on the performer, and source discovery then adds exactly that room as a source. + */ +const STRIPCHAT_USERNAME = /^[A-Za-z0-9_-]{3,40}$/; + +export function stripchatSearchUsernames(query: string): string[] { + let text = query.trim(); + try { if (/^https?:\/\//i.test(text)) text = new URL(text).pathname.split("/").filter(Boolean).at(-1) ?? ""; } catch { return []; } + text = text.replace(/^@/, ""); + const words = text.split(/\s+/).filter(Boolean); + const names = words.length > 1 ? [words.join(""), words.join("_"), words.join("-")] : [text]; + return [...new Map(names.filter((name) => STRIPCHAT_USERNAME.test(name)).map((name) => [name.toLowerCase(), name])).values()]; +} + +type StripchatModel = { username: string; avatarUrl?: string; online?: boolean; gender?: string; country?: string; renamedFrom?: string }; + +const textValue = (value: unknown) => typeof value === "string" && value.trim() ? value.trim() : undefined; + +/** + * Stripchat blocks its JSON API for server requests (HTTP 403 plain, 418 even with + * a Chrome fingerprint), but serves the public profile page through the browser- + * compatible helper of the EasyX image, the same page the plugin loads to record. + * That page embeds window.__PRELOADED_STATE__, which describes the model whether + * the room is online or not. + */ +function preloadedState(html: string): unknown { + const marker = html.indexOf("window.__PRELOADED_STATE__"); + if (marker < 0) return undefined; + const start = html.indexOf("{", marker); + if (start < 0) return undefined; + let depth = 0; let quoted = false; + for (let index = start; index < html.length; index += 1) { + const character = html[index]; + if (quoted && character === "\\") { index += 1; continue; } + if (character === "\"") quoted = !quoted; + else if (!quoted && character === "{") depth += 1; + else if (!quoted && character === "}" && --depth === 0) { + try { return JSON.parse(html.slice(start, index + 1)); } catch { return undefined; } + } + } + return undefined; +} + +/** Model objects in the page state with exactly this username (any nesting depth). */ +export function stripchatModelsInState(state: unknown, username: string): Record[] { + const wanted = username.toLowerCase(); + const found: Record[] = []; + const seen = new Set(); + const visit = (value: unknown, depth: number) => { + if (!value || typeof value !== "object" || depth > 12 || seen.has(value)) return; + seen.add(value); + if (Array.isArray(value)) { for (const child of value) visit(child, depth + 1); return; } + const item = value as Record; + const name = textValue(item.username) ?? textValue(item.login); + if (name?.toLowerCase() === wanted && (item.id !== undefined || item.isModel !== undefined)) found.push(item); + for (const child of Object.values(item)) visit(child, depth + 1); + }; + visit(state, 0); + // Model records first, then the ones with the most detail. + return found.sort((left, right) => Number(right.isModel === true) - Number(left.isModel === true) || Object.keys(right).length - Object.keys(left).length); +} + +export function stripchatModelFromPage(html: string, username: string): StripchatModel | undefined { + const models = stripchatModelsInState(preloadedState(html), username); + if (!models.length || models.every((item) => item.isModel === false)) return undefined; + const pick = (key: string) => models.map((item) => textValue(item[key])).find(Boolean); + return { + username: pick("username") ?? pick("login") ?? username, + avatarUrl: pick("avatarUrl") ?? pick("previewUrlThumbSmall") ?? pick("previewUrl"), + online: models.some((item) => item.isLive === true || item.isOnline === true) || undefined, + gender: pick("gender"), country: pick("country"), + }; +} + +/** Exact username lookup (online or offline) via the public profile page. Undefined when there is no such model. */ +export async function stripchatModelByUsername(context: PluginContext, username: string): Promise { + let html: string; + try { + html = await browserHtml(context, `https://stripchat.com/${encodeURIComponent(username)}`); + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + if (/HTTP 404/.test(message)) return undefined; + throw new Error(`Stripchat profile lookup for ${username} failed: ${message}`); + } + return stripchatModelFromPage(html, username); +} + +function personFromModel(model: StripchatModel): PersonCandidate { + const profileUrl = `https://stripchat.com/${encodeURIComponent(model.username)}`; + return { + externalId: model.username.toLowerCase(), name: model.username, + ...(model.renamedFrom ? { aliases: [model.renamedFrom] } : {}), + ...(model.avatarUrl ? { imageUrl: model.avatarUrl } : {}), + profileUrls: [profileUrl], + metadata: { site: "stripchat.com", ...(model.online !== undefined ? { online: model.online } : {}), ...(model.gender ? { gender: model.gender } : {}), ...(model.country ? { country: model.country } : {}), ...(model.renamedFrom ? { renamedFrom: model.renamedFrom } : {}) }, + }; +} + +export async function searchStripchatPeople(context: PluginContext, query: string): Promise { + const results = new Map(); + let firstError: unknown; + for (const username of stripchatSearchUsernames(query)) { + try { + const model = await stripchatModelByUsername(context, username); + if (model) results.set(model.username.toLowerCase(), personFromModel(model)); + } catch (error) { firstError ??= error; } + } + if (!results.size && firstError) throw firstError instanceof Error ? firstError : new Error(String(firstError)); + return [...results.values()]; +} + +/** Adds the Stripchat room of a performer picked in "Find a performer" (or linked to Stripchat before). */ +export async function discoverStripchatSources(_context: PluginContext, performer: PerformerRecord): Promise { + const linked = textValue(performer.externalRefs?.["org.easyx.stripchat"]); + const found = linked ? stripchatSearchUsernames(linked)[0] : undefined; + if (!found) return []; + // Prefer the spelling of the performer name (the stored reference is lower case). + const username = performer.name.toLowerCase() === found.toLowerCase() ? performer.name : found; + const profileUrl = `https://stripchat.com/${encodeURIComponent(username)}`; + // Same external ID as a source added by hand (its profile URL), so nothing is added twice. + return [{ externalId: profileUrl, label: "stripchat.com", profileUrl, domain: "stripchat.com" }]; +} + +plugin.manifest.capabilities = [...new Set([...plugin.manifest.capabilities, "identity-search" as const, "source-discovery" as const])]; +plugin.searchPeople = searchStripchatPeople; +plugin.discoverSources = discoverStripchatSources; + export default plugin; From 5f5a11a77e33c55f5a4d557b2d912d08ebc454dc Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Tue, 6 Oct 2026 23:01:07 +0200 Subject: [PATCH 02/10] CAM4: add performer search and continuous recording - searchPeople/discoverSources: exact username lookup via rest/v1.0/profile//info (browser-compatible helper on HTTP 403); the picked room is added as the only source, no name-based guessing. - Recordings use the shared live recorder and continue through short breaks (CAM4_MERGE_GAP_MINUTES, falls back to STRIPCHAT_MERGE_GAP_MINUTES, default 10). Falls back to yt-dlp when the stream API cannot be used. - live-recorder: optional refresh endpoint + field (args 8 and 9), so the recorder can follow a room whose stream address changes after a break. Existing callers are unaffected. Tests: 9 new tests in plugins/cam4/search.test.ts. --- plugins/cam4/index.ts | 207 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 206 insertions(+), 1 deletion(-) diff --git a/plugins/cam4/index.ts b/plugins/cam4/index.ts index 49cc89c..0d19afd 100644 --- a/plugins/cam4/index.ts +++ b/plugins/cam4/index.ts @@ -1,6 +1,8 @@ +import { LIVE_RECORDER_SCRIPT, retryDelay } from "../live-recorder.js"; import { createLiveCamPlugin } from "../live-cam-plugin-factory.js"; import { accountSignal, cookieHeader, readAccountCookies } from "../account-cookies.js"; -import type { LiveCam, LiveCamFavoriteSnapshot, PluginContext } from "../../packages/plugin-sdk/index.js"; +import { browserHtml } from "../browser-html-utils.js"; +import type { CommandDownloadRequest, DownloadRequest, LiveCam, LiveCamFavoriteSnapshot, MediaCandidate, PerformerRecord, PersonCandidate, PluginContext, SourceCandidate } from "../../packages/plugin-sdk/index.js"; const plugin = createLiveCamPlugin({ id: "org.easyx.cam4", name: "CAM4 Live", prefix: "cam4", homepage: "https://www.cam4.com", @@ -170,4 +172,207 @@ plugin.testConnection = async (context) => { plugin.listFollowedLiveCams = cam4FollowedSnapshot; plugin.setLiveCamFavorite = setCam4Favorite; +// --- Performer search ("Find a performer") -------------------------------------- +/* + * CAM4 has no public name search, so this looks up exact usernames: the text as + * typed and, for multi-word input, the words joined with nothing and "_" + * ("Jane Doe" -> JaneDoe, Jane_Doe). The profile API confirms the account; the user + * reviews and picks a result. Picking it stores the CAM4 username on the performer, + * and source discovery then adds exactly that room as a source. + */ +const CAM4_USERNAME = /^[a-z0-9_]{2,64}$/i; + +export function cam4SearchUsernames(query: string): string[] { + let text = query.trim(); + try { if (/^https?:\/\//i.test(text)) text = new URL(text).pathname.split("/").filter(Boolean).at(-1) ?? ""; } catch { return []; } + text = text.replace(/^@/, ""); + const words = text.split(/\s+/).filter(Boolean); + const names = words.length > 1 ? [words.join(""), words.join("_")] : [text]; + return [...new Map(names.filter((name) => CAM4_USERNAME.test(name)).map((name) => [name.toLowerCase(), name])).values()]; +} + +function profileHeaders(username: string): Record { + return { accept: "application/json, text/plain, */*", "accept-language": "en-US,en;q=0.8", referer: `https://www.cam4.com/${encodeURIComponent(username)}`, "user-agent": USER_AGENT }; +} + +/** + * GET a CAM4 JSON endpoint. A plain request first (CAM4 normally allows it); when it + * is blocked (403/429), the browser-compatible helper of the EasyX image. + */ +async function cam4Json(context: PluginContext, url: string, username: string): Promise<{ status: number; data?: Record }> { + let status = 0; + try { + const response = await context.fetch(url, { headers: profileHeaders(username), signal: context.signal ?? AbortSignal.timeout(20_000) }); + status = response.status; + if (response.status !== 403 && response.status !== 429) { + if (!response.ok || response.status === 204) return { status: response.status }; + try { + const data = await response.json() as unknown; + return { status: response.status, ...(data && typeof data === "object" && !Array.isArray(data) ? { data: data as Record } : {}) }; + } catch { return { status: 502 }; } + } + } catch (error) { if (context.signal?.aborted) throw error; } + try { + const body = await browserHtml(context, url); + if (!body.trim()) return { status: 204 }; + try { const data = JSON.parse(body) as unknown; return { status: 200, ...(data && typeof data === "object" && !Array.isArray(data) ? { data: data as Record } : {}) }; } + catch { return { status: 502 }; } + } catch (error) { + const code = /HTTP (\d{3})/.exec(error instanceof Error ? error.message : String(error))?.[1]; + return { status: code ? Number(code) : status || 502 }; + } +} + +type Cam4Profile = { username: string; imageUrl?: string; online?: boolean; gender?: string; country?: string }; + +/** Exact username lookup via the CAM4 profile API. Undefined when there is no such performer. */ +export async function cam4ProfileByUsername(context: PluginContext, username: string): Promise { + const { status, data } = await cam4Json(context, `https://www.cam4.com/rest/v1.0/profile/${encodeURIComponent(username)}/info`, username); + if (status === 404 || status === 400 || status === 410 || status === 204) return undefined; + if (status === 403) throw new Error(`CAM4 refused the profile lookup for ${username} (HTTP 403)`); + if (!data) throw new Error(`CAM4 profile lookup for ${username} returned HTTP ${status}`); + const found = findString(data, new Set(["username", "screenname", "login"])); + if (found && found.toLowerCase() !== username.toLowerCase()) return undefined; + const imageUrl = findString(data, new Set(["profileimagelink", "profileimageurl", "profilepictureurl", "avatarurl", "avatar", "photourl"])); + return { + username: found ?? username, + ...(imageUrl && /^https?:\/\//i.test(imageUrl) ? { imageUrl } : {}), + ...(typeof data.online === "boolean" ? { online: data.online } : {}), + ...(findString(data, new Set(["gender", "sex"])) ? { gender: findString(data, new Set(["gender", "sex"])) } : {}), + ...(findString(data, new Set(["country", "countrycode"])) ? { country: findString(data, new Set(["country", "countrycode"])) } : {}), + }; +} + +export async function searchCam4People(context: PluginContext, query: string): Promise { + const results = new Map(); + let firstError: unknown; + for (const username of cam4SearchUsernames(query)) { + let profile: Cam4Profile | undefined; + try { profile = await cam4ProfileByUsername(context, username); } catch (error) { firstError ??= error; continue; } + if (!profile) continue; + const profileUrl = `https://www.cam4.com/${encodeURIComponent(profile.username)}`; + results.set(profile.username.toLowerCase(), { + externalId: profile.username.toLowerCase(), name: profile.username, + ...(profile.imageUrl ? { imageUrl: profile.imageUrl } : {}), + profileUrls: [profileUrl], + metadata: { site: "cam4.com", ...(profile.online !== undefined ? { online: profile.online } : {}), ...(profile.gender ? { gender: profile.gender } : {}), ...(profile.country ? { country: profile.country } : {}) }, + }); + } + if (!results.size && firstError) throw firstError instanceof Error ? firstError : new Error(String(firstError)); + return [...results.values()]; +} + +/** Adds the CAM4 room of a performer picked in "Find a performer" (or linked to CAM4 before). */ +export async function discoverCam4Sources(_context: PluginContext, performer: PerformerRecord): Promise { + const linked = performer.externalRefs?.["org.easyx.cam4"]; + const found = typeof linked === "string" ? cam4SearchUsernames(linked)[0] : undefined; + if (!found) return []; + // Prefer the spelling of the performer name (the stored reference is lower case). + const username = performer.name.toLowerCase() === found.toLowerCase() ? performer.name : found; + const profileUrl = `https://www.cam4.com/${encodeURIComponent(username)}`; + // Same external ID as a source added by hand (its profile URL), so nothing is added twice. + return [{ externalId: profileUrl, label: "cam4.com", profileUrl, domain: "cam4.com" }]; +} + +// --- Continuous recording --------------------------------------------------------- +/* + * A CAM4 room that goes private or briefly offline stops its public stream, which + * used to end the recording; every return became a separate video. Recordings now + * run through the shared live recorder: when the stream stops it keeps checking + * the room for up to CAM4_MERGE_GAP_MINUTES (default: STRIPCHAT_MERGE_GAP_MINUTES, + * otherwise 10). CAM4 gives a returning room a new stream address, so the recorder + * asks streamInfo for the current one. Breaks within the limit end up in one video. + */ +const mergeGapMinutes = Number(process.env.CAM4_MERGE_GAP_MINUTES ?? process.env.STRIPCHAT_MERGE_GAP_MINUTES ?? 10); +const MERGE_GAP_MS = Number.isFinite(mergeGapMinutes) && mergeGapMinutes > 0 ? mergeGapMinutes * 60_000 : 0; +const MERGE_POLL_MS = 20_000; +const HLS_ATTEMPTS = 4; +const HLS_RETRY_MS = 10_000; + +export function cam4StreamHeaders(): Record { + return { referer: "https://www.cam4.com/", origin: "https://www.cam4.com" }; +} + +function cam4RoomName(pageUrl: string): string | undefined { + try { const name = new URL(pageUrl).pathname.split("/").filter(Boolean)[0]; return name && CAM4_USERNAME.test(name) ? name : undefined; } + catch { return undefined; } +} + +function variantUrls(manifest: string, baseUrl: string): string[] { + if (!manifest.trimStart().startsWith("#EXTM3U")) return []; + const variants: Array<{ url: string; bandwidth: number }> = []; let info = ""; + for (const raw of manifest.split(/\r?\n/)) { + const line = raw.trim(); + if (line.startsWith("#EXT-X-STREAM-INF")) { info = line; continue; } + if (!line || line.startsWith("#") || !/\.m3u8(?:$|\?)/i.test(line)) continue; + variants.push({ url: new URL(line, baseUrl).toString(), bandwidth: Number(/(?:^|[:,])BANDWIDTH=(\d+)/i.exec(info)?.[1] ?? 0) }); + info = ""; + } + return variants.sort((left, right) => right.bandwidth - left.bandwidth).map((variant) => variant.url); +} + +const isLivePlaylist = (text: string) => text.trimStart().startsWith("#EXTM3U") && /#EXTINF:/i.test(text) && !/#EXT-X-ENDLIST/i.test(text); + +async function playlistText(context: PluginContext, url: string): Promise { + try { + const response = await context.fetch(url, { headers: { ...cam4StreamHeaders(), "user-agent": USER_AGENT }, signal: context.signal ?? AbortSignal.timeout(15_000) }); + return response.ok ? await response.text() : undefined; + } catch (error) { if (context.signal?.aborted) throw error; return undefined; } +} + +/** Current public master playlist and its best live variant; undefined while the room is not public. */ +export async function cam4LiveStream(context: PluginContext, username: string): Promise<{ masterUrl: string; mediaUrl: string } | undefined> { + const { status, data } = await cam4Json(context, `https://www.cam4.com/rest/v1.0/profile/${encodeURIComponent(username)}/streamInfo`, username); + if (status === 204 || status === 404) return undefined; + const masterUrl = typeof data?.cdnURL === "string" && /^https?:\/\//i.test(data.cdnURL) ? data.cdnURL : undefined; + if (!masterUrl) { + if (status >= 200 && status < 300) return undefined; + throw new Error(`CAM4 stream lookup for ${username} returned HTTP ${status}`); + } + const master = await playlistText(context, masterUrl); + if (!master) return undefined; + if (isLivePlaylist(master)) return { masterUrl, mediaUrl: masterUrl }; + for (const variant of variantUrls(master, masterUrl)) { + const playlist = await playlistText(context, variant); + if (playlist && isLivePlaylist(playlist)) return { masterUrl, mediaUrl: variant }; + } + return undefined; +} + +const genericResolveDownload = plugin.resolveDownload!; + +export async function resolveCam4Download(context: PluginContext, item: MediaCandidate): Promise { + const username = item.pageUrl ? cam4RoomName(item.pageUrl) : undefined; + if (!username || item.mediaType !== "video") return genericResolveDownload(context, item); + let lastError: unknown; + for (let attempt = 1; attempt <= HLS_ATTEMPTS; attempt += 1) { + context.signal?.throwIfAborted(); + try { + const stream = await cam4LiveStream(context, username); + if (stream) { + return { + kind: "command", command: process.execPath, requireSuccessfulExit: true, filename: item.filename ?? `${username}-live.mp4`, + args: [ + "-e", LIVE_RECORDER_SCRIPT, stream.mediaUrl, stream.masterUrl, JSON.stringify(cam4StreamHeaders()), "{output}", + String(MERGE_GAP_MS), String(MERGE_POLL_MS), USER_AGENT, + `https://www.cam4.com/rest/v1.0/profile/${encodeURIComponent(username)}/streamInfo`, "cdnURL", + ], + } satisfies CommandDownloadRequest; + } + lastError = undefined; + } catch (error) { lastError = error; } + if (attempt < HLS_ATTEMPTS) await retryDelay(HLS_RETRY_MS, context.signal); + } + // CAM4 answered, but the room has no public stream. + if (!lastError) throw new Error("The CAM4 room is not public"); + // The room API could not be used: let yt-dlp try, as before this change. + context.log("debug", "CAM4 stream lookup failed; falling back to yt-dlp", lastError instanceof Error ? lastError.message : String(lastError)); + return genericResolveDownload(context, item); +} + +plugin.manifest.capabilities = [...new Set([...plugin.manifest.capabilities, "identity-search" as const, "source-discovery" as const])]; +plugin.searchPeople = searchCam4People; +plugin.discoverSources = discoverCam4Sources; +plugin.resolveDownload = resolveCam4Download; + export default plugin; From 989ae5e8d87c9b9ed6f48f04b79a4c6eac607c2e Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Tue, 6 Oct 2026 23:16:07 +0200 Subject: [PATCH 03/10] Stripchat: add performer search to "Find a performer" CAM4: add performer search and continuous recording - searchPeople/discoverSources: exact username lookup via rest/v1.0/profile//info (browser-compatible helper on HTTP 403); the picked room is added as the only source, no name-based guessing. - Recordings use the shared live recorder and continue through short breaks (CAM4_MERGE_GAP_MINUTES, falls back to STRIPCHAT_MERGE_GAP_MINUTES, default 10). Falls back to yt-dlp when the stream API cannot be used. - live-recorder: optional refresh endpoint + field (args 8 and 9), so the recorder can follow a room whose stream address changes after a break. Existing callers are unaffected. --- plugins/cam4/index.ts | 50 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 8 deletions(-) diff --git a/plugins/cam4/index.ts b/plugins/cam4/index.ts index 0d19afd..fe8b9bd 100644 --- a/plugins/cam4/index.ts +++ b/plugins/cam4/index.ts @@ -225,24 +225,58 @@ async function cam4Json(context: PluginContext, url: string, username: string): type Cam4Profile = { username: string; imageUrl?: string; online?: boolean; gender?: string; country?: string }; -/** Exact username lookup via the CAM4 profile API. Undefined when there is no such performer. */ -export async function cam4ProfileByUsername(context: PluginContext, username: string): Promise { - const { status, data } = await cam4Json(context, `https://www.cam4.com/rest/v1.0/profile/${encodeURIComponent(username)}/info`, username); - if (status === 404 || status === 400 || status === 410 || status === 204) return undefined; - if (status === 403) throw new Error(`CAM4 refused the profile lookup for ${username} (HTTP 403)`); - if (!data) throw new Error(`CAM4 profile lookup for ${username} returned HTTP ${status}`); +function profileFromInfo(data: Record, username: string): Cam4Profile | undefined { const found = findString(data, new Set(["username", "screenname", "login"])); if (found && found.toLowerCase() !== username.toLowerCase()) return undefined; const imageUrl = findString(data, new Set(["profileimagelink", "profileimageurl", "profilepictureurl", "avatarurl", "avatar", "photourl"])); + const gender = findString(data, new Set(["gender", "sex"])); + const country = findString(data, new Set(["country", "countrycode"])); return { username: found ?? username, ...(imageUrl && /^https?:\/\//i.test(imageUrl) ? { imageUrl } : {}), ...(typeof data.online === "boolean" ? { online: data.online } : {}), - ...(findString(data, new Set(["gender", "sex"])) ? { gender: findString(data, new Set(["gender", "sex"])) } : {}), - ...(findString(data, new Set(["country", "countrycode"])) ? { country: findString(data, new Set(["country", "countrycode"])) } : {}), + ...(gender ? { gender } : {}), ...(country ? { country } : {}), }; } +/** The username as written in the profile page data, when the page describes that performer. */ +export function cam4UsernameInPage(html: string, username: string): string | undefined { + const escaped = username.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); + const match = new RegExp(`"(?:username|screenName|nickname)"\\s*:\\s*"(${escaped})"`, "i").exec(html); + return match?.[1]; +} + +/** + * Exact username lookup. Undefined when there is no such performer. + * + * CAM4's profile info API now answers HTTP 401 without a login on www.cam4.com, so + * this tries, in order: the info API on hu.cam4.com (used by other recorders), the + * public stream API (confirms rooms that are live), and the public profile page. + */ +export async function cam4ProfileByUsername(context: PluginContext, username: string): Promise { + const problems: string[] = []; + for (const host of ["hu.cam4.com", "www.cam4.com"]) { + const { status, data } = await cam4Json(context, `https://${host}/rest/v1.0/profile/${encodeURIComponent(username)}/info`, username); + if (data && status >= 200 && status < 300) return profileFromInfo(data, username); + if (status === 404 || status === 410) return undefined; + problems.push(`info on ${host}: HTTP ${status}`); + } + const stream = await cam4Json(context, `https://www.cam4.com/rest/v1.0/profile/${encodeURIComponent(username)}/streamInfo`, username); + if (stream.data && typeof stream.data.cdnURL === "string") return { username, online: true }; + if (stream.status !== 204 && !(stream.status >= 200 && stream.status < 300)) problems.push(`streamInfo: HTTP ${stream.status}`); + try { + const html = await browserHtml(context, `https://www.cam4.com/${encodeURIComponent(username)}`); + const found = cam4UsernameInPage(html, username); + if (found) return { username: found, ...(stream.status === 204 ? { online: false } : {}) }; + return undefined; + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + if (/HTTP 404/.test(message)) return undefined; + problems.push(`profile page: ${message}`); + } + throw new Error(`CAM4 profile lookup for ${username} failed (${problems.join("; ")})`); +} + export async function searchCam4People(context: PluginContext, query: string): Promise { const results = new Map(); let firstError: unknown; From 9b41deb2ea23fffe919d676b37d3a76afa054054 Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Wed, 7 Oct 2026 21:58:23 +0200 Subject: [PATCH 04/10] Server: add performer recording priority with live-recording preemption - database.ts: new performers.priority column (-1 low, 0 normal, 1 high, default 0), added by migration. nextQueued orders by performer priority, then by age. New helpers: setPerformerPriority, itemPriority and queuedLivePriorities. Positional INSERT INTO performers statements now name their columns, so the extra column does not break them. - downloader.ts: when every slot is busy and a higher-priority live recording is queued, the lowest-priority live recording (latest started first) is stopped so the waiting one gets the slot. One recording per waiting item; paused, encoding and non-live downloads are never interrupted. Preempted recordings are kept and not treated as a user stop, so the room is recorded again once a slot is free. - index.ts: PUT /api/performers/:id/priority with { "priority": "low" | "normal" | "high" }. - performer-priority.test.ts: 4 tests for storage, queue order and preemption. --- server/database.ts | 35 ++++++++-- server/downloader.ts | 40 +++++++++-- server/index.ts | 8 ++- server/performer-priority.test.ts | 106 ++++++++++++++++++++++++++++++ 4 files changed, 180 insertions(+), 9 deletions(-) create mode 100644 server/performer-priority.test.ts diff --git a/server/database.ts b/server/database.ts index 7669709..297486a 100644 --- a/server/database.ts +++ b/server/database.ts @@ -11,9 +11,13 @@ import { PerformerConflictError } from "./performer-conflict.js"; export type Performer = { id: string; name: string; aliases: string[]; imageUrl?: string; externalRefs: Record; + /** Recording priority: -1 low, 0 normal, 1 high. Higher priorities start first and may preempt lower live recordings. */ + priority?: number; createdAt: string; updatedAt: string; }; +export const PERFORMER_PRIORITIES = { low: -1, normal: 0, high: 1 } as const; + export type Source = { id: string; performerId: string; pluginId: string; externalId: string; label: string; profileUrl: string; domain: string; enabled: boolean; autoDownload: boolean; @@ -127,6 +131,8 @@ export class Database { PRIMARY KEY(provider_id, username_key) ); `); + const performerColumns = new Set((this.sqlite.prepare("PRAGMA table_info(performers)").all() as Array<{ name: string }>).map((column) => column.name)); + if (!performerColumns.has("priority")) this.sqlite.exec("ALTER TABLE performers ADD COLUMN priority INTEGER NOT NULL DEFAULT 0"); const sourceColumns = new Set((this.sqlite.prepare("PRAGMA table_info(sources)").all() as Array<{ name: string }>).map((column) => column.name)); if (!sourceColumns.has("profile_key")) this.sqlite.exec("ALTER TABLE sources ADD COLUMN profile_key TEXT"); for (const source of this.sqlite.prepare("SELECT id,profile_url FROM sources WHERE profile_key IS NULL").all() as Array<{ id: string; profile_url: string }>) { @@ -322,7 +328,7 @@ export class Database { const mergedName = this.resolvePerformerName(values.name); if (mergedName !== values.name) throw Object.assign(new Error(`This name belongs to the merged profile ${mergedName}`), { statusCode: 409 }); const performerId = id("person"); const stamp = now(); - this.sqlite.prepare("INSERT INTO performers VALUES(?,?,?,?,?,?,?)") + this.sqlite.prepare("INSERT INTO performers(id,name,aliases_json,image_url,external_refs_json,created_at,updated_at) VALUES(?,?,?,?,?,?,?)") .run(performerId, values.name, JSON.stringify(values.aliases ?? []), values.imageUrl ?? null, "{}", stamp, stamp); return this.getPerformer(performerId)!; } @@ -335,6 +341,25 @@ export class Database { return this.getPerformer(performerId); } + setPerformerPriority(performerId: string, priority: number): Performer | undefined { + const value = Math.max(-1, Math.min(1, Math.trunc(priority))); + this.sqlite.prepare("UPDATE performers SET priority=?,updated_at=? WHERE id=?").run(value, now(), performerId); + return this.getPerformer(performerId); + } + + /** Recording priority of the performer an item belongs to (0 when unknown). */ + itemPriority(itemId: string): number { + const row = this.sqlite.prepare("SELECT p.priority FROM items i LEFT JOIN performers p ON p.id=i.performer_id WHERE i.id=?").get(itemId) as { priority: number | null } | undefined; + return Number(row?.priority ?? 0) || 0; + } + + /** Priorities of queued live recordings, highest first. */ + queuedLivePriorities(): number[] { + return (this.sqlite.prepare(`SELECT COALESCE(p.priority,0) AS priority FROM items i LEFT JOIN performers p ON p.id=i.performer_id + WHERE i.status='queued' AND json_extract(i.metadata_json,'$.live')=1 ORDER BY priority DESC, i.created_at`).all() as Array<{ priority: number }>) + .map((row) => Number(row.priority) || 0); + } + deletePerformer(performerId: string): boolean { return this.sqlite.prepare("DELETE FROM performers WHERE id=?").run(performerId).changes > 0; } @@ -403,7 +428,7 @@ export class Database { return this.getPerformer(existing.id)!; } const performerId = id("person"); - this.sqlite.prepare("INSERT INTO performers VALUES(?,?,?,?,?,?,?)") + this.sqlite.prepare("INSERT INTO performers(id,name,aliases_json,image_url,external_refs_json,created_at,updated_at) VALUES(?,?,?,?,?,?,?)") .run(performerId, candidate.name, JSON.stringify(candidate.aliases ?? []), candidate.imageUrl ?? null, JSON.stringify({ [pluginId]: candidate.externalId }), stamp, stamp); this.sqlite.prepare("INSERT OR IGNORE INTO performer_identities VALUES(?,?,?)").run(performerId, pluginId, candidate.externalId); return this.getPerformer(performerId)!; @@ -411,7 +436,7 @@ export class Database { private mapPerformer(row: any): Performer { return { id: row.id, name: row.name, aliases: asJson(row.aliases_json, []), imageUrl: row.image_url ?? undefined, - externalRefs: asJson(row.external_refs_json, {}), createdAt: row.created_at, updatedAt: row.updated_at }; + externalRefs: asJson(row.external_refs_json, {}), priority: Number(row.priority ?? 0) || 0, createdAt: row.created_at, updatedAt: row.updated_at }; } addSource(performerId: string, pluginId: string, candidate: SourceCandidate): Source { @@ -650,7 +675,9 @@ export class Database { } nextQueued(): DownloadItem | undefined { - const row = this.sqlite.prepare("SELECT * FROM items WHERE status='queued' ORDER BY created_at LIMIT 1").get() as any; + // Highest performer priority first, then oldest. + const row = this.sqlite.prepare(`SELECT i.* FROM items i LEFT JOIN performers p ON p.id=i.performer_id + WHERE i.status='queued' ORDER BY COALESCE(p.priority,0) DESC, i.created_at LIMIT 1`).get() as any; return row ? this.mapItem(row) : undefined; } diff --git a/server/downloader.ts b/server/downloader.ts index dc652ad..a1043bf 100644 --- a/server/downloader.ts +++ b/server/downloader.ts @@ -14,7 +14,9 @@ import { downloadOutputPath, recordingEncodingArgs } from "./output-settings.js" import { outputSettings } from "../packages/output-settings.js"; import { canMatchVideoExcerpt, fingerprintVideo, verifyVideoContainment, videoFileStamp, type VideoFingerprint } from "./video-matching.js"; -type ActiveDownload = { child?: ChildProcess; abort?: AbortController; paused: boolean; encoding?: boolean; matching?: boolean; action?: "stop" | "cancel" | "delete" }; +type ActiveDownload = { + /** Live recording of a performer with this priority; preempted when a higher one has to wait for a slot. */ + live?: boolean; priority?: number; startedAt?: number; preempted?: boolean; child?: ChildProcess; abort?: AbortController; paused: boolean; encoding?: boolean; matching?: boolean; action?: "stop" | "cancel" | "delete" }; export class DownloadQueue { private active = new Map(); @@ -108,13 +110,39 @@ export class DownloadQueue { const max = concurrentDownloads(this.db.getSettings().maxConcurrentDownloads); while (this.active.size < max) { const item = this.db.nextQueued(); - if (!item || this.active.has(item.id)) return; - const control: ActiveDownload = { paused: false }; + if (!item || this.active.has(item.id)) break; + const control: ActiveDownload = { paused: false, live: item.metadata.live === true, priority: this.db.itemPriority(item.id), startedAt: Date.now() }; this.active.set(item.id, control); const startedItem = this.db.setItemStatus(item.id, "downloading", { progress: 0 })!; this.writeLog?.("info", "download", "Download started", { itemId: item.id, pluginId: item.pluginId, title: item.title, mediaType: item.mediaType }); void this.download(startedItem, control).finally(() => this.active.delete(item.id)); } + if (this.active.size >= max) this.preemptForPriority(); + } + + /** + * All slots are busy and a live recording of a higher-priority performer is waiting: + * stop the lowest-priority live recording (latest started first) so the waiting one + * gets its slot. The stopped recording is kept, and the room is not suppressed, so + * it is recorded again once a slot is free. Recordings already being stopped for a + * waiting item are counted, so one waiting item never stops two recordings. + */ + private preemptForPriority() { + const waiting = this.db.queuedLivePriorities(); + if (!waiting.length) return; + let freeing = [...this.active.values()].filter((control) => control.preempted).length; + for (const priority of waiting) { + if (freeing > 0) { freeing -= 1; continue; } + const victim = [...this.active.entries()] + .filter(([, control]) => control.live && !control.preempted && !control.action && !control.paused && !control.encoding && !control.matching && (control.priority ?? 0) < priority) + .sort(([, left], [, right]) => (left.priority ?? 0) - (right.priority ?? 0) || (right.startedAt ?? 0) - (left.startedAt ?? 0))[0]; + if (!victim) return; + const [itemId, control] = victim; + control.preempted = true; control.action = "stop"; + this.signal(control, "SIGCONT"); this.signal(control, "SIGINT"); control.abort?.abort(); + const item = this.db.setItemStatus(itemId, "stopping"); + this.writeLog?.("info", "download", "Recording stopped for a higher-priority performer", { itemId, title: item?.title, priority: control.priority ?? 0, waitingPriority: priority }); + } } private async download(item: DownloadItem, control: ActiveDownload) { @@ -269,7 +297,11 @@ export class DownloadQueue { message += ` Recording preserved in staging at ${path.relative(this.mediaRoot, temporary)}; recover it before retrying.`; } } - if (control.action) { + if (control.preempted && control.action === "stop") { + // Not a user action: keep the room eligible for a new session once a slot is free. + this.db.setItemStatus(item.id, "failed", { error: "Stopped for a higher-priority performer" }); + this.writeLog?.("info", "download", "Recording stopped for a higher-priority performer", { itemId: item.id, title: item.title }); + } else if (control.action) { if (control.action !== "delete") this.db.setItemStatus(item.id, "cancelled", { error: null }); this.writeLog?.("info", "download", control.action === "stop" ? "Recording stopped" : "Download cancelled", { itemId: item.id, title: item.title }); } else { diff --git a/server/index.ts b/server/index.ts index 05d5b62..cdbf086 100644 --- a/server/index.ts +++ b/server/index.ts @@ -7,7 +7,7 @@ import fastifyHttpProxy from "@fastify/http-proxy"; import fastifyStatic from "@fastify/static"; import pino from "pino"; import { z } from "zod"; -import { Database } from "./database.js"; +import { Database, PERFORMER_PRIORITIES } from "./database.js"; import { PluginManager, pluginMatchesSource } from "./plugin-manager.js"; import { DownloadQueue } from "./downloader.js"; import { discoverPeople } from "./discovery.js"; @@ -482,6 +482,12 @@ app.post("/api/performers/refresh", async () => { performerRefreshStatus.running = false; } }); +app.put<{ Params: { id: string }; Body: unknown }>("/api/performers/:id/priority", async (request) => { + const body = z.object({ priority: z.enum(["low", "normal", "high"]) }).parse(request.body); + const performer = db.setPerformerPriority(request.params.id, PERFORMER_PRIORITIES[body.priority]); + if (!performer) throw Object.assign(new Error("Performer not found"), { statusCode: 404 }); + return performer; +}); app.post<{ Params: { id: string } }>("/api/performers/:id/refresh", async (request) => { return refreshPerformer(request.params.id); }); diff --git a/server/performer-priority.test.ts b/server/performer-priority.test.ts new file mode 100644 index 0000000..cbb9b36 --- /dev/null +++ b/server/performer-priority.test.ts @@ -0,0 +1,106 @@ +import { afterEach, describe, expect, it } from "vitest"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { Database } from "./database.js"; +import { PluginManager } from "./plugin-manager.js"; +import { DownloadQueue } from "./downloader.js"; +import { LiveCamService } from "./live-cams.js"; + +const dirs: string[] = []; +afterEach(() => { for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true }); }); +const temp = (name: string) => { const dir = fs.mkdtempSync(path.join(os.tmpdir(), `${name}-`)); dirs.push(dir); return dir; }; +async function waitFor(check: () => boolean, ms = 15_000) { + const deadline = Date.now() + ms; + while (!check()) { if (Date.now() > deadline) throw new Error("Timed out"); await new Promise((resolve) => setTimeout(resolve, 25)); } +} + +async function setup() { + const dataDir = temp("easyx-prio-data"); const mediaDir = temp("easyx-prio-media"); const pluginDir = temp("easyx-prio-plugins"); + const packageDir = path.join(pluginDir, "test"); fs.mkdirSync(packageDir); + const recorder = "const fs=require('node:fs'),file=process.argv[1];fs.writeFileSync(file,'start');const timer=setInterval(()=>fs.appendFileSync(file,'x'),25);process.on('SIGINT',()=>{clearInterval(timer);process.exit(0)})"; + fs.writeFileSync(path.join(packageDir, "index.mjs"), `export default { + manifest: { id: "test.prio", name: "Prio", version: "1", description: "Test", author: "Test", capabilities: ["live-cam", "download-resolver"], sourceUrlPatterns: ["https://live.test/*"] }, + listLiveCams: async () => ({ cams: [], total: 0, page: 1, pageSize: 24, pages: 1 }), + resolveLiveStream: async () => ({ url: "https://cdn.test/live.m3u8" }), + resolveDownload: async () => ({ kind: "command", command: process.execPath, args: ["-e", ${JSON.stringify(recorder)}, "{output}"], filename: "recording.mp4" }) + };`); + const db = new Database(dataDir); const manager = new PluginManager(db, [pluginDir]); await manager.load(); manager.install("test.prio"); + db.updateSettings({ maxConcurrentDownloads: 1 }); + const logs: Array<{ message: string; details?: unknown }> = []; + const queue = new DownloadQueue(db, manager, mediaDir, (_level, _scope, message, details) => { logs.push({ message, details }); }); + const service = new LiveCamService(db, manager); + const record = (name: string, priority?: number) => { + const { itemId } = service.record("test.prio", { id: name, username: name, pageUrl: `https://live.test/${name}` }); + if (priority !== undefined) db.setPerformerPriority(db.getItem(itemId)!.performerId, priority); + return itemId; + }; + const staged = (itemId: string) => path.join(mediaDir, ".downloads", itemId, "recording.mp4"); + const recording = (itemId: string) => fs.existsSync(staged(itemId)) && fs.statSync(staged(itemId)).size > 5; + return { db, queue, record, logs, recording }; +} + +describe("performer recording priority", () => { + it("stores a clamped priority on the performer", async () => { + const { db, record } = await setup(); + try { + const performerId = db.getItem(record("alice"))!.performerId; + expect(db.getPerformer(performerId)?.priority).toBe(0); + expect(db.setPerformerPriority(performerId, 5)?.priority).toBe(1); + expect(db.setPerformerPriority(performerId, -9)?.priority).toBe(-1); + } finally { db.close(); } + }); + + it("starts the highest priority first when several recordings are queued", async () => { + const { db, record } = await setup(); + try { + const low = record("low", -1); const normal = record("normal"); const high = record("high", 1); + expect(db.nextQueued()?.id).toBe(high); + db.setItemStatus(high, "downloading"); + expect(db.nextQueued()?.id).toBe(normal); + db.setItemStatus(normal, "downloading"); + expect(db.nextQueued()?.id).toBe(low); + } finally { db.close(); } + }); + + it("stops a lower-priority live recording when a high-priority one has to wait for a slot", { timeout: 60_000 }, async () => { + const { db, queue, record, logs, recording } = await setup(); + queue.start(); + try { + const bob = record("bob"); + await waitFor(() => recording(bob)); + const alice = record("alice", 1); + await waitFor(() => db.getItem(alice)?.status === "downloading"); + await waitFor(() => db.getItem(bob)?.status === "completed"); + expect(db.getItem(bob)?.storagePath).toBeTruthy(); + expect(logs.some((log) => log.message === "Recording stopped for a higher-priority performer")).toBe(true); + // The stopped room is not treated as stopped by the user: a new session is allowed. + const bobItem = db.getItem(bob)!; + const source = db.getSource(bobItem.sourceId)!; + const next = db.liveScanCandidates(source, [{ externalId: "bob-live", pageUrl: "https://live.test/bob", mediaType: "video", metadata: { live: true } }], Date.now() + 20 * 60_000); + expect(next).toHaveLength(1); + await waitFor(() => recording(alice)); + queue.stopRecording(alice); + await waitFor(() => !["downloading", "stopping"].includes(db.getItem(alice)?.status ?? "")); + expect(db.getItem(alice)?.status, String(db.getItem(alice)?.error)).toBe("completed"); + } finally { queue.stop(); db.close(); } + }); + + it("does not stop a recording for an equal or lower priority", { timeout: 60_000 }, async () => { + const { db, queue, record, recording } = await setup(); + queue.start(); + try { + const bob = record("bob"); + await waitFor(() => recording(bob)); + const carol = record("carol"); + const dave = record("dave", -1); + await new Promise((resolve) => setTimeout(resolve, 2500)); + expect(db.getItem(bob)?.status).toBe("downloading"); + expect(db.getItem(carol)?.status).toBe("queued"); + expect(db.getItem(dave)?.status).toBe("queued"); + db.setItemStatus(carol, "cancelled"); db.setItemStatus(dave, "cancelled"); + queue.stopRecording(bob); + await waitFor(() => db.getItem(bob)?.status === "completed"); + } finally { queue.stop(); db.close(); } + }); +}); From c259887ee9bb914905cbd3c57a1a39277058c3ce Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Wed, 7 Oct 2026 21:59:05 +0200 Subject: [PATCH 05/10] UI: add recording priority selector and badge - main.tsx: "Recording priority" selector (High / Normal / Low) in Manage profile, and a High/Low badge next to the name on performer cards. - styles.css: styles for the selector and the badge. --- src/main.tsx | 8 +++++--- src/styles.css | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.tsx b/src/main.tsx index 354bb26..61ce7de 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -26,7 +26,9 @@ import "./responsive.css"; type Plugin = { manifest: { id: string; name: string; version: string; description: string; author: string; homepage?: string; capabilities: string[]; settings?: Array<{ key: string; label: string; type: string; required?: boolean; default?: unknown; placeholder?: string; help?: string; cookieDomains?: string[]; sessionFormat?: "cookies" | "raw-json" }>; browserAuth?: { loginUrl: string; sessionSetting: string; capture?: "cookies" | "onlyfans" | "manyvids" | "authorization-header"; requestDomains?: string[] }; sourceUrlPatterns?: string[]; fallback?: boolean; polling?: { mode: "periodic" | "live"; defaultIntervalSeconds: number; minimumIntervalSeconds: number } }; installed: boolean; enabled: boolean; config: Record; origin: string }; type PluginRepository = { id: string; name: string; url: string; official: boolean; removable: boolean; addedAt: string; updatedAt: string; pluginCount: number }; -type Performer = { id: string; name: string; aliases: string[]; imageUrl?: string; externalRefs: Record }; +type Performer = { id: string; name: string; aliases: string[]; imageUrl?: string; externalRefs: Record; priority?: number }; +const priorityKey = (value?: number) => value && value > 0 ? "high" : value && value < 0 ? "low" : "normal"; +const priorityLabels = { high: "High", normal: "Normal", low: "Low" } as const; type LocalPerformerImage = { id: string; title: string; source: string; modifiedAt: string; thumbnailUrl: string }; type Source = { id: string; performerId: string; pluginId: string; label: string; profileUrl: string; domain: string; enabled: boolean; autoDownload: boolean; scraperPluginId?: string; scrapeEnabled: boolean; syncIntervalSeconds: number; lastSyncedAt?: string; lastError?: string }; type Item = { id: string; performerId: string; sourceId: string; pluginId: string; title?: string; mediaType: string; status: string; progress: number; downloadedBytes: number; qualityScore: number; expectedBytes?: number; storagePath?: string; outputPath?: string; duplicateReason?: string; error?: string; downloadStartedAt?: string; downloadFinishedAt?: string; updatedAt: string }; @@ -262,7 +264,7 @@ function Library({ dashboard, plugins, run }: { dashboard: Dashboard; plugins: P
setFilter(event.target.value)}/>
{people.length} performer{people.length === 1 ? "" : "s"}
{people.length ?
{people.map((person) => { const sources = dashboard.sources.filter((source) => source.performerId === person.id); const items = dashboard.items.filter((item) => item.performerId === person.id); - return

{person.name}

{person.aliases.slice(0, 3).join(" · ") || "No aliases"}

{sources.length} URL{sources.length === 1 ? "" : "s"}
{sources.slice(0, 3).map((source) => {source.domain})}{sources.length > 3 && +{sources.length - 3}}
; + return

{person.name}{priorityKey(person.priority) !== "normal" && {priorityLabels[priorityKey(person.priority)]}}

{person.aliases.slice(0, 3).join(" · ") || "No aliases"}

{sources.length} URL{sources.length === 1 ? "" : "s"}
{sources.slice(0, 3).map((source) => {source.domain})}{sources.length > 3 && +{sources.length - 3}}
; })}
: } {discovering &&
event.target === event.currentTarget && closeDiscovery()}>

PERFORMER SEARCH

Find a performer

} {adding && setAdding(false)} run={run}/>} @@ -326,7 +328,7 @@ function PerformerManager({ performer, sources, items, plugins, close, run }: { if (mode === "add-url") return setMode("details")} run={run}/>; if (mode === "delete") return item.storagePath).length} close={() => setMode("details")} deleted={close} run={run}/>; return
event.target === event.currentTarget && close()}>

PERFORMER

Manage profile

-

{performer.name}

{performer.aliases.join(" · ") || "No aliases"}

+

{performer.name}

{performer.aliases.join(" · ") || "No aliases"}

{conflicts.map((conflict) => )}
{managedSources.length}Profile URLs
{Object.keys(performer.externalRefs).length}Connected plugins
{managedItems.filter((item) => item.status === "completed").length}Downloaded files

CONNECTED IDENTITIES

Provider references

{Object.entries(performer.externalRefs).length ?
{Object.entries(performer.externalRefs).map(([pluginId, externalId]) =>
{pluginName(pluginId).slice(0, 2).toUpperCase()}
{pluginName(pluginId)}{externalId}
Connected
)}
:

This performer was added manually and has no provider identity yet.

}
diff --git a/src/styles.css b/src/styles.css index a2f228e..6d5c103 100644 --- a/src/styles.css +++ b/src/styles.css @@ -21,3 +21,6 @@ .cover-button{height:180px;min-height:180px;max-height:180px;overflow:hidden;isolation:isolate;margin:0!important}.cover-button>img{position:absolute;inset:0;min-width:0;min-height:0;object-position:center 28%}.cover-button>.file-count{z-index:2}.cover-button>.image-fallback{position:relative;right:auto;bottom:auto;background:none;padding:0;border-radius:0}.profile-url-copy small{display:block;color:#555560;font-size:8px;margin-top:4px}.scrape-toggle{border:1px solid #34343c;background:#202026;color:#8d8d97;border-radius:9px;padding:8px 10px;display:inline-flex;align-items:center;gap:5px;font-size:9px;font-weight:700}.scrape-toggle.active{border-color:rgba(66,211,146,.28);background:rgba(66,211,146,.1);color:#64dea8}.scraper-notice{display:flex;align-items:center;gap:10px;border:1px solid rgba(255,190,70,.18);background:rgba(255,190,70,.05);color:#d7aa58;border-radius:10px;padding:11px 13px;margin:0 0 10px}.scraper-notice span,.scraper-notice strong,.scraper-notice small{display:block}.scraper-notice strong{font-size:10px}.scraper-notice small{color:#81745d;font-size:9px;margin-top:3px}@media(max-width:720px){.profile-url-row{grid-template-columns:34px minmax(0,1fr) auto 34px}.scrape-toggle{padding:7px}.scrape-toggle svg{display:none}} .performer-image-field>span{display:block;margin-bottom:7px;font-size:11px;font-weight:700}.performer-image-selector{width:100%;display:grid;grid-template-columns:88px minmax(0,1fr) 20px;align-items:center;gap:14px;padding:9px;text-align:left;color:#ddd;background:#18181d;border:1px solid #303037;border-radius:12px}.performer-image-selector:hover{border-color:#4b4b55;background:#1c1c22}.performer-image-selector>span:nth-child(2){min-width:0}.performer-image-selector b,.performer-image-selector small{display:block}.performer-image-selector b{font-size:11px}.performer-image-selector small{margin-top:5px;color:#73737d;font-size:9px;line-height:1.45}.performer-image-selector>svg{width:17px;color:#686873}.performer-image-preview{width:88px;height:100px;display:grid;place-items:center;overflow:hidden;border-radius:9px;background:#101014}.performer-image-preview img{width:100%;height:100%;object-fit:cover}.performer-image-preview .image-fallback svg{width:28px;height:28px}.performer-image-picker-backdrop{z-index:75}.performer-image-picker{width:min(940px,100%);max-height:min(820px,92vh);display:flex;flex-direction:column;overflow:hidden}.performer-image-picker .modal-head>div>span{color:#777781;font-size:10px}.performer-image-grid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px;margin-top:20px;padding-right:4px;overflow:auto}.performer-image-grid>button{position:relative;min-width:0;padding:6px;border:1px solid #292930;border-radius:11px;background:#111115;color:#ddd;text-align:left}.performer-image-grid>button:hover{border-color:#565661}.performer-image-grid>button.selected{border-color:var(--red);box-shadow:0 0 0 2px rgba(255,64,87,.16)}.performer-image-grid>button>.image-fallback,.performer-image-grid>button>img{width:100%;aspect-ratio:1/1.18;border-radius:7px;object-fit:cover;background:#1b1b20}.performer-image-grid>button>span{display:block;min-width:0;padding:8px 4px 3px}.performer-image-grid b,.performer-image-grid small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.performer-image-grid b{font-size:10px}.performer-image-grid small{margin-top:4px;color:#696974;font-size:8px}.performer-image-grid i{position:absolute;right:10px;top:10px;width:24px;height:24px;display:grid;place-items:center;border-radius:50%;background:var(--red);color:#fff}.performer-image-grid i svg{width:14px}.performer-image-picker-state{min-height:320px;display:flex;align-items:center;justify-content:center;flex-direction:column;gap:9px;color:#777781;text-align:center}.performer-image-picker-state>svg{width:36px;height:36px;color:#555560}.performer-image-picker-state strong{color:#ddd;font-size:13px}.performer-image-picker-state span{font-size:10px}.performer-image-picker-state.error{color:#ff7788}@media(max-width:720px){.performer-image-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(max-width:440px){.performer-image-selector{grid-template-columns:70px minmax(0,1fr) 18px}.performer-image-preview{width:70px;height:82px}.performer-image-grid{grid-template-columns:repeat(2,minmax(0,1fr))}} + +.priority-select{display:flex;flex-direction:column;gap:4px}.priority-select>span{font-size:8px;color:#62626d;text-transform:uppercase;letter-spacing:.08em}.priority-select select{background:#0d0d10;border:1px solid #303037;color:#ddd;border-radius:8px;padding:7px 8px;outline:none;font-size:11px} +.priority-badge{display:inline-block;margin-left:7px;vertical-align:middle;font:700 8px/1 Inter,sans-serif;letter-spacing:.08em;text-transform:uppercase;padding:3px 6px;border-radius:5px}.priority-badge.high{background:rgba(255,64,87,.14);color:#ff8291;border:1px solid rgba(255,64,87,.3)}.priority-badge.low{background:#1d1d23;color:#80808a;border:1px solid #303037} From fb05b5ed52dae7daefcb95e166a4df6fcb92ad27 Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Thu, 8 Oct 2026 13:11:23 +0200 Subject: [PATCH 06/10] UI: add Backup settings for export and import - BackupSettings.tsx (new): "Backup" panel with an Export backup button (downloads a JSON file) and an Import backup button. Two options choose whether settings are imported and whether missing plugins are installed. After an import it shows a summary of added and updated performers and sources, plus any skipped sources or plugins with the reason. The page reloads so the imported library is visible right away. - main.tsx: adds "Backup" as a fourth settings category, next to Automation, Storage and Subtitles. - styles.css: styles for the backup panel, its options and the import summary. --- src/BackupSettings.tsx | 63 ++++++++++++++++++++++++++++++++++++++++++ src/main.tsx | 7 +++-- src/styles.css | 1 + 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 src/BackupSettings.tsx diff --git a/src/BackupSettings.tsx b/src/BackupSettings.tsx new file mode 100644 index 0000000..aecfa4d --- /dev/null +++ b/src/BackupSettings.tsx @@ -0,0 +1,63 @@ +import { useRef, useState } from "react"; +import { Download, LoaderCircle, Upload } from "lucide-react"; +import { api } from "./api"; + +type ImportResult = { + performers: { created: number; updated: number }; + sources: { added: number; updated: number; skipped: Array<{ performer: string; profileUrl: string; reason: string }> }; + settings: { applied: string[]; skipped: string[] }; + plugins: { installed: string[]; skipped: Array<{ id: string; reason: string }> }; +}; + +export function importSummary(result: ImportResult): string { + const parts = [ + `${result.performers.created} performer${result.performers.created === 1 ? "" : "s"} added`, + `${result.performers.updated} updated`, + `${result.sources.added} source${result.sources.added === 1 ? "" : "s"} added`, + ]; + if (result.sources.skipped.length) parts.push(`${result.sources.skipped.length} skipped`); + if (result.plugins.installed.length) parts.push(`${result.plugins.installed.length} plugin${result.plugins.installed.length === 1 ? "" : "s"} installed`); + return `Import finished: ${parts.join(", ")}.`; +} + +export function BackupSettings({ setNotice, onImported }: { setNotice: (message: string) => void; onImported: () => void }) { + const input = useRef(null); + const [busy, setBusy] = useState(false); const [error, setError] = useState(""); + const [includeSettings, setIncludeSettings] = useState(true); const [includePlugins, setIncludePlugins] = useState(true); + const [result, setResult] = useState(); + + const importFile = async (file: File) => { + setBusy(true); setError(""); setResult(undefined); + try { + let backup: unknown; + try { backup = JSON.parse(await file.text()); } catch { throw new Error("This file is not valid JSON"); } + const query = new URLSearchParams({ settings: includeSettings ? "1" : "0", plugins: includePlugins ? "1" : "0" }); + const imported = await api(`/api/backup/import?${query}`, { method: "POST", body: JSON.stringify(backup) }); + setResult(imported); setNotice(importSummary(imported)); onImported(); + } catch (reason) { setError(reason instanceof Error ? reason.message : String(reason)); } + finally { setBusy(false); if (input.current) input.current.value = ""; } + }; + + return
+

BACKUP

Export and import

+

Save your performers, their sources, recording priorities, settings and installed plugins to a file, and load them again after a reinstall or on another server. Downloads and plugin passwords, cookies or sessions are not included.

+ +
+ + +
+

Importing adds to your current library and never deletes anything. Performers are matched by name and sources by account, so importing the same file again does not create duplicates.

+
+ { const file = event.target.files?.[0]; if (file) void importFile(file); }}/> + +
+ {error &&

{error}

} + {result &&
+

{importSummary(result)}

+ {result.sources.skipped.length > 0 &&
    {result.sources.skipped.map((skip) =>
  • {skip.performer}: {skip.profileUrl} — {skip.reason}
  • )}
} + {result.plugins.skipped.length > 0 &&
    {result.plugins.skipped.map((skip) =>
  • {skip.id}: {skip.reason}
  • )}
} +
} +
; +} diff --git a/src/main.tsx b/src/main.tsx index 61ce7de..add3226 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,7 +1,8 @@ import { SourceHardRefresh } from "./SourceHardRefresh.js"; import React, { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { createRoot } from "react-dom/client"; -import { Activity, Box, Captions, Check, ChevronLeft, ChevronRight, CircleAlert, ClipboardPaste, CloudDownload, Database, Download, ExternalLink, FolderOpen, Gauge, Globe2, HardDrive, LayoutDashboard, Link2, LoaderCircle, PackagePlus, Pause, Pencil, Play, Plug, Plus, RefreshCw, Search, Settings, ShieldCheck, Sparkles, Square, Terminal, Trash2, UserRound, Users, X } from "lucide-react"; +import { Activity, Box, Captions, Check, ChevronLeft, ChevronRight, CircleAlert, ClipboardPaste, CloudDownload, Database, Download, ArchiveRestore, ExternalLink, FolderOpen, Gauge, Globe2, HardDrive, LayoutDashboard, Link2, LoaderCircle, PackagePlus, Pause, Pencil, Play, Plug, Plus, RefreshCw, Search, Settings, ShieldCheck, Sparkles, Square, Terminal, Trash2, UserRound, Users, X } from "lucide-react"; +import { BackupSettings } from "./BackupSettings"; import { api, ApiError } from "./api.js"; import { PerformerMergeDialog, PerformerConflictNotice } from "./PerformerMergeDialog.js"; import type { PerformerConflict } from "../packages/profile-identity.js"; @@ -553,11 +554,12 @@ function PluginConfig({ plugin, installing, close, run }: { plugin: Plugin; inst function SettingsPage({ settings, run, setNotice, onSettingsChange }: { settings: Record; run: (op: () => Promise, msg: string) => Promise; setNotice: (text: string) => void; onSettingsChange: (settings: Record) => void }) { const [values, setValues] = useState(settings); - const [category, setCategory] = useState<"automation" | "storage" | "subtitles">("automation"); + const [category, setCategory] = useState<"automation" | "storage" | "subtitles" | "backup">("automation"); const categories = [ { key: "automation", label: "Automation", description: "Discovery and downloads", icon: Gauge }, { key: "storage", label: "Storage", description: "Media location", icon: HardDrive }, { key: "subtitles", label: "Subtitles", description: "Local transcription", icon: Captions }, + { key: "backup", label: "Backup", description: "Export and import", icon: ArchiveRestore }, ] as const; const saveAutomation = () => void run(() => api("/api/settings", { method: "PUT", body: JSON.stringify({ defaultScrapeIntervalMinutes: values.defaultScrapeIntervalMinutes, defaultLiveIntervalSeconds: values.defaultLiveIntervalSeconds, maxConcurrentDownloads: values.maxConcurrentDownloads, autoQueueDiscovered: values.autoQueueDiscovered, retentionDays: values.retentionDays }) }), "Settings saved"); return
@@ -567,6 +569,7 @@ function SettingsPage({ settings, run, setNotice, onSettingsChange }: { settings
{category === "automation" &&

AUTOMATION

Scraping and downloads

} {category === "storage" && } + {category === "backup" && window.location.reload()}/>} {category === "subtitles" &&
}
diff --git a/src/styles.css b/src/styles.css index 6d5c103..55eb7a5 100644 --- a/src/styles.css +++ b/src/styles.css @@ -24,3 +24,4 @@ .priority-select{display:flex;flex-direction:column;gap:4px}.priority-select>span{font-size:8px;color:#62626d;text-transform:uppercase;letter-spacing:.08em}.priority-select select{background:#0d0d10;border:1px solid #303037;color:#ddd;border-radius:8px;padding:7px 8px;outline:none;font-size:11px} .priority-badge{display:inline-block;margin-left:7px;vertical-align:middle;font:700 8px/1 Inter,sans-serif;letter-spacing:.08em;text-transform:uppercase;padding:3px 6px;border-radius:5px}.priority-badge.high{background:rgba(255,64,87,.14);color:#ff8291;border:1px solid rgba(255,64,87,.3)}.priority-badge.low{background:#1d1d23;color:#80808a;border:1px solid #303037} +.backup-actions{display:flex;gap:10px;margin:14px 0}.backup-actions a.button{text-decoration:none;color:inherit}.check-row{display:flex;align-items:center;gap:10px}.check-row>span{margin:0!important}.backup-result{background:#18181d;border:1px solid #292930;border-radius:10px;padding:12px 14px;font-size:11px;color:#bbb}.backup-result p{margin:0}.backup-result ul{margin:8px 0 0;padding-left:18px;color:#8a8a94;font-size:10px;line-height:1.6} From a799d1df91b7b23304d80b78310d60502fe82915 Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Thu, 8 Oct 2026 13:12:12 +0200 Subject: [PATCH 07/10] Server: add backup export and import - backup.ts (new): exports performers (name, aliases, image, links, recording priority), their sources (auto-download, scraper, interval), application settings and installed plugins to a JSON backup. Downloads and plugin configuration (passwords, cookies, sessions) are never included. Import merges into the current library and never deletes anything: performers are matched by name, sources by plugin + external ID, so importing the same file twice creates no duplicates. A source that belongs to another performer is skipped and reported. Settings are validated with the existing settings schema; newer backup formats are rejected. - database.ts: mergePerformerDetails adds imported aliases and links to an existing performer and keeps its current image. - index.ts: GET /api/backup/export (downloads the file) and POST /api/backup/import (?settings=0 / ?plugins=0 to skip those parts, 32 MB body limit). - backup.test.ts (new): 5 tests for export without secrets, restore into an empty library, importing twice, source conflicts and invalid files. --- server/backup.test.ts | 95 ++++++++++++++++++++++++++++++ server/backup.ts | 132 ++++++++++++++++++++++++++++++++++++++++++ server/database.ts | 18 ++++++ server/index.ts | 15 +++++ 4 files changed, 260 insertions(+) create mode 100644 server/backup.test.ts create mode 100644 server/backup.ts diff --git a/server/backup.test.ts b/server/backup.test.ts new file mode 100644 index 0000000..bc48229 --- /dev/null +++ b/server/backup.test.ts @@ -0,0 +1,95 @@ +import { afterEach, describe, expect, it } from "vitest"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { Database } from "./database.js"; +import { PluginManager } from "./plugin-manager.js"; +import { BACKUP_FORMAT, exportBackup, importBackup, parseBackup } from "./backup.js"; + +const dirs: string[] = []; +afterEach(() => { for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true }); }); +const temp = (name: string) => { const dir = fs.mkdtempSync(path.join(os.tmpdir(), `${name}-`)); dirs.push(dir); return dir; }; + +async function library() { + const pluginDir = temp("easyx-backup-plugins"); const packageDir = path.join(pluginDir, "test"); fs.mkdirSync(packageDir); + fs.writeFileSync(path.join(packageDir, "index.mjs"), `export default { + manifest: { id: "test.live", name: "Live", version: "1", description: "Test", author: "Test", capabilities: ["media-listing"], sourceUrlPatterns: ["https://live.test/*"], + settings: [{ key: "password", label: "Password", type: "password" }] }, + listMedia: async () => [] + };`); + const db = new Database(temp("easyx-backup-data")); const plugins = new PluginManager(db, [pluginDir]); await plugins.load(); + return { db, plugins }; +} + +async function filledLibrary() { + const lib = await library(); + lib.plugins.install("test.live", { password: "secret-value" }); + lib.db.updateSettings({ maxConcurrentDownloads: 6, defaultLiveIntervalSeconds: 30 }); + const alice = lib.db.createPerformer({ name: "Alice", aliases: ["Ally"], imageUrl: "https://img.test/alice.jpg" }); + lib.db.mergePerformerDetails(alice.id, { externalRefs: { "test.live": "alice" } }); + lib.db.setPerformerPriority(alice.id, 1); + const source = lib.db.addSource(alice.id, "test.live", { externalId: "https://live.test/alice", label: "live.test", profileUrl: "https://live.test/alice", domain: "live.test" }); + lib.db.updateSource(source.id, { autoDownload: true, scraperPluginId: "test.live", scrapeEnabled: true, syncIntervalSeconds: 30 }); + lib.db.createPerformer({ name: "Bob" }); + return lib; +} + +describe("backup export and import", () => { + it("exports performers, sources, settings and installed plugins without plugin secrets", async () => { + const { db, plugins } = await filledLibrary(); + try { + const backup = exportBackup(db, plugins, "test"); + expect(backup).toMatchObject({ format: BACKUP_FORMAT, version: 1, appVersion: "test", settings: { maxConcurrentDownloads: 6, defaultLiveIntervalSeconds: 30 }, plugins: [{ id: "test.live", enabled: true }] }); + expect(backup.performers).toHaveLength(2); + expect(backup.performers[0]).toMatchObject({ + name: "Alice", aliases: ["Ally"], imageUrl: "https://img.test/alice.jpg", externalRefs: { "test.live": "alice" }, priority: 1, + sources: [{ pluginId: "test.live", profileUrl: "https://live.test/alice", autoDownload: true, scraperPluginId: "test.live", scrapeEnabled: true, syncIntervalSeconds: 30 }], + }); + expect(JSON.stringify(backup)).not.toContain("secret-value"); + } finally { db.close(); } + }); + + it("restores everything into an empty library", async () => { + const source = await filledLibrary(); + const backup = JSON.parse(JSON.stringify(exportBackup(source.db, source.plugins))); + source.db.close(); + const { db, plugins } = await library(); + try { + const result = importBackup(db, plugins, parseBackup(backup)); + expect(result).toMatchObject({ performers: { created: 2, updated: 0 }, sources: { added: 1, updated: 0, skipped: [] }, plugins: { installed: ["test.live"], skipped: [] } }); + expect(db.getPluginState("test.live")).toMatchObject({ installed: true, enabled: true, config: {} }); + expect(db.getSettings()).toMatchObject({ maxConcurrentDownloads: 6, defaultLiveIntervalSeconds: 30 }); + const alice = db.getPerformerByName("Alice")!; + expect(alice).toMatchObject({ aliases: ["Ally"], imageUrl: "https://img.test/alice.jpg", externalRefs: { "test.live": "alice" }, priority: 1 }); + expect(db.findPerformerByIdentity("test.live", "alice")?.id).toBe(alice.id); + expect(db.listSources(alice.id)).toMatchObject([{ profileUrl: "https://live.test/alice", autoDownload: true, scrapeEnabled: true, scraperPluginId: "test.live", syncIntervalSeconds: 30 }]); + } finally { db.close(); } + }); + + it("merges into an existing library and is safe to import twice", async () => { + const { db, plugins } = await filledLibrary(); + try { + const backup = parseBackup(JSON.parse(JSON.stringify(exportBackup(db, plugins)))); + backup.performers[0].aliases.push("Alicia"); + const result = importBackup(db, plugins, backup, { settings: false }); + expect(result).toMatchObject({ performers: { created: 0, updated: 2 }, sources: { added: 0, updated: 1, skipped: [] }, settings: { applied: [] } }); + expect(db.listPerformers()).toHaveLength(2); + expect(db.listSources()).toHaveLength(1); + expect(db.getPerformerByName("Alice")?.aliases).toEqual(["Ally", "Alicia"]); + } finally { db.close(); } + }); + + it("skips a source that already belongs to another performer", async () => { + const { db, plugins } = await filledLibrary(); + try { + const result = importBackup(db, plugins, parseBackup({ format: BACKUP_FORMAT, version: 1, performers: [{ name: "Carol", sources: [{ pluginId: "test.live", externalId: "x", profileUrl: "https://live.test/alice", domain: "live.test" }] }] })); + expect(result.performers.created).toBe(1); + expect(result.sources.skipped).toEqual([{ performer: "Carol", profileUrl: "https://live.test/alice", reason: "Already belongs to Alice" }]); + } finally { db.close(); } + }); + + it("rejects files that are not a backup", () => { + expect(() => parseBackup({ hello: "world" })).toThrow("This file is not an Open EasyX backup"); + expect(() => parseBackup({ format: BACKUP_FORMAT, version: 99, performers: [] })).toThrow(/newer Open EasyX/); + }); +}); diff --git a/server/backup.ts b/server/backup.ts new file mode 100644 index 0000000..c094022 --- /dev/null +++ b/server/backup.ts @@ -0,0 +1,132 @@ +import { z } from "zod"; +import type { Database } from "./database.js"; +import type { PluginManager } from "./plugin-manager.js"; +import { PerformerConflictError } from "./performer-conflict.js"; +import { settingsSchema } from "./output-settings.js"; + +/* + * Export and import of the library setup: performers (with aliases, links and + * priority), their sources, the application settings and which plugins are + * installed. Downloads, files and plugin configuration (passwords, cookies, + * sessions) are never part of a backup. + * + * Importing merges into the current library and never deletes anything: + * performers are matched by name, sources by plugin + external ID, so importing + * the same file twice changes nothing. + */ +export const BACKUP_FORMAT = "open-easyx-backup"; +export const BACKUP_VERSION = 1; + +const sourceSchema = z.object({ + pluginId: z.string().min(1), externalId: z.string().min(1), label: z.string().default(""), + profileUrl: z.string().min(1), domain: z.string().default(""), + enabled: z.boolean().optional(), autoDownload: z.boolean().optional(), + scraperPluginId: z.string().nullable().optional(), scrapeEnabled: z.boolean().optional(), + syncIntervalSeconds: z.number().int().min(5).max(31_536_000).optional(), +}); + +const performerSchema = z.object({ + name: z.string().trim().min(1), aliases: z.array(z.string()).default([]), imageUrl: z.string().nullable().optional(), + externalRefs: z.record(z.string(), z.string()).default({}), priority: z.number().int().min(-1).max(1).optional(), + sources: z.array(sourceSchema).default([]), +}); + +export const backupSchema = z.object({ + format: z.literal(BACKUP_FORMAT), version: z.number().int().min(1), + exportedAt: z.string().optional(), appVersion: z.string().optional(), + settings: z.record(z.string(), z.unknown()).optional(), + plugins: z.array(z.object({ id: z.string().min(1), enabled: z.boolean().optional() })).optional(), + performers: z.array(performerSchema), +}); + +export type Backup = z.infer; +export type ImportOptions = { settings?: boolean; plugins?: boolean }; +export type ImportResult = { + performers: { created: number; updated: number }; + sources: { added: number; updated: number; skipped: Array<{ performer: string; profileUrl: string; reason: string }> }; + settings: { applied: string[]; skipped: string[] }; + plugins: { installed: string[]; skipped: Array<{ id: string; reason: string }> }; +}; + +export function exportBackup(db: Database, plugins: PluginManager, appVersion?: string): Backup { + const sources = db.listSources(); + const backupSettings = settingsSchema.safeParse(db.getSettings()); + return { + format: BACKUP_FORMAT, version: BACKUP_VERSION, exportedAt: new Date().toISOString(), ...(appVersion ? { appVersion } : {}), + settings: backupSettings.success ? Object.fromEntries(Object.entries(backupSettings.data).filter(([, value]) => value !== undefined)) : {}, + plugins: plugins.list().filter((plugin) => plugin.installed).map((plugin) => ({ id: plugin.manifest.id, enabled: plugin.enabled })), + performers: db.listPerformers().map((performer) => ({ + name: performer.name, aliases: performer.aliases, ...(performer.imageUrl ? { imageUrl: performer.imageUrl } : {}), + externalRefs: performer.externalRefs, priority: performer.priority ?? 0, + sources: sources.filter((source) => source.performerId === performer.id).map((source) => ({ + pluginId: source.pluginId, externalId: source.externalId, label: source.label, profileUrl: source.profileUrl, domain: source.domain, + enabled: source.enabled, autoDownload: source.autoDownload, scraperPluginId: source.scraperPluginId ?? null, + scrapeEnabled: source.scrapeEnabled, syncIntervalSeconds: source.syncIntervalSeconds, + })), + })), + }; +} + +export function parseBackup(input: unknown): Backup { + const parsed = backupSchema.safeParse(input); + if (!parsed.success) { + const format = input && typeof input === "object" ? (input as Record).format : undefined; + const reason = format !== BACKUP_FORMAT ? "This file is not an Open EasyX backup" : parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).slice(0, 3).join("; "); + throw Object.assign(new Error(reason), { statusCode: 400 }); + } + if (parsed.data.version > BACKUP_VERSION) throw Object.assign(new Error(`This backup was made by a newer Open EasyX (format ${parsed.data.version}); update first`), { statusCode: 400 }); + return parsed.data; +} + +export function importBackup(db: Database, plugins: PluginManager, backup: Backup, options: ImportOptions = {}): ImportResult { + const result: ImportResult = { performers: { created: 0, updated: 0 }, sources: { added: 0, updated: 0, skipped: [] }, settings: { applied: [], skipped: [] }, plugins: { installed: [], skipped: [] } }; + + if (options.plugins !== false) { + const known = new Map(plugins.list().map((plugin) => [plugin.manifest.id, plugin])); + for (const entry of backup.plugins ?? []) { + const plugin = known.get(entry.id); + if (!plugin) { result.plugins.skipped.push({ id: entry.id, reason: "Plugin not available in this installation" }); continue; } + if (plugin.installed) continue; + try { plugins.install(entry.id); result.plugins.installed.push(entry.id); } + catch (error) { result.plugins.skipped.push({ id: entry.id, reason: error instanceof Error ? error.message : String(error) }); } + } + } + + if (options.settings !== false && backup.settings) { + const values: Record = {}; + for (const [key, value] of Object.entries(backup.settings)) { + const check = settingsSchema.safeParse({ [key]: value }); + if (check.success && key in check.data) values[key] = (check.data as Record)[key]; + else result.settings.skipped.push(key); + } + if (Object.keys(values).length) { db.updateSettings(values); result.settings.applied.push(...Object.keys(values)); } + } + + for (const entry of backup.performers) { + const name = db.resolvePerformerName(entry.name); + let performer = db.getPerformerByName(name); + if (performer) result.performers.updated += 1; + else { performer = db.createPerformer({ name, aliases: [], imageUrl: entry.imageUrl ?? null }); result.performers.created += 1; } + db.mergePerformerDetails(performer.id, { aliases: entry.name === name ? entry.aliases : [...entry.aliases, entry.name], imageUrl: entry.imageUrl ?? undefined, externalRefs: entry.externalRefs }); + if (entry.priority !== undefined) db.setPerformerPriority(performer.id, entry.priority); + + const existing = new Set(db.listSources(performer.id).map((source) => `${source.pluginId}\u0000${source.externalId}`)); + for (const source of entry.sources) { + try { + const saved = db.addSource(performer.id, source.pluginId, { externalId: source.externalId, label: source.label || source.domain, profileUrl: source.profileUrl, domain: source.domain }); + db.updateSource(saved.id, { + ...(source.enabled !== undefined ? { enabled: source.enabled } : {}), ...(source.autoDownload !== undefined ? { autoDownload: source.autoDownload } : {}), + ...(source.scraperPluginId !== undefined ? { scraperPluginId: source.scraperPluginId } : {}), ...(source.scrapeEnabled !== undefined ? { scrapeEnabled: source.scrapeEnabled } : {}), + ...(source.syncIntervalSeconds !== undefined ? { syncIntervalSeconds: source.syncIntervalSeconds } : {}), + }); + if (existing.has(`${source.pluginId}\u0000${source.externalId}`)) result.sources.updated += 1; else result.sources.added += 1; + } catch (error) { + const reason = error instanceof PerformerConflictError + ? `Already belongs to ${error.conflict.existingPerformer.name}` + : error instanceof Error ? error.message : String(error); + result.sources.skipped.push({ performer: name, profileUrl: source.profileUrl, reason }); + } + } + } + return result; +} diff --git a/server/database.ts b/server/database.ts index 297486a..0c6ba3b 100644 --- a/server/database.ts +++ b/server/database.ts @@ -341,6 +341,24 @@ export class Database { return this.getPerformer(performerId); } + /** Merges imported details into a performer: aliases and links are added, an existing image is kept. */ + mergePerformerDetails(performerId: string, values: { aliases?: string[]; imageUrl?: string; externalRefs?: Record }): Performer | undefined { + const performer = this.getPerformer(performerId); + if (!performer) return undefined; + const aliases = [...new Map([...performer.aliases, ...(values.aliases ?? [])] + .filter((alias) => typeof alias === "string" && alias.trim() && alias.toLowerCase() !== performer.name.toLowerCase()) + .map((alias) => [alias.toLowerCase(), alias])).values()]; + const refs = { ...Object.fromEntries(Object.entries(values.externalRefs ?? {}).filter(([, value]) => typeof value === "string" && value)), ...performer.externalRefs }; + this.sqlite.prepare("UPDATE performers SET aliases_json=?,image_url=COALESCE(image_url,?),external_refs_json=?,updated_at=? WHERE id=?") + .run(JSON.stringify(aliases), values.imageUrl ?? null, JSON.stringify(refs), now(), performerId); + const identity = this.sqlite.prepare("INSERT OR IGNORE INTO performer_identities(performer_id,plugin_id,external_id) VALUES(?,?,?)"); + for (const [pluginId, externalId] of Object.entries(refs)) { + const owner = this.findPerformerByIdentity(pluginId, externalId); + if (!owner || owner.id === performerId) identity.run(performerId, pluginId, externalId); + } + return this.getPerformer(performerId); + } + setPerformerPriority(performerId: string, priority: number): Performer | undefined { const value = Math.max(-1, Math.min(1, Math.trunc(priority))); this.sqlite.prepare("UPDATE performers SET priority=?,updated_at=? WHERE id=?").run(value, now(), performerId); diff --git a/server/index.ts b/server/index.ts index cdbf086..f3c3e80 100644 --- a/server/index.ts +++ b/server/index.ts @@ -23,6 +23,7 @@ import { LibraryDatabase } from "./library-database.js"; import { Catalog } from "./catalog.js"; import { registerLibraryRoutes } from "./library-routes.js"; import { settingsSchema } from "./output-settings.js"; +import { exportBackup, importBackup, parseBackup } from "./backup.js"; import { SourceSync } from "./source-sync.js"; import { PerformerConflictError } from "./performer-conflict.js"; import { registerPerformerMergeRoutes } from "./performer-merge-routes.js"; @@ -595,6 +596,20 @@ app.post<{ Params: { id: string } }>("/api/items/:id/cancel", async (request) => app.delete<{ Params: { id: string } }>("/api/items/:id", async (request) => queue.delete(request.params.id)); app.get("/api/settings", async () => ({ ...db.getSettings(), mediaRoot: mediaDir, ...library.settings(), maxConcurrentDownloadsLimit })); +app.get("/api/backup/export", async (_request, reply) => { + const backup = exportBackup(db, plugins, process.env.APP_VERSION); + const stamp = new Date().toISOString().slice(0, 16).replace(/[-:]/g, "").replace("T", "-"); + reply.header("content-disposition", `attachment; filename="open-easyx-backup-${stamp}.json"`); + reply.type("application/json; charset=utf-8"); + return JSON.stringify(backup, null, 2); +}); +app.post<{ Body: unknown; Querystring: { settings?: string; plugins?: string } }>("/api/backup/import", { bodyLimit: 32 * 1024 * 1024 }, async (request) => { + const backup = parseBackup(request.body); + const off = (value?: string) => value === "0" || value === "false"; + const result = importBackup(db, plugins, backup, { settings: !off(request.query.settings), plugins: !off(request.query.plugins) }); + app.log.info({ scope: "backup", performers: result.performers, sourcesAdded: result.sources.added, sourcesSkipped: result.sources.skipped.length }, "Backup imported"); + return result; +}); app.put<{ Body: Record }>("/api/settings", async (request) => { const parsed = settingsSchema.safeParse(request.body); if (!parsed.success) throw Object.assign(new Error(parsed.error.issues.map((issue) => issue.message).join(" ")), { statusCode: 400 }); From c4d19bd856fe01dd06c7b0691fe28ce1f2d34348 Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Thu, 8 Oct 2026 19:18:07 +0200 Subject: [PATCH 08/10] Security: update dependencies with known CVEs npm (production, all fixed within the existing version ranges): - fastify 5.12.1 -> 5.12.5: CVE-2026-76169, CVE-2026-84504, CVE-2026-84469, CVE-2026-84428, CVE-2026-92081 - fast-uri -> 3.1.8 / 4.1.5: CVE-2026-86472, CVE-2026-84394, CVE-2026-84292, CVE-2026-86818 - undici -> 7.29.1 (via @fastify/reply-from): CVE-2026-85014, CVE-2026-18149, CVE-2026-84947, CVE-2026-84890, CVE-2026-19534, CVE-2026-84961, CVE-2026-85008, CVE-2026-84933, CVE-2026-18540, CVE-2026-85024 - brace-expansion -> 5.0.12 (via @fastify/static): CVE-2026-102276, CVE-2026-102277, CVE-2026-102278 npm (development only): vitest 3 -> 5.0.3 (tinypool prototype pollution, @vitest/mocker path traversal), plus shell-quote, concurrently and source-map-js updates. `npm audit` now reports 0 vulnerabilities. Docker image: ofscraper 3.14.7 pins idna==3.7 and lxml~=5.1. idna 3.20 (CVE-2026-45409) and lxml 6.1.3 (CVE-2026-41066) are installed over them; ofscraper still imports and runs. Tests: full suite (446 tests) and the web build pass. --- Dockerfile | 3 + package-lock.json | 950 +++++++++++++++++----------------------------- package.json | 2 +- 3 files changed, 354 insertions(+), 601 deletions(-) diff --git a/Dockerfile b/Dockerfile index f102c36..3502922 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,12 +16,15 @@ ENV NODE_ENV=production PORT=3210 EASYX_DATA_DIR=/data EASYX_MEDIA_DIR=/media EA HF_HOME=/data/subtitle-models/huggingface PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 OMP_NUM_THREADS=1 MKL_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 TOKENIZERS_PARALLELISM=false ENV PATH=/opt/easyx/bin:/opt/ofscraper/bin:$PATH WORKDIR /app +# ofscraper 3.14.7 pins idna==3.7 and lxml~=5.1, which have known CVEs +# (CVE-2026-45409, CVE-2026-41066); the fixed versions are installed over them. RUN apt-get update \ && apt-get install -y --no-install-recommends ca-certificates chromium ffmpeg libimage-exiftool-perl novnc openbox python3 python3-venv python3-dev tini websockify x11vnc xvfb gcc g++ \ && python3 -m venv /opt/easyx \ && /opt/easyx/bin/pip install --no-cache-dir --upgrade pip "yt-dlp[default,curl-cffi]" gallery-dl \ && python3 -m venv /opt/ofscraper \ && /opt/ofscraper/bin/pip install --no-cache-dir --upgrade pip "ofscraper==3.14.7" \ + && /opt/ofscraper/bin/pip install --no-cache-dir "idna==3.20" "lxml==6.1.3" \ && python3 -m venv /opt/subtitles \ && /opt/subtitles/bin/pip install --no-cache-dir --upgrade pip \ && apt-get purge -y --auto-remove python3-dev gcc g++ \ diff --git a/package-lock.json b/package-lock.json index a386e9a..b145149 100644 --- a/package-lock.json +++ b/package-lock.json @@ -30,7 +30,7 @@ "concurrently": "^9.2.1", "typescript": "^5.9.2", "vite": "^7.1.3", - "vitest": "^3.2.4" + "vitest": "^5.0.3" }, "engines": { "node": ">=22.5" @@ -209,23 +209,23 @@ } }, "node_modules/@babel/helpers": { - "version": "7.29.7", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz", - "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==", + "version": "7.29.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.10.tgz", + "integrity": "sha512-EMCx3AGZ3WfAl6ht7AyQoPm2Lh+BGYEMdc4Q6Hf7uSCDOZFuLq44qNwL+iaim8VlyYhRAo4X43+weadK8ZB4Yg==", "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.29.7", - "@babel/types": "^7.29.7" + "@babel/types": "^7.29.8" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.29.8", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.8.tgz", - "integrity": "sha512-E8lTAYNB1KW+FH+VGJuZM1ioAx2E6oVlvQFRrf5P8ZZmsiJXYAD9vTFV7yyEURNzgh1dFqMZuO6tUwcARbqFCA==", + "version": "7.29.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", + "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", "dev": true, "license": "MIT", "dependencies": { @@ -286,16 +286,16 @@ } }, "node_modules/@babel/traverse": { - "version": "7.29.8", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.8.tgz", - "integrity": "sha512-I5z7H3bf/41ktsNVLtpN0wAa336HkqIHQ5BuPLEhTkt1jVSyZpeNKIzTgEWmlxjdg81R0IgUCcaE+Ok3NvrfZg==", + "version": "7.29.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.10.tgz", + "integrity": "sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/generator": "^7.29.8", "@babel/helper-globals": "^7.29.7", - "@babel/parser": "^7.29.8", + "@babel/parser": "^7.29.9", "@babel/template": "^7.29.7", "@babel/types": "^7.29.8", "debug": "^4.3.1" @@ -827,9 +827,9 @@ "license": "MIT" }, "node_modules/@fastify/http-proxy": { - "version": "11.6.1", - "resolved": "https://registry.npmjs.org/@fastify/http-proxy/-/http-proxy-11.6.1.tgz", - "integrity": "sha512-VhlqlN4Np0cmJByJfUIIDlTVHeYJsS0U5AMKta1gPCRKkP9u2GTWr0lYuhrUJF38kDA8n3oT8wcioZtIrL+tlw==", + "version": "11.6.4", + "resolved": "https://registry.npmjs.org/@fastify/http-proxy/-/http-proxy-11.6.4.tgz", + "integrity": "sha512-JPsbLX9D5X5yES1A6M2yx1i2PGf8eNyKT48j+6pgLIwxfRYpj1MEzR1CwASRvqdZOWhcPmdsZiIKehSgioW6ww==", "funding": [ { "type": "github", @@ -868,9 +868,9 @@ } }, "node_modules/@fastify/proxy-addr": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@fastify/proxy-addr/-/proxy-addr-5.1.0.tgz", - "integrity": "sha512-INS+6gh91cLUjB+PVHfu1UqcB76Sqtpyp7bnL+FYojhjygvOPA9ctiD/JDKsyD9Xgu4hUhCSJBPig/w7duNajw==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@fastify/proxy-addr/-/proxy-addr-5.1.1.tgz", + "integrity": "sha512-zv07Y9GEuDsJPegZoDFd4SDWaZOW8N2pa0GSrYmKpId/tjt1Hgo3BjZBVjdVpfVrHaA+Qv5jawtS2O50J5xM9g==", "funding": [ { "type": "github", @@ -888,9 +888,9 @@ } }, "node_modules/@fastify/reply-from": { - "version": "12.6.4", - "resolved": "https://registry.npmjs.org/@fastify/reply-from/-/reply-from-12.6.4.tgz", - "integrity": "sha512-WpHqGNRKzEraRQwBFK64g2HijN0ZuDuiiwWg06r5LY0lv1iu0qYg1BfVM0iYcCMiovrM8kKXsKm5GDH9JH9aPA==", + "version": "12.7.1", + "resolved": "https://registry.npmjs.org/@fastify/reply-from/-/reply-from-12.7.1.tgz", + "integrity": "sha512-F26CIcy6PKqyhsTwQI7p5UwH5vrv2yz7BOqAnkHTmNVSU9J+vmRh8CNfOk/ZD8AjcKbiyRkNl6Lb3AuJdxIADQ==", "funding": [ { "type": "github", @@ -905,7 +905,7 @@ "dependencies": { "@fastify/error": "^4.0.0", "end-of-stream": "^1.4.4", - "fast-content-type-parse": "^3.0.0", + "fast-content-type-parse": "^4.0.0", "fast-querystring": "^1.1.2", "fastify-plugin": "^6.0.0", "toad-cache": "^3.7.0", @@ -936,9 +936,9 @@ } }, "node_modules/@fastify/static": { - "version": "10.1.3", - "resolved": "https://registry.npmjs.org/@fastify/static/-/static-10.1.3.tgz", - "integrity": "sha512-W6jqajYS974XjPjB5hQWoxPM8NKM4+p8YmQT6G5IbCa4uhdWSVadZUv75siy1wEA/3ty8RYdpBydfWeu9AqAqQ==", + "version": "10.1.5", + "resolved": "https://registry.npmjs.org/@fastify/static/-/static-10.1.5.tgz", + "integrity": "sha512-3r0ZFXo82nKlPzySOUYhwWVfPZStfiwjmyevkX7cJWL2yXmEzl0Rpxv+L6L1R4OxqvlDGqf3g8OdBzILKgqe6w==", "funding": [ { "type": "github", @@ -954,7 +954,7 @@ "@fastify/accept-negotiator": "^2.0.0", "@fastify/error": "^4.0.0", "@fastify/send": "^4.0.0", - "content-disposition": "^2.0.1", + "content-disposition": "^3.0.0", "fastify-plugin": "^6.0.0", "fastq": "^1.17.1", "glob": "^13.0.0" @@ -993,9 +993,9 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", "dev": true, "license": "MIT" }, @@ -1027,9 +1027,6 @@ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1053,9 +1050,9 @@ "license": "MIT" }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.5.tgz", - "integrity": "sha512-jfkGfTwhQpsiSckPF8r9bU3pn3vyd72NlWaO+TgEO6WPSDnUhXzrNYCHBMOYj0ACaUgjm6eERLF+XV9a6RstoA==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.64.2.tgz", + "integrity": "sha512-gjNDUwMswogkw3fNqV00u54uZlgmInuw5EU/1TeqQ6K0bEagoGvqjPdKzy112lKyhe7PkGudZ/kSQHsc9qroIg==", "cpu": [ "arm" ], @@ -1067,9 +1064,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.5.tgz", - "integrity": "sha512-oGVqyQlxnrz9/ty89oHpU857VUHEl5/Xu4R2lS+aivCTrNnSsbiENzTnNaBsjxH0CNWGPhzHArOLFwo+oKXveA==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.64.2.tgz", + "integrity": "sha512-YkAW8q7p5SCLSaGWaUkmsRnBEb3MGA1pB5nI/8k0lAK5fZsQKRBqkdR1h4UU9p8u3c7ZGdUF2Zcx7mK+E/pUKg==", "cpu": [ "arm64" ], @@ -1081,9 +1078,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.5.tgz", - "integrity": "sha512-bW7B8xMEq8n99Q3ieEcPRGuphurdZAaFzQc9Efyyw3FL6DZO6pMy9xhdN+kBoD7Sy05xNXSr4OyPPnpkYriS/A==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.64.2.tgz", + "integrity": "sha512-hNmuIHv+LnrP/+q/44vsmIMWfoh7X2YXOp5FLtjGuvqN52VdtFpOpnshTc1k28tWv1wE/0D5gLjsozBUowEGbQ==", "cpu": [ "arm64" ], @@ -1095,9 +1092,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.5.tgz", - "integrity": "sha512-YSwBS86QeHOGlrxJ1PSOIZSkzRL/JmKeunhc+lV6M1a6En8QuVCD/T/qIA0J4Gd2Y86RIOBYrLcOUtqGh9+/1w==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.64.2.tgz", + "integrity": "sha512-B0t5CoxgF2KL7R5FHAsyN8yVEQCSIkh4XVs8MCDjuBLNjEa8l3zd5tVKaFMv53LfUtHs9p2rnqeavPTOunV+Ww==", "cpu": [ "x64" ], @@ -1109,9 +1106,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.5.tgz", - "integrity": "sha512-2fST8lILgl7cKbme/1KDdPCmbXbG+gqoV3bHp19L0ypX/3akYMBVdOunPleRCwonoLnXOZ/0F+Mt/v8POFmfcQ==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.64.2.tgz", + "integrity": "sha512-QQdYnfwrPmc1DoPlddjFvQPzUHFbStKXsHrG6EBYsWHhBVUCjsCRdcfGGXGAvhDpDtTzKK4vy1UrGFJ45rQaiw==", "cpu": [ "arm64" ], @@ -1123,9 +1120,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.5.tgz", - "integrity": "sha512-cpIxQCP9J+EVad0a6LO1kY3ZGODlk80VlI+2I96B8xMcdHZ4pLVhfQ49JFpYqjPF91FFkQWftf57YlDcTiw9yQ==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.64.2.tgz", + "integrity": "sha512-1xRxtGWif6BB58VSfMavi0Yfs2M4x6CtRp4o7ScY4W7AGlgvf6GSPKdDNdw7TX3tMiQwZY5W/mvyrOJTq/7AKA==", "cpu": [ "x64" ], @@ -1137,16 +1134,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.5.tgz", - "integrity": "sha512-r9fGh3eFs3e/udWh5ZjXQtxiYK/xoFxQaYR/cELxac/Udkl5Th+IsFm0CX3Kl9hmUH/we7EoMpjJgeQNnE0+IA==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.64.2.tgz", + "integrity": "sha512-CXFLEt384BUwwOLR9DURWNHl1bQOVLd1ibOee+yKBJm/fZtvrSAOZ0JbxjAxszVMIovYMwFMS+oP+Q1aPcx8Eg==", "cpu": [ "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1154,16 +1148,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.5.tgz", - "integrity": "sha512-xdvFdp7OM6KLJviJT2g/YuRSUjnZgGHk4RNgwIbN7X6cPugOucV60DdHXWzsBVCUdrGb6qSXnJQrrAKMmQuj3Q==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.64.2.tgz", + "integrity": "sha512-T1dorY0WHm5mMNpMHFl5rYRZ02gLSZcr6J45r66tYb3S3R3DyIRGiGWVdLtF+zOQjratNJaObl9jYumueRiL1A==", "cpu": [ "arm" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1171,16 +1162,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.5.tgz", - "integrity": "sha512-rRqILAndyzHzP7T9NFQrq+4HFWNhqkqkKur7eiBpfLmz01PO0JKx5Vchu3YllE4YXI/Ftgq/szrDWg5GJ0mI8g==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.64.2.tgz", + "integrity": "sha512-ia6bfaCIc0ldp6bvs9oEkFrJVJKNUMoiDF0+LBZsQAZg+vE0znXnzGqH+ew/FYswE30cruAWPTO3dPw7keaVkQ==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1188,16 +1176,13 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.5.tgz", - "integrity": "sha512-Gf4X3qVMucayUvux6aXXPgXovocSFUC0rrffDuPI/S2nHhNMhjcZxsrAFYCOF350PRreW1XwzFj3CT/3bKsWCw==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.64.2.tgz", + "integrity": "sha512-mB/gwfBfXtT0EBpbSssqKCqMFuX8b21Zy2TGoIhehSJEssZ5ksybxymwp1BkEM5Nczh/AAxpmh5q+MkhtundGg==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1205,16 +1190,13 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.5.tgz", - "integrity": "sha512-+s5qA0TNM0qm8PK/a5gt/1Hpx+NV08uSuCncvhziIlQzT6AEV2fnUQo7eBtFTFO0nA9scauvoR2HusfXmQnO4w==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.64.2.tgz", + "integrity": "sha512-VPd0a+XlHoNRI9jIPRHww2UKhDkD6XjbtcKYXZijAnhJS1jLLbiNtVl6a5LyEfNN+eyiyWcJOZXPzBo69oTsew==", "cpu": [ "loong64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1222,16 +1204,13 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-musl": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.5.tgz", - "integrity": "sha512-ybb6QvWwWJCbBWqERpc8K3pYVGIrXlG8MEQ8IIuJY6Y9KdHQxoFoNyfkAOtKn1VHu3KuLidXvwrvGR1mEjeWCw==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.64.2.tgz", + "integrity": "sha512-10N1I6oBpERqzGtHKcCLrEpHlbXSBbMK9TURHvqgWbIFZuU3oJROxJ0H2nHfq96TVI0XJHQ9qzolJMFd2tz0LA==", "cpu": [ "loong64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1239,16 +1218,13 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.5.tgz", - "integrity": "sha512-nZb1DtnOyhCmYvsC8A2CwOkopVg+IS1+fPUa7rMOAXtNw5+lLCLLPqd6XAiNrGtoQKsbvIBOwsHnBH/3wnb4HQ==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.64.2.tgz", + "integrity": "sha512-dhJrLVZ3wNNhwCmy9/VTg6Pq6J8a8eZ0n15dVRlbSWcDb+8V/1mDfbnvis+vt8W6Pbxzv6gUbTEl4piOT3bbUQ==", "cpu": [ "ppc64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1256,16 +1232,13 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-musl": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.5.tgz", - "integrity": "sha512-yMbj63Sp89ryrXLWyz+sy+fYD2HpOnMCLGbe4Oa1smclFSUukdtD/BgdiHaAetJNb74URD8U4hM+qG5KVzMEkg==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.64.2.tgz", + "integrity": "sha512-tPd2QuwxkTxgju5eARyb3RdgBWWi/O9dn/NFH0VkvGbLzoQeXrH6qMABtW8IODb5lUeBzB3sy2U7qmI4MtQ72g==", "cpu": [ "ppc64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1273,16 +1246,13 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.5.tgz", - "integrity": "sha512-mhoan3OJw2kYV/e1jtIdmvUZgyBFeA6zGWsOswmR0Tg19TQbowZuR+JMLID6spbbBN7Zee2ejrgmy3+FxGrIdA==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.64.2.tgz", + "integrity": "sha512-njtDdPvSQWI9CDhIPPxsiEMeHayCfu7wwcbSQ7c2kYPhGVviL+WGVhq6Jfj/b+VuhSTkFuQ0z4ZFbFjkWwBFmg==", "cpu": [ "riscv64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1290,16 +1260,13 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.5.tgz", - "integrity": "sha512-5ZTLmjWbb1VZdjuyhe83K/8QO0/h11midQCBP+X5OYn32ra7eOBoM0ZqtaY4nkgNsYgmdVhMYPoyVPTjUpHf3w==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.64.2.tgz", + "integrity": "sha512-EbOBo3dqCj9ecEV9Z7zvulB6AieMP2ztnKQYGVOSN0pzIyOu+3JH2YJZnLmbPeVvfn6yP6Qi7NbBM27EzGbj2w==", "cpu": [ "riscv64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1307,16 +1274,13 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.5.tgz", - "integrity": "sha512-m53kG+br6PGxOTmgBEM2DHSDs9RVjsyEbUwjJPJGTFm1grWOG8EKJggDCTb60unD4Tjby8fi7/m9XfkEWasVWg==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.64.2.tgz", + "integrity": "sha512-8wLt2Q5n4qmfiE2Gk8V6KNLSf+oJuBX7Kdw5joFDtnZIZvirS0hLzBc79OiJjV71oYDmBUZLNy6pDgvylo4qiQ==", "cpu": [ "s390x" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1324,16 +1288,13 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.5.tgz", - "integrity": "sha512-6RHPJR1g/uvdYU8uXBnfq3nlqyZCP82Fr6NHgfGoaIeSh0YEqnX/x6uA9MmJJbnSH7swqX4F+CkGdUF+6doiQA==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.64.2.tgz", + "integrity": "sha512-aIChbkhC4d33bxkVP0LSi2/2lUSGRXE6k4Qa0G7tgpgTOK7kxHTixmx5qC3SKUJ6yUMznHBtQoWaG4QMqLUnhw==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ @@ -1341,16 +1302,13 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.5.tgz", - "integrity": "sha512-xs+OXQtEXgpXT0DmA5+U3qnRZHdCST/5HRQxS8wSPZTUZN/EMWeHuSIod32LQklTBZBV9DyfncKBQ8n5V3eFdw==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.64.2.tgz", + "integrity": "sha512-gQ+TkVZRfjZVcl/UOAxxfWw+sHjzIXoieNwxEyJlD3tRBmBhR8ZDq11w+QEgQDcpslEB+fhN/OEpaTsDoIIHhQ==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ @@ -1358,9 +1316,9 @@ ] }, "node_modules/@rollup/rollup-openbsd-x64": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.5.tgz", - "integrity": "sha512-e7hD+sl3s+mcLQDZ8pbudBVsdG6r5yN4w3LqG2TJ8sQHDpblWj5lrJs/3m01Cvlxbt4x13zu5thLjgypgtkYzw==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.64.2.tgz", + "integrity": "sha512-sUaJpMKS2JBCvUk8fYimG7aMq2jHVT4kw/uVHxPolKLrMmkKy0KXirmZyZehdNpL7PffqAlPAWUELQcTiD8ChA==", "cpu": [ "x64" ], @@ -1372,9 +1330,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.5.tgz", - "integrity": "sha512-GiyJaCf+WpMub/17aPcKk27QMl5W6f+KhdPTjlFOn5akH5Wa/DCM9Stdx5cDfmasyKB08MqpVQ1uJE2RkkpbXg==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.64.2.tgz", + "integrity": "sha512-j1RdJWb0CrlSuwt12OPjLucPlwfLtA/KMOKVvh5rXSJEtl/WDoIGR3CSykK/jLGTo9RqNfW5Ub6kY5Z5ccYl9w==", "cpu": [ "arm64" ], @@ -1386,9 +1344,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.5.tgz", - "integrity": "sha512-+OQ8U2DdoEfXl8T4Fb18AjmEwbXMerKDKCL8yCPAYhKCEEKoul7rkbeGCBFCbAlaGaa7pmtRTpkAJM2LE/i5FA==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.64.2.tgz", + "integrity": "sha512-i3r04aHCIY3eggTBLUp/4IxiBjDpAgQaK89Ue2nMJ2MKuIXX5JfoeZjHw+kPjGGNVDlhi8FT8xzuGMJZe3aehg==", "cpu": [ "arm64" ], @@ -1400,9 +1358,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.5.tgz", - "integrity": "sha512-KanvAZrPKbDBFwrgiU9yEVpQoox9QPV1WZOXX7HudJQY+eSlu82CtWxDU8WtuRRvtN5EGkLczkd6Y6DTcvm9wA==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.64.2.tgz", + "integrity": "sha512-kCQ15h/uwNMGdN8gjXBZGf+aGE+ODzHfbi90/cAm4+Q89WoMiLODNoj8HoGZmYx87HPxfu5CBNPsZ+ZG4uIAoA==", "cpu": [ "ia32" ], @@ -1414,9 +1372,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.5.tgz", - "integrity": "sha512-1aC3UEWTtRl3RK3VpDJ/Tqk1XI4SLTmXIthAq6wRWo8XiSXJNd+VprJM4/1P4+i6HIaFEFlVi9sTTziniD2tOQ==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.64.2.tgz", + "integrity": "sha512-yYAuySSs+0X2gSMJPw/Q4jHsHZHyMq1dpAE+XnN790Jg1WuReUAD/+j+e4vuDvS4PXJ4PA4NCzTR4OYtDf18/g==", "cpu": [ "x64" ], @@ -1428,9 +1386,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.5.tgz", - "integrity": "sha512-/gDJaRs4gl0NPIwqCz+6PkpmhhjRAD2j6P4rSNHBzUkO3naEx2mIU0pRle1vUNRQ7mE/+8OOeXLTv/J56FKiQg==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.64.2.tgz", + "integrity": "sha512-JY1rQdWOJrKutORqKO1uzrHXV86jFiQzfLFKx2s8S1CjLXL9fC5LOIvk0q7Z7PXJvsByt+sdoE1Q2a9gBr4gLQ==", "cpu": [ "x64" ], @@ -1512,19 +1470,19 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.13.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.3.tgz", - "integrity": "sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==", + "version": "24.19.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.1.tgz", + "integrity": "sha512-aS3/DG0oM05K0RIXXP+hKjinGG5IgSSVGzswZxW3O0sS3pH4/fycXundUC9XsszgKCk4gHXylTEK6hyFxVxnoQ==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~7.18.0" + "undici-types": ">=7.24.0 <7.24.7" } }, "node_modules/@types/react": { - "version": "19.2.18", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz", - "integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", "dev": true, "license": "MIT", "dependencies": { @@ -1532,13 +1490,13 @@ } }, "node_modules/@types/react-dom": { - "version": "19.2.5", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.5.tgz", - "integrity": "sha512-fMPwH9v7r/pp43yUd2/Mbiex5KouJwwR3dzHkhLREUC6764VyDsqxhAxv6OFEYR1RhjOyD1naqba8ECDBe7ZQg==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", "dev": true, "license": "MIT", "peerDependencies": { - "@types/react": "^19.2.0" + "@types/react": "^19.3.0" } }, "node_modules/@vitejs/plugin-react": { @@ -1562,40 +1520,24 @@ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/@vitest/expect": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.7.tgz", - "integrity": "sha512-E8eBXaKibuvH2pSZErOjdVb5vF4PbKYcrnluBTYxEk1l/VhhwZg1kZQsdtjq+CsF5CFydf2Rdkz7jDHKSisi3w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/chai": "^5.2.2", - "@vitest/spy": "3.2.7", - "@vitest/utils": "3.2.7", - "chai": "^5.2.0", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, "node_modules/@vitest/mocker": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.7.tgz", - "integrity": "sha512-Trr0hYO9CM3Wj6ksWHRhK9IZpIY6wTMO5u/MqXurMxT57sWBaOPEtP3Oq60ihZuh5JsiagKfz95OcxdEP6dBrA==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.0.3.tgz", + "integrity": "sha512-T8sWAIbkSyAjkwTcaEc3Iu0o9A27X1/kdXrizhZkGuSKScRQtRzclfAMpOTcGdXCsqxeWlpGy3XjqaW8CpLORg==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "3.2.7", + "@jridgewell/trace-mapping": "0.3.31", + "@vitest/spy": "5.0.3", "estree-walker": "^3.0.3", - "magic-string": "^0.30.17" + "magic-string": "^1.2.3" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "msw": "^2.4.9", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "msw": { @@ -1606,73 +1548,12 @@ } } }, - "node_modules/@vitest/pretty-format": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.7.tgz", - "integrity": "sha512-KUHlwqVu0sRlhCdyPdQ/wBoTfRahjUky1MubOmYw9fWfIZy1gNoHpuaaQBPAaMaVYdQYHJLurzj8ECCj5OwTqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/runner": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.7.tgz", - "integrity": "sha512-sB9y4ovltoQP+WaUPwmSxO9WIg9Ig694Di5PalVPsYHklAdE027mehpWF2SQSVq+k6sFgaivbTjTJwZLSHbedA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/utils": "3.2.7", - "pathe": "^2.0.3", - "strip-literal": "^3.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/snapshot": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.7.tgz", - "integrity": "sha512-7C+MwShwtBSI5Buwoyg3s/iY1eHL9PKAf+O1wVh/TdnjXUtkoL/9YQtre90i4MtNXM6edP1wJ2zOBpfCyhIS7g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "3.2.7", - "magic-string": "^0.30.17", - "pathe": "^2.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, "node_modules/@vitest/spy": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.7.tgz", - "integrity": "sha512-Q2eQGI6d2L/hBtZ0qNuKcAGid68XK6cv1xsoaIma6PaJhHPoqcEJhYpXZ/5myCMqkNgtP6UKuBhbc0nHKnrkuQ==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.0.3.tgz", + "integrity": "sha512-XhFysQTB8AZ+P4gMi+Lpo99vg2AZi0qKpaB9yXQl37+CaMEAPO3iH/wGVnSyL5MPERiLezpqTVtrR6UZH5GCXg==", "dev": true, "license": "MIT", - "dependencies": { - "tinyspy": "^4.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/utils": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.7.tgz", - "integrity": "sha512-x6BDOd7dyo3PFLY3I9/HJ25X/6OurhGXk2/B9gOZNPF7XDVjeBK4k01lQE5uvDpbuheErh91qYuE1E2OEjK3Rw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "3.2.7", - "loupe": "^3.1.4", - "tinyrainbow": "^2.0.0" - }, "funding": { "url": "https://opencollective.com/vitest" } @@ -1717,9 +1598,9 @@ } }, "node_modules/ajv/node_modules/fast-uri": { - "version": "3.1.6", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.6.tgz", - "integrity": "sha512-7Ical1vFEMr0onbVzEDIreM22I4khW+fzyQPwvAFWBp1iwdshSZRsL4jjRvPG9JP1uiqMHRto+YU6R2/CzDz5Q==", + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.8.tgz", + "integrity": "sha512-GZMtZUTNRpOVIECoXwLNZS5xUGE+mVNbTB8h/7Rwh2TFWcBQiPzTgyZi05BF9UMZKkLJv8XBRJTlU7zg8+ZfMg==", "funding": [ { "type": "github", @@ -1807,9 +1688,9 @@ } }, "node_modules/baseline-browser-mapping": { - "version": "2.11.18", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.18.tgz", - "integrity": "sha512-1iEmLEYSiE1SeBoAfPo/Mnx3PzfzHUkDK61ASkCpuk3YXugYLH5DYK1SzqV55F8FMI6s0F+/tCP7Polz1QRjxw==", + "version": "2.11.27", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.27.tgz", + "integrity": "sha512-ElY12DaROGuan+lMmZ8Cvo/ZUbXPe7Enc/9VU/b1T3Kp4dwytRcNdR8DoSJN5SNJT/CuvcCA0DHDVmMOCePdRQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -1820,9 +1701,9 @@ } }, "node_modules/brace-expansion": { - "version": "5.0.9", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", - "integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", "license": "MIT", "dependencies": { "balanced-match": "^4.0.2" @@ -1832,9 +1713,9 @@ } }, "node_modules/browserslist": { - "version": "4.28.8", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz", - "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==", + "version": "4.29.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.3.tgz", + "integrity": "sha512-1R4kiYKXGViqEN0CnoDrXc1StD9niAwu+j2dukWzrD4bJgsD4lDmEp0CRbc6E/vYJIfTHwPmwyaKtVSudICdPA==", "dev": true, "funding": [ { @@ -1852,11 +1733,11 @@ ], "license": "MIT", "dependencies": { - "baseline-browser-mapping": "^2.11.12", - "caniuse-lite": "^1.0.30001809", - "electron-to-chromium": "^1.5.402", - "node-releases": "^2.0.53", - "update-browserslist-db": "^1.3.0" + "baseline-browser-mapping": "^2.11.26", + "caniuse-lite": "^1.0.30001813", + "electron-to-chromium": "^1.5.439", + "node-releases": "^2.0.57", + "update-browserslist-db": "^1.3.3" }, "bin": { "browserslist": "cli.js" @@ -1865,20 +1746,10 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/caniuse-lite": { - "version": "1.0.30001809", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001809.tgz", - "integrity": "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ==", + "version": "1.0.30001815", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001815.tgz", + "integrity": "sha512-uDybUEyfgbyJJ93J1vikTylBX31AkdVYeVPeffMQpf8XN7hSfr0oZOn4VFOIMNvtU5+rHvC5Udg2TgtJKHm23Q==", "dev": true, "funding": [ { @@ -1897,18 +1768,11 @@ "license": "CC-BY-4.0" }, "node_modules/chai": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/chai/-/chai-5.3.3.tgz", - "integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", "dev": true, "license": "MIT", - "dependencies": { - "assertion-error": "^2.0.1", - "check-error": "^2.1.1", - "deep-eql": "^5.0.1", - "loupe": "^3.1.0", - "pathval": "^2.0.0" - }, "engines": { "node": ">=18" } @@ -1943,16 +1807,6 @@ "node": ">=8" } }, - "node_modules/check-error": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz", - "integrity": "sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 16" - } - }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -1989,15 +1843,15 @@ "license": "MIT" }, "node_modules/concurrently": { - "version": "9.2.4", - "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.4.tgz", - "integrity": "sha512-TZ0CEhyzvFjgtAvHTusDMgj7wNdihCh7LLLrzdUOXIhdlnL2JBBGA9eJxR24rtqgmdjh3OA3hrN1rCHj6HM8qA==", + "version": "9.2.5", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.5.tgz", + "integrity": "sha512-YMZlvWrTPQEhjKp60XSmMGt60+pffbv6DyRnOMvVO98+J7aF8w8Ui9FhdcOwvSixc/kyR6SoVvmejcn/2lZBqg==", "dev": true, "license": "MIT", "dependencies": { "chalk": "4.1.2", "rxjs": "7.8.2", - "shell-quote": "1.9.0", + "shell-quote": "1.12.0", "supports-color": "8.1.1", "tree-kill": "1.2.2", "yargs": "17.7.2" @@ -2014,12 +1868,12 @@ } }, "node_modules/content-disposition": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-2.0.1.tgz", - "integrity": "sha512-e+H0ZXHSWYrENhQzw1LPuP4oF5MzVKmDU6d3hxlvaPEYLLg62MxtQNPRx4SYSuYJSBUgnQIG4HIN2tEtNv7Dog==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-3.0.0.tgz", + "integrity": "sha512-ZH/0Xs9rMIFWCOmGdmS9eHBTF62qqQYNz4nVjQhkdIO/a0fCP4UIM3mRz/wiqL0L14YgAz/1xio4OaSY4+ON/A==", "license": "MIT", "engines": { - "node": ">=18" + "node": ">=22" }, "funding": { "type": "opencollective", @@ -2071,16 +1925,6 @@ } } }, - "node_modules/deep-eql": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", - "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -2100,9 +1944,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.5.413", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.413.tgz", - "integrity": "sha512-F1XPKvt7HVfly5WND90ec16nFsdr4g5x/cVUP3EqjeyXynupabGDqpMa84wwvuYGDnldXLBz6DLXyZXWO9TPvw==", + "version": "1.5.451", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.451.tgz", + "integrity": "sha512-vUNKPrUzw8ByEMOxloq0a71iD/mPuPxVkbDm3G5YhnxTzOw/I6qAg2MUS0cYj/c267lWmw26yW4Vv7foxTxPLg==", "dev": true, "license": "ISC" }, @@ -2123,9 +1967,9 @@ } }, "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", "dev": true, "license": "MIT" }, @@ -2207,9 +2051,9 @@ } }, "node_modules/fast-content-type-parse": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-3.0.0.tgz", - "integrity": "sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-4.0.0.tgz", + "integrity": "sha512-rvu3AY9s3EsDXSDUWzFU5M9/fDpjAUwyIkDR9VrwZA3H9J5f4ymkT0J4iWw9iLaMvFVwsYTGFClUgy9VIvnabA==", "funding": [ { "type": "github", @@ -2268,9 +2112,9 @@ } }, "node_modules/fast-uri": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-4.1.3.tgz", - "integrity": "sha512-7+72G6vLt7jjNas8SmSATx2qeyRIjxeqO3i4IkmDTxlqYZRKANhOe1bnovcp4WZmvsYrp60WyqPyHqgRiX0yXw==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-4.2.1.tgz", + "integrity": "sha512-TmHQgewjHtMq1E5QKA0tOE0yeYGQs25KZC/ziJpubRtWI15W92e6vPFydWOeZBVROSHBYw/QhD9d5OefdD6LDg==", "funding": [ { "type": "github", @@ -2284,9 +2128,9 @@ "license": "BSD-3-Clause" }, "node_modules/fastify": { - "version": "5.12.1", - "resolved": "https://registry.npmjs.org/fastify/-/fastify-5.12.1.tgz", - "integrity": "sha512-FWi+tQvwxR/PeRX7Z2mhfEF5ozJ3jn9asiiclzKXNSzJRHAYcU924aIOKAdHFJ+YIKieh3cqr1IwCOvTr41B3Q==", + "version": "5.12.5", + "resolved": "https://registry.npmjs.org/fastify/-/fastify-5.12.5.tgz", + "integrity": "sha512-OB2k1dlxs5/NAABqeKV2FUHkSD2BbENsCak8yULVcymn3fHIPDVa9TI3SDnJSWYSllZmSYuZXy2gTnsT+Sut1A==", "funding": [ { "type": "github", @@ -2345,9 +2189,9 @@ } }, "node_modules/fastq": { - "version": "1.20.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", - "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", + "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", "license": "ISC", "dependencies": { "reusify": "^1.0.4" @@ -2447,9 +2291,9 @@ } }, "node_modules/hls.js": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.7.1.tgz", - "integrity": "sha512-DlzIkeBAS9IIQ432k3BUf3HlwbsR0+trB1i2lDdN2gUkNkrehFurh0/48M5c1/EjlDkdGng1gwZIpwyPxvdZ/g==", + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/hls.js/-/hls.js-1.7.3.tgz", + "integrity": "sha512-MsPlx6yVW4Qv4C7mEVou4/gk/5cN2dVxOTnrNjPSmyH2f0Ln+/UkG10Ax1PE6OvrmTVPKgQYozTtBaPOuCzq7A==", "license": "Apache-2.0" }, "node_modules/http-errors": { @@ -2592,13 +2436,6 @@ ], "license": "MIT" }, - "node_modules/loupe": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz", - "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==", - "dev": true, - "license": "MIT" - }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -2619,13 +2456,13 @@ } }, "node_modules/magic-string": { - "version": "0.30.21", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", - "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.3.tgz", + "integrity": "sha512-z12OxmaPGE0F4xlpGdjuAUckipLpQlTAuAmyGhNoD7ODpYUzvDfvtxUbjM/jwznyP178oju/KDdyi220wNJ0RQ==", "dev": true, "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" + "@jridgewell/sourcemap-codec": "^1.6.0" } }, "node_modules/mime": { @@ -2672,9 +2509,9 @@ "license": "MIT" }, "node_modules/nanoid": { - "version": "3.3.18", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.18.tgz", - "integrity": "sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==", + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", "dev": true, "funding": [ { @@ -2691,15 +2528,29 @@ } }, "node_modules/node-releases": { - "version": "2.0.53", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.53.tgz", - "integrity": "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ==", + "version": "2.0.58", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.58.tgz", + "integrity": "sha512-BdiKAgbfRlvfMq/XzO/AF9NPmaA8a+YpLAyAFTVFBj3gARrAIfWvNq7Q7NE4se3KgFu0KkrvQMxTS0XVnsGzHg==", "dev": true, "license": "MIT", "engines": { "node": ">=18" } }, + "node_modules/obug": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/obug/-/obug-2.2.1.tgz", + "integrity": "sha512-XrsrhT5sybtKI6wakr2SPOlGZWWYbUXZ7a0jT8/QOeAPau+1X/bSegNe5YR75oJmEZQbKningirmGOEJCIk61Q==", + "dev": true, + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/on-exit-leak-free": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", @@ -2735,31 +2586,14 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "11.5.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.2.tgz", - "integrity": "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g==", + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", "license": "BlueOak-1.0.0", "engines": { "node": "20 || >=22" } }, - "node_modules/pathe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", - "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", - "dev": true, - "license": "MIT" - }, - "node_modules/pathval": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", - "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.16" - } - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -2768,9 +2602,9 @@ "license": "ISC" }, "node_modules/picomatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", - "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", "dev": true, "license": "MIT", "engines": { @@ -2781,9 +2615,9 @@ } }, "node_modules/pino": { - "version": "10.3.1", - "resolved": "https://registry.npmjs.org/pino/-/pino-10.3.1.tgz", - "integrity": "sha512-r34yH/GlQpKZbU1BvFFqOjhISRo1MNx1tWYsYvmj6KIRHSPMT2+yHOEb1SG6NMvRoHRF0a07kCOox/9yakl1vg==", + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-10.4.0.tgz", + "integrity": "sha512-bk1ZMTwG/Vymx+zPoa28MhNzucFvXJWp3csrSuxuHPSMeUettaCoQ5Jvg07mtC4JGNpcfTwz41oVCnNgBK9+vA==", "license": "MIT", "dependencies": { "@pinojs/redact": "^0.4.0", @@ -2793,7 +2627,7 @@ "pino-std-serializers": "^7.0.0", "process-warning": "^5.0.0", "quick-format-unescaped": "^4.0.3", - "real-require": "^0.2.0", + "real-require": "^1.0.0", "safe-stable-stringify": "^2.3.1", "sonic-boom": "^4.0.1", "thread-stream": "^4.0.0" @@ -2818,9 +2652,9 @@ "license": "MIT" }, "node_modules/postcss": { - "version": "8.5.26", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.26.tgz", - "integrity": "sha512-u82N74LFzG8ca+dD8puPnplTXoGH4fTPpVGuIbt36G3qvNlkvfD0lEAZSxaly3KX8TS/L1A1gsCEmvKmBcVbkQ==", + "version": "8.5.29", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.29.tgz", + "integrity": "sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ==", "dev": true, "funding": [ { @@ -2838,9 +2672,9 @@ ], "license": "MIT", "dependencies": { - "nanoid": "^3.3.17", + "nanoid": "^3.3.19", "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" + "source-map-js": "^1.2.2" }, "engines": { "node": "^10 || ^12 || >=14" @@ -2869,24 +2703,24 @@ "license": "MIT" }, "node_modules/react": { - "version": "19.2.8", - "resolved": "https://registry.npmjs.org/react/-/react-19.2.8.tgz", - "integrity": "sha512-PWaYA1L/q9u2u7xYQi+Y3L3Yfnie7XyLeaJICV1MGD6LprsBxcAqGjYyr0eY3p+QdsA+x/Irkt4Qif8D63+Sbw==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.0.tgz", + "integrity": "sha512-E8LUcbtBWt20bbl2YoHfx4ZDBdxVTfOKtCZn9cDSJ4l6/nuoApcpIBcj47t2wZoVX8g2ZHuMHbiShgCR1T5Sog==", "license": "MIT", "engines": { "node": ">=0.10.0" } }, "node_modules/react-dom": { - "version": "19.2.8", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.8.tgz", - "integrity": "sha512-rVprimfGBG3DR+Tq0IQG2DT5PxKth1WIGDmj5yPmlzr4YBe7uyE+Du4oVqTDXZSHGGGXRtTJEGSSePyQCMBglQ==", + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-JDk8dgif51OjFoDE70+OT9ICyYr+69HlmihNwp1+Nsfbna3t5sIiCa9ZJktDmQ4/1b/rn26hIAR2uYXDMr5r0Q==", "license": "MIT", "dependencies": { - "scheduler": "^0.27.0" + "scheduler": "^0.28.0" }, "peerDependencies": { - "react": "^19.2.8" + "react": "^19.3.0" } }, "node_modules/react-refresh": { @@ -2900,13 +2734,10 @@ } }, "node_modules/real-require": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", - "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", - "license": "MIT", - "engines": { - "node": ">= 12.13.0" - } + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-1.0.0.tgz", + "integrity": "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g==", + "license": "MIT" }, "node_modules/require-directory": { "version": "2.1.1", @@ -2953,9 +2784,9 @@ "license": "MIT" }, "node_modules/rollup": { - "version": "4.62.5", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.5.tgz", - "integrity": "sha512-/tqMfgP7GPA3PHhCmuiS4vIjrSVhHLgY++i+dhbG462euyAj7FpM4D9uq1X3BgjlqRdpcOrYhcQtfiQLNc8tqw==", + "version": "4.64.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.64.2.tgz", + "integrity": "sha512-RxXm0XVVV1hFI3dYe12ruaOgsYQ725lUcUWeMSQqkF9tTxVErY+fy2Ets6vWhItL9MZMSNZGbvZFc7rH/VHp2Q==", "dev": true, "license": "MIT", "dependencies": { @@ -2970,31 +2801,31 @@ }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", - "@rollup/rollup-android-arm-eabi": "4.62.5", - "@rollup/rollup-android-arm64": "4.62.5", - "@rollup/rollup-darwin-arm64": "4.62.5", - "@rollup/rollup-darwin-x64": "4.62.5", - "@rollup/rollup-freebsd-arm64": "4.62.5", - "@rollup/rollup-freebsd-x64": "4.62.5", - "@rollup/rollup-linux-arm-gnueabihf": "4.62.5", - "@rollup/rollup-linux-arm-musleabihf": "4.62.5", - "@rollup/rollup-linux-arm64-gnu": "4.62.5", - "@rollup/rollup-linux-arm64-musl": "4.62.5", - "@rollup/rollup-linux-loong64-gnu": "4.62.5", - "@rollup/rollup-linux-loong64-musl": "4.62.5", - "@rollup/rollup-linux-ppc64-gnu": "4.62.5", - "@rollup/rollup-linux-ppc64-musl": "4.62.5", - "@rollup/rollup-linux-riscv64-gnu": "4.62.5", - "@rollup/rollup-linux-riscv64-musl": "4.62.5", - "@rollup/rollup-linux-s390x-gnu": "4.62.5", - "@rollup/rollup-linux-x64-gnu": "4.62.5", - "@rollup/rollup-linux-x64-musl": "4.62.5", - "@rollup/rollup-openbsd-x64": "4.62.5", - "@rollup/rollup-openharmony-arm64": "4.62.5", - "@rollup/rollup-win32-arm64-msvc": "4.62.5", - "@rollup/rollup-win32-ia32-msvc": "4.62.5", - "@rollup/rollup-win32-x64-gnu": "4.62.5", - "@rollup/rollup-win32-x64-msvc": "4.62.5", + "@rollup/rollup-android-arm-eabi": "4.64.2", + "@rollup/rollup-android-arm64": "4.64.2", + "@rollup/rollup-darwin-arm64": "4.64.2", + "@rollup/rollup-darwin-x64": "4.64.2", + "@rollup/rollup-freebsd-arm64": "4.64.2", + "@rollup/rollup-freebsd-x64": "4.64.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.64.2", + "@rollup/rollup-linux-arm-musleabihf": "4.64.2", + "@rollup/rollup-linux-arm64-gnu": "4.64.2", + "@rollup/rollup-linux-arm64-musl": "4.64.2", + "@rollup/rollup-linux-loong64-gnu": "4.64.2", + "@rollup/rollup-linux-loong64-musl": "4.64.2", + "@rollup/rollup-linux-ppc64-gnu": "4.64.2", + "@rollup/rollup-linux-ppc64-musl": "4.64.2", + "@rollup/rollup-linux-riscv64-gnu": "4.64.2", + "@rollup/rollup-linux-riscv64-musl": "4.64.2", + "@rollup/rollup-linux-s390x-gnu": "4.64.2", + "@rollup/rollup-linux-x64-gnu": "4.64.2", + "@rollup/rollup-linux-x64-musl": "4.64.2", + "@rollup/rollup-openbsd-x64": "4.64.2", + "@rollup/rollup-openharmony-arm64": "4.64.2", + "@rollup/rollup-win32-arm64-msvc": "4.64.2", + "@rollup/rollup-win32-ia32-msvc": "4.64.2", + "@rollup/rollup-win32-x64-gnu": "4.64.2", + "@rollup/rollup-win32-x64-msvc": "4.64.2", "fsevents": "~2.3.2" } }, @@ -3040,9 +2871,9 @@ } }, "node_modules/scheduler": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", - "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", "license": "MIT" }, "node_modules/secure-json-parse": { @@ -3084,9 +2915,9 @@ "license": "ISC" }, "node_modules/shell-quote": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.9.0.tgz", - "integrity": "sha512-Iov+JwFv/2HcTpcwNMKd8+IWNb8tboQJNQTkAY/LLVK7gGH9jy+LGkVqPxfekHl+yMmiqXszdGWXgkfml7hjqA==", + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.12.0.tgz", + "integrity": "sha512-PcByqNyT/38F2kDNi006HAMRJaULuBzq/FOsw3qdZvX/GA9W/jamDaRskgHjubHiftXK5sIFxLNkvrXUwcof6Q==", "dev": true, "license": "MIT", "engines": { @@ -3096,13 +2927,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true, - "license": "ISC" - }, "node_modules/sonic-boom": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.1.tgz", @@ -3113,9 +2937,9 @@ } }, "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", "dev": true, "license": "BSD-3-Clause", "engines": { @@ -3131,13 +2955,6 @@ "node": ">= 10.x" } }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true, - "license": "MIT" - }, "node_modules/statuses": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", @@ -3148,9 +2965,9 @@ } }, "node_modules/std-env": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", - "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", "dev": true, "license": "MIT" }, @@ -3182,26 +2999,6 @@ "node": ">=8" } }, - "node_modules/strip-literal": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.1.0.tgz", - "integrity": "sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==", - "dev": true, - "license": "MIT", - "dependencies": { - "js-tokens": "^9.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/strip-literal/node_modules/js-tokens": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", - "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", - "dev": true, - "license": "MIT" - }, "node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -3230,25 +3027,25 @@ "node": ">=20" } }, - "node_modules/thread-stream/node_modules/real-require": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/real-require/-/real-require-1.0.0.tgz", - "integrity": "sha512-P4nbQYQfePJxRSmY+v/KINxVucm4NF3p3s7pJveMTtom52FR4YGltUQLB8idDXwDDWW+eYrWDFbuzUnjoWHF7g==", - "license": "MIT" - }, "node_modules/tinybench": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", - "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.1.tgz", + "integrity": "sha512-IAbQaPJIIdhVxi0mqy9lez1wEwje0UQf9F1vwtbelEG5Nbgn0nPOxCvU+mNeNS9gyJTAhrHp74CbUaSynQpZcQ==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=20.0.0" + } }, "node_modules/tinyexec": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", - "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=18" + } }, "node_modules/tinyglobby": { "version": "0.2.17", @@ -3267,36 +3064,6 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinypool": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", - "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.0.0 || >=20.0.0" - } - }, - "node_modules/tinyrainbow": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", - "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.4.tgz", - "integrity": "sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/toad-cache": { "version": "3.7.4", "resolved": "https://registry.npmjs.org/toad-cache/-/toad-cache-3.7.4.tgz", @@ -3333,9 +3100,9 @@ "license": "0BSD" }, "node_modules/tsx": { - "version": "4.23.12", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.12.tgz", - "integrity": "sha512-FDf4L4sYzKtzWYhU/Xm0AQFdTjdIxNo9ElTf2mxXM6k8YMHXzYUe4yODVaXP4V9uMFbVg8c0qyBccK2OOxb45Q==", + "version": "4.23.15", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.23.15.tgz", + "integrity": "sha512-Yiex1Ovn8z2xPpOWckIiysV1SSyRMY9BkLF++q0yKiDxCqRhosKfMg3janKkiLBwZ5c/YryloKwGZcrEmtwxKw==", "license": "MIT", "dependencies": { "esbuild": "~0.28.0" @@ -3365,25 +3132,25 @@ } }, "node_modules/undici": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-7.29.0.tgz", - "integrity": "sha512-IDxfleLmmbSskfWSUATiN1nfn2rDuvnMOqb5CWR92iIfojA0Ud+ulOAAEQ57LPr9rWmsreUyf5lwyao+7GNNVw==", + "version": "7.30.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.0.tgz", + "integrity": "sha512-dkrQXeHSaoamnItlYbmzG0wFYrM0ZwDxCIg0A7aKjTyyhh9svRzCNFEzV+Vm05/yehjCzjDZ31KXfGEjYSztDQ==", "license": "MIT", "engines": { "node": ">=20.18.1" } }, "node_modules/undici-types": { - "version": "7.18.2", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz", - "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==", + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", "dev": true, "license": "MIT" }, "node_modules/update-browserslist-db": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.1.tgz", - "integrity": "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ==", + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz", + "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==", "dev": true, "funding": [ { @@ -3412,9 +3179,9 @@ } }, "node_modules/vite": { - "version": "7.3.6", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.6.tgz", - "integrity": "sha512-4XP60spRGjSZFf1qYH+dJIkK2znL3zQfl9KkOV9MkkRR/3Dls0dxaBsQPTloEc5BLXWPL9vsOxopxyKoMmDueg==", + "version": "7.3.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.7.tgz", + "integrity": "sha512-AHEzTORMbi7/7aXp7w7KZ5+DCUdSeLsJz0grY8xHpc9DHdYb0vQu6DqJfm2tOw3gDExNgPgnJTXxM6syYFHaCA==", "dev": true, "license": "MIT", "dependencies": { @@ -3486,89 +3253,73 @@ } } }, - "node_modules/vite-node": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", - "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.4.1", - "es-module-lexer": "^1.7.0", - "pathe": "^2.0.3", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, "node_modules/vitest": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.7.tgz", - "integrity": "sha512-KrxIJ62Fd89gfysR4WotlgZABiz2dqFPgqGzX7s+CwsqLFomRH7777ZcrOD6+WVAh7khPQP41A+BKbpcJFrdEg==", + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.0.3.tgz", + "integrity": "sha512-xMw97S3rjdtj5dkVat7jCsqWBpvchs3RlpQctUqwJD0KkERk40vz2fJ77lDwW/Vzh/pk18eItYAzkodhSes3jQ==", "dev": true, "license": "MIT", "dependencies": { "@types/chai": "^5.2.2", - "@vitest/expect": "3.2.7", - "@vitest/mocker": "3.2.7", - "@vitest/pretty-format": "^3.2.7", - "@vitest/runner": "3.2.7", - "@vitest/snapshot": "3.2.7", - "@vitest/spy": "3.2.7", - "@vitest/utils": "3.2.7", - "chai": "^5.2.0", - "debug": "^4.4.1", - "expect-type": "^1.2.1", - "magic-string": "^0.30.17", - "pathe": "^2.0.3", - "picomatch": "^4.0.2", - "std-env": "^3.9.0", - "tinybench": "^2.9.0", - "tinyexec": "^0.3.2", - "tinyglobby": "^0.2.14", - "tinypool": "^1.1.1", - "tinyrainbow": "^2.0.0", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", - "vite-node": "3.2.4", - "why-is-node-running": "^2.3.0" + "@vitest/mocker": "5.0.3", + "chai": "^6.2.2", + "es-module-lexer": "^2.3.2", + "expect-type": "^1.4.0", + "magic-string": "^1.2.3", + "obug": "^2.1.4", + "picomatch": "^4.0.7", + "std-env": "^4.2.0", + "tinybench": "^6.1.4", + "tinyexec": "^1.3.0", + "tinyglobby": "^0.2.17", + "why-is-node-running": "3.2.1" }, "bin": { "vitest": "vitest.mjs" }, "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + "node": "^22.12.0 || ^24.0.0 || >=26.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "@edge-runtime/vm": "*", - "@types/debug": "^4.1.12", - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "@vitest/browser": "3.2.7", - "@vitest/ui": "3.2.7", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "5.0.3", + "@vitest/browser-preview": "5.0.3", + "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", + "@vitest/coverage-istanbul": "5.0.3", + "@vitest/coverage-v8": "5.0.3", + "@vitest/ui": "5.0.3", "happy-dom": "*", - "jsdom": "*" + "jsdom": "*", + "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "@edge-runtime/vm": { "optional": true }, - "@types/debug": { + "@opentelemetry/api": { "optional": true }, "@types/node": { "optional": true }, - "@vitest/browser": { + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { "optional": true }, "@vitest/ui": { @@ -3579,24 +3330,23 @@ }, "jsdom": { "optional": true + }, + "vite": { + "optional": false } } }, "node_modules/why-is-node-running": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", - "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz", + "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==", "dev": true, "license": "MIT", - "dependencies": { - "siginfo": "^2.0.0", - "stackback": "0.0.2" - }, "bin": { "why-is-node-running": "cli.js" }, "engines": { - "node": ">=8" + "node": ">=20.11" } }, "node_modules/wrap-ansi": { @@ -3624,9 +3374,9 @@ "license": "ISC" }, "node_modules/ws": { - "version": "8.21.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.3.tgz", - "integrity": "sha512-201TZ/kPWxoPr/OKWjquZR1SWKXcvxdH+e1xrx89b3YbmzLMFCLfnaG1HFIgWzJOEWZ7MvpK++odZufgYR50Rw==", + "version": "8.22.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.22.0.tgz", + "integrity": "sha512-Ydggc987+RO0AnWtZ/7Wq9FtNvcrL1b/RO0ud9mWjUPgDrsAAwQSF51sm2hm1XofbU/4jkpGEsLFsZZxU+1DOg==", "license": "MIT", "engines": { "node": ">=10.0.0" @@ -3691,9 +3441,9 @@ } }, "node_modules/zod": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz", - "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==", + "version": "4.6.5", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.5.tgz", + "integrity": "sha512-v5l/aFXZQeai4awLbOpSoHecE9UiMrnfx75tEXLjNonXVARxQ5mOeipTjROUchszUNCqnE+hqAMujRsRHsut2Q==", "license": "MIT", "funding": { "url": "https://github.com/sponsors/colinhacks" diff --git a/package.json b/package.json index c7fa5f4..d18503a 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "concurrently": "^9.2.1", "typescript": "^5.9.2", "vite": "^7.1.3", - "vitest": "^3.2.4" + "vitest": "^5.0.3" }, "engines": { "node": ">=22.5" From ae3ab5adbcb9720d083c8c1dbdab7304c40bf918 Mon Sep 17 00:00:00 2001 From: MajorLOL <56225967+MajorLOL@users.noreply.github.com> Date: Fri, 9 Oct 2026 09:30:21 +0200 Subject: [PATCH 09/10] UI: delete single videos from the library and auto-hide fullscreen player controls - Add a delete button to each library card (shown on hover, always visible on touch devices) and a Delete action on the watch page, both with a confirmation. After deleting from the watch page you return to the list. - Fix the player controls and progress bar staying visible for the whole video in fullscreen: the hide timer was cleared on every timeupdate. Auto-hide now lives in src/player-controls.ts with unit tests. --- src/Player.test.tsx | 15 ++++++++++ src/Player.tsx | 38 ++++++++++++++++-------- src/library-app.tsx | 18 ++++++++---- src/library.css | 1 + src/player-controls.test.ts | 58 +++++++++++++++++++++++++++++++++++++ src/player-controls.ts | 27 +++++++++++++++++ src/watch-page.css | 1 + 7 files changed, 141 insertions(+), 17 deletions(-) create mode 100644 src/player-controls.test.ts create mode 100644 src/player-controls.ts diff --git a/src/Player.test.tsx b/src/Player.test.tsx index 3eebcea..b44b940 100644 --- a/src/Player.test.tsx +++ b/src/Player.test.tsx @@ -50,3 +50,18 @@ describe("video player", () => { expect(html).not.toContain('autoPlay=""'); }); }); + +describe("delete from the player", () => { + it("offers a delete action when the library allows it", () => { + vi.stubGlobal("localStorage", { getItem: () => null, setItem: vi.fn() }); + const html = renderToStaticMarkup(); + expect(html).toContain("watch-delete"); + expect(html).toContain(">Delete"); + }); + + it("hides the delete action when no delete handler is given", () => { + vi.stubGlobal("localStorage", { getItem: () => null, setItem: vi.fn() }); + const html = renderToStaticMarkup(); + expect(html).not.toContain("watch-delete"); + }); +}); diff --git a/src/Player.tsx b/src/Player.tsx index 67875dc..b8f4369 100644 --- a/src/Player.tsx +++ b/src/Player.tsx @@ -1,10 +1,11 @@ import { useEffect, useRef, useState } from "react"; -import { AlertTriangle, ArrowLeft, Captions, Check, Clock3, Grid3X3, Heart, LoaderCircle, Maximize, Minimize, Pause, Play, RefreshCw, Upload, Volume2, VolumeX } from "lucide-react"; +import { AlertTriangle, ArrowLeft, Captions, Check, Clock3, Grid3X3, Heart, LoaderCircle, Maximize, Minimize, Pause, Play, RefreshCw, Trash2, Upload, Volume2, VolumeX } from "lucide-react"; import { api } from "./api"; import { initialAutoplay, nextMediaId, PHOTO_AUTOPLAY_SECONDS } from "./playback"; import { loadPlayerAudio, savePlayerAudio } from "./player-audio"; import { monitorVideoStalls } from "./video-stall-recovery"; import { usePlayerFullscreen } from "./player-fullscreen"; +import { createControlsAutoHide } from "./player-controls"; import "./player.css"; import "./photo-player.css"; import "./watch-page.css"; @@ -28,11 +29,11 @@ function bytes(value = 0) { const units = ["B", "KB", "MB", "GB", "TB"]; const index = value ? Math.min(4, Math.floor(Math.log(value) / Math.log(1024))) : 0; return `${(value / 1024 ** index).toFixed(index > 2 ? 1 : 0)} ${units[index]}`; } -export function PlayerViewer({ media, context, autoStart = false, close, favorite, advance, setNotice }: { - media: Media; context: PlaybackContext; autoStart?: boolean; close: () => void; +export function PlayerViewer({ media, context, autoStart = false, close, favorite, advance, setNotice, remove }: { + media: Media; context: PlaybackContext; autoStart?: boolean; close: () => void; remove?: (media: Media) => Promise; favorite: (media: Media, value: boolean) => void; advance: (media: Media) => void; setNotice: (value: string) => void; }) { - const video = useRef(null); const player = useRef(null); const lastSaved = useRef(0); const hideTimer = useRef(undefined); + const video = useRef(null); const player = useRef(null); const lastSaved = useRef(0); const initialAudio = useRef(loadPlayerAudio()); const recoveryPosition = useRef(undefined); const [playbackError, setPlaybackError] = useState(""); @@ -43,7 +44,8 @@ export function PlayerViewer({ media, context, autoStart = false, close, favorit const { fullscreen, pageFullscreen, toggleFullscreen } = usePlayerFullscreen(player, video, media.id); const [autoplay, setAutoplay] = useState(() => initialAutoplay(media.kind, autoStart, localStorage.getItem("open-easyx.autoplay"))); const [photoRemaining, setPhotoRemaining] = useState(PHOTO_AUTOPLAY_SECONDS); const [photoReady, setPhotoReady] = useState(false); - const [captionMenu, setCaptionMenu] = useState(false); const [subtitleTrack, setSubtitleTrack] = useState(() => localStorage.getItem("open-easyx.subtitle-track") || "original"); + const [deleting, setDeleting] = useState(false); + const [captionMenu, setCaptionMenu] = useState(false); const captionMenuOpen = useRef(false); captionMenuOpen.current = captionMenu; const [subtitleTrack, setSubtitleTrack] = useState(() => localStorage.getItem("open-easyx.subtitle-track") || "original"); const [subtitles, setSubtitles] = useState({ status: "disabled", progress: 0, sourceLanguage: "", error: "", tracks: [] }); const [languages, setLanguages] = useState([]); const [uploadLanguage, setUploadLanguage] = useState("en"); const [uploading, setUploading] = useState(false); @@ -68,9 +70,15 @@ export function PlayerViewer({ media, context, autoStart = false, close, favorit return api(`/api/media/${media.id}/progress`, { method: "PUT", body: JSON.stringify({ position: element.currentTime, duration: element.duration || media.duration || 0, completed }) }).catch((error) => setNotice(error.message)); }; const closeViewer = () => { void save(false, true); close(); }; - const reveal = () => { - setControls(true); window.clearTimeout(hideTimer.current); - if (!video.current?.paused) hideTimer.current = window.setTimeout(() => { if (!captionMenu) setControls(false); }, 2400); + const autoHide = useRef>(undefined); + autoHide.current ??= createControlsAutoHide({ show: () => setControls(true), hide: () => setControls(false), paused: () => video.current?.paused ?? true, pinned: () => captionMenuOpen.current }); + const reveal = () => autoHide.current?.reveal(); + const deleteCurrent = async () => { + if (!remove || deleting) return; + if (!window.confirm(`Permanently delete "${media.title}"? This cannot be undone.`)) return; + setDeleting(true); video.current?.pause(); + try { if (await remove(media)) return; } catch { /* The app-level notice reports request failures. */ } + setDeleting(false); }; const togglePlayback = () => { const element = video.current; if (!element) return; if (element.paused) safePlay(element); else element.pause(); }; const seek = (value: number) => { const element = video.current; if (!element) return; element.currentTime = Math.max(0, Math.min(element.duration || 0, value)); setCurrentTime(element.currentTime); reveal(); }; @@ -91,7 +99,7 @@ export function PlayerViewer({ media, context, autoStart = false, close, favorit if (media.kind === "image") void api(`/api/media/${media.id}/progress`, { method: "PUT", body: JSON.stringify({ position: 0, duration: 0, completed: true }) }).catch(() => {}); }, [media.id, media.kind]); useEffect(() => { - lastSaved.current = 0; window.clearTimeout(hideTimer.current); + lastSaved.current = 0; autoHide.current?.cancel(); recoveryPosition.current = undefined; setPlaybackError(""); if (media.kind === "video" && video.current) { video.current.src = media.streamUrl; video.current.load(); @@ -140,12 +148,18 @@ export function PlayerViewer({ media, context, autoStart = false, close, favorit const key = (event: KeyboardEvent) => { if (event.key === "Escape" && captionMenu) { setCaptionMenu(false); return; } if (media.kind !== "video" || ["INPUT", "SELECT", "BUTTON"].includes((event.target as HTMLElement).tagName)) return; + reveal(); if (event.code === "Space" || event.key.toLowerCase() === "k") { event.preventDefault(); togglePlayback(); } else if (event.key === "ArrowLeft") seek(currentTime - 10); else if (event.key === "ArrowRight") seek(currentTime + 10); else if (event.key.toLowerCase() === "m") toggleMute(); else if (event.key.toLowerCase() === "f") void toggleFullscreen(); }; - window.addEventListener("keydown", key); return () => { window.removeEventListener("keydown", key); window.clearTimeout(hideTimer.current); }; + window.addEventListener("keydown", key); return () => window.removeEventListener("keydown", key); }, [captionMenu, currentTime, media.id, media.kind, fullscreen, pageFullscreen]); + // Only clear the auto-hide timer on unmount. Clearing it whenever the effect above re-runs (on every + // timeupdate) kept the controls and progress bar visible for the whole video in fullscreen. + useEffect(() => () => autoHide.current?.cancel(), []); + useEffect(() => { if (!captionMenu) reveal(); }, [captionMenu]); + useEffect(() => { reveal(); }, [fullscreen]); const upload = async (file?: File) => { if (!file) return; setUploading(true); @@ -175,11 +189,11 @@ export function PlayerViewer({ media, context, autoStart = false, close, favorit
event.stopPropagation()}>
seek(Number(event.target.value))} aria-label="Video position"/>
{ const element = video.current; if (!element) return; element.volume = Number(event.target.value); element.muted = element.volume === 0; }}/>
{playerTime(currentTime)}/{playerTime(duration)}
-
{captionMenu &&
Subtitles{subtitles.tracks.map((track) => )}{!subtitles.tracks.length &&

{subtitleText}

}
}
+
{captionMenu &&
Subtitles{subtitles.tracks.map((track) => )}{!subtitles.tracks.length &&

{subtitleText}

}
}
:
{media.title} setPhotoReady(true)} onError={() => setPhotoReady(true)}/>
{autoplay ? photoReady ? `Next item in ${photoRemaining}s` : "Loading photo…" : "Autoplay is off"}
}
-
{media.source || "Local library"} · {media.kind === "video" ? "Video" : "Photo"}

{media.title}

{media.performer || "Unsorted"}

+
{media.source || "Local library"} · {media.kind === "video" ? "Video" : "Photo"}

{media.title}

{media.performer || "Unsorted"}

{remove && }
{media.completed ? "Completed" : media.progressSeconds > 0 ? `${Math.round(media.progressSeconds / Math.max(1, media.duration) * 100)}% watched` : "Not started"}{media.viewCount} {media.viewCount === 1 ? "view" : "views"}{duration > 0 && {playerTime(duration)}}{media.width > 0 && media.height > 0 && {media.width}×{media.height}}{media.extension.replace(".", "").toUpperCase()} · {bytes(media.size)}
Local file{media.relativePath}
diff --git a/src/library-app.tsx b/src/library-app.tsx index ff6fa00..76ba79c 100644 --- a/src/library-app.tsx +++ b/src/library-app.tsx @@ -232,7 +232,7 @@ export function LibraryApp() { if (!dashboard) return
EX

Opening your private library…

; return
void rescan()} onRefreshPerformers={() => void refreshAllPerformers()}> - {routeMedia ? selected ? { const target = location.state?.easyx?.from ?? "/library"; setSelected(null); navigate(target, { replace: true }); void refresh(); }} favorite={updateFavorite} advance={(media) => { const from = location.state?.easyx?.from ?? "/library"; setSelected({ media, context: selected.context, autoStart: true }); navigate(mediaUrl(media), { state: playbackLocationState(from, selected.context, true) }); }} setNotice={setNotice}/> :
Loading media…
: routeLiveCam ? navigate(location.state?.easyx?.from ?? "/live-cam", { replace: true })}/> :
+ {routeMedia ? selected ? { const target = location.state?.easyx?.from ?? "/library"; setSelected(null); navigate(target, { replace: true }); void refresh(); }} favorite={updateFavorite} advance={(media) => { const from = location.state?.easyx?.from ?? "/library"; setSelected({ media, context: selected.context, autoStart: true }); navigate(mediaUrl(media), { state: playbackLocationState(from, selected.context, true) }); }} setNotice={setNotice} remove={async (media) => { const response = await deleteMedia([media.id]); if (!response.deleted.some((item) => item.id === media.id)) return false; const target = location.state?.easyx?.from ?? "/library"; setSelected(null); navigate(target, { replace: true }); return true; }}/> :
Loading media…
: routeLiveCam ? navigate(location.state?.easyx?.from ?? "/live-cam", { replace: true })}/> :
{page === "home" && } {page === "live-cam" && navigate(liveCamListUrl(preset), { replace: true })}/>} {page === "library" && navigate(pageUrl("library", preset), { replace: true })}/>} @@ -357,12 +357,20 @@ function Library({ preset = {}, favoriteOnly = false, historyOnly = false, open, const toggleSelected = (id: string) => setSelectedIds((current) => { const next = new Set(current); if (next.has(id)) next.delete(id); else next.add(id); return next; }); const selectPage = () => setSelectedIds((current) => result?.items.every((item) => current.has(item.id)) ? new Set() : new Set(result?.items.map((item) => item.id) ?? [])); const cancelSelection = () => { setSelectionMode(false); setSelectedIds(new Set()); }; + const dropFromResult = (removed: Set) => setResult((current) => current && ({ ...current, items: current.items.filter((item) => !removed.has(item.id)), total: Math.max(0, current.total - removed.size), pages: Math.max(1, Math.ceil((current.total - removed.size) / current.pageSize)) })); + const deleteOne = async (media: Media) => { + if (deleting || !window.confirm(`Permanently delete "${media.title}"? This cannot be undone.`)) return; + setDeleting(true); + try { const response = await remove([media.id]); dropFromResult(new Set(response.deleted.map((item) => item.id))); } + catch { /* The app-level notice reports request failures. */ } + finally { setDeleting(false); } + }; const deleteSelected = async () => { if (!selectedIds.size || !window.confirm(`Permanently delete ${selectedIds.size} selected ${selectedIds.size === 1 ? "file" : "files"}? This cannot be undone.`)) return; setDeleting(true); try { const response = await remove([...selectedIds]); const removed = new Set(response.deleted.map((item) => item.id)); - setResult((current) => current && ({ ...current, items: current.items.filter((item) => !removed.has(item.id)), total: Math.max(0, current.total - removed.size), pages: Math.max(1, Math.ceil((current.total - removed.size) / current.pageSize)) })); + dropFromResult(removed); setSelectedIds((current) => new Set([...current].filter((id) => !removed.has(id)))); if (!response.failed.length) cancelSelection(); } catch { /* The app-level notice reports request failures. */ } @@ -380,7 +388,7 @@ function Library({ preset = {}, favoriteOnly = false, historyOnly = false, open,
- {loading ?
Loading media…
: result?.items.length ?
{result.items.map((media) => open(item, { query: playlistQuery })} favorite={favorite} selectionMode={selectionMode} selected={selectedIds.has(media.id)} toggleSelected={toggleSelected}/>)}
:

No media found

Try another filter or scan the mounted media folder.

} + {loading ?
Loading media…
: result?.items.length ?
{result.items.map((media) => open(item, { query: playlistQuery })} favorite={favorite} selectionMode={selectionMode} selected={selectedIds.has(media.id)} toggleSelected={toggleSelected} remove={deleting ? undefined : deleteOne}/>)}
:

No media found

Try another filter or scan the mounted media folder.

} {result && result.pages > 1 &&
Page {page} of {result.pages}
} ; } @@ -407,7 +415,7 @@ function LazyImage({ src, className, alt, onLoad, onError }: { src: string; clas return {alt}; } -function MediaCard({ media, open, favorite, selectionMode = false, selected = false, toggleSelected }: { media: Media; open: OpenMedia; favorite: (media: Media, value: boolean) => void; selectionMode?: boolean; selected?: boolean; toggleSelected?: (id: string) => void }) { +function MediaCard({ media, open, favorite, selectionMode = false, selected = false, toggleSelected, remove }: { media: Media; open: OpenMedia; favorite: (media: Media, value: boolean) => void; selectionMode?: boolean; selected?: boolean; toggleSelected?: (id: string) => void; remove?: (media: Media) => void }) { const viewed = media.completed || (media.kind === "image" && media.viewCount > 0); const progress = viewed ? 100 : media.duration ? Math.min(100, media.progressSeconds / media.duration * 100) : 0; const timer = useRef(undefined); const [preview, setPreview] = useState(false); const [previewReady, setPreviewReady] = useState(false); const [unavailable, setUnavailable] = useState(false); @@ -424,7 +432,7 @@ function MediaCard({ media, open, favorite, selectionMode = false, selected = fa return
{selectionMode && } internalLink(event, activate)} onMouseMove={startPreview} onMouseLeave={stopPreview} onFocus={startPreview} onBlur={stopPreview} onWheel={stopPreview}> setUnavailable(true)}/>{preview && setPreviewReady(true)} onError={stopPreview}/>} {media.kind === "video" ? : }{media.kind === "video" ? : }{media.duration > 0 && }{progress > 0 && {viewed ? "Completed" : `${Math.round(progress)}%`}}{progress > 0 && } -
internalLink(event, activate)}>{media.title}

{media.performer || "Unsorted"}{media.source ? ` - ${sourceDomain(media.source)}` : ""}{media.viewCount ? ` · ${media.viewCount} ${media.viewCount === 1 ? "view" : "views"}` : ""}

{mediaQualityLabel(media)}
{!selectionMode && }
; +
internalLink(event, activate)}>{media.title}

{media.performer || "Unsorted"}{media.source ? ` - ${sourceDomain(media.source)}` : ""}{media.viewCount ? ` · ${media.viewCount} ${media.viewCount === 1 ? "view" : "views"}` : ""}

{mediaQualityLabel(media)}
{!selectionMode && }{!selectionMode && remove && }; } function EmptyLibrary({ scan }: { scan: Scan }) { diff --git a/src/library.css b/src/library.css index f622210..8edac38 100644 --- a/src/library.css +++ b/src/library.css @@ -62,3 +62,4 @@ .home-carousel>.home-carousel-image{position:absolute;inset:0;display:block;width:100%;height:100%;min-width:100%;min-height:100%;object-fit:cover;object-position:center;animation:home-carousel-in .45s ease both}.home-carousel-controls{position:absolute;right:24px;bottom:22px;z-index:3;display:flex;align-items:center;gap:8px;padding:5px;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:rgba(13,13,16,.72);backdrop-filter:blur(14px)}.home-carousel-controls button{width:34px;height:34px;display:grid;place-items:center;padding:0;border:0;border-radius:8px;background:rgba(255,255,255,.06)}.home-carousel-controls button:hover{background:rgba(255,255,255,.14)}.home-carousel-controls button svg{width:17px}.home-carousel-controls span{min-width:44px;color:#aaaab3;font-size:9px;font-weight:750;text-align:center}.home-carousel-dots{position:absolute;left:50%;bottom:15px;z-index:3;display:flex;max-width:38%;gap:5px;transform:translateX(-50%);overflow:hidden}.home-carousel-dots button{width:18px;height:3px;flex:0 1 18px;padding:0;border:0;border-radius:99px;background:rgba(255,255,255,.24);transition:.2s}.home-carousel-dots button.active{width:34px;flex-basis:34px;background:var(--red)}@keyframes home-carousel-in{from{opacity:.35;transform:scale(1.015)}to{opacity:1;transform:scale(1)}}@media(max-width:800px){.home-carousel-controls{right:14px;bottom:13px}.home-carousel-dots{left:24px;bottom:20px;max-width:45%;transform:none}.home-carousel-dots button{width:12px;flex-basis:12px}.home-carousel-dots button.active{width:24px;flex-basis:24px}}@media(max-width:520px){.home-carousel-controls span{display:none}.home-carousel-dots{display:none}} .media-facts{display:flex;align-items:center;gap:6px;margin-top:7px;color:#64646f;font-size:8px;font-weight:700}.media-facts>span{color:#9a9aa4}.media-facts>i{width:3px;height:3px;border-radius:50%;background:#484851}.media-facts time{white-space:nowrap} +.card-delete-button{position:absolute;z-index:4;top:12px;right:12px;display:grid;place-items:center;width:30px;height:30px;padding:0;border:1px solid rgba(255,255,255,.14);border-radius:9px;color:#fff;background:rgba(9,9,11,.72);backdrop-filter:blur(6px);opacity:0;transition:opacity .15s,background .15s,color .15s;cursor:pointer}.card-delete-button svg{width:15px;height:15px}.media-card:hover .card-delete-button,.card-delete-button:focus-visible{opacity:1}.card-delete-button:hover{color:#ff7082;background:rgba(40,8,14,.9);border-color:rgba(250,64,88,.45)}@media(hover:none){.card-delete-button{opacity:.85}} diff --git a/src/player-controls.test.ts b/src/player-controls.test.ts new file mode 100644 index 0000000..4c6f3af --- /dev/null +++ b/src/player-controls.test.ts @@ -0,0 +1,58 @@ +import { afterEach, describe, expect, it, vi } from "vitest"; +import { createControlsAutoHide, CONTROLS_HIDE_DELAY_MS } from "./player-controls"; + +function setup(state = { paused: false, pinned: false }) { + const show = vi.fn(); const hide = vi.fn(); + const controls = createControlsAutoHide({ show, hide, paused: () => state.paused, pinned: () => state.pinned }); + return { show, hide, controls, state }; +} + +afterEach(() => vi.useRealTimers()); + +describe("player controls auto-hide", () => { + it("hides the controls after the idle delay while playing", () => { + vi.useFakeTimers(); + const { show, hide, controls } = setup(); + controls.reveal(); + expect(show).toHaveBeenCalledOnce(); + vi.advanceTimersByTime(CONTROLS_HIDE_DELAY_MS - 1); + expect(hide).not.toHaveBeenCalled(); + vi.advanceTimersByTime(1); + expect(hide).toHaveBeenCalledOnce(); + }); + + it("keeps hiding even though playback progress keeps updating", () => { + vi.useFakeTimers(); + const { hide, controls } = setup(); + controls.reveal(); + for (let tick = 0; tick < 20; tick += 1) vi.advanceTimersByTime(250); // timeupdate cadence + expect(hide).toHaveBeenCalledOnce(); + }); + + it("restarts the idle delay on new activity", () => { + vi.useFakeTimers(); + const { hide, controls } = setup(); + controls.reveal(); vi.advanceTimersByTime(CONTROLS_HIDE_DELAY_MS - 100); + controls.reveal(); vi.advanceTimersByTime(CONTROLS_HIDE_DELAY_MS - 100); + expect(hide).not.toHaveBeenCalled(); + vi.advanceTimersByTime(100); + expect(hide).toHaveBeenCalledOnce(); + }); + + it("keeps the controls visible while paused or while a menu is open", () => { + vi.useFakeTimers(); + const paused = setup({ paused: true, pinned: false }); paused.controls.reveal(); + const pinned = setup({ paused: false, pinned: true }); pinned.controls.reveal(); + vi.advanceTimersByTime(CONTROLS_HIDE_DELAY_MS * 3); + expect(paused.hide).not.toHaveBeenCalled(); + expect(pinned.hide).not.toHaveBeenCalled(); + }); + + it("cancel stops a pending hide", () => { + vi.useFakeTimers(); + const { hide, controls } = setup(); + controls.reveal(); controls.cancel(); + vi.advanceTimersByTime(CONTROLS_HIDE_DELAY_MS * 2); + expect(hide).not.toHaveBeenCalled(); + }); +}); diff --git a/src/player-controls.ts b/src/player-controls.ts new file mode 100644 index 0000000..607de1f --- /dev/null +++ b/src/player-controls.ts @@ -0,0 +1,27 @@ +export const CONTROLS_HIDE_DELAY_MS = 2500; + +type AutoHideOptions = { + show: () => void; + hide: () => void; + /** True while playback is paused; the controls then stay visible. */ + paused: () => boolean; + /** True while something (such as the subtitle menu) needs the controls to stay open. */ + pinned: () => boolean; + delay?: number; +}; + +/** + * Shows the player controls on activity and hides them again after a short idle period while the + * video plays. The timer is only restarted by `reveal` (pointer, touch or keyboard activity), never + * by playback progress, so the progress bar disappears in fullscreen as expected. + */ +export function createControlsAutoHide({ show, hide, paused, pinned, delay = CONTROLS_HIDE_DELAY_MS }: AutoHideOptions) { + let timer: ReturnType | undefined; + const cancel = () => { if (timer !== undefined) clearTimeout(timer); timer = undefined; }; + const reveal = () => { + show(); cancel(); + if (paused()) return; + timer = setTimeout(() => { timer = undefined; if (!paused() && !pinned()) hide(); }, delay); + }; + return { reveal, cancel }; +} diff --git a/src/watch-page.css b/src/watch-page.css index f744d22..89a56b1 100644 --- a/src/watch-page.css +++ b/src/watch-page.css @@ -167,3 +167,4 @@ padding: 10px; } } +.watch-actions .watch-delete{color:#ff7082;border-color:rgba(250,64,88,.3)}.watch-actions .watch-delete:hover{background:rgba(250,64,88,.12)} From 8c81d88e5b86a5a622a49a2b65c3dad021402d24 Mon Sep 17 00:00:00 2001 From: raccommode Date: Fri, 9 Oct 2026 06:22:40 -0400 Subject: [PATCH 10/10] Fix live reconnects, backup identity merges and priority updates --- .env.example | 1 + README.md | 6 +- compose.yaml | 1 + plugins/cam4/index.ts | 16 ++-- plugins/cam4/search.test.ts | 42 ++++++++++ plugins/live-recorder.test.ts | 20 +++-- plugins/live-recorder.ts | 23 ++++-- plugins/stripchat/index.ts | 13 ++- plugins/stripchat/search.test.ts | 24 ++++++ scripts/docker-runtime-smoke.sh | 2 + server/backup.test.ts | 77 ++++++++++++++++- server/backup.ts | 133 +++++++++++++++++++----------- server/database.ts | 16 ++-- server/downloader.ts | 3 +- server/index.ts | 4 +- server/performer-priority.test.ts | 14 ++++ src/BackupSettings.tsx | 11 ++- src/Player.tsx | 6 +- src/library-app.tsx | 8 +- src/main.tsx | 3 +- 20 files changed, 332 insertions(+), 91 deletions(-) create mode 100644 plugins/cam4/search.test.ts create mode 100644 plugins/stripchat/search.test.ts diff --git a/.env.example b/.env.example index ba6a4d1..71f316e 100644 --- a/.env.example +++ b/.env.example @@ -10,4 +10,5 @@ EASYX_LOG_LEVEL=info EASYX_MAX_CONCURRENT_DOWNLOADS_LIMIT=8 # Wait for short live interruptions before finalizing an MP4; 0 disables merging. STRIPCHAT_MERGE_GAP_MINUTES=10 +CAM4_MERGE_GAP_MINUTES=10 BONGACAMS_MERGE_GAP_MINUTES=10 diff --git a/README.md b/README.md index db98ddf..280b838 100644 --- a/README.md +++ b/README.md @@ -104,7 +104,7 @@ For JavLibrary, see [Connect FlareSolverr](docs/FLARESOLVERR.md) for an existing Set `EASYX_MAX_CONCURRENT_DOWNLOADS_LIMIT` to a positive integer (default `8`) to raise the ceiling of **Settings → Automation → Maximum concurrent downloads**. Restart the server after changing it, then save the desired concurrency in Settings. Invalid values fall back to 8; the API, input and download queue share the same ceiling. -Stripchat and BongaCams recordings can span short interruptions. `STRIPCHAT_MERGE_GAP_MINUTES` and `BONGACAMS_MERGE_GAP_MINUTES` default to 10; set either to `0` to finalize as soon as its stream ends. BongaCams falls back to the Stripchat value when its own variable is unset. Waiting recordings occupy a download slot. Automatic recording restarts after a completed or failed session, with backoff for short/failed recordings. A manual stop, cancel or deletion stays suppressed until a successful scan observes the room offline or non-public, including across app restarts. +Stripchat, BongaCams and CAM4 recordings can span short interruptions. `STRIPCHAT_MERGE_GAP_MINUTES`, `BONGACAMS_MERGE_GAP_MINUTES` and `CAM4_MERGE_GAP_MINUTES` default to 10; set any of them to `0` to finalize as soon as its stream ends. BongaCams and CAM4 fall back to the Stripchat value when their own variable is unset. Waiting recordings occupy a download slot. Automatic recording restarts after a completed or failed session, with backoff for short/failed recordings. A manual stop, cancel or deletion stays suppressed until a successful scan observes the room offline or non-public, including across app restarts. Important environment variables include `PUID`, `PGID`, `EASYX_SCAN_INTERVAL_MINUTES`, `EASYX_WHISPER_MODEL`, `EASYX_TRANSLATION_MODEL`, and `EASYX_LOG_LEVEL`. @@ -125,3 +125,7 @@ Only download, retain, and view material you are legally authorized to access. T ## License [MIT](LICENSE) + +Settings → Backup exports your performer directory, source URLs, recording priorities, supported app settings and installed plugin IDs. Media files, local portraits, playback history and plugin credentials are excluded. Import merges records by name or linked account, reports conflicts and skipped settings, and keeps the result visible. Back up the data and media volumes separately for a complete recovery. + +A performer’s recording priority can be changed under Manage profile. Higher priorities start first and can stop a lower-priority live recording when all slots are occupied; the captured recording is kept. Paused recordings, file downloads and finalization are not interrupted. diff --git a/compose.yaml b/compose.yaml index d354ea3..8fee82c 100644 --- a/compose.yaml +++ b/compose.yaml @@ -11,6 +11,7 @@ services: PGID: ${PGID:-1000} EASYX_MAX_CONCURRENT_DOWNLOADS_LIMIT: ${EASYX_MAX_CONCURRENT_DOWNLOADS_LIMIT:-8} STRIPCHAT_MERGE_GAP_MINUTES: ${STRIPCHAT_MERGE_GAP_MINUTES:-10} + CAM4_MERGE_GAP_MINUTES: ${CAM4_MERGE_GAP_MINUTES:-10} BONGACAMS_MERGE_GAP_MINUTES: ${BONGACAMS_MERGE_GAP_MINUTES:-10} EASYX_DATA_DIR: /data EASYX_MEDIA_DIR: /media diff --git a/plugins/cam4/index.ts b/plugins/cam4/index.ts index fe8b9bd..cdcf638 100644 --- a/plugins/cam4/index.ts +++ b/plugins/cam4/index.ts @@ -202,7 +202,7 @@ function profileHeaders(username: string): Record { async function cam4Json(context: PluginContext, url: string, username: string): Promise<{ status: number; data?: Record }> { let status = 0; try { - const response = await context.fetch(url, { headers: profileHeaders(username), signal: context.signal ?? AbortSignal.timeout(20_000) }); + const response = await context.fetch(url, { headers: profileHeaders(username), signal: accountSignal(context, 20_000) }); status = response.status; if (response.status !== 403 && response.status !== 429) { if (!response.ok || response.status === 204) return { status: response.status }; @@ -218,6 +218,7 @@ async function cam4Json(context: PluginContext, url: string, username: string): try { const data = JSON.parse(body) as unknown; return { status: 200, ...(data && typeof data === "object" && !Array.isArray(data) ? { data: data as Record } : {}) }; } catch { return { status: 502 }; } } catch (error) { + context.signal?.throwIfAborted(); const code = /HTTP (\d{3})/.exec(error instanceof Error ? error.message : String(error))?.[1]; return { status: code ? Number(code) : status || 502 }; } @@ -227,7 +228,7 @@ type Cam4Profile = { username: string; imageUrl?: string; online?: boolean; gend function profileFromInfo(data: Record, username: string): Cam4Profile | undefined { const found = findString(data, new Set(["username", "screenname", "login"])); - if (found && found.toLowerCase() !== username.toLowerCase()) return undefined; + if (!found || found.toLowerCase() !== username.toLowerCase()) return undefined; const imageUrl = findString(data, new Set(["profileimagelink", "profileimageurl", "profilepictureurl", "avatarurl", "avatar", "photourl"])); const gender = findString(data, new Set(["gender", "sex"])); const country = findString(data, new Set(["country", "countrycode"])); @@ -257,12 +258,12 @@ export async function cam4ProfileByUsername(context: PluginContext, username: st const problems: string[] = []; for (const host of ["hu.cam4.com", "www.cam4.com"]) { const { status, data } = await cam4Json(context, `https://${host}/rest/v1.0/profile/${encodeURIComponent(username)}/info`, username); - if (data && status >= 200 && status < 300) return profileFromInfo(data, username); + if (data && status >= 200 && status < 300) { const profile = profileFromInfo(data, username); if (profile) return profile; } if (status === 404 || status === 410) return undefined; problems.push(`info on ${host}: HTTP ${status}`); } const stream = await cam4Json(context, `https://www.cam4.com/rest/v1.0/profile/${encodeURIComponent(username)}/streamInfo`, username); - if (stream.data && typeof stream.data.cdnURL === "string") return { username, online: true }; + if (stream.data && typeof stream.data.cdnURL === "string" && /^https?:\/\//i.test(stream.data.cdnURL)) return { username, online: true }; if (stream.status !== 204 && !(stream.status >= 200 && stream.status < 300)) problems.push(`streamInfo: HTTP ${stream.status}`); try { const html = await browserHtml(context, `https://www.cam4.com/${encodeURIComponent(username)}`); @@ -282,7 +283,7 @@ export async function searchCam4People(context: PluginContext, query: string): P let firstError: unknown; for (const username of cam4SearchUsernames(query)) { let profile: Cam4Profile | undefined; - try { profile = await cam4ProfileByUsername(context, username); } catch (error) { firstError ??= error; continue; } + try { profile = await cam4ProfileByUsername(context, username); } catch (error) { context.signal?.throwIfAborted(); firstError ??= error; continue; } if (!profile) continue; const profileUrl = `https://www.cam4.com/${encodeURIComponent(profile.username)}`; results.set(profile.username.toLowerCase(), { @@ -299,7 +300,7 @@ export async function searchCam4People(context: PluginContext, query: string): P /** Adds the CAM4 room of a performer picked in "Find a performer" (or linked to CAM4 before). */ export async function discoverCam4Sources(_context: PluginContext, performer: PerformerRecord): Promise { const linked = performer.externalRefs?.["org.easyx.cam4"]; - const found = typeof linked === "string" ? cam4SearchUsernames(linked)[0] : undefined; + const found = typeof linked === "string" ? cam4SearchUsernames(linked.replace(/^live:/i, ""))[0] : undefined; if (!found) return []; // Prefer the spelling of the performer name (the stored reference is lower case). const username = performer.name.toLowerCase() === found.toLowerCase() ? performer.name : found; @@ -349,7 +350,7 @@ const isLivePlaylist = (text: string) => text.trimStart().startsWith("#EXTM3U") async function playlistText(context: PluginContext, url: string): Promise { try { - const response = await context.fetch(url, { headers: { ...cam4StreamHeaders(), "user-agent": USER_AGENT }, signal: context.signal ?? AbortSignal.timeout(15_000) }); + const response = await context.fetch(url, { headers: { ...cam4StreamHeaders(), "user-agent": USER_AGENT }, signal: accountSignal(context, 15_000) }); return response.ok ? await response.text() : undefined; } catch (error) { if (context.signal?.aborted) throw error; return undefined; } } @@ -397,6 +398,7 @@ export async function resolveCam4Download(context: PluginContext, item: MediaCan } catch (error) { lastError = error; } if (attempt < HLS_ATTEMPTS) await retryDelay(HLS_RETRY_MS, context.signal); } + context.signal?.throwIfAborted(); // CAM4 answered, but the room has no public stream. if (!lastError) throw new Error("The CAM4 room is not public"); // The room API could not be used: let yt-dlp try, as before this change. diff --git a/plugins/cam4/search.test.ts b/plugins/cam4/search.test.ts new file mode 100644 index 0000000..4f8edb7 --- /dev/null +++ b/plugins/cam4/search.test.ts @@ -0,0 +1,42 @@ +import { describe, expect, it, vi } from "vitest"; +import { cam4SearchUsernames, cam4ProfileByUsername, searchCam4People, discoverCam4Sources, resolveCam4Download } from "./index.js"; +import type { PluginContext } from "../../packages/plugin-sdk/index.js"; +function context(): PluginContext { + return { config: {}, fetch: vi.fn(async () => Response.json({ username: "Alice", online: false, gender: "female" })), log: vi.fn(), runCommand: vi.fn(async () => ({ exitCode: 0, stdout: '', stderr: "" })) }; +} +describe("CAM4 performer discovery", () => { + it.each([["@Alice", ["Alice"]], ["Jane Doe", ["JaneDoe", "Jane_Doe"]], ["https://www.cam4.com/Alice", ["Alice"]], ["a/b", []]])("accepts exact username query %s", (query, expected) => { + expect(cam4SearchUsernames(query as string)).toEqual(expected); + }); + it("finds a confirmed offline account", async () => { + expect(await searchCam4People(context(), "Alice")).toMatchObject([{ externalId: "alice", metadata: { online: false } }]); + }); + it("does not invent an account from an empty success response", async () => { + const ctx = context(); vi.mocked(ctx.fetch).mockImplementation(async () => Response.json({})); + vi.mocked(ctx.runCommand).mockResolvedValue({ exitCode: 0, stdout: "Not found", stderr: "" }); + expect(await cam4ProfileByUsername(ctx, "Ghost")).toBeUndefined(); + }); + it("uses the public page when JSON endpoints require authentication", async () => { + const ctx = context(); vi.mocked(ctx.fetch).mockImplementation(async () => new Response("", { status: 401 })); + expect(await cam4ProfileByUsername(ctx, "Alice")).toMatchObject({ username: "Alice" }); + }); + it("accepts legacy live links and never guesses a source from a name", async () => { + expect(await discoverCam4Sources(context(), { id: "p", name: "Alice", aliases: [], externalRefs: {} })).toEqual([]); + expect(await discoverCam4Sources(context(), { id: "p", name: "Alice", aliases: [], externalRefs: { "org.easyx.cam4": "live:alice" } })).toMatchObject([{ profileUrl: "https://www.cam4.com/Alice" }]); + }); + it("passes a stream refresh endpoint to the shared recorder and selects the best variant", async () => { + const ctx = context(); vi.mocked(ctx.fetch).mockImplementation(async (url) => { + if (String(url).includes("streamInfo")) return Response.json({ cdnURL: "https://cdn.test/master.m3u8" }); + if (String(url).endsWith("master.m3u8")) return new Response("#EXTM3U\n#EXT-X-STREAM-INF:BANDWIDTH=100\nlow.m3u8\n#EXT-X-STREAM-INF:BANDWIDTH=900\nhigh.m3u8\n"); + return new Response("#EXTM3U\n#EXTINF:2\npart.ts\n"); + }); + expect(await resolveCam4Download(ctx, { externalId: "alice", mediaType: "video", pageUrl: "https://www.cam4.com/Alice" })).toMatchObject({ requireSuccessfulExit: true, args: expect.arrayContaining(["https://cdn.test/high.m3u8", "https://www.cam4.com/rest/v1.0/profile/Alice/streamInfo", "cdnURL"]) }); + }); + it("propagates cancellation without trying the next lookup or downloader", async () => { + const controller = new AbortController(); controller.abort(new Error("Cancelled")); + const ctx = { ...context(), signal: controller.signal }; vi.mocked(ctx.fetch).mockRejectedValue(controller.signal.reason); + await expect(searchCam4People(ctx, "Jane Doe")).rejects.toThrow("Cancelled"); + expect(ctx.fetch).toHaveBeenCalledTimes(1); + await expect(resolveCam4Download(ctx, { externalId: "alice", mediaType: "video", pageUrl: "https://www.cam4.com/Alice" })).rejects.toThrow("Cancelled"); + }); +}); diff --git a/plugins/live-recorder.test.ts b/plugins/live-recorder.test.ts index ea8b66c..8b4fc3e 100644 --- a/plugins/live-recorder.test.ts +++ b/plugins/live-recorder.test.ts @@ -8,23 +8,25 @@ import { afterEach, describe, expect, it } from "vitest"; import { LIVE_RECORDER_SCRIPT, retryDelay } from "./live-recorder.js"; const cleanup: Array<() => unknown> = []; afterEach(() => { for (const dispose of cleanup.splice(0).reverse()) dispose(); }); -async function fixture(mode: "merge" | "stop" | "cancel" | "finite") { +async function fixture(mode: "merge" | "stop" | "cancel" | "finite" | "refresh") { const root = fs.mkdtempSync(path.join(os.tmpdir(), "easyx-recorder-'quoted-")); cleanup.push(() => fs.rmSync(root, { recursive: true, force: true })); const sample = path.join(root, "sample.ts"); execFileSync("ffmpeg", ["-v", "error", "-f", "lavfi", "-i", "testsrc2=size=64x64:rate=10", "-t", "0.5", "-c:v", "libx264", "-f", "mpegts", sample]); const ffmpeg = execFileSync("which", ["ffmpeg"], { encoding: "utf8" }).trim(); const bin = path.join(root, "bin"); fs.mkdirSync(bin); // Controlled stream endings; real FFmpeg remuxes the captured MPEG-TS parts. - fs.writeFileSync(path.join(bin, "ffmpeg"), `#!${process.execPath}\nconst fs=require('node:fs'),{spawnSync}=require('node:child_process');const args=process.argv.slice(2);if(args.includes('concat')){const result=spawnSync(${JSON.stringify(ffmpeg)},args,{stdio:'inherit'});process.exit(result.status??1)}fs.copyFileSync(${JSON.stringify(sample)},args.at(-1));if(${JSON.stringify(mode)}==='stop'||${JSON.stringify(mode)}==='cancel'){setInterval(()=>{},1000);process.on('SIGINT',()=>process.exit(0))}`); + fs.writeFileSync(path.join(bin, "ffmpeg"), `#!${process.execPath}\nconst fs=require('node:fs'),{spawnSync}=require('node:child_process');const args=process.argv.slice(2);if(args.includes('concat')){const result=spawnSync(${JSON.stringify(ffmpeg)},args,{stdio:'inherit'});process.exit(result.status??1)}fs.appendFileSync(${JSON.stringify(path.join(root, "inputs.txt"))}, args[args.indexOf('-i')+1]+'\\n');fs.copyFileSync(${JSON.stringify(sample)},args.at(-1));if(${JSON.stringify(mode)}==='stop'||${JSON.stringify(mode)}==='cancel'){setInterval(()=>{},1000);process.on('SIGINT',()=>process.exit(0))}`); fs.chmodSync(path.join(bin, "ffmpeg"), 0o755); const output = path.join(root, "output.mp4"); - const server = http.createServer((_request, response) => { + const server = http.createServer((request, response) => { + if (request.url === "/streamInfo") { response.setHeader("content-type", "application/json"); response.end(JSON.stringify({ cdnURL: `http://${request.headers.host}/second.m3u8` })); return; } + const firstEnded = mode === "refresh" && request.url === "/live.m3u8" && fs.existsSync(path.join(root, "live-parts", "part-001.ts")); const second = fs.existsSync(path.join(root, "live-parts", "part-002.ts")); - response.end("#EXTM3U\n#EXT-X-MEDIA-SEQUENCE:1\n#EXTINF:1\nsegment.ts\n" + ((second || mode === "finite") ? "#EXT-X-ENDLIST\n" : "")); + response.end("#EXTM3U\n#EXT-X-MEDIA-SEQUENCE:1\n#EXTINF:1\nsegment.ts\n" + ((second || firstEnded || mode === "finite") ? "#EXT-X-ENDLIST\n" : "")); }); server.listen(0, "127.0.0.1"); await once(server, "listening"); cleanup.push(() => server.close()); const address = server.address() as { port: number }; const url = `http://127.0.0.1:${address.port}/live.m3u8`; - const child = spawn(process.execPath, ["-e", LIVE_RECORDER_SCRIPT, url, url, "{}", output, "180", "20", "Test"], { detached: true, env: { ...process.env, PATH: `${bin}:${process.env.PATH}` }, stdio: ["ignore", "pipe", "pipe"] }); + const child = spawn(process.execPath, ["-e", LIVE_RECORDER_SCRIPT, url, url, "{}", output, "300", "20", "Test", ...(mode === "refresh" ? [`http://127.0.0.1:${address.port}/streamInfo`, "cdnURL"] : [])], { detached: true, env: { ...process.env, PATH: `${bin}:${process.env.PATH}` }, stdio: ["ignore", "pipe", "pipe"] }); cleanup.push(() => { try { process.kill(-child.pid!, "SIGKILL"); } catch {} }); const finished = once(child, "close"); let logs = ""; child.stderr.on("data", (chunk) => { logs += chunk; }); return { root, output, child, finished, logs: () => logs }; @@ -36,6 +38,14 @@ describe("segmented live recorder", () => { expect(duration).toBeGreaterThan(.7); expect(f.logs()).toContain("joined 2 parts"); expect(fs.existsSync(path.join(f.root, "live-parts"))).toBe(false); }, 10_000); + it("refreshes the room address when CAM4 returns on a different stream", { timeout: 10_000 }, async () => { + const f = await fixture("refresh"); expect((await f.finished)[0], f.logs()).toBe(0); + const inputs = fs.readFileSync(path.join(f.root, "inputs.txt"), "utf8").trim().split("\n"); + expect(inputs).toHaveLength(2); expect(inputs[0]).toContain("/live.m3u8"); expect(inputs[1]).toContain("/second.m3u8"); + expect(f.logs()).toContain("joined 2 parts"); + const duration = Number(execFileSync("ffprobe", ["-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", f.output], { encoding: "utf8" })); + expect(duration).toBeGreaterThan(.7); + }); it("does not resume a finite playlist", async () => { const f = await fixture("finite"); expect((await f.finished)[0], f.logs()).toBe(0); expect(f.logs()).not.toContain("continuing the recording"); expect(fs.statSync(f.output).size).toBeGreaterThan(0); diff --git a/plugins/live-recorder.ts b/plugins/live-recorder.ts index 5658aeb..c68906c 100644 --- a/plugins/live-recorder.ts +++ b/plugins/live-recorder.ts @@ -3,8 +3,9 @@ export const LIVE_RECORDER_SCRIPT = String.raw` const { spawn } = require("node:child_process"); const fs = require("node:fs"); const path = require("node:path"); -const [mediaUrl, masterUrl, headersJson, output, gapArg, pollArg, userAgent] = process.argv.slice(1); +const [mediaUrl, masterUrl, headersJson, output, gapArg, pollArg, userAgent, refreshUrl, refreshField] = process.argv.slice(1); const headers = JSON.parse(headersJson); +let currentMasterUrl = masterUrl; const gapMs = Number(gapArg) || 0; const pollMs = Number(pollArg) || 20000; const partsDir = path.join(path.dirname(output), "live-parts"); @@ -28,17 +29,25 @@ async function get(url) { const response = await fetch(url, { headers: { ...headers, "user-agent": userAgent }, signal: AbortSignal.any([controller.signal, AbortSignal.timeout(15000)]) }); return response.ok ? response.text() : undefined; } -async function variants() { - const text = await get(masterUrl); +async function variants(refresh = false) { + if (refresh && refreshUrl && refreshField) { + const body = await get(refreshUrl); + if (!body) return []; + const data = JSON.parse(body); + const next = data && data[refreshField]; + if (typeof next !== "string" || !/^https?:\/\//i.test(next)) return []; + currentMasterUrl = next; + } + const text = await get(currentMasterUrl); if (!text || !text.trimStart().startsWith("#EXTM3U") || text.includes("#EXT-X-MOUFLON-ADVERT")) return []; - if (isLive(text)) return [{ url: masterUrl, resolution: "", bandwidth: 0 }]; - const pkey = new URL(masterUrl).searchParams.get("pkey"); + if (isLive(text)) return [{ url: currentMasterUrl, resolution: "", bandwidth: 0 }]; + const pkey = new URL(currentMasterUrl).searchParams.get("pkey"); const list = []; let info = ""; for (const raw of text.split(/\r?\n/)) { const line = raw.trim(); if (line.startsWith("#EXT-X-STREAM-INF")) { info = line; continue; } if (!line || line.startsWith("#") || !/\.m3u8(?:$|\?)/i.test(line)) continue; - const url = new URL(line, masterUrl); + const url = new URL(line, currentMasterUrl); if (pkey && !url.searchParams.has("pkey")) url.searchParams.set("pkey", pkey); list.push({ url: url.toString(), bandwidth: Number((info.match(/(?:^|[:,])BANDWIDTH=(\d+)/i) || [])[1] || 0), resolution: (info.match(/RESOLUTION=(\d+x\d+)/i) || [])[1] || "" }); info = ""; @@ -46,7 +55,7 @@ async function variants() { return list.sort((a, b) => b.bandwidth - a.bandwidth); } async function liveVariant(resolution) { - const list = await variants(); + const list = await variants(true); const ordered = resolution ? list.filter((item) => item.resolution === resolution) : list; for (const item of ordered) { try { const text = await get(item.url); if (text && isLive(text)) return item; } catch {} diff --git a/plugins/stripchat/index.ts b/plugins/stripchat/index.ts index eb063eb..5c9ac4f 100644 --- a/plugins/stripchat/index.ts +++ b/plugins/stripchat/index.ts @@ -459,12 +459,17 @@ export function stripchatModelsInState(state: unknown, username: string): Record export function stripchatModelFromPage(html: string, username: string): StripchatModel | undefined { const models = stripchatModelsInState(preloadedState(html), username); - if (!models.length || models.every((item) => item.isModel === false)) return undefined; + const state = preloadedState(html) as { viewCam?: { model?: Record } } | undefined; + const roomModel = state?.viewCam?.model; + const confirmed = models.some((item) => item.isModel === true) + || (roomModel && roomModel.isModel !== false && String(roomModel.username ?? roomModel.login ?? "").toLowerCase() === username.toLowerCase()); + if (!models.length || !confirmed) return undefined; const pick = (key: string) => models.map((item) => textValue(item[key])).find(Boolean); return { username: pick("username") ?? pick("login") ?? username, avatarUrl: pick("avatarUrl") ?? pick("previewUrlThumbSmall") ?? pick("previewUrl"), - online: models.some((item) => item.isLive === true || item.isOnline === true) || undefined, + online: models.some((item) => item.isLive === true || item.isOnline === true) ? true + : models.some((item) => item.isLive === false || item.isOnline === false) ? false : undefined, gender: pick("gender"), country: pick("country"), }; } @@ -500,7 +505,7 @@ export async function searchStripchatPeople(context: PluginContext, query: strin try { const model = await stripchatModelByUsername(context, username); if (model) results.set(model.username.toLowerCase(), personFromModel(model)); - } catch (error) { firstError ??= error; } + } catch (error) { context.signal?.throwIfAborted(); firstError ??= error; } } if (!results.size && firstError) throw firstError instanceof Error ? firstError : new Error(String(firstError)); return [...results.values()]; @@ -509,7 +514,7 @@ export async function searchStripchatPeople(context: PluginContext, query: strin /** Adds the Stripchat room of a performer picked in "Find a performer" (or linked to Stripchat before). */ export async function discoverStripchatSources(_context: PluginContext, performer: PerformerRecord): Promise { const linked = textValue(performer.externalRefs?.["org.easyx.stripchat"]); - const found = linked ? stripchatSearchUsernames(linked)[0] : undefined; + const found = linked ? stripchatSearchUsernames(linked.replace(/^live:/i, ""))[0] : undefined; if (!found) return []; // Prefer the spelling of the performer name (the stored reference is lower case). const username = performer.name.toLowerCase() === found.toLowerCase() ? performer.name : found; diff --git a/plugins/stripchat/search.test.ts b/plugins/stripchat/search.test.ts new file mode 100644 index 0000000..7fe819c --- /dev/null +++ b/plugins/stripchat/search.test.ts @@ -0,0 +1,24 @@ +import { describe, expect, it, vi } from "vitest"; +import { stripchatSearchUsernames, stripchatModelFromPage, searchStripchatPeople, discoverStripchatSources } from "./index.js"; +const page = (state: unknown) => ``; +const context = () => ({ config: {}, fetch, log: vi.fn(), runCommand: vi.fn(async () => ({ exitCode: 0, stdout: page({ viewCam: { model: { id: 1, username: "Alice", isOnline: false } } }), stderr: "" })) }); +describe("Stripchat performer discovery", () => { + it.each([["@Alice", ["Alice"]], ["Jane Doe", ["JaneDoe", "Jane_Doe", "Jane-Doe"]], ["https://stripchat.com/Alice", ["Alice"]], ["a/b", []]])("accepts exact username query %s", (query, expected) => { + expect(stripchatSearchUsernames(query as string)).toEqual(expected); + }); + it("finds offline room models and preserves their online=false status", async () => { + expect(await searchStripchatPeople(context(), "Alice")).toMatchObject([{ externalId: "alice", metadata: { online: false } }]); + }); + it("does not confuse viewer/user records with model records", () => { + expect(stripchatModelFromPage(page({ user: { username: "Alice", id: 1 } }), "Alice")).toBeUndefined(); + expect(stripchatModelFromPage(page({ viewCam: { model: { username: "Alice", id: 1, isModel: false } } }), "Alice")).toBeUndefined(); + expect(stripchatModelFromPage(page({ models: [{ username: "Alice", id: 1, isModel: true }] }), "Alice")).toMatchObject({ username: "Alice" }); + }); + it("parses escaped quotes and braces without confusing the page state", () => { + expect(stripchatModelFromPage(page({ viewCam: { model: { id: 1, username: "Alice", bio: 'hello "{world}"', isModel: true } } }), "Alice")?.username).toBe("Alice"); + }); + it("only discovers a linked room, including legacy live references", async () => { + expect(await discoverStripchatSources(context(), { id: "p", name: "Alice", aliases: [], externalRefs: {} })).toEqual([]); + expect(await discoverStripchatSources(context(), { id: "p", name: "Alice", aliases: [], externalRefs: { "org.easyx.stripchat": "live:alice" } })).toMatchObject([{ externalId: "https://stripchat.com/Alice" }]); + }); +}); diff --git a/scripts/docker-runtime-smoke.sh b/scripts/docker-runtime-smoke.sh index 8026804..7df97b9 100644 --- a/scripts/docker-runtime-smoke.sh +++ b/scripts/docker-runtime-smoke.sh @@ -25,6 +25,8 @@ for attempt in {1..20}; do sleep 1 done +# The dependency overrides must preserve the imports used by the authentication helper. +docker exec "$container" /opt/ofscraper/bin/python -c 'from ofscraper.main.open import load; from ofscraper.data.api.init import getstatus; import idna, lxml.etree; print("OF-Scraper imports OK", idna.__version__, lxml.etree.LXML_VERSION)' docker exec "$container" sh -lc 'test "$(awk "/^Uid:/ { print \$2 }" /proc/1/status)" = 99 && test "$(cat /proc/1/comm)" = tini' docker exec "$container" sh -lc 'test -w /data && test -f /data/easyx.sqlite && test -f /data/open-easyx-library.sqlite' docker exec -e EXPECTED_VERSION="$version" "$container" node -e "fetch('http://127.0.0.1:3210/api/health').then(r=>r.json()).then(v=>{if(v.product!=='Open EasyX'||!v.ok||v.version!==process.env.EXPECTED_VERSION)throw Error(JSON.stringify(v))})" diff --git a/server/backup.test.ts b/server/backup.test.ts index bc48229..64dfa2b 100644 --- a/server/backup.test.ts +++ b/server/backup.test.ts @@ -1,4 +1,4 @@ -import { afterEach, describe, expect, it } from "vitest"; +import { afterEach, describe, expect, it, vi } from "vitest"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; @@ -14,7 +14,7 @@ async function library() { const pluginDir = temp("easyx-backup-plugins"); const packageDir = path.join(pluginDir, "test"); fs.mkdirSync(packageDir); fs.writeFileSync(path.join(packageDir, "index.mjs"), `export default { manifest: { id: "test.live", name: "Live", version: "1", description: "Test", author: "Test", capabilities: ["media-listing"], sourceUrlPatterns: ["https://live.test/*"], - settings: [{ key: "password", label: "Password", type: "password" }] }, + polling: { mode: "live", minimumIntervalSeconds: 5, defaultIntervalSeconds: 10 }, settings: [{ key: "password", label: "Password", type: "password" }] }, listMedia: async () => [] };`); const db = new Database(temp("easyx-backup-data")); const plugins = new PluginManager(db, [pluginDir]); await plugins.load(); @@ -88,6 +88,79 @@ describe("backup export and import", () => { } finally { db.close(); } }); + it("restores all linked identities after performers were merged", async () => { + const source = await filledLibrary(); const alice = source.db.getPerformerByName("Alice")!; + source.db.upsertPerformer({ externalId: "second-alice", name: "Alice" }, "test.live", alice.id); + const backup = parseBackup(exportBackup(source.db, source.plugins)); source.db.close(); + const { db, plugins } = await library(); + try { + importBackup(db, plugins, backup); + expect(db.findPerformerByIdentity("test.live", "alice")?.id).toBe(db.findPerformerByIdentity("test.live", "second-alice")?.id); + expect(db.performerIdentities(db.getPerformerByName("Alice")!.id)).toHaveLength(2); + } finally { db.close(); } + }); + + it("matches a renamed performer by identity and reports conflicting identities without changing records", async () => { + const { db, plugins } = await filledLibrary(); + try { + const backup = parseBackup(exportBackup(db, plugins)); backup.performers[0].name = "Alicia"; + const result = importBackup(db, plugins, backup); + expect(result.performers.created).toBe(0); expect(db.listPerformers()).toHaveLength(2); + expect(db.getPerformerByName("Alice")?.aliases).toContain("Alicia"); + const bob = db.getPerformerByName("Bob")!; db.mergePerformerDetails(bob.id, { externalRefs: { "test.live": "bob" } }); + backup.performers[0].name = "Alice"; backup.performers[0].externalRefs = { "test.live": "bob" }; + const conflicted = importBackup(db, plugins, backup); + expect(conflicted.performers.skipped).toMatchObject([{ name: "Alice" }]); + expect(db.getPerformerByName("Alice")?.externalRefs).toEqual({ "test.live": "alice" }); + expect(() => db.mergePerformerDetails(bob.id, { externalRefs: { "test.live": "alice" } })).toThrow(); + expect(db.getPerformer(bob.id)?.externalRefs).toEqual({ "test.live": "bob" }); + } finally { db.close(); } + }); + + it("deduplicates sources by normalized account URL even when external IDs differ", async () => { + const { db, plugins } = await filledLibrary(); + try { + const backup = parseBackup(exportBackup(db, plugins)); const source = backup.performers[0].sources[0]; + source.externalId = "manual-alice"; source.profileUrl += "/"; + const result = importBackup(db, plugins, backup); + expect(result.sources).toMatchObject({ added: 0, updated: 1 }); expect(db.listSources()).toHaveLength(1); + } finally { db.close(); } + }); + + it("keeps other settings when a persisted value exceeds this server's ceiling", async () => { + const { db, plugins } = await filledLibrary(); + try { + db.updateSettings({ maxConcurrentDownloads: 100_000, retentionDays: 7, secretValue: "not-exported" }); + const backup = parseBackup(exportBackup(db, plugins)); + expect(backup.settings).toMatchObject({ maxConcurrentDownloads: 100_000, retentionDays: 7 }); + expect(backup.settings).not.toHaveProperty("secretValue"); + const result = importBackup(db, plugins, backup); expect(result.settings.skipped).toContain("maxConcurrentDownloads"); + expect(result.settings.applied).toContain("retentionDays"); + } finally { db.close(); } + }); + + it("restores unavailable sources with scraping disabled and enforces plugin polling minimums", async () => { + const { db, plugins } = await filledLibrary(); + try { + const backup = parseBackup(exportBackup(db, plugins)); const source = backup.performers[0].sources[0]; + source.scraperPluginId = "unknown"; source.syncIntervalSeconds = 5; + const result = importBackup(db, plugins, backup); + expect(result.sources.warnings).toHaveLength(2); + expect(db.listSources()[0]).toMatchObject({ scrapeEnabled: false, syncIntervalSeconds: 300 }); + } finally { db.close(); } + }); + + it("rolls back unexpected import errors instead of leaving a partial restore", async () => { + const { db, plugins } = await library(); + try { + const backup = parseBackup({ format: BACKUP_FORMAT, version: 1, settings: { retentionDays: 7 }, performers: [{ name: "Alice" }, { name: "Bob" }] }); + const original = db.createPerformer.bind(db); + vi.spyOn(db, "createPerformer").mockImplementation((values) => { if (values.name === "Bob") throw new Error("Database error"); return original(values); }); + expect(() => importBackup(db, plugins, backup)).toThrow("Database error"); + expect(db.listPerformers()).toEqual([]); expect(db.getSettings().retentionDays).not.toBe(7); + } finally { db.close(); } + }); + it("rejects files that are not a backup", () => { expect(() => parseBackup({ hello: "world" })).toThrow("This file is not an Open EasyX backup"); expect(() => parseBackup({ format: BACKUP_FORMAT, version: 99, performers: [] })).toThrow(/newer Open EasyX/); diff --git a/server/backup.ts b/server/backup.ts index c094022..fe886b5 100644 --- a/server/backup.ts +++ b/server/backup.ts @@ -1,8 +1,9 @@ import { z } from "zod"; import type { Database } from "./database.js"; -import type { PluginManager } from "./plugin-manager.js"; +import { pluginMatchesSource, type PluginManager } from "./plugin-manager.js"; import { PerformerConflictError } from "./performer-conflict.js"; import { settingsSchema } from "./output-settings.js"; +import { profileIdentity } from "../packages/profile-identity.js"; /* * Export and import of the library setup: performers (with aliases, links and @@ -11,7 +12,7 @@ import { settingsSchema } from "./output-settings.js"; * sessions) are never part of a backup. * * Importing merges into the current library and never deletes anything: - * performers are matched by name, sources by plugin + external ID, so importing + * performers are matched by name or linked identity, sources by account, so importing * the same file twice changes nothing. */ export const BACKUP_FORMAT = "open-easyx-backup"; @@ -19,7 +20,7 @@ export const BACKUP_VERSION = 1; const sourceSchema = z.object({ pluginId: z.string().min(1), externalId: z.string().min(1), label: z.string().default(""), - profileUrl: z.string().min(1), domain: z.string().default(""), + profileUrl: z.string().url().refine((url) => /^https?:\/\//i.test(url), "Use an HTTP or HTTPS profile URL"), domain: z.string().default(""), enabled: z.boolean().optional(), autoDownload: z.boolean().optional(), scraperPluginId: z.string().nullable().optional(), scrapeEnabled: z.boolean().optional(), syncIntervalSeconds: z.number().int().min(5).max(31_536_000).optional(), @@ -28,6 +29,7 @@ const sourceSchema = z.object({ const performerSchema = z.object({ name: z.string().trim().min(1), aliases: z.array(z.string()).default([]), imageUrl: z.string().nullable().optional(), externalRefs: z.record(z.string(), z.string()).default({}), priority: z.number().int().min(-1).max(1).optional(), + identities: z.array(z.object({ pluginId: z.string().min(1), externalId: z.string().min(1) })).default([]), sources: z.array(sourceSchema).default([]), }); @@ -42,22 +44,22 @@ export const backupSchema = z.object({ export type Backup = z.infer; export type ImportOptions = { settings?: boolean; plugins?: boolean }; export type ImportResult = { - performers: { created: number; updated: number }; - sources: { added: number; updated: number; skipped: Array<{ performer: string; profileUrl: string; reason: string }> }; + performers: { created: number; updated: number; skipped: Array<{ name: string; reason: string }> }; + sources: { added: number; updated: number; warnings: Array<{ performer: string; profileUrl: string; reason: string }>; skipped: Array<{ performer: string; profileUrl: string; reason: string }> }; settings: { applied: string[]; skipped: string[] }; plugins: { installed: string[]; skipped: Array<{ id: string; reason: string }> }; }; export function exportBackup(db: Database, plugins: PluginManager, appVersion?: string): Backup { const sources = db.listSources(); - const backupSettings = settingsSchema.safeParse(db.getSettings()); + const settings = db.getSettings(); return { format: BACKUP_FORMAT, version: BACKUP_VERSION, exportedAt: new Date().toISOString(), ...(appVersion ? { appVersion } : {}), - settings: backupSettings.success ? Object.fromEntries(Object.entries(backupSettings.data).filter(([, value]) => value !== undefined)) : {}, + settings: Object.fromEntries(Object.entries(settings).filter(([key]) => Object.hasOwn(settingsSchema.shape, key))), plugins: plugins.list().filter((plugin) => plugin.installed).map((plugin) => ({ id: plugin.manifest.id, enabled: plugin.enabled })), performers: db.listPerformers().map((performer) => ({ name: performer.name, aliases: performer.aliases, ...(performer.imageUrl ? { imageUrl: performer.imageUrl } : {}), - externalRefs: performer.externalRefs, priority: performer.priority ?? 0, + externalRefs: performer.externalRefs, identities: db.performerIdentities(performer.id), priority: performer.priority ?? 0, sources: sources.filter((source) => source.performerId === performer.id).map((source) => ({ pluginId: source.pluginId, externalId: source.externalId, label: source.label, profileUrl: source.profileUrl, domain: source.domain, enabled: source.enabled, autoDownload: source.autoDownload, scraperPluginId: source.scraperPluginId ?? null, @@ -79,54 +81,85 @@ export function parseBackup(input: unknown): Backup { } export function importBackup(db: Database, plugins: PluginManager, backup: Backup, options: ImportOptions = {}): ImportResult { - const result: ImportResult = { performers: { created: 0, updated: 0 }, sources: { added: 0, updated: 0, skipped: [] }, settings: { applied: [], skipped: [] }, plugins: { installed: [], skipped: [] } }; + const result: ImportResult = { performers: { created: 0, updated: 0, skipped: [] }, sources: { added: 0, updated: 0, warnings: [], skipped: [] }, settings: { applied: [], skipped: [] }, plugins: { installed: [], skipped: [] } }; - if (options.plugins !== false) { - const known = new Map(plugins.list().map((plugin) => [plugin.manifest.id, plugin])); - for (const entry of backup.plugins ?? []) { - const plugin = known.get(entry.id); - if (!plugin) { result.plugins.skipped.push({ id: entry.id, reason: "Plugin not available in this installation" }); continue; } - if (plugin.installed) continue; - try { plugins.install(entry.id); result.plugins.installed.push(entry.id); } - catch (error) { result.plugins.skipped.push({ id: entry.id, reason: error instanceof Error ? error.message : String(error) }); } + db.sqlite.exec("SAVEPOINT backup_import"); + try { + if (options.plugins !== false) { + const known = new Map(plugins.list().map((plugin) => [plugin.manifest.id, plugin])); + for (const entry of backup.plugins ?? []) { + const plugin = known.get(entry.id); + if (!plugin) { result.plugins.skipped.push({ id: entry.id, reason: "Plugin not available in this installation" }); continue; } + if (plugin.installed) continue; + if (entry.enabled === false) { result.plugins.skipped.push({ id: entry.id, reason: "Disabled plugin left inactive" }); continue; } + try { plugins.install(entry.id); result.plugins.installed.push(entry.id); } + catch (error) { result.plugins.skipped.push({ id: entry.id, reason: error instanceof Error ? error.message : String(error) }); } + } } - } - if (options.settings !== false && backup.settings) { - const values: Record = {}; - for (const [key, value] of Object.entries(backup.settings)) { - const check = settingsSchema.safeParse({ [key]: value }); - if (check.success && key in check.data) values[key] = (check.data as Record)[key]; - else result.settings.skipped.push(key); + if (options.settings !== false && backup.settings) { + const values: Record = {}; + for (const [key, value] of Object.entries(backup.settings)) { + const check = settingsSchema.safeParse({ [key]: value }); + if (check.success && key in check.data) values[key] = (check.data as Record)[key]; + else result.settings.skipped.push(key); + } + if (Object.keys(values).length) { db.updateSettings(values); result.settings.applied.push(...Object.keys(values)); } } - if (Object.keys(values).length) { db.updateSettings(values); result.settings.applied.push(...Object.keys(values)); } - } - for (const entry of backup.performers) { - const name = db.resolvePerformerName(entry.name); - let performer = db.getPerformerByName(name); - if (performer) result.performers.updated += 1; - else { performer = db.createPerformer({ name, aliases: [], imageUrl: entry.imageUrl ?? null }); result.performers.created += 1; } - db.mergePerformerDetails(performer.id, { aliases: entry.name === name ? entry.aliases : [...entry.aliases, entry.name], imageUrl: entry.imageUrl ?? undefined, externalRefs: entry.externalRefs }); - if (entry.priority !== undefined) db.setPerformerPriority(performer.id, entry.priority); + for (const entry of backup.performers) { + const name = db.resolvePerformerName(entry.name); + let performer = db.getPerformerByName(name); + const identities = [...Object.entries(entry.externalRefs).map(([pluginId, externalId]) => ({ pluginId, externalId })), ...entry.identities]; + const owners = new Map(identities.flatMap(({ pluginId, externalId }) => { + const owner = db.findPerformerByIdentity(pluginId, externalId); return owner ? [[owner.id, owner] as const] : []; + })); + if (owners.size > 1 || (performer && [...owners.keys()].some((owner) => owner !== performer?.id))) { + result.performers.skipped.push({ name: entry.name, reason: "Linked accounts belong to another performer; resolve the conflict before importing" }); + continue; + } + performer ??= owners.values().next().value; + if (performer) result.performers.updated += 1; + else { performer = db.createPerformer({ name, aliases: [], imageUrl: entry.imageUrl ?? null }); result.performers.created += 1; } + db.mergePerformerDetails(performer.id, { aliases: entry.name.toLowerCase() === performer.name.toLowerCase() ? entry.aliases : [...entry.aliases, entry.name], imageUrl: entry.imageUrl ?? undefined, externalRefs: entry.externalRefs, identities: entry.identities }); + if (entry.priority !== undefined) db.setPerformerPriority(performer.id, entry.priority); - const existing = new Set(db.listSources(performer.id).map((source) => `${source.pluginId}\u0000${source.externalId}`)); - for (const source of entry.sources) { - try { - const saved = db.addSource(performer.id, source.pluginId, { externalId: source.externalId, label: source.label || source.domain, profileUrl: source.profileUrl, domain: source.domain }); - db.updateSource(saved.id, { - ...(source.enabled !== undefined ? { enabled: source.enabled } : {}), ...(source.autoDownload !== undefined ? { autoDownload: source.autoDownload } : {}), - ...(source.scraperPluginId !== undefined ? { scraperPluginId: source.scraperPluginId } : {}), ...(source.scrapeEnabled !== undefined ? { scrapeEnabled: source.scrapeEnabled } : {}), - ...(source.syncIntervalSeconds !== undefined ? { syncIntervalSeconds: source.syncIntervalSeconds } : {}), - }); - if (existing.has(`${source.pluginId}\u0000${source.externalId}`)) result.sources.updated += 1; else result.sources.added += 1; - } catch (error) { - const reason = error instanceof PerformerConflictError - ? `Already belongs to ${error.conflict.existingPerformer.name}` - : error instanceof Error ? error.message : String(error); - result.sources.skipped.push({ performer: name, profileUrl: source.profileUrl, reason }); + const existing = db.listSources(performer.id); + for (const source of entry.sources) { + try { + const same = existing.find((stored) => (stored.pluginId === source.pluginId && stored.externalId === source.externalId) + || profileIdentity(stored.profileUrl) === profileIdentity(source.profileUrl)); + const saved = same ?? db.addSource(performer.id, source.pluginId, { externalId: source.externalId, label: source.label || source.domain, profileUrl: source.profileUrl, domain: source.domain || new URL(source.profileUrl).hostname }); + let scrapeEnabled = source.scrapeEnabled; + let interval = source.syncIntervalSeconds; + const scraperId = source.scraperPluginId === undefined ? saved.scraperPluginId : source.scraperPluginId; + if (scraperId) { + const scraper = plugins.list().find((plugin) => plugin.manifest.id === scraperId); + if (!scraper?.installed || !scraper.enabled || !scraper.manifest.capabilities.includes("media-listing") || !pluginMatchesSource(scraper.manifest, saved.profileUrl)) { + scrapeEnabled = false; + result.sources.warnings.push({ performer: name, profileUrl: source.profileUrl, reason: "Source restored with scraping disabled: configure a compatible scraper first" }); + } + const minimum = scraper?.manifest.polling?.minimumIntervalSeconds ?? 300; + if (interval !== undefined && interval < minimum) { + interval = minimum; + result.sources.warnings.push({ performer: name, profileUrl: source.profileUrl, reason: `Scrape interval raised to the plugin minimum of ${minimum} seconds` }); + } + } else if (scrapeEnabled) scrapeEnabled = false; + db.updateSource(saved.id, { + ...(source.enabled !== undefined ? { enabled: source.enabled } : {}), ...(source.autoDownload !== undefined ? { autoDownload: source.autoDownload } : {}), + ...(source.scraperPluginId !== undefined ? { scraperPluginId: source.scraperPluginId } : {}), ...(scrapeEnabled !== undefined ? { scrapeEnabled } : {}), + ...(interval !== undefined ? { syncIntervalSeconds: interval } : {}), + }); + if (same) result.sources.updated += 1; else { result.sources.added += 1; existing.push(saved); } + } catch (error) { + const reason = error instanceof PerformerConflictError + ? `Already belongs to ${error.conflict.existingPerformer.name}` + : error instanceof Error ? error.message : String(error); + result.sources.skipped.push({ performer: name, profileUrl: source.profileUrl, reason }); + } } } - } - return result; + db.sqlite.exec("RELEASE backup_import"); + return result; + } catch (error) { db.sqlite.exec("ROLLBACK TO backup_import; RELEASE backup_import"); throw error; } } diff --git a/server/database.ts b/server/database.ts index 0c6ba3b..e4a2706 100644 --- a/server/database.ts +++ b/server/database.ts @@ -342,23 +342,29 @@ export class Database { } /** Merges imported details into a performer: aliases and links are added, an existing image is kept. */ - mergePerformerDetails(performerId: string, values: { aliases?: string[]; imageUrl?: string; externalRefs?: Record }): Performer | undefined { + mergePerformerDetails(performerId: string, values: { aliases?: string[]; imageUrl?: string; externalRefs?: Record; identities?: Array<{ pluginId: string; externalId: string }> }): Performer | undefined { const performer = this.getPerformer(performerId); if (!performer) return undefined; const aliases = [...new Map([...performer.aliases, ...(values.aliases ?? [])] .filter((alias) => typeof alias === "string" && alias.trim() && alias.toLowerCase() !== performer.name.toLowerCase()) .map((alias) => [alias.toLowerCase(), alias])).values()]; + const identities = [...Object.entries(values.externalRefs ?? {}).map(([pluginId, externalId]) => ({ pluginId, externalId })), ...(values.identities ?? [])]; + for (const { pluginId, externalId } of identities) { + const owner = this.findPerformerByIdentity(pluginId, externalId); + if (owner && owner.id !== performerId) throw new PerformerConflictError({ performerId, existingPerformer: owner }); + } const refs = { ...Object.fromEntries(Object.entries(values.externalRefs ?? {}).filter(([, value]) => typeof value === "string" && value)), ...performer.externalRefs }; this.sqlite.prepare("UPDATE performers SET aliases_json=?,image_url=COALESCE(image_url,?),external_refs_json=?,updated_at=? WHERE id=?") .run(JSON.stringify(aliases), values.imageUrl ?? null, JSON.stringify(refs), now(), performerId); const identity = this.sqlite.prepare("INSERT OR IGNORE INTO performer_identities(performer_id,plugin_id,external_id) VALUES(?,?,?)"); - for (const [pluginId, externalId] of Object.entries(refs)) { - const owner = this.findPerformerByIdentity(pluginId, externalId); - if (!owner || owner.id === performerId) identity.run(performerId, pluginId, externalId); - } + for (const { pluginId, externalId } of identities) identity.run(performerId, pluginId, externalId); return this.getPerformer(performerId); } + performerIdentities(performerId: string): Array<{ pluginId: string; externalId: string }> { + return this.sqlite.prepare("SELECT plugin_id AS pluginId, external_id AS externalId FROM performer_identities WHERE performer_id=? ORDER BY plugin_id,external_id").all(performerId) as Array<{ pluginId: string; externalId: string }>; + } + setPerformerPriority(performerId: string, priority: number): Performer | undefined { const value = Math.max(-1, Math.min(1, Math.trunc(priority))); this.sqlite.prepare("UPDATE performers SET priority=?,updated_at=? WHERE id=?").run(value, now(), performerId); diff --git a/server/downloader.ts b/server/downloader.ts index a1043bf..f0833f1 100644 --- a/server/downloader.ts +++ b/server/downloader.ts @@ -130,7 +130,8 @@ export class DownloadQueue { private preemptForPriority() { const waiting = this.db.queuedLivePriorities(); if (!waiting.length) return; - let freeing = [...this.active.values()].filter((control) => control.preempted).length; + for (const [itemId, control] of this.active) control.priority = this.db.itemPriority(itemId); + let freeing = [...this.active.values()].filter((control) => control.preempted || control.action).length; for (const priority of waiting) { if (freeing > 0) { freeing -= 1; continue; } const victim = [...this.active.entries()] diff --git a/server/index.ts b/server/index.ts index f3c3e80..983506e 100644 --- a/server/index.ts +++ b/server/index.ts @@ -484,7 +484,9 @@ app.post("/api/performers/refresh", async () => { } }); app.put<{ Params: { id: string }; Body: unknown }>("/api/performers/:id/priority", async (request) => { - const body = z.object({ priority: z.enum(["low", "normal", "high"]) }).parse(request.body); + const parsed = z.object({ priority: z.enum(["low", "normal", "high"]) }).safeParse(request.body); + if (!parsed.success) throw Object.assign(new Error("Choose a recording priority of low, normal or high"), { statusCode: 400 }); + const body = parsed.data; const performer = db.setPerformerPriority(request.params.id, PERFORMER_PRIORITIES[body.priority]); if (!performer) throw Object.assign(new Error("Performer not found"), { statusCode: 404 }); return performer; diff --git a/server/performer-priority.test.ts b/server/performer-priority.test.ts index cbb9b36..81ccd68 100644 --- a/server/performer-priority.test.ts +++ b/server/performer-priority.test.ts @@ -86,6 +86,20 @@ describe("performer recording priority", () => { } finally { queue.stop(); db.close(); } }); + it("uses priority changes made while a recording is already running", { timeout: 30_000 }, async () => { + const { db, queue, record, recording } = await setup(); queue.start(); + try { + const bob = record("bob"); await waitFor(() => recording(bob)); + db.setPerformerPriority(db.getItem(bob)!.performerId, 1); + const alice = record("alice", 1); + await new Promise((resolve) => setTimeout(resolve, 1500)); + expect(db.getItem(bob)?.status).toBe("downloading"); expect(db.getItem(alice)?.status).toBe("queued"); + db.setPerformerPriority(db.getItem(bob)!.performerId, -1); + await waitFor(() => recording(alice)); await waitFor(() => db.getItem(bob)?.status === "completed"); + queue.stopRecording(alice); await waitFor(() => db.getItem(alice)?.status === "completed"); + } finally { queue.stop(); db.close(); } + }); + it("does not stop a recording for an equal or lower priority", { timeout: 60_000 }, async () => { const { db, queue, record, recording } = await setup(); queue.start(); diff --git a/src/BackupSettings.tsx b/src/BackupSettings.tsx index aecfa4d..899f70d 100644 --- a/src/BackupSettings.tsx +++ b/src/BackupSettings.tsx @@ -3,8 +3,8 @@ import { Download, LoaderCircle, Upload } from "lucide-react"; import { api } from "./api"; type ImportResult = { - performers: { created: number; updated: number }; - sources: { added: number; updated: number; skipped: Array<{ performer: string; profileUrl: string; reason: string }> }; + performers: { created: number; updated: number; skipped: Array<{ name: string; reason: string }> }; + sources: { added: number; updated: number; warnings: Array<{ performer: string; profileUrl: string; reason: string }>; skipped: Array<{ performer: string; profileUrl: string; reason: string }> }; settings: { applied: string[]; skipped: string[] }; plugins: { installed: string[]; skipped: Array<{ id: string; reason: string }> }; }; @@ -15,6 +15,7 @@ export function importSummary(result: ImportResult): string { `${result.performers.updated} updated`, `${result.sources.added} source${result.sources.added === 1 ? "" : "s"} added`, ]; + if (result.performers.skipped.length) parts.push(`${result.performers.skipped.length} performer conflicts`); if (result.sources.skipped.length) parts.push(`${result.sources.skipped.length} skipped`); if (result.plugins.installed.length) parts.push(`${result.plugins.installed.length} plugin${result.plugins.installed.length === 1 ? "" : "s"} installed`); return `Import finished: ${parts.join(", ")}.`; @@ -29,6 +30,7 @@ export function BackupSettings({ setNotice, onImported }: { setNotice: (message: const importFile = async (file: File) => { setBusy(true); setError(""); setResult(undefined); try { + if (file.size > 32 * 1024 * 1024) throw new Error("Backup files must be smaller than 32 MB"); let backup: unknown; try { backup = JSON.parse(await file.text()); } catch { throw new Error("This file is not valid JSON"); } const query = new URLSearchParams({ settings: includeSettings ? "1" : "0", plugins: includePlugins ? "1" : "0" }); @@ -48,7 +50,7 @@ export function BackupSettings({ setNotice, onImported }: { setNotice: (message:
-

Importing adds to your current library and never deletes anything. Performers are matched by name and sources by account, so importing the same file again does not create duplicates.

+

Importing adds to your current library and never deletes anything. Performers are matched by name or linked account and sources by account, so importing the same file again does not create duplicates.

{ const file = event.target.files?.[0]; if (file) void importFile(file); }}/> @@ -56,6 +58,9 @@ export function BackupSettings({ setNotice, onImported }: { setNotice: (message: {error &&

{error}

} {result &&

{importSummary(result)}

+ {result.performers.skipped.length > 0 &&
    {result.performers.skipped.map((skip) =>
  • {skip.name}: {skip.reason}
  • )}
} + {result.sources.warnings.length > 0 &&
    {result.sources.warnings.map((warning, index) =>
  • {warning.performer}: {warning.reason}
  • )}
} + {result.settings.skipped.length > 0 &&

Settings not imported: {result.settings.skipped.join(", ")}

} {result.sources.skipped.length > 0 &&
    {result.sources.skipped.map((skip) =>
  • {skip.performer}: {skip.profileUrl} — {skip.reason}
  • )}
} {result.plugins.skipped.length > 0 &&
    {result.plugins.skipped.map((skip) =>
  • {skip.id}: {skip.reason}
  • )}
}
} diff --git a/src/Player.tsx b/src/Player.tsx index b8f4369..b0d9acb 100644 --- a/src/Player.tsx +++ b/src/Player.tsx @@ -87,7 +87,7 @@ export function PlayerViewer({ media, context, autoStart = false, close, favorit const toggleAutoplay = () => { const value = !autoplay; setAutoplay(value); localStorage.setItem("open-easyx.autoplay", String(value)); }; const next = async () => { await save(true, true); - if (!autoplay) return; + if (!autoplay || deleting) return; let ids = context.ids ?? []; if (context.query) ids = (await api<{ ids: string[] }>(`/api/library/playlist?${context.query}`).catch(() => ({ ids }))).ids; const nextId = nextMediaId(ids, media.id); @@ -112,13 +112,13 @@ export function PlayerViewer({ media, context, autoStart = false, close, favorit useEffect(() => { if (media.kind !== "image") return; setPhotoRemaining(PHOTO_AUTOPLAY_SECONDS); - if (!autoplay || !photoReady) return; + if (!autoplay || !photoReady || deleting) return; const startedAt = Date.now(); const updateCountdown = () => setPhotoRemaining(Math.max(0, Math.ceil(PHOTO_AUTOPLAY_SECONDS - (Date.now() - startedAt) / 1000))); const interval = window.setInterval(updateCountdown, 250); const timer = window.setTimeout(() => { void next(); }, PHOTO_AUTOPLAY_SECONDS * 1000); return () => { window.clearInterval(interval); window.clearTimeout(timer); }; - }, [media.id, media.kind, autoplay, photoReady]); + }, [media.id, media.kind, autoplay, photoReady, deleting]); useEffect(() => { if (media.kind !== "video") return; let cancelled = false; diff --git a/src/library-app.tsx b/src/library-app.tsx index 76ba79c..b93ba5f 100644 --- a/src/library-app.tsx +++ b/src/library-app.tsx @@ -357,7 +357,13 @@ function Library({ preset = {}, favoriteOnly = false, historyOnly = false, open, const toggleSelected = (id: string) => setSelectedIds((current) => { const next = new Set(current); if (next.has(id)) next.delete(id); else next.add(id); return next; }); const selectPage = () => setSelectedIds((current) => result?.items.every((item) => current.has(item.id)) ? new Set() : new Set(result?.items.map((item) => item.id) ?? [])); const cancelSelection = () => { setSelectionMode(false); setSelectedIds(new Set()); }; - const dropFromResult = (removed: Set) => setResult((current) => current && ({ ...current, items: current.items.filter((item) => !removed.has(item.id)), total: Math.max(0, current.total - removed.size), pages: Math.max(1, Math.ceil((current.total - removed.size) / current.pageSize)) })); + const dropFromResult = (removed: Set) => { + if (!result) return; + const total = Math.max(0, result.total - removed.size); const pages = Math.max(1, Math.ceil(total / result.pageSize)); + setResult({ ...result, items: result.items.filter((item) => !removed.has(item.id)), total, pages }); + setSelectedIds((current) => new Set([...current].filter((id) => !removed.has(id)))); + if (page > pages) setPage(pages); + }; const deleteOne = async (media: Media) => { if (deleting || !window.confirm(`Permanently delete "${media.title}"? This cannot be undone.`)) return; setDeleting(true); diff --git a/src/main.tsx b/src/main.tsx index add3226..9278d3d 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -554,6 +554,7 @@ function PluginConfig({ plugin, installing, close, run }: { plugin: Plugin; inst function SettingsPage({ settings, run, setNotice, onSettingsChange }: { settings: Record; run: (op: () => Promise, msg: string) => Promise; setNotice: (text: string) => void; onSettingsChange: (settings: Record) => void }) { const [values, setValues] = useState(settings); + useEffect(() => setValues(settings), [settings]); const [category, setCategory] = useState<"automation" | "storage" | "subtitles" | "backup">("automation"); const categories = [ { key: "automation", label: "Automation", description: "Discovery and downloads", icon: Gauge }, @@ -569,7 +570,7 @@ function SettingsPage({ settings, run, setNotice, onSettingsChange }: { settings
{category === "automation" &&

AUTOMATION

Scraping and downloads

} {category === "storage" && } - {category === "backup" && window.location.reload()}/>} + {category === "backup" && { void run(async () => {}, "Backup imported"); }}/>} {category === "subtitles" &&
}