Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

66
LINES

< > BotCompany Repo | #1033536 // New Snippet Transpiler Web Bot [dev.]

JavaX module (desktop) [tags: use-pretranspiled]

Download Jar. Transpiled version (14273L) is out of date.

1  
!7
2  
3  
static int refreshDelay = 1; // seconds
4  
5  
p {
6  
  set transpileRaw_dontCopyFromCreator;
7  
  //set transpileForServer_forceJavacWhenLibs;
8  
  transpileRaw_silent = false;
9  
}
10  
11  
html {
12  
  try object checkWebAuthed(params);
13  
  
14  
  lock programLock();
15  
  
16  
  if (eq("1", params.get('medium))) {
17  
    veryQuickJava_mediumRefresh();
18  
    print("Medium-refreshed transpiler.");
19  
  }
20  
  
21  
  if (eq("1", params.get('fresh))) {
22  
    refreshTranspiler();
23  
    print("Refreshed transpiler.");
24  
  }
25  
  
26  
  // use new TranspileForServer class
27  
  bool useNewTFS = eq("1", params.get("newTFS"));
28  
  
29  
  uri = dropPrefixSlash(uri);
30  
  if (isSnippetID(uri)) params.put(snippetID := uri);
31  
  
32  
  if (empty(params.get('snippetID))) ret "OK";
33  
  
34  
  sendToSnippetUpdatesBot("/transpiling/" + params.get('snippetID));
35  
  
36  
  final bool compile = eq("1", params.get('compile));
37  
  
38  
  final new Flag ok;
39  
  print_byThread = new InheritableThreadLocal;
40  
  S text = hijackPrint_tee(r {
41  
    S snippetID = fsI(params.get('snippetID));
42  
    pcall {
43  
      bool isInclude = getSnippetType(snippetID) == snippetType_JavaXInclude();
44  
      transpileRaw_translator();
45  
      set(transpileRaw_trans, +print_byThread);
46  
      print("Set print_byThread (" + print_byThread! + ") in " + systemHashCode(transpileRaw_trans));
47  
      temp tempSetTL(transpileRaw_asInclude, isInclude);
48  
      
49  
      if (useNewTFS)
50  
        new TranspileForServer(snippetID).run();
51  
      else {
52  
        temp tempSetTL(transpileForServer_compile, compile);
53  
        transpileForServer(snippetID);
54  
      }
55  
      
56  
      ok.raise();
57  
    }
58  
  });
59  
  
60  
  S redirect = params.get('redirect);
61  
  
62  
  ret hhtml(hhead(htitle((ok.isUp() ? "OK" : "Failed") + " Transpilation")
63  
    + (ok.isUp() && nempty(redirect) ? hrefresh(refreshDelay, redirect) : ""))
64  
    + hbody(hsourcecode(text)))
65  
    + (ok.isUp() ? "" : hjs_scrollDownOnPageLoad());
66  
}

Author comment

Began life as a copy of #1018308

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033536
Snippet name: New Snippet Transpiler Web Bot [dev.]
Eternal ID of this version: #1033536/3
Text MD5: f694ca952d1e41c15f82bd0c55393206
Author: stefan
Category: javax / web
Type: JavaX module (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-01 20:37:39
Source code size: 1891 bytes / 66 lines
Pitched / IR pitched: No / No
Views / Downloads: 257 / 944
Version history: 2 change(s)
Referenced in: [show references]