!7
html {
if (eq(uri, "/update")) {
try object checkWebAuthed(params);
thread { update(); }
ret "Updating";
}
if (eq(uri, "/serve"))
ret subBot_serveHTMLFile(theFile());
ret "File: " + formatLocalDateWithMinutes(lastModified(theFile())) + " (" + fileSize(theFile()) + ")";
}
p {
if (!fileExists(theFile())) thread { update(); }
atTheStartOfEveryHour(r update);
}
svoid update {
saveTextFileIfNotNull(theFile(), loadPage(tb_mainServer() + "/tb/snippets.php?reverse=1&longlist=1&withmd5=1"));
}
static File theFile() { ret programFile("public-snippets.html"); }