caelum0x d56639a594
Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

50 lines
1.6 KiB
TypeScript

import { contextBridge, ipcRenderer } from "electron";
import { IpcChannel } from "./ipc";
import type {
ApiRequestInput,
ConfigPatch,
PublicConfig,
ReelforgeBridge,
ScreenSource,
} from "./ipc";
/**
* Preload: the ONLY channel between the sandboxed renderer and the main process.
*
* A single, minimal, typed object is exposed on `window.reelforge` via the
* contextBridge. No `ipcRenderer`, no Node built-ins, and no secrets are exposed
* — every method is a thin, argument-shaped wrapper over a named IPC channel,
* and main re-validates all input. The implementation is asserted to
* `satisfies ReelforgeBridge` so it can never drift from the shared contract.
*/
const bridge = {
getConfig(): Promise<PublicConfig> {
return ipcRenderer.invoke(IpcChannel.ConfigGet);
},
saveConfig(patch: ConfigPatch): Promise<PublicConfig> {
// Only forward the two known fields — never leak arbitrary renderer objects.
const safe: ConfigPatch = {};
if (typeof patch?.apiBase === "string") safe.apiBase = patch.apiBase;
if (typeof patch?.token === "string") safe.token = patch.token;
return ipcRenderer.invoke(IpcChannel.ConfigSave, safe);
},
request<T>(input: ApiRequestInput): Promise<T> {
const safe: ApiRequestInput = {
method: input?.method,
path: input?.path,
body: input?.body,
};
return ipcRenderer.invoke(IpcChannel.ApiRequest, safe) as Promise<T>;
},
getScreenSources(): Promise<ScreenSource[]> {
return ipcRenderer.invoke(IpcChannel.ScreenSources);
},
} satisfies ReelforgeBridge;
contextBridge.exposeInMainWorld("reelforge", bridge);