- FlashROM Support for LC2 and newer. - FlashROM system can handle local files, or proxy from server (default). No need to have a local FlashROM collection! - Added 'verbosity' configuration option - Update HTML Mode to async fileRead - Config option for sending tellyscripts or not - Config option to mask SSIDs in console log - Update wtv-home:/home and wtv-home:/zefie - Update .gitignore - Add wtv-music:/demo/index courtesy of MattMan69 - Update HTML Mode to async fileRead - Update Raw TXT Mode to async fileRead - Replaced .async.js feature with defining `request_is_async` in standard .js script - Cleaned up code a bit - Moved global var 'query' to 'request_headers.query' - Tidied ServiceDeps - Upgraded wtv-log:/log to async, now also logs query arguments, saves to .txt for easier reading.
42 lines
1.6 KiB
JavaScript
42 lines
1.6 KiB
JavaScript
// todo: async (and make this work anyway)
|
|
|
|
var content_dir = service_dir + '/content/';
|
|
var diskmap_dir = content_dir + '/diskmaps/';
|
|
|
|
if (request_headers.post_data) {
|
|
console.log(request_headers.post_data.toString('CryptoJS.enc.Latin1'))
|
|
}
|
|
|
|
if (request_headers.query.diskmap) {
|
|
if (fs.lstatSync(diskmap_dir + request_headers.query.diskmap + ".txt")) {
|
|
var diskmap_data = fs.readFileSync(diskmap_dir + request_headers.query.diskmap + ".txt").toString();
|
|
// try to parse diskmap and get an accurate timestamp for webtv versioning
|
|
// check all files in the diskmap and return the timestamp of the most recently modified
|
|
|
|
data = '';
|
|
var latest_file_ts = 0;
|
|
diskmap_data.split("\n").forEach(function (v) {
|
|
if (v.indexOf(" sync ") != -1) {
|
|
v = v.trim();
|
|
var vcon = v.substring(v.indexOf("content/"));
|
|
vcon = vcon.replace("content/", content_dir)
|
|
var vconstat = Math.floor(fs.lstatSync(vcon).mtimeMs / 1000);
|
|
if (vconstat > latest_file_ts) {
|
|
latest_file_ts = vconstat
|
|
}
|
|
// todo read client post and only give whats needed
|
|
// instead of all that is available
|
|
// vconstat has the mtime of each file, we need to parse the post_data
|
|
data += v + "\n";
|
|
} else {
|
|
data += v + "\n";
|
|
}
|
|
});
|
|
//data = diskmap_data.replace("!VERS!", latest_file_ts);
|
|
}
|
|
}
|
|
|
|
headers = `200 OK
|
|
Content-type: text/download-list`
|
|
|