Uses 911K of libraries. Click here for Pure Java version (15652L/83K).
!7 concept User { GlobalID eleuUserGlobalID; S googleEmail; Superposition defaultSuperposition; Superposition defaultSuperposition() { ret withDBLock(this, () -> { if (defaultSuperposition == null) cset(this, defaultSuperposition := cnew Superposition(user := User.this, name := shortUserName() + "1")); ret defaultSuperposition; }); } S shortUserName() { ret or2(takeCharsWhile isLetter(googleEmail), "unknown"); } } concept Superposition > ConceptWithGlobalID { User user; S name; } concept Rewrite > ConceptWithGlobalID { Superposition sp; S in, out, purpose, conditions; } concept Statement > ConceptWithGlobalID { Superposition sp; S text, meta; bool enabled; } cmodule RewriteDBWebBot > DynPrintLogAndEnabled { set flag NoNanoHTTPD. S myLink() { ret "/db/"; } start { dbIndexing(User, 'eleuUserGlobalID); } O html(virtual Request req) { try { SS params = cast rget params(req); virtual User eleuUser = rcall loggedInUser(req); if (eleuUser == null) ret "Need cookie"; GlobalID userID = cast quickImport(rcall globalID(eleuUser)); User user = uniq User(eleuUserGlobalID := assertNotNull(userID)); cset(user, googleEmail := getString googleEmail(eleuUser)); HCRUD_Concepts<Superposition> data = new <>(Superposition.class).addFilter(+user); HCRUD crud = new(myLink(), data); crud.uneditableFields = litset("globalID", "user"); ret "Hello " + eleuUser + ", " + user.eleuUserGlobalID + ", " + user.googleEmail + h3("Your superpositions") + crud.renderPage(params); } on fail e { printStackTrace(e); } } // API for Eleu void setEleu(O eleu) { mainBot = eleu; } }
Began life as a copy of #1028961
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1028965 |
Snippet name: | Rewrite DB Web Bot [dev.] |
Eternal ID of this version: | #1028965/24 |
Text MD5: | d6ba93d7ad924d9412c37b14f157644e |
Transpilation MD5: | 325f3d54e496c57c8a5fc2f28e432d4f |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-14 21:51:40 |
Source code size: | 1836 bytes / 69 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 281 / 30416 |
Version history: | 23 change(s) |
Referenced in: | #1028671 - Eleu Cruddie [old] #1029494 - Eleu 3 [backup without WebSockets] #1029617 - Eleu 3 [backup before DynEleu] |