1 | sO snippetTranspileWebBot(S uri, SS params, int refreshDelay) {
|
2 | if (eq("1", params.get('medium))) {
|
3 | veryQuickJava_mediumRefresh(); |
4 | print("Medium-refreshed transpiler.");
|
5 | } |
6 | |
7 | if (eq("1", params.get('fresh))) {
|
8 | refreshTranspiler(); |
9 | print("Refreshed transpiler.");
|
10 | } |
11 | |
12 | // use new TranspileForServer class (now default) |
13 | //bool useNewTFS = eq("1", params.get("newTFS"));
|
14 | bool useNewTFS = !eq("0", params.get("newTFS"));
|
15 | |
16 | uri = dropPrefixSlash(uri); |
17 | if (isSnippetID(uri)) params.put(snippetID := uri); |
18 | |
19 | if (empty(params.get('snippetID))) ret "OK";
|
20 | |
21 | sendToSnippetUpdatesBot("/transpiling/" + psI(params.get('snippetID)));
|
22 | |
23 | final bool compile = eq("1", params.get('compile));
|
24 | |
25 | final new Flag ok; |
26 | print_byThread = new InheritableThreadLocal; |
27 | S text = hijackPrint_tee(r {
|
28 | S snippetID = fsI(params.get('snippetID));
|
29 | pcall {
|
30 | bool isInclude = getSnippetType(snippetID) == snippetType_JavaXInclude(); |
31 | transpileRaw_translator(); |
32 | set(transpileRaw_trans, +print_byThread); |
33 | print("Set print_byThread (" + print_byThread! + ") in " + systemHashCode(transpileRaw_trans));
|
34 | temp tempSetTL(transpileRaw_asInclude, isInclude); |
35 | |
36 | if (useNewTFS) |
37 | new TranspileForServer(snippetID).run(); |
38 | else {
|
39 | temp tempSetTL(transpileForServer_compile, compile); |
40 | transpileForServer(snippetID); |
41 | } |
42 | |
43 | ok.raise(); |
44 | } |
45 | }); |
46 | |
47 | S redirect = params.get('redirect);
|
48 | |
49 | ret hhtml(hhead(htitle((ok.isUp() ? "OK" : "Failed") + " Transpilation") |
50 | + (ok.isUp() && nempty(redirect) ? hrefresh(refreshDelay, redirect) : "")) |
51 | + hbody(hsourcecode(text))) |
52 | + (ok.isUp() ? "" : hjs_scrollDownOnPageLoad()); |
53 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1034707 |
| Snippet name: | snippetTranspileWebBot |
| Eternal ID of this version: | #1034707/4 |
| Text MD5: | 952401a2081af7b181a863ff483bfc46 |
| Author: | stefan |
| Category: | javax / transpiling |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-03-06 16:24:07 |
| Source code size: | 1770 bytes / 53 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 376 / 417 |
| Version history: | 3 change(s) |
| Referenced in: | [show references] |