MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / applyFakeUpdateFromEnv

Function applyFakeUpdateFromEnv

apps/desktop/src/main/index.ts:886–917  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

884// `{"state":"downloaded","version":"99.0.0"}`) seeds a status to exercise the
885// renderer card and the install handler without one. Ignored in production.
886const applyFakeUpdateFromEnv = () => {
887 // Never honor the fake seam in a packaged build: a stray env var would seed a
888 // phantom "downloaded" update whose install quits the app against nothing.
889 if (app.isPackaged) return;
890 const raw = process.env.EXECUTOR_DESKTOP_FAKE_UPDATE?.trim();
891 if (!raw) return;
892 // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: dev-only env override is untrusted text; a malformed value is logged and ignored, not fatal
893 try {
894 // oxlint-disable-next-line executor/no-json-parse -- boundary: dev-only env override, shape-checked below
895 const parsed = JSON.parse(raw) as { readonly state?: string; readonly version?: string };
896 const version = typeof parsed.version === "string" ? parsed.version : "0.0.0";
897 const state = parsed.state ?? "downloaded";
898 if (
899 state === "available" ||
900 state === "downloaded" ||
901 state === "downloading" ||
902 state === "error" ||
903 state === "installing"
904 ) {
905 if (state === "downloaded") downloadedUpdateVersion = version;
906 setUpdateStatus(
907 state === "downloading"
908 ? { state, version, percent: 100 }
909 : state === "error"
910 ? { state, version, message: "Update failed" }
911 : { state, version },
912 );
913 }
914 } catch (error) {
915 log.warn("[updater] bad EXECUTOR_DESKTOP_FAKE_UPDATE", error);
916 }
917};
918
919const promptInstallUpdate = async (version: string) => {
920 if (updateDialogOpen) return;

Callers 1

bootFunction · 0.85

Calls 2

setUpdateStatusFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected