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

100
LINES

< > BotCompany Repo | #1032188 // gaz.ai [LIVE]

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

Uses 1951K of libraries. Click here for Pure Java version (8888L/68K).

1  
!7
2  
3  
mainPackage gazelle
4  
mainClassName main
5  
6  
module GazAI > GazelleBEA {
7  
  transient long filesObjectID = 270;
8  
  
9  
  /*O html4(Req req) {
10  
    ret hfullcenter(centerGazelleLogo());
11  
  }*/
12  
  
13  
  @Override O serveHomePage_base() {
14  
    new HTMLFramer1 framer;
15  
    framer.title = "Gaz.AI";
16  
    framer.renderTitle = () -> "";
17  
    framer.addInHead(hsansserif());
18  
    framer.add(hfullcenter(
19  
      centerGazelleLogo()
20  
      + p(ahref(baseLink + "/login", "Internal"))
21  
      ));
22  
    ret framer!;
23  
  }
24  
  
25  
  @Override Cl<Class> cruddableClasses(DynGazelleRocks.Req req) {
26  
    ret addAllAndReturnCollection(super.cruddableClasses(req), Settings);
27  
  }
28  
29  
  S authFormMoreContent() {
30  
    printStackTrace();
31  
    ret super.authFormMoreContent();
32  
  }
33  
  
34  
  void init :: after {
35  
    runRefChecker = false;
36  
    botName = heading = adminName = "Gaz.AI";
37  
    showCRUDToEveryone = false;
38  
    showCRUDToNonMasterUsers = true; // TODO: make sure no classes "leak"
39  
    showInputAndPatternNavItems = false;
40  
    set authedDialogIDForEveryCookie;
41  
  }
42  
  
43  
  L<Class> publicCRUDs() {
44  
    ret ll(UploadedImage.class, UploadedSound.class);
45  
  }
46  
  
47  
  // put the public CRUDs here but make sure to filter them in
48  
  // the next method!
49  
  @Override L<Class> crudClasses(DynGazelleRocks.Req req) {
50  
    if (!masterAuthed(req))
51  
      ret publicCRUDs();
52  
    else
53  
      ret super.crudClasses(req);
54  
  }
55  
  
56  
  @Override MapSO filtersForClass(Class c, DynGazelleRocks.Req req) {
57  
    if (!masterAuthed(req) && contains(publicCRUDs(), c))
58  
      ret litmap(user := user(req));
59  
    ret super.filtersForClass(c, req);
60  
  }
61  
  
62  
  O serve404Page() {
63  
    if (startsWith(currentReq().uri, "/crud/"))
64  
      ret hredirect(baseLink + "/login");
65  
    else
66  
      ret subBot_serve404("Resource not found, please try the " + ahref("/", "home page"));
67  
  }
68  
  
69  
  @Override O serveDefaultPage(DynGazelleRocks.Req req) {
70  
    if (ewicOneOf(req.uri(), ".css", ".js"))
71  
      ret serve404Page();
72  
      
73  
    if (eqicOneOf(req.uri(), "/gazelle.jar", "/webhook"))
74  
      ret eleu_callModuleHTMLMethod("gazAiHomePage", req);
75  
      //ret subBot_serveRedirect("https://ultrafast.gaz.ai" + req.uri());
76  
      
77  
    S uri = replacePrefix("/kb/", "/", req.uri());
78  
    ret hrefresh(addParamsToURL("https://gazelle.rocks/kb" + uri, req.params());
79  
  }
80  
  
81  
  @Override O serveOtherPage2(Req req) {
82  
    new Matches m;
83  
    S uri = req.uri();
84  
85  
    if (startsWith(uri, "/files/", m)) {
86  
      req.subURI = m.rest();
87  
      ret beaCall(filesObjectID, "html", req);
88  
    }
89  
    ret super.serveOtherPage2(req);
90  
  }
91  
  
92  
  void makeNavItems_base(DynGazelleRocks.Req req, HTMLFramer1 framer) {
93  
    super.makeNavItems_base(req, framer);
94  
    
95  
    if (isMasterAuthed(req))
96  
      framer.addNavItem(ahref("https://vnc.gaz.ai", "VNC"));
97  
  }
98  
}
99  
100  
!include early #1031418 // Gazelle BEA

Author comment

Began life as a copy of #1031945

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032188
Snippet name: gaz.ai [LIVE]
Eternal ID of this version: #1032188/45
Text MD5: 407fcdf158f7e61a1e58d5ada913ae07
Transpilation MD5: 2f647e3b79f7ae3bbc3dc8a69c14edec
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2023-02-19 00:52:52
Source code size: 2860 bytes / 100 lines
Pitched / IR pitched: No / No
Views / Downloads: 465 / 172406
Version history: 44 change(s)
Referenced in: [show references]