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.

!7

static int refreshDelay = 1; // seconds

p {
  set transpileRaw_dontCopyFromCreator;
  //set transpileForServer_forceJavacWhenLibs;
  transpileRaw_silent = false;
}

html {
  try object checkWebAuthed(params);
  
  lock programLock();
  
  if (eq("1", params.get('medium))) {
    veryQuickJava_mediumRefresh();
    print("Medium-refreshed transpiler.");
  }
  
  if (eq("1", params.get('fresh))) {
    refreshTranspiler();
    print("Refreshed transpiler.");
  }
  
  // use new TranspileForServer class
  bool useNewTFS = eq("1", params.get("newTFS"));
  
  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 {
    S snippetID = fsI(params.get('snippetID));
    pcall {
      bool isInclude = getSnippetType(snippetID) == snippetType_JavaXInclude();
      transpileRaw_translator();
      set(transpileRaw_trans, +print_byThread);
      print("Set print_byThread (" + print_byThread! + ") in " + systemHashCode(transpileRaw_trans));
      temp tempSetTL(transpileRaw_asInclude, isInclude);
      
      if (useNewTFS)
        new TranspileForServer(snippetID).run();
      else {
        temp tempSetTL(transpileForServer_compile, compile);
        transpileForServer(snippetID);
      }
      
      ok.raise();
    }
  });
  
  S redirect = params.get('redirect);
  
  ret hhtml(hhead(htitle((ok.isUp() ? "OK" : "Failed") + " Transpilation")
    + (ok.isUp() && nempty(redirect) ? hrefresh(refreshDelay, redirect) : ""))
    + hbody(hsourcecode(text)))
    + (ok.isUp() ? "" : hjs_scrollDownOnPageLoad());
}

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: 256 / 943
Version history: 2 change(s)
Referenced in: