streaming output data with drain detection support

- other stuff x.x
This commit is contained in:
zefie
2021-08-11 19:48:27 -04:00
parent fecbd032da
commit 0f0cc623c0
4 changed files with 100 additions and 35 deletions

View File

@@ -146,16 +146,21 @@ class WTVDownloadList {
* @param {string} checksum md5sum of the file
* @param {string} file_permission File permissions
*/
get(file, path, source, group, checksum = null, uncompressed_size = null, file_permission = 'r') {
file = this.wtvshared.stripGzipFromPath(file);
this.download_list += "GET " + file + "\n";
get(file, path, source, group, checksum = null, uncompressed_size = null, original_filename = null, file_permission = 'r') {
if (original_filename) this.download_list += "GET " + original_filename + "\n";
else this.download_list += "GET " + file + "\n";
this.download_list += "group: " + group + "-UPDATE\n";
this.download_list += "location: " + source + "\n";
this.download_list += "file-permission: " + file_permission + "\n";
if (checksum != null) this.download_list += "wtv-checksum: " + checksum + "\n";
if (uncompressed_size != null) this.download_list += "wtv-uncompressed-filesize: " + uncompressed_size + "\n";
this.download_list += "service-source-location: /webtv/content/" + source.substr(source.indexOf('-') + 1, source.indexOf(':/') - source.indexOf('-') - 1) + "d/" + source.substr(source.indexOf(':/') + 2) + "\n";
path = this.wtvshared.stripGzipFromPath(path);
this.download_list += "service-source-location: /webtv/content/" + source.substr(source.indexOf('-') + 1, source.indexOf(':/') - source.indexOf('-') - 1) + "d/" + source.substr(source.indexOf(':/') + 2) + "\n";
if (original_filename) {
file = file.split('/');
file = file[file.length - 1];
path = path.replace(file, original_filename);
}
this.download_list += "client-dest-location: " + path + "\n\n";
}
@@ -241,7 +246,7 @@ class WTVDownloadList {
if (fail_url === null) fail_url = new this.clientShowAlert({
'image': this.minisrv_config.config.service_logo,
'message': "Download failed...",
'buttonlabel1': "Okay...",
'buttonlabel1': "Fuck!",
'buttonaction1': "client:goback",
'noback': true,
}).getURL();