!7
// TODO: share transpiler
html {
if (!webAuthed(params)) ret "not authed";
if (eq("1", params.get('fresh)))
refreshTranspiler();
uri = dropPrefixSlash(uri);
if (isSnippetID(uri)) params.put(snippetID := uri);
if (empty(params.get('snippetID))) ret "OK";
final new Flag ok;
S text = hijackPrint_tee(r {
S snippetID = fsI(params.get('snippetID));
pcall {
transpileForServer(snippetID);
ok.raise();
}
});
S redirect = params.get('redirect);
ret hhtml(hhead(htitle((ok.isUp() ? "OK" : "Failed") ? " Transpilation")
+ (ok.isUp() && nempty(redirect) ? hrefresh(2, redirect) : ""))
+ hbody(hsourcecode(text)));
}