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

Function applyFakeUpdateFromEnv

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

Source from the content-addressed store, hash-verified

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

Callers 1

bootFunction · 0.85

Calls 2

setUpdateStatusFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected