MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / getScriptSource

Function getScriptSource

pages/viewScriptSource/main.js:31–41  ·  view source on GitHub ↗
(scriptId)

Source from the content-addressed store, hash-verified

29
30// https://stackoverflow.com/a/26276924/11898496
31async function getScriptSource(scriptId) {
32 try {
33 let fileName = scriptId + ".js";
34 let path = "/scripts/" + fileName;
35 let res = await fetch(path);
36 let source = await res.text();
37 return source;
38 } catch (e) {
39 return "// Không lấy được source code\n// Cannot load source code";
40 }
41}
42
43// https://stackoverflow.com/a/6234804/11898496
44function escapeHTML(unsafe_str) {

Callers 1

main.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected