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

!7

concept Log {
  S programID, ip;
  long count, last;
}

static ConceptFieldIndexDesc lastAccessIndex;

p {
  dbSaveEvery(60);
  dbIndexing(Log, 'ip);
  lastAccessIndex = new ConceptFieldIndexDesc(Log, 'last);
  makeSalt();
}

static File saltFile() { ret secretProgramFile("salt"); }
sS salt() { ret trim(loadTextFile(saltFile())); }
svoid makeSalt {
  if (empty(salt())) saveTextFile(saltFile(), aGlobalID());
}

html {
  if (webAuthed(params) && eq(uri, "/logs")) {
    long since = parseLongOpt(params.get("since"));
    //L<Log> l = unlistedCopies(sortedByFieldDesc(Log, 'last));
    Iterator<Log> it = lastAccessIndex.objectIterator();
    new L<Log> l;
    while (l(l) < 500 && it.hasNext()) {
      Log log = it.next();
      if (log.last < since) break;
      l.add(unlistedCopy(log));
    }
    S salt = salt();
    for (Log log : l) log.ip = md5(log.ip + salt);
    ret serveText(renderConcepts(l));
    //ret serveText(renderConcepts(list(Log)));
  }
  
  S id = fsI(params.get("id"));
  S ip = clientIP();
  
  Log log = uniq(Log, +ip, programID := id);
  cset(log, count := log.count+1, last := now());
  
  S md5 = getServerTranspilationMD5(id);
  
  // if transpilation is outdated, hasServerDex will be false
  if (isMD5(md5) && !hasServerDex(id)) md5 = "-";
  
  if (isMD5(md5))
    ret md5;
  else
    ret "-";
}

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: 552 / 4555
Version history: 17 change(s)
Referenced in: