mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-08 10:46:06 +00:00
feat(cli): let projects opt out of automatic proxying (#2591)
* feat(studio-server): serve H.264 proxies from the preview route Wires the codec manifest and the transcoder into the preview surface: the route negotiates a proxy via a query param and serves it through the existing range and ETag machinery, composition HTML carries a codec map for the runtime, and hostile assets pre-warm so a first play does not wait on a cold transcode. Exposes the three subpath exports the CLI surfaces consume upstack. Drops the TEMP fallow entry added with the transcoder: it has real importers now. * fix(studio-server): publish media proxy exports * fix(parsers): scan HTML comments linearly * feat(cli): let projects opt out of automatic proxying Adds media.autoProxy to hyperframes.json plus --proxy/--no-proxy flags, and forwards the resolved value into the studio and preview servers and the vite adapter. Lands before the runtime slice that turns auto-proxying on, so the switch exists before there is any behavior to switch off. * fix(cli): align media config schema
This commit is contained in:
@@ -26,11 +26,12 @@ import {
|
||||
createBackgroundRemovalJob,
|
||||
consumeFileWriteReceipt,
|
||||
getMimeType,
|
||||
type StudioApiAdapter,
|
||||
type PreviewApiAdapter,
|
||||
type ResolvedProject,
|
||||
type RenderJobState,
|
||||
type BackgroundRemovalRender,
|
||||
} from "@hyperframes/studio-server";
|
||||
import { resolveAutoProxy } from "../utils/projectConfig.js";
|
||||
import { getElementScreenshotClip } from "@hyperframes/studio-server/screenshot-clip";
|
||||
import type { ScreenshotClip } from "@hyperframes/studio-server/screenshot-clip";
|
||||
import type { RenderJob } from "@hyperframes/producer";
|
||||
@@ -229,11 +230,21 @@ export interface StudioServerOptions {
|
||||
projectDir: string;
|
||||
/** Display name for the project. Defaults to basename of projectDir. */
|
||||
projectName?: string;
|
||||
/**
|
||||
* Auto-transcode browser-hostile video codecs to a cached H.264 preview
|
||||
* proxy. The preview command passes its resolved `--proxy`/`--no-proxy` +
|
||||
* `hyperframes.json` value; when omitted, the project's `media.autoProxy`
|
||||
* config (default true) applies.
|
||||
*/
|
||||
autoProxy?: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface StudioServer {
|
||||
app: Hono;
|
||||
watcher: ProjectWatcher;
|
||||
/** Exposed for tests: the adapter handed to the shared studio API (carries
|
||||
* the resolved `autoProxy` flag the preview routes read). */
|
||||
adapter: PreviewApiAdapter;
|
||||
}
|
||||
|
||||
export async function loadPreviewServerBuildSignature(): Promise<string> {
|
||||
@@ -303,7 +314,13 @@ export function createStudioServer(options: StudioServerOptions): StudioServer {
|
||||
cachedProjectSignature = null;
|
||||
});
|
||||
|
||||
const adapter: StudioApiAdapter = {
|
||||
const adapter: PreviewApiAdapter = {
|
||||
// Explicit option wins (preview's resolved --proxy/--no-proxy + config);
|
||||
// otherwise honor the project's hyperframes.json media.autoProxy so every
|
||||
// createStudioServer caller (e.g. the background preview child) gets the
|
||||
// configured behavior without its own plumbing.
|
||||
autoProxy: options.autoProxy ?? resolveAutoProxy(projectDir, undefined),
|
||||
|
||||
listProjects: () => [project],
|
||||
|
||||
resolveProject: (id: string) => (id === projectId ? project : null),
|
||||
@@ -785,5 +802,5 @@ export function createStudioServer(options: StudioServerOptions): StudioServer {
|
||||
return c.html(html);
|
||||
});
|
||||
|
||||
return { app, watcher };
|
||||
return { app, watcher, adapter };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user