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

1  
!7
2  
3  
!include once #1028763 // helper for HttpFromFileSystem
4  
set flag NoNanoHTTPD.
5  
6  
sbool pkiValidation = true;
7  
8  
html {
9  
  if (domain() == null) ret serve404();
10  
  
11  
  S vis = registerVisitor();
12  
  
13  
  ret domainAndURISwitch(uri, params);
14  
}
15  
16  
sO domainAndURISwitch(S uri, SS params) {
17  
  S domain = domain();
18  
19  
  uri = addSlash(addSlashPrefix(uri));
20  
  
21  
  if (pkiValidation && startsWith(uri, "/.well-known/"))
22  
    ret subBot_serveText(loadTextFile(userDir("validation.txt")));
23  
    
24  
  // URI switches
25  
  
26  
  new Matches m;
27  
  
28  
  if (swic(uri, "/ada/admin/", m))
29  
    ret callHtmlMethod2(getBot(#1028301), "/" + m.rest(), params);
30  
    
31  
  if (eqic(uri, "/script/"))
32  
    ret callHtmlMethod2(getBot(#1028300), "/raw", params);
33  
   
34  
  if (eq(uri, "/"))
35  
    ret hrefresh("/ada/admin");
36  
  
37  
  null;
38  
}

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: 296 / 973
Version history: 3 change(s)
Referenced in: [show references]