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

59
LINES

< > BotCompany Repo | #1018308 - Snippet Transpiler Web Bot [LIVE]

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

Libraryless. Click here for Pure Java version (9302L/68K).

!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.");
  }
  
  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(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)));
}

Author comment

Began life as a copy of #1018300

download  show line numbers  debug dex   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1018308
Snippet name: Snippet Transpiler Web Bot [LIVE]
Eternal ID of this version: #1018308/30
Text MD5: 317ec9dc77af72981ef0020a80794a0d
Transpilation MD5: 1e3e071208ca4ce0c8741c9617b5bbd0
Author: stefan
Category: javax / web
Type: JavaX module (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-09 21:08:08
Source code size: 1747 bytes / 59 lines
Pitched / IR pitched: No / No
Views / Downloads: 355 / 1163
Version history: 29 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1018308 & http://1018308.tinybrain.de