- BREAKING CHANGE from v0.9.35 and eariler: Move accounts into subfolder of SessionStore
 - viewergen and viewer updates from @GraspYonOx
 - new homepage theme inspired by @GraspYonOx
 - connect setup also mostly by @GraspYonOx
 - numerous bug fixes
 - nntp-server-zefie is now on npmjs
 - implement proper nodejs debugging
   - will start to phase out using console.log for actual debugging
   - existing "debug" (verbose) messages will stay as is
   - future code debugging will use debug() to debug WIP, therefore not showing to most users if it is accidently left in
This commit is contained in:
zefie
2022-10-16 18:58:30 -04:00
parent b89e0e932c
commit c2a3081afd
91 changed files with 1653 additions and 1694 deletions

View File

@@ -1,5 +1,6 @@
var minisrv_service_file = true;
request_is_async = true;
var request_is_async = true;
var bf0app_update = false;
var request_path = request_headers.request_url.replace(service_name + ":/", "");

View File

@@ -1,6 +1,5 @@
var minisrv_service_file = true;
const WTVFlashrom = require(classPath + "/WTVFlashrom.js");
request_is_async = true;
// this build can be local or on zefie's server

View File

@@ -1,6 +1,5 @@
var minisrv_service_file = true;
const WTVFlashrom = require(classPath + "/WTVFlashrom.js");
request_is_async = true;
var bf0app_update = false;

View File

@@ -1,7 +1,5 @@
var minisrv_service_file = true;
const WTVFlashrom = require(classPath + "/WTVFlashrom.js");
var wtvflashrom;
request_is_async = true;
if (!request_headers.query.path) {
@@ -13,15 +11,23 @@ if (!request_headers.query.path) {
var request_path = request_headers.query.path;
// read flashrom header info into array using WTVFlashrom class
wtvflashrom.getFlashromMeta(request_path, function (data) {
processLC2DownloadPage(request_headers.query.path, data, (request_headers.query.numparts ? request_headers.query.numparts : null));
wtvflashrom.getFlashromMeta(request_path, function (data, headers) {
processLC2DownloadPage(data, headers, (request_headers.query.numparts ? request_headers.query.numparts : null));
});
}
async function processLC2DownloadPage(path, flashrom_info, numparts = null) {
async function processLC2DownloadPage(flashrom_info, headers, numparts = null) {
if (typeof flashrom_info === 'string') {
// zefie_flashrom_server error
data = flashrom_info;
headers += "\nminisrv-no-mail-count: true";
headers += "\nwtv-expire-all: wtv-flashrom:/get-lc2-page?";
headers += "\nwtv-expire-all: wtv-flashrom:/content";
sendToClient(socket, headers, data);
return false;
}
if (numparts != null) flashrom_info.part_count = parseInt(numparts);
if (!flashrom_info.part_count) flashrom_info.part_count = parseInt(flashrom_info.message.substring(flashrom_info.message.length - 4).replace(/\D/g, ''));
console.log(flashrom_info);
if (parseInt(flashrom_info.part_number) >= 0 && flashrom_info.rompath && flashrom_info.next_rompath) {
if (!flashrom_info.message && flashrom_info.is_bootrom) {
flashrom_info.message = "BootRom Part " + (flashrom_info.part_number + 1) + " of " + flashrom_info.part_count;
@@ -31,7 +37,8 @@ async function processLC2DownloadPage(path, flashrom_info, numparts = null) {
}
headers = `200 OK
Content-type: text/html`
Content-type: text/html
minisrv-no-mail-count: true`
data = `<html>
<head>
@@ -97,16 +104,10 @@ data += `
<upgradeblock width=250 height=15
nexturl="${flashrom_info.next_rompath}"
errorurl="${service_name}:/lc2-download-failed?"
blockurl="${flashrom_info.rompath}"`;
data += `
blockurl="${flashrom_info.rompath}"
lastblock="${flashrom_info.is_last_part}"
curblock="` + (flashrom_info.part_number + 1) + `"
`;
if (flashrom_info.part_count) {
data += `totalblocks="${flashrom_info.part_count}"`;
}
data += `>
curblock="${(flashrom_info.part_number + 1)}"${(flashrom_info.part_count) ? `
totalblocks="${flashrom_info.part_count}">` : `>`}
<font size="-1" color="#D6DFD0">
<br>
<img src="${service_name}:/ROMCache/Spacer.gif" width=2 height=10><br>
@@ -150,6 +151,9 @@ ${flashrom_info.message}
} else {
var errpage = wtvshared.doErrorPage(400)
headers = errpage[0];
headers += "\nminisrv-no-mail-count: true";
headers += "\nwtv-expire-all: wtv-flashrom:/get-lc2-page?";
headers += "\nwtv-expire-all: wtv-flashrom:/content";
data = errpage[1];
}
sendToClient(socket, headers, data);

View File

@@ -10,6 +10,7 @@ var romtype = session_data.get("wtv-client-rom-type");
if (request_headers.query.numparts) url += "&numparts=" + request_headers.query.numparts;
}
headers = "300 OK\n";
headers += "minisrv-no-mail-count: true\n";
headers += "wtv-visit: " + url + "\n";
headers += "Location: " + url + "\n";
headers += "Content-type: text/html";

View File

@@ -1,7 +1,8 @@
var minisrv_service_file = true;
headers = `200 OK
Content-type: text/html`
Content-type: text/html
minisrv-no-mail-count: true`
data = `<html>

View File

@@ -1,6 +1,5 @@
var minisrv_service_file = true;
const WTVFlashrom = require(classPath + "/WTVFlashrom.js");
request_is_async = true;
// this build can be local or on zefie's server