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

1  
!7
2  
3  
cmodule2 BEALogIn {
4  
  S user, botToken, status;
5  
  bool loggedIn;
6  
  
7  
  visual
8  
    jCenteredSection("Log-in to bea.gazelle.rocks",
9  
      makeForm3(
10  
        "User name", dm_textField user(),
11  
        "Bot token", dm_passwordField botToken(),
12  
        "Status", dm_label status(),
13  
        "", dm_button check()));
14  
      
15  
  start-thread {
16  
    check();
17  
  }
18  
  
19  
  void check {
20  
    try {
21  
      S user = trim(this.user), botToken = trim(this.botToken);
22  
      Map data = cast postJSONPage("https://bea.gazelle.rocks/bot/beaList", _user := user, _botToken := botToken, changedAfter := now()+60000);
23  
      L<Map> list = cast data.get("result");
24  
      if (list != null)
25  
        setFields(status := "Logged in as " + user, loggedIn := true);
26  
      else
27  
        setFields(status := "Error: " + str(data.get("error")), loggedIn := false);
28  
    } catch print e {
29  
      setFields(status := "Error: " + exceptionToStringShort(e), loggedIn := false);
30  
    }
31  
  }
32  
33  
  // API
34  
35  
  bool loggedIn() { ret loggedIn; }
36  
  PairS userAndBotToken() { ret pair(user, botToken); }
37  
}

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: 135 / 1458
Version history: 8 change(s)
Referenced in: [show references]