!7 static int refreshDelay = 1; // seconds // TODO: share transpiler p { set transpileRaw_dontCopyFromCreator; transpileRaw_silent = false; } html { if (!webAuthed(params)) ret "not authed"; lock programLock(); if (eqOneOf("1", params.get('medium), params.get('fresh))) { refreshTranspiler(); print("Refreshed transpiler."); } uri = dropPrefixSlash(uri); if (isSnippetID(uri)) params.put(snippetID := uri); if (empty(params.get('snippetID))) ret "OK"; sendToSnippetUpdatesBot("/transpiling/" + params.get('snippetID)); final bool compile = eq("1", params.get('compile)); final new Flag ok; print_byThread = new InheritableThreadLocal; S text = hijackPrint_tee(r { bool isInclude = getSnippetType(snippetID) == snippetType_JavaXInclude(); S snippetID = fsI(params.get('snippetID)); pcall { transpileRaw_translator(); set(transpileRaw_trans, +print_byThread); print("Set print_byThread (" + print_byThread! + ") in " + systemHashCode(transpileRaw_trans)); temp tempSetTL(transpileForServer_compile, compile); temp tempSetTL(transpileRaw_asInclude, isInclude); transpileForServer(snippetID); ok.raise(); } }); S redirect = params.get('redirect); sendToSnippetUpdatesBot("/transpile" + (ok.isUp() ? "OK" : "Fail") + "/" + psI(params.get('snippetID))); ret hhtml(hhead(htitle((ok.isUp() ? "OK" : "Failed") + " Transpilation") + (ok.isUp() && nempty(redirect) ? hrefresh(refreshDelay, redirect) : "")) + hbody(hsourcecode(text))); }