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

40
LINES

< > BotCompany Repo | #1031530 // WebRequestFromNanoHTTPD (doesn't compile)

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (5934L) is out of date.

sclass WebRequestFromNanoHTTPD implements IWebRequest {
  NanoHTTPD.IHTTPSession httpSession;
  S uri, subURI;
  SS params, files;
  S cookie, clientIP;
  Session session;
  bool isHttps, noSpam;
  
  *(NanoHTTPD.IHTTPSession *httpSession, S *uri, SS *params) {}
  
  public S uri() { ret uri; }
  public SS params() { ret params; }
  public SS files() { ret files; }
  
  public SS headers() { ret httpSession.getHeaders(); }
  
  public S cookie() { ret cookie; }
  
  public bool isHttps() { ret isHttps; }
  
  User loggedInUser() {
    ret session == null ? null : session.user();
  }
  
  S googleClientID() {
    S domain = lower(domain());
    File jsonFile = googleClientSecretFileForDomain(domain);
    if (!fileExists(jsonFile)) null;
    
    Map map = decodeJSONMap(loadTextFile(jsonFile));
    map = (Map) map.get("web");
    ret (S) map.get("client_id");
  }
  
  public void noSpam {
    if (noSpam) ret;
    set noSpam;
    print("noSpam count: " + simpleSpamClientDetect2_markNoSpam(clientIP, uri) + " (" + clientIP + "/" + uri + ")");
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1031530
Snippet name: WebRequestFromNanoHTTPD (doesn't compile)
Eternal ID of this version: #1031530/3
Text MD5: 4514e3d68fc4798db3c4b3d84a328f32
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-18 20:30:18
Source code size: 1098 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 85 / 122
Version history: 2 change(s)
Referenced in: [show references]