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

48
LINES

< > BotCompany Repo | #1028676 // Snippet Transpiler Web Bot [Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (22579L/144K).

!7

// uses its own transpiler so it can set options

module SnippetTranspiler > DynPrintLog {
  set flag NoNanoHTTPD.
  !include #1029545 // API for Eleu
  
  switchable int refreshDelay = 0; // seconds
  
  start {
   dm_onSnippetTranspiled(voidfunc(S snippetID) {
      if (sameSnippetID(snippetID, defaultTranspilerID()))
        refresh();
    });
  }
  
  void refresh {
    veryQuickJava_refresh();
    vmBus_send('refreshedTranspiler);
    print("Refreshed translator.");
  }

  virtual WebResponse html(IWebRequest req) {
    S realPW = realPW();
    if (empty(realPW))
      ret "No password set by admin - please put password in: " + realPWFile().getAbsolutePath();
    
    S pw = req.get("_pass");
    if (empty(pw)) ret "Need pw";
    
    if (neq(pw, realPW)) {
      print("XXX - Alert, bad PW entered on web - XXX");
      ret "Bad PW, bugger";
    } 
    
    ret dm_evalInQ(->
      snippetTranspileWebBot(req.uri(), req.params(), refreshDelay));
  }
  
  File realPWFile() {
    ret secretProgramFile("master-pw");
  }

  S realPW() {
    ret trim(loadTextFile(realPWFile()));
  }
}

Author comment

Began life as a copy of #1018308

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028676
Snippet name: Snippet Transpiler Web Bot [Dyn Module]
Eternal ID of this version: #1028676/17
Text MD5: 86bccafb0b1200bfaf6ed340f8f62811
Transpilation MD5: 2a543244392d3a5bbcaa0c015d34e995
Author: stefan
Category: javax / web
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-06 18:12:42
Source code size: 1149 bytes / 48 lines
Pitched / IR pitched: No / No
Views / Downloads: 296 / 4942
Version history: 16 change(s)
Referenced in: [show references]