- 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
52 lines
2.0 KiB
JavaScript
52 lines
2.0 KiB
JavaScript
// write posted log data to disk. should be decrypted by this point (if it was encrypted) if the crypto stream didn't break
|
|
|
|
request_is_async = true;
|
|
data = '';
|
|
var fullpath = __dirname + "/ServiceLogPost/" + Math.floor(new Date().getTime() / 1000) + "_" + request_headers.query.type;
|
|
if (socket.ssid) fullpath += "_" + socket.ssid;
|
|
fullpath += ".txt";
|
|
|
|
fullpath = fullpath.replace(/\\/g, "/");
|
|
|
|
if (request_headers.post_data) {
|
|
headers = `200 OK
|
|
Connection: Keep-Alive
|
|
Content-length: 0`;
|
|
|
|
var logdata_outstring = '';
|
|
Object.keys(request_headers.query).forEach(function (k) {
|
|
logdata_outstring += k + "=" + unescape(request_headers.query[k].toString()) + "\r\n";
|
|
});
|
|
logdata_outstring += "\r\n";
|
|
var logdata_outstring_hex = Buffer.from(logdata_outstring, 'utf8').toString('hex');
|
|
logdata_outstring_hex += request_headers.post_data.toString(CryptoJS.enc.Hex);
|
|
if (minisrv_config.services[service_name].write_logs_to_disk) {
|
|
fs.writeFile(fullpath, logdata_outstring_hex, "Hex", function () {
|
|
if (!zquiet) console.log(" * Wrote POST log data from", filterSSID(socket.ssid), "for", socket.id);
|
|
sendToClient(socket, headers, data);
|
|
});
|
|
} else {
|
|
sendToClient(socket, headers, data);
|
|
}
|
|
|
|
} else {
|
|
headers = `200 OK
|
|
Connection: Keep-Alive
|
|
Content-length: 0`;
|
|
|
|
var logdata_outstring = '';
|
|
Object.keys(request_headers.query).forEach(function (k) {
|
|
logdata_outstring += k + "=" + unescape(request_headers.query[k].toString()) + "\r\n";
|
|
});
|
|
var logdata_outstring_hex = Buffer.from(logdata_outstring, 'utf8').toString('hex');
|
|
if (minisrv_config.services[service_name].write_logs_to_disk) {
|
|
fs.writeFile(fullpath, logdata_outstring_hex, "Hex", function () {
|
|
if (!zquiet) console.log(" * Wrote GET log data from", filterSSID(socket.ssid), "for", socket.id);
|
|
sendToClient(socket, headers, data);
|
|
});
|
|
} else {
|
|
sendToClient(socket, headers, data);
|
|
}
|
|
}
|
|
|