From d2aa4b89417a5a82b96b36614d514cd91097fbe5 Mon Sep 17 00:00:00 2001 From: Miguel Angel Simon Sierra Date: Thu, 1 Oct 2026 22:45:20 -0700 Subject: [PATCH] fix(studio): freeze-frame, loudness and peak-map requests go through studioApiFetch too --- packages/studio/src/hooks/useFreezeFrame.ts | 5 +++-- packages/studio/src/player/components/clipMenuNormalize.ts | 3 ++- packages/studio/src/player/components/clipPeakMap.ts | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/studio/src/hooks/useFreezeFrame.ts b/packages/studio/src/hooks/useFreezeFrame.ts index 4e3d85ac94..233a6d8b7c 100644 --- a/packages/studio/src/hooks/useFreezeFrame.ts +++ b/packages/studio/src/hooks/useFreezeFrame.ts @@ -6,6 +6,7 @@ import { buildProjectApiPath } from "../utils/projectRouting"; import { markStudioWriteToken } from "../utils/studioFileVersion"; import { serializeStudioFileMutations } from "../utils/studioFileMutationCoordinator"; import type { RecordEditInput } from "../utils/studioFileHistory"; +import { studioApiFetch } from "../utils/studioApiFetch"; type ProjectFileWriter = (path: string, content: string, expectedContent?: string) => Promise; @@ -31,7 +32,7 @@ function errorOf(value: unknown): string | null { } async function readVersion(projectId: string, path: string): Promise { - const response = await fetch( + const response = await studioApiFetch( buildProjectApiPath(projectId, `/files/${encodeURIComponent(path)}`), ); const body: unknown = await response.json().catch(() => null); @@ -53,7 +54,7 @@ export async function requestFreezeFrame(input: { const expectedVersion = await readVersion(input.projectId, input.path); const transactionToken = `freeze:${crypto.randomUUID()}`; markStudioWriteToken(transactionToken); - const response = await fetch( + const response = await studioApiFetch( buildProjectApiPath(input.projectId, "/file-mutations/freeze-frame"), { method: "POST", diff --git a/packages/studio/src/player/components/clipMenuNormalize.ts b/packages/studio/src/player/components/clipMenuNormalize.ts index 50b6e50dd9..83ffc02ae8 100644 --- a/packages/studio/src/player/components/clipMenuNormalize.ts +++ b/packages/studio/src/player/components/clipMenuNormalize.ts @@ -4,6 +4,7 @@ import { resolveMediaPreviewUrl } from "./thumbnailUtils"; import type { TimelineElement } from "../store/timelineElement"; import { parseAutomation, VOLUME_TARGET } from "@hyperframes/core/audio-automation"; import type { TimelineEditOutcome } from "../../hooks/timelineEditPermission"; +import { studioApiFetch } from "../../utils/studioApiFetch"; export interface NormalizePlan { targetLufs: number; @@ -74,7 +75,7 @@ function isNormalizePlan(value: unknown): value is NormalizePlan { export async function requestNormalizePlan( projectId: string, el: TimelineElement, - fetchImpl: typeof fetch = fetch, + fetchImpl: typeof studioApiFetch = studioApiFetch, ): Promise { const origin = window.location.origin; const relative = resolvePreviewRelative( diff --git a/packages/studio/src/player/components/clipPeakMap.ts b/packages/studio/src/player/components/clipPeakMap.ts index e6eeaee6bb..01ee899fa3 100644 --- a/packages/studio/src/player/components/clipPeakMap.ts +++ b/packages/studio/src/player/components/clipPeakMap.ts @@ -1,4 +1,5 @@ import { buildProjectApiPath } from "../../utils/projectRouting"; +import { studioApiFetch } from "../../utils/studioApiFetch"; import { resolvePreviewRelative } from "../../utils/previewRelativePath"; import type { TimelineElement } from "../store/timelineElement"; import { clipSourcePeak, isPeakMap, type ClipSourceWindow, type PeakMap } from "./clipPeakRuns"; @@ -10,7 +11,7 @@ const peakMapRequests = new Map>(); export function loadPeakMap(url: string): Promise { const pending = peakMapRequests.get(url); if (pending) return pending; - const request = fetch(url) + const request = studioApiFetch(url) .then((res) => (res.ok ? res.json() : null)) .then((body: unknown) => (isPeakMap(body) ? body : null)) .catch(() => null);