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

38
LINES

< > BotCompany Repo | #1029909 // ADA Main Bot

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

Download Jar. Libraryless. Click here for Pure Java version (2920L/18K).

!7

!include once #1028763 // helper for HttpFromFileSystem
set flag NoNanoHTTPD.

sbool pkiValidation = true;

html {
  if (domain() == null) ret serve404();
  
  S vis = registerVisitor();
  
  ret domainAndURISwitch(uri, params);
}

sO domainAndURISwitch(S uri, SS params) {
  S domain = domain();

  uri = addSlash(addSlashPrefix(uri));
  
  if (pkiValidation && startsWith(uri, "/.well-known/"))
    ret subBot_serveText(loadTextFile(userDir("validation.txt")));
    
  // URI switches
  
  new Matches m;
  
  if (swic(uri, "/ada/admin/", m))
    ret callHtmlMethod2(getBot(#1028301), "/" + m.rest(), params);
    
  if (eqic(uri, "/script/"))
    ret callHtmlMethod2(getBot(#1028300), "/raw", params);
   
  if (eq(uri, "/"))
    ret hrefresh("/ada/admin");
  
  null;
}

Author comment

Began life as a copy of #1016323

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1029909
Snippet name: ADA Main Bot
Eternal ID of this version: #1029909/4
Text MD5: d8a31abc2c2dfe61e84779ca4c69599b
Transpilation MD5: b70cb47a011174475a87c7a7e6bf8b76
Author: stefan
Category: javax / html
Type: JavaX module (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-10-01 15:02:07
Source code size: 814 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 157 / 665
Version history: 3 change(s)
Referenced in: [show references]