v0.9.5
- major update: app.js: rewrite socket handling to stream data (fix issues POSTing with shoddy dialup, namely fix wtv-update:/sync issues)
- update: wtv-home:/home: remove broken irc test, add links to DiskHax and VFatHax, remove URL Accessor form from MiniBrowser because it doesn't work
- update: wtv-update:/sync: skip file if the Content-length matches the client and the client file is equal or newer, since client is not storing wtv-checksum for some reason. Client file time is set to when the client received the file last, and not actually when the file was modified on our end
- update: wtv-head-waiter:/login-stage-two: offer prompt to minibrowser to go to home or willie
- fix: clean up socket session data on socket error
- code fixup: use `${}` instead of escaping string
- app.js: better minibrowser session cleanup
- update: http(s) proxy: do not send internal 'wtv-connection-close' header to client
- fix: http(s) proxy: handle socks HostUnreachable error
- fix: wtv-head-waiter:/login-stage-two: usernames longerfix: build 3833 crashes when `wtv-user-name` is too long
- fix: wtv-log:/log
- add: wtv-chat
- add: wtv-setup
This commit is contained in:
@@ -83,7 +83,7 @@ function processGroup(diskmap_primary_group, diskmap_group_data, diskmap_subgrou
|
||||
if (!post_data_fileinfo[post_data_filecount]) post_data_fileinfo[post_data_filecount] = new Array();
|
||||
|
||||
if (post_data_line_name == "Last-modified") {
|
||||
post_data_fileinfo[post_data_filecount][post_data_line_name] = (Date.parse(post_data_line_data) / 1000);
|
||||
post_data_fileinfo[post_data_filecount][post_data_line_name] = (new Date(new Date(Date.parse(post_data_line_data)).toUTCString()) / 1000);
|
||||
} else if (post_data_line_name == "Content-length") {
|
||||
post_data_fileinfo[post_data_filecount][post_data_line_name] = parseInt(post_data_line_data);
|
||||
}
|
||||
@@ -107,14 +107,17 @@ function processGroup(diskmap_primary_group, diskmap_group_data, diskmap_subgrou
|
||||
if (!fs.existsSync(post_match_file)) post_match_file = null;
|
||||
});
|
||||
|
||||
var post_match_file_lstat = fs.lstatSync(post_match_file);
|
||||
var post_match_result = post_data_fileinfo.find(el => el.file === diskmap_group_data.files[k].file) || null;
|
||||
var file_in_postdata = function (post_file) {
|
||||
return post_file.file === diskmap_group_data.files[k].file
|
||||
}
|
||||
|
||||
var post_match_file_lstat = fs.lstatSync(post_match_file);
|
||||
var post_match_result = post_data_fileinfo.find(file_in_postdata) || null;
|
||||
var post_match_file_data = new Buffer.from(fs.readFileSync(post_match_file, {
|
||||
encoding: null,
|
||||
flags: 'r'
|
||||
}));
|
||||
diskmap_group_data.files[k]["Last-modified"] = (post_match_file_lstat.mtime / 1000);
|
||||
diskmap_group_data.files[k]["Last-modified"] = (new Date(new Date(post_match_file_lstat.mtime).toUTCString()) / 1000);
|
||||
diskmap_group_data.files[k]["Content-length"] = post_match_file_lstat.size;
|
||||
diskmap_group_data.files[k]["wtv-checksum"] = CryptoJS.MD5(CryptoJS.lib.WordArray.create(post_match_file_data)).toString(CryptoJS.enc.Hex).toLowerCase();
|
||||
if (!diskmap_group_data.files[k].display) diskmap_group_data.files[k].display = diskmap_group_data.display;
|
||||
@@ -122,6 +125,9 @@ function processGroup(diskmap_primary_group, diskmap_group_data, diskmap_subgrou
|
||||
if (post_match_result) {
|
||||
// md5s match, so client doesn't need file
|
||||
if (diskmap_group_data.files[k]['wtv-checksum'].toLowerCase() == post_match_result["wtv-checksum"]) return;
|
||||
// last modified is equal to or newer than the last update, and file size match, so assume same file and client does not need it
|
||||
else if ((post_match_result["Last-modified"] >= diskmap_group_data.files[k]["Last-modified"]) && (post_match_result["Content-length"] == diskmap_group_data.files[k]["Content-length"])) return;
|
||||
// otherwise send to client
|
||||
else wtv_download_list.push(diskmap_group_data.files[k]);
|
||||
} else {
|
||||
wtv_download_list.push(diskmap_group_data.files[k]);
|
||||
@@ -170,12 +176,12 @@ if (request_headers.query.diskmap && request_headers.query.group && request_head
|
||||
var errpage = doErrorPage(404,"The requested DiskMap does not exist.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
console.log("wtv-update:/sync error", "could not find diskmap");
|
||||
if (zdebug) console.log(" # wtv-update:/sync error", "could not find diskmap");
|
||||
}
|
||||
} else {
|
||||
var errpage = doErrorPage(400);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
if (zdebug) console.log("wtv-update:/sync error", "missing query arguments");
|
||||
if (zdebug) console.log(" # wtv-update:/sync error", "missing query arguments");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user