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

37
LINES

< > BotCompany Repo | #1030815 // Gazelle BEA Log-In

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

Uses 1113K of libraries. Click here for Pure Java version (13422L/72K).

!7

cmodule2 BEALogIn {
  S user, botToken, status;
  bool loggedIn;
  
  visual
    jCenteredSection("Log-in to bea.gazelle.rocks",
      makeForm3(
        "User name", dm_textField user(),
        "Bot token", dm_passwordField botToken(),
        "Status", dm_label status(),
        "", dm_button check()));
      
  start-thread {
    check();
  }
  
  void check {
    try {
      S user = trim(this.user), botToken = trim(this.botToken);
      Map data = cast postJSONPage("https://bea.gazelle.rocks/bot/beaList", _user := user, _botToken := botToken, changedAfter := now()+60000);
      L<Map> list = cast data.get("result");
      if (list != null)
        setFields(status := "Logged in as " + user, loggedIn := true);
      else
        setFields(status := "Error: " + str(data.get("error")), loggedIn := false);
    } catch print e {
      setFields(status := "Error: " + exceptionToStringShort(e), loggedIn := false);
    }
  }

  // API

  bool loggedIn() { ret loggedIn; }
  PairS userAndBotToken() { ret pair(user, botToken); }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

-
Snippet ID: #1030815
Snippet name: Gazelle BEA Log-In
Eternal ID of this version: #1030815/9
Text MD5: 2db78ac5f44decd064204dbc250ae3b6
Transpilation MD5: badfc89373252212906a7881a60c67a3
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-11 23:19:39
Source code size: 1045 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 198 / 1552
Version history: 8 change(s)
Referenced in: