diff --git a/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/get-lc2-page.js b/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/get-lc2-page.js index 7f0e2a8d..d8c46cd8 100644 --- a/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/get-lc2-page.js +++ b/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/get-lc2-page.js @@ -1,6 +1,5 @@ var minisrv_service_file = true; -var wtvflashrom; request_is_async = true; if (!request_headers.query.path) { @@ -12,12 +11,19 @@ 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\nwtv-expire-all: wtv-flashrom:/get-lc2-page?"; + 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); @@ -30,7 +36,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 = ` @@ -96,16 +103,10 @@ data += ` +curblock="${(flashrom_info.part_number + 1)}"${(flashrom_info.part_count) ? ` +totalblocks="${flashrom_info.part_count}">` : `>`}

@@ -149,6 +150,7 @@ ${flashrom_info.message} } else { var errpage = wtvshared.doErrorPage(400) headers = errpage[0]; + headers += "\nminisrv-no-mail-count: true\nwtv-expire-all: wtv-flashrom:/get-lc2-page?"; data = errpage[1]; } sendToClient(socket, headers, data); diff --git a/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/initiate-lc2-download.js b/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/initiate-lc2-download.js index a757e999..90b8d7de 100644 --- a/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/initiate-lc2-download.js +++ b/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/initiate-lc2-download.js @@ -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"; diff --git a/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/lc2-download-complete.js b/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/lc2-download-complete.js index fbf033c8..cafe95fa 100644 --- a/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/lc2-download-complete.js +++ b/zefie_wtvp_minisrv/ServiceVault/wtv-flashrom/lc2-download-complete.js @@ -1,7 +1,9 @@ var minisrv_service_file = true; headers = `200 OK -Content-type: text/html` +Content-type: text/html +minisrv-no-mail-count: true +Connection: close` data = `