fix disk (for real) + other

This commit is contained in:
zefie
2025-08-09 02:32:34 -04:00
parent 4105300f1b
commit d5aa7a6341
5 changed files with 13 additions and 39 deletions

View File

@@ -46,8 +46,9 @@ data = `<html>
http-equiv=refresh http-equiv=refresh
content="0;url=client:Fetch?source=wtv-disk:/sync`; content="0;url=client:Fetch?source=wtv-disk:/sync`;
if (request_headers.query.diskmap) data += `%3fdiskmap%3d${request_headers.query.diskmap}`; if (request_headers.query.diskmap) data += `%3fdiskmap%3d${request_headers.query.diskmap}`;
if (request_headers.query.force) data += `%26force%3dtrue`
if (!request_headers.query.group) data += `&root=file://Disk/Browser/`; if (!request_headers.query.group) data += `&root=file://Disk/Browser/`;
else data += `&group=${request_headers.query.group}`; else data += `&group=${request_headers.query.group}`;;
data += `&message=Retrieving Files..." data += `&message=Retrieving Files..."
> >
<display downloadsuccess="${success_url}" downloadfail="${fail_url}"> <display downloadsuccess="${success_url}" downloadfail="${fail_url}">
@@ -77,7 +78,7 @@ data += `&message=Retrieving Files..."
<td colspan=2> <td colspan=2>
<td> <td>
<font size=+1> <font size=+1>
Your ${wtvshared.getBoxName(session_data.get("wtv-client-rom-type"))} is retrieving some files. Your ${session_data.getBoxName()} is retrieving some files.
<p>This usually takes a while. <p>This usually takes a while.
</font> </font>
<tr> <tr>

View File

@@ -65,7 +65,11 @@ if (request_headers['wtv-request-type'] == 'download') {
if (update_list[k].checksum_match && !force_update) return; if (update_list[k].checksum_match && !force_update) return;
if (!update_list[k].invalid && !force_update) return; if (!update_list[k].invalid && !force_update) return;
} }
wtvdl.delete(update_list[k].file.replace(diskmap_group_data.base, ""), diskmap_group_name); delete_file = update_list[k].file.replace(diskmap_group_data.base, "")
if (!diskmap_group_data.files[k].dont_extract_filename) {
delete_file = delete_file.replace(".gz","");
}
wtvdl.delete(delete_file, diskmap_group_name);
}); });
Object.keys(update_list).forEach(function (k) { Object.keys(update_list).forEach(function (k) {
@@ -228,11 +232,12 @@ if (request_headers['wtv-request-type'] == 'download') {
// we need the checksum of the uncompressed data // we need the checksum of the uncompressed data
if (wtvshared.getFileExt(diskmap_data_file).toLowerCase() == "gz") { if (wtvshared.getFileExt(diskmap_data_file).toLowerCase() == "gz") {
var diskmap_data_filename = path.basename(diskmap_data_file);
var gunzipped = zlib.gunzipSync(diskmap_file_data); var gunzipped = zlib.gunzipSync(diskmap_file_data);
diskmap_group_data.files[k].checksum = CryptoJS.MD5(CryptoJS.lib.WordArray.create(gunzipped)).toString(CryptoJS.enc.Hex).toLowerCase(); diskmap_group_data.files[k].checksum = CryptoJS.MD5(CryptoJS.lib.WordArray.create(gunzipped)).toString(CryptoJS.enc.Hex).toLowerCase();
var gzip_fn_end = diskmap_file_data.indexOf("\0", 10); var gzip_fn_end = diskmap_file_data.indexOf("\0", 10);
if (!diskmap_group_data.files[k].dont_extract_filename) { if (!diskmap_group_data.files[k].dont_extract_filename) {
diskmap_group_data.files[k].original_filename = diskmap_file_data.toString('utf8', 10, gzip_fn_end); diskmap_group_data.files[k].original_filename = diskmap_group_data.files[k].file.replace(diskmap_group_data.base,"").replace(diskmap_data_filename, diskmap_file_data.toString('utf8', 10, gzip_fn_end));
} }
diskmap_group_data.files[k].uncompressed_size = gunzipped.byteLength; diskmap_group_data.files[k].uncompressed_size = gunzipped.byteLength;
gunzipped = null; gunzipped = null;

View File

@@ -2,6 +2,7 @@ var minisrv_service_file = true;
headers = `200 OK headers = `200 OK
Content-type: text/html Content-type: text/html
wtv-expire-all: wtv-flashrom:
minisrv-no-mail-count: true` minisrv-no-mail-count: true`
if (socket.ssid && ssid_sessions[socket.ssid]) { if (socket.ssid && ssid_sessions[socket.ssid]) {

View File

@@ -150,14 +150,9 @@ class WTVDownloadList {
*/ */
get(file, path, source, group, checksum = null, uncompressed_size = null, original_filename = null, file_permission = 'r') { get(file, path, source, group, checksum = null, uncompressed_size = null, original_filename = null, file_permission = 'r') {
if (original_filename) { if (original_filename) {
file = file.split('/'); path = path.replace(file, original_filename);
const file_name = file[file.length - 1];
path = path.replace(file_name, original_filename);
file.pop();
if (file.length > 0) file = file.join('/') + '/' + original_filename;
else file = original_filename;
} }
this.download_list += `GET ${file}\n`; this.download_list += `GET ${original_filename || file}\n`;
source = source.replace(/\\/g, "/"); source = source.replace(/\\/g, "/");
this.download_list += `group: ${group}-UPDATE\n`; this.download_list += `group: ${group}-UPDATE\n`;

View File

@@ -176,34 +176,6 @@ class WTVShared {
return out; return out;
} }
/**
* Gets the box name based on the client ROM type
* @param {string} client_rom_type The client ROM type
* @returns {string} The box name
*/
getBoxName(client_rom_type) {
switch (client_rom_type) {
case "bf0app":
case "bfeapp":
case "US-BPS-flashdisk-0MB-8MB-softmodem-CPU5230":
case "US-BPS-flashdisk-0MB-16MB-softmodem-CPU5230":
return "WebTV Internet Terminal";
case "US-DTV-disk-0MB-32MB-softmodem-CPU5230":
case "US-WEBSTAR-disk-0MB-8MB-softmodem-CPU5230":
case "US-WEBSTAR-disk-0MB-16MB-softmodem-CPU5230":
return "WebTV Satellite Receiver";
case "US-LC2-disk-0MB-8MB":
case "US-LC2-disk-0MB-8MB-softmodem-CPU5230":
case "US-LC2-flashdisk-0MB-16MB-softmodem-CPU5230":
return "WebTV Plus Internet Receiver";
default:
return "WebTV Internet Receiver";
}
}
/** /**
* Calculates the CRC of an SSID, WNI Style * Calculates the CRC of an SSID, WNI Style
* @param {string} ssid * @param {string} ssid