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

55
LINES

< > BotCompany Repo | #1010693 // Central Bot for autoRestart - LIVE

JavaX source code (desktop) [tags: ai1-lol butter use-pretranspiled] - run with: x30.jar - homepage - homepage

Download Jar. Libraryless. Click here for Pure Java version (14556L/103K).

1  
!7
2  
3  
concept Log {
4  
  S programID, ip;
5  
  long count, last;
6  
}
7  
8  
static ConceptFieldIndexDesc lastAccessIndex;
9  
10  
p {
11  
  dbSaveEvery(60);
12  
  dbIndexing(Log, 'ip);
13  
  lastAccessIndex = new ConceptFieldIndexDesc(Log, 'last);
14  
  makeSalt();
15  
}
16  
17  
static File saltFile() { ret secretProgramFile("salt"); }
18  
sS salt() { ret trim(loadTextFile(saltFile())); }
19  
svoid makeSalt {
20  
  if (empty(salt())) saveTextFile(saltFile(), aGlobalID());
21  
}
22  
23  
html {
24  
  if (webAuthed(params) && eq(uri, "/logs")) {
25  
    long since = parseLongOpt(params.get("since"));
26  
    //L<Log> l = unlistedCopies(sortedByFieldDesc(Log, 'last));
27  
    Iterator<Log> it = lastAccessIndex.objectIterator();
28  
    new L<Log> l;
29  
    while (l(l) < 500 && it.hasNext()) {
30  
      Log log = it.next();
31  
      if (log.last < since) break;
32  
      l.add(unlistedCopy(log));
33  
    }
34  
    S salt = salt();
35  
    for (Log log : l) log.ip = md5(log.ip + salt);
36  
    ret serveText(renderConcepts(l));
37  
    //ret serveText(renderConcepts(list(Log)));
38  
  }
39  
  
40  
  S id = fsI(params.get("id"));
41  
  S ip = clientIP();
42  
  
43  
  Log log = uniq(Log, +ip, programID := id);
44  
  cset(log, count := log.count+1, last := now());
45  
  
46  
  S md5 = getServerTranspilationMD5(id);
47  
  
48  
  // if transpilation is outdated, hasServerDex will be false
49  
  if (isMD5(md5) && !hasServerDex(id)) md5 = "-";
50  
  
51  
  if (isMD5(md5))
52  
    ret md5;
53  
  else
54  
    ret "-";
55  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010693
Snippet name: Central Bot for autoRestart - LIVE
Eternal ID of this version: #1010693/18
Text MD5: 85f4d3cb5aed2e0d8829f4fe88cbec93
Transpilation MD5: 8c248370aa6b10991a210c9dd20500ba
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-19 13:10:16
Source code size: 1388 bytes / 55 lines
Pitched / IR pitched: No / No
Views / Downloads: 672 / 4810
Version history: 17 change(s)
Referenced in: [show references]