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

Function applyFakeUpdateFromEnv

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

Source from the content-addressed store, hash-verified

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

Callers 1

bootFunction · 0.85

Calls 2

setUpdateStatusFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected