This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* appjet:version 0.1 */ | |
import("storage", "cron", "dlog"); | |
// latest build no store | |
if (!storage.latest) { | |
storage.latest = 0; | |
} | |
const BASE_URL = "http://build.chromium.org/buildbot/snapshots/sub-rel-mac/"; | |
var latestBuildNo = wget(BASE_URL + "LATEST"); | |
var latestURL = BASE_URL + latestBuildNo; | |
function get_main() { | |
dlog.info("Call form http"); | |
print(H1("Chromium official build watcher")); | |
print(DIV({style: "font-size: 400%"}, | |
"Latest build is ... ", | |
A({href: latestURL}, latestBuildNo) | |
)); | |
} | |
function get_admin() { | |
if (!appjet.isPreview) { | |
response.redirect("/"); | |
return; | |
} | |
print("welcom admin!"); | |
} | |
function cron_tweet() { | |
dlog.info("Call from Cron"); | |
dlog.info("Latest(storage):" + storage.latest); | |
dlog.info("Latest(site) :" + latestBuildNo); | |
if (storage.latest < latestBuildNo) { | |
storage.latest = latestBuildNo; | |
var res = wpost( | |
"http://twitter.com/statuses/update.json", { | |
status: "Chromium latest build " + latestBuildNo + | |
" available now." + latestURL | |
}, { | |
headers: {Authorization: "Basic " + storage.auth}, | |
complete: true | |
} | |
); | |
} | |
} | |
//storage.cron = scheduleRepeating(new Date("May 19, 2009"), 15, "/tweet", {}, true); | |
//unschedule(storage.cron); | |
//unscheduleAll(); | |
//print(listAll()); | |
//print(new Date); | |
//print((new Date) + 1000); | |
dispatch(); |