Skip to content

Commit 8fb3c39

Browse files
committed
2023.03.27b1
1 parent 6b38be9 commit 8fb3c39

File tree

5 files changed

+37
-4
lines changed

5 files changed

+37
-4
lines changed

appdata.backup.beta.plg

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!ENTITY name "appdata.backup.beta">
44
<!ENTITY author "Robin Kluth">
55
<!ENTITY version "2023.03.27b1">
6-
<!ENTITY sha256 "e0ed774bba1360147c47c028a58d96e6ca7f13690caeabb78ddd93249ff7996e">
6+
<!ENTITY sha256 "5bd76d929c12bfc1cd0d8377600fede227507a653a883879207fbe784cad12ea">
77
<!ENTITY launch "Settings/AB.Beta.Main">
88
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
99
<!ENTITY github "Commifreak/unraid-appdata.backup">

src/include/ABSettings.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public static function getConfigPath() {
9191
*/
9292
public function getContainerSpecificSettings($name, $setEmptyToDefault = true) {
9393
if (!isset($this->containerSettings[$name])) {
94-
return array_merge($this->defaults, ['skip' => 'no', 'exclude' => [], 'dontStop' => 'no']);
94+
return array_merge($this->defaults, ['skip' => 'no', 'exclude' => '', 'dontStop' => 'no']);
9595
}
9696

9797
$settings = $this->containerSettings[$name];

src/include/http.php

+26-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
use unraid\plugins\AppdataBackup\ABSettings;
88

99
if (isset($_GET['action'])) {
10-
header('Content-Type: application/json; charset=utf-8');
10+
11+
if ($_GET['action'] != 'dlLog') {
12+
header('Content-Type: application/json; charset=utf-8');
13+
}
14+
1115
switch ($_GET['action']) {
1216
case 'getBackupState':
1317

@@ -98,6 +102,27 @@
98102
case 'startRestore':
99103
exec('php ' . dirname(__DIR__) . '/scripts/restore.php ' . escapeshellarg(json_encode($_GET)) . ' > /dev/null &');
100104
break;
105+
case 'dlLog':
106+
$filename = ($_GET['type'] ?? 'dlLogBtn') == 'dlLogBtn' ? ABSettings::$logfile : ABSettings::$debugLogFile;
107+
$filePath = ABSettings::$tempFolder . '/' . $filename;
108+
109+
header('Content-Type: application/octet-stream');
110+
header('Content-Disposition: attachment; filename="' . $filename . '"');
111+
header('Expires: 0');
112+
header('Cache-Control: must-revalidate');
113+
header('Pragma: public');
114+
115+
if (!file_exists($filePath)) {
116+
echo "Log does not exist!";
117+
exit;
118+
}
119+
120+
header('Content-Length: ' . filesize($filePath));
121+
readfile($filePath);
122+
exit;
123+
124+
125+
break;
101126

102127

103128
}

src/pages/content/log.php

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
<h3>The backup is <span id="backupStatusText" class=""></span>.</h3>
3636
<div style='border: 1px solid red; height:500px; overflow:auto' id='abLog'>Loading...</div>
3737
<input type='button' id="abortBtn" value='Abort' disabled/>
38+
<input type='button' id="dlLogBtn" value='Download log' disabled/>
39+
<input type='button' id="dlDbgLogBtn" value='Download debug log' disabled/>
3840

3941

4042
<script>
@@ -60,6 +62,10 @@
6062
});
6163
});
6264
});
65+
66+
$('#dlLogBtn, #dlDbgLogBtn').on('click', function () {
67+
window.location = url + '?action=dlLog&type=' + $(this).attr('id');
68+
});
6369
});
6470

6571
function checkBackup() {
@@ -69,13 +75,15 @@ function checkBackup() {
6975
}).done(function (data) {
7076
if (data.running) {
7177
$('#abortBtn').removeAttr('disabled');
78+
$('#dlLogBtn, #dlDbgLogBtn').attr('disabled', 'disabled');
7279
$('#backupStatusText').removeClass('backupNotRunning');
7380
$('#backupStatusText').addClass('backupRunning');
7481
$('#abLog').animate({
7582
scrollTop: $('#abLog')[0].scrollHeight - $('#abLog')[0].clientHeight
7683
}, 100);
7784
} else {
7885
$('#abortBtn').attr('disabled', 'disabled');
86+
$('#dlLogBtn, #dlDbgLogBtn').removeAttr('disabled');
7987
$('#backupStatusText').removeClass('backupRunning');
8088
$('#backupStatusText').addClass('backupNotRunning');
8189
}

src/pages/content/settings.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ class="fa fa-info"></i> Those must return exit code 0 for success detection</sma
451451
<p>If you need assistance, you can ask in the unraid community for help.</p>
452452
<dl>
453453
<dt>Plugin thread @ Unraid community</dt>
454-
<dd><a href="https://forums.unraid.net/topic/132721-plugin-ca-appdata-backup-restore-v3" target="_blank">Open</a>
454+
<dd><a href="<?= ABSettings::$supportUrl ?>" target="_blank">Open</a>
455455
</dd>
456456

457457
<dt>Maintainer</dt>

0 commit comments

Comments
 (0)