MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / getTempCode

Function getTempCode

src/pkg/utils/scriptInstall.ts:38–50  ·  view source on GitHub ↗
(tempUUID: string)

Source from the content-addressed store, hash-verified

36};
37
38export const getTempCode = async (tempUUID: string): Promise<string | undefined> => {
39 try {
40 const folder = await navigator.storage.getDirectory().then((root) => root.getDirectoryHandle("temp_install_codes"));
41 const handle = await folder.getFileHandle(`${tempUUID}.user.js`);
42 return await handle.getFile().then((f) => f.text());
43 } catch (err: any) {
44 if (err?.name === "NotFoundError") {
45 return undefined;
46 }
47 console.error("[scriptInstall] getTempCode failed:", err);
48 throw err;
49 }
50};
51
52export const removeCachedCodes = async (uuids: string[]) => {
53 if (!uuids.length) return;

Callers 1

initAsyncFunction · 0.90

Calls 2

errorMethod · 0.80
textMethod · 0.45

Tested by

no test coverage detected