switch from sync.js to DownloadScript.tmpl

This commit is contained in:
zefie
2025-07-14 18:13:45 -04:00
parent 3c96fe08ff
commit 813abb0e2d
3 changed files with 35 additions and 100 deletions

View File

@@ -254,104 +254,6 @@ class WTVDownloadList {
this.deleteGroup(group + "-UPDATE");
this.delete(path + ".GROUP-UPDATE/");
}
/**
* Generates the Download page
* @param {object} minisrv_config minisrv config object
* @param {string} title Page title
* @param {string} group
* @param {string|null} diskmap
* @param {string|null} main_message Message displayed in the center of the page
* @param {string|null} message Initial progress bar message
* @param {boolean|null} force_update Force this update even if the client reports the files are synced
* @param {string|null} success_url Where the client goes when the process succeeds
* @param {string|null} fail_url Where the client goes when the process fails.
* @param {string|null} url Use your own URL for client:fetch?source= instead of our generated one
* @returns {string} HTML Download Page
*/
getSyncPage(title, group, diskmap = null, main_message = null, message = null, force_update = null, dont_delete_files = null, success_url = null, fail_url = null, url = null) {
// Begin Set defaults
if (main_message === null) main_message = "Your receiver is downloading files.";
if (message === null) message = "Retrieving files";
if (force_update === null) force_update = false;
if (url === null) url = this.service_name + ":/sync?diskmap=" + escape(diskmap);
if (force_update) url += "&force=" + force_update;
if (dont_delete_files) url += "&dont_delete_files=" + dont_delete_files;
if (success_url === null) success_url = new this.clientShowAlert({
'image': this.minisrv_config.config.service_logo,
'message': "Download successful!",
'buttonlabel1': "Okay",
'buttonaction1': "client:goback",
'noback': true,
}).getURL();
if (fail_url === null) fail_url = new this.clientShowAlert({
'image': this.minisrv_config.config.service_logo,
'message': "Download failed...",
'buttonlabel1': "Okay",
'buttonaction1': "client:goback",
'noback': true,
}).getURL();
// End set defaults
return `<html>
<head>
<meta
http-equiv=refresh
content="0;url=client:Fetch?group=${encodeURIComponent(group)}&source=${encodeURIComponent(url)}&message=${encodeURIComponent(message)}"
>
<display downloadsuccess="${success_url}" downloadfail="${fail_url}">
<title>${title}</title>
</head>
<body bgcolor=#0 text=#42CC55 fontsize=large hspace=0 vspace=0>
<table cellspacing=0 cellpadding=0>
<tr>
<td width=104 height=74 valign=middle align=center bgcolor=3B3A4D>
<img src="${this.minisrv_config.config.service_logo}" width=86 height=64>
<td width=20 valign=top align=left bgcolor=3B3A4D>
<spacer>
<td colspan=2 width=436 valign=middle align=left bgcolor=3B3A4D>
<font color=D6DFD0 size=+2><blackface><shadow>
<spacer type=block width=1 height=4>
<br>
${message}
</shadow>
</blackface>
</font>
<tr>
<td width=104 height=20>
<td width=20>
<td width=416>
<td width=20>
<tr>
<td colspan=2>
<td>
<font size=+1>
${main_message}
<p>This may take a while.
</font>
<tr>
<td colspan=2>
<td>
<br><br>
<font color=white>
<progressindicator name="downloadprogress"
message="Preparing..."
height=40 width=250>
</font>
<br>
</table>
</body>
</html>
`
}
}
module.exports = WTVDownloadList;