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).

1  
!7
2  
3  
// uses its own transpiler so it can set options
4  
5  
module SnippetTranspiler > DynPrintLog {
6  
  set flag NoNanoHTTPD.
7  
  !include #1029545 // API for Eleu
8  
  
9  
  switchable int refreshDelay = 0; // seconds
10  
  
11  
  start {
12  
   dm_onSnippetTranspiled(voidfunc(S snippetID) {
13  
      if (sameSnippetID(snippetID, defaultTranspilerID()))
14  
        refresh();
15  
    });
16  
  }
17  
  
18  
  void refresh {
19  
    veryQuickJava_refresh();
20  
    vmBus_send('refreshedTranspiler);
21  
    print("Refreshed translator.");
22  
  }
23  
24  
  virtual WebResponse html(IWebRequest req) {
25  
    S realPW = realPW();
26  
    if (empty(realPW))
27  
      ret "No password set by admin - please put password in: " + realPWFile().getAbsolutePath();
28  
    
29  
    S pw = req.get("_pass");
30  
    if (empty(pw)) ret "Need pw";
31  
    
32  
    if (neq(pw, realPW)) {
33  
      print("XXX - Alert, bad PW entered on web - XXX");
34  
      ret "Bad PW, bugger";
35  
    } 
36  
    
37  
    ret dm_evalInQ(->
38  
      snippetTranspileWebBot(req.uri(), req.params(), refreshDelay));
39  
  }
40  
  
41  
  File realPWFile() {
42  
    ret secretProgramFile("master-pw");
43  
  }
44  
45  
  S realPW() {
46  
    ret trim(loadTextFile(realPWFile()));
47  
  }
48  
}

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: 242 / 4868
Version history: 16 change(s)
Referenced in: [show references]