Skip to content

Commit edc0d15

Browse files
committed
fix: always download 7.1 versioned files for patching
1 parent fcd6fbc commit edc0d15

File tree

9 files changed

+87
-34
lines changed

9 files changed

+87
-34
lines changed

api/dev/Unraid.net/myservers.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[api]
2-
version="4.7.0"
2+
version="4.4.1"
33
extraOrigins="https://google.com,https://test.com"
44
[local]
55
sandbox="yes"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1745509523866
1+
1747746267705

api/src/unraid-api/unraid-file-modifier/modifications/__test__/__fixtures__/downloaded/DefaultPageLayout.php

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,30 @@ function flashReport() {
769769

770770
// Build page content
771771
// Reload page every X minutes during extended viewing?
772-
if (isset($myPage['Load']) && $myPage['Load'] > 0) echo "\n<script>timers.reload = setInterval(function(){if (nchanPaused === false)location.reload();},".($myPage['Load']*60000).");</script>\n";
772+
if (isset($myPage['Load']) && $myPage['Load'] > 0) {
773+
?>
774+
<script>
775+
function setTimerReload() {
776+
timers.reload = setInterval(function(){
777+
if (nchanPaused === false && ! dialogOpen() ) {
778+
location.reload();
779+
}
780+
},<?=$myPage['Load']*60000?>);
781+
}
782+
783+
$(document).click(function(e) {
784+
clearInterval(timers.reload);
785+
setTimerReload();
786+
});
787+
788+
function dialogOpen() {
789+
return ($('.sweet-alert').is(':visible') || $('.swal-overlay--show-modal').is(':visible') );
790+
}
791+
setTimerReload();
792+
793+
</script>
794+
<?
795+
}
773796
echo "<div class='tabs'>";
774797
$tab = 1;
775798
$pages = [];
@@ -1265,39 +1288,41 @@ function isValidURL(url) {
12651288
}
12661289
});
12671290

1268-
// Start & stop live updates when window loses focus
1291+
// Only include window focus/blur event handlers when live updates are disabled
1292+
// to prevent unnecessary page reloads when live updates are already handling data refreshes
1293+
// nchanPaused / blurTimer used elsewhere so need to always be defined
1294+
12691295
var nchanPaused = false;
12701296
var blurTimer = false;
12711297

1298+
<? if ( $display['liveUpdate'] == "no" ):?>
12721299
$(window).focus(function() {
12731300
nchanFocusStart();
12741301
});
12751302

12761303
// Stop nchan on loss of focus
1277-
<? if ( $display['liveUpdate'] == "no" ):?>
12781304
$(window).blur(function() {
12791305
blurTimer = setTimeout(function(){
12801306
nchanFocusStop();
12811307
},30000);
12821308
});
1283-
<?endif;?>
12841309

12851310
document.addEventListener("visibilitychange", (event) => {
1286-
<? if ( $display['liveUpdate'] == "no" ):?>
1287-
if (document.hidden) {
1288-
nchanFocusStop();
1289-
}
1290-
<?else:?>
12911311
if (document.hidden) {
12921312
nchanFocusStop();
12931313
} else {
12941314
<? if (isset($myPage['Load']) && $myPage['Load'] > 0):?>
1295-
window.location.reload();
1315+
if ( dialogOpen() ) {
1316+
clearInterval(timers.reload);
1317+
setTimerReload();
1318+
nchanFocusStart();
1319+
} else {
1320+
window.location.reload();
1321+
}
12961322
<?else:?>
12971323
nchanFocusStart();
12981324
<?endif;?>
12991325
}
1300-
<?endif;?>
13011326
});
13021327

13031328
function nchanFocusStart() {
@@ -1338,6 +1363,7 @@ function nchanFocusStop(banner=true) {
13381363
}
13391364
}
13401365
}
1366+
<?endif;?>
13411367
</script>
13421368
</body>
13431369
</html>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1745509523160
1+
1747746267422
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1745509523526
1+
1747746267527
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1745509524137
1+
1747746267741

api/src/unraid-api/unraid-file-modifier/modifications/__test__/generic-modification.spec.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,25 @@ const patchTestCases: ModificationTestCase[] = [
2626
{
2727
ModificationClass: DefaultPageLayoutModification,
2828
fileUrl:
29-
'https://github.com/unraid/webgui/raw/refs/heads/master/emhttp/plugins/dynamix/include/DefaultPageLayout.php',
29+
'https://raw.githubusercontent.com/unraid/webgui/refs/heads/7.1/emhttp/plugins/dynamix/include/DefaultPageLayout.php',
3030
fileName: 'DefaultPageLayout.php',
3131
},
3232
{
3333
ModificationClass: NotificationsPageModification,
3434
fileUrl:
35-
'https://github.com/unraid/webgui/raw/refs/heads/master/emhttp/plugins/dynamix/Notifications.page',
35+
'https://raw.githubusercontent.com/unraid/webgui/refs/heads/7.1/emhttp/plugins/dynamix/Notifications.page',
3636
fileName: 'Notifications.page',
3737
},
3838
{
3939
ModificationClass: SSOFileModification,
4040
fileUrl:
41-
'https://github.com/unraid/webgui/raw/refs/heads/master/emhttp/plugins/dynamix/include/.login.php',
41+
'https://raw.githubusercontent.com/unraid/webgui/refs/heads/7.1/emhttp/plugins/dynamix/include/.login.php',
4242
fileName: '.login.php',
4343
},
4444
{
4545
ModificationClass: AuthRequestModification,
46-
fileUrl: 'https://github.com/unraid/webgui/raw/refs/heads/master/emhttp/auth-request.php',
46+
fileUrl:
47+
'https://raw.githubusercontent.com/unraid/webgui/refs/heads/7.1/emhttp/auth-request.php',
4748
fileName: 'auth-request.php',
4849
},
4950
];

api/src/unraid-api/unraid-file-modifier/modifications/__test__/snapshots/DefaultPageLayout.php.modified.snapshot.php

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,30 @@ function flashReport() {
778778

779779
// Build page content
780780
// Reload page every X minutes during extended viewing?
781-
if (isset($myPage['Load']) && $myPage['Load'] > 0) echo "\n<script>timers.reload = setInterval(function(){if (nchanPaused === false)location.reload();},".($myPage['Load']*60000).");</script>\n";
781+
if (isset($myPage['Load']) && $myPage['Load'] > 0) {
782+
?>
783+
<script>
784+
function setTimerReload() {
785+
timers.reload = setInterval(function(){
786+
if (nchanPaused === false && ! dialogOpen() ) {
787+
location.reload();
788+
}
789+
},<?=$myPage['Load']*60000?>);
790+
}
791+
792+
$(document).click(function(e) {
793+
clearInterval(timers.reload);
794+
setTimerReload();
795+
});
796+
797+
function dialogOpen() {
798+
return ($('.sweet-alert').is(':visible') || $('.swal-overlay--show-modal').is(':visible') );
799+
}
800+
setTimerReload();
801+
802+
</script>
803+
<?
804+
}
782805
echo "<div class='tabs'>";
783806
$tab = 1;
784807
$pages = [];
@@ -1266,39 +1289,41 @@ function isValidURL(url) {
12661289
}
12671290
});
12681291

1269-
// Start & stop live updates when window loses focus
1292+
// Only include window focus/blur event handlers when live updates are disabled
1293+
// to prevent unnecessary page reloads when live updates are already handling data refreshes
1294+
// nchanPaused / blurTimer used elsewhere so need to always be defined
1295+
12701296
var nchanPaused = false;
12711297
var blurTimer = false;
12721298

1299+
<? if ( $display['liveUpdate'] == "no" ):?>
12731300
$(window).focus(function() {
12741301
nchanFocusStart();
12751302
});
12761303

12771304
// Stop nchan on loss of focus
1278-
<? if ( $display['liveUpdate'] == "no" ):?>
12791305
$(window).blur(function() {
12801306
blurTimer = setTimeout(function(){
12811307
nchanFocusStop();
12821308
},30000);
12831309
});
1284-
<?endif;?>
12851310

12861311
document.addEventListener("visibilitychange", (event) => {
1287-
<? if ( $display['liveUpdate'] == "no" ):?>
1288-
if (document.hidden) {
1289-
nchanFocusStop();
1290-
}
1291-
<?else:?>
12921312
if (document.hidden) {
12931313
nchanFocusStop();
12941314
} else {
12951315
<? if (isset($myPage['Load']) && $myPage['Load'] > 0):?>
1296-
window.location.reload();
1316+
if ( dialogOpen() ) {
1317+
clearInterval(timers.reload);
1318+
setTimerReload();
1319+
nchanFocusStart();
1320+
} else {
1321+
window.location.reload();
1322+
}
12971323
<?else:?>
12981324
nchanFocusStart();
12991325
<?endif;?>
13001326
}
1301-
<?endif;?>
13021327
});
13031328

13041329
function nchanFocusStart() {
@@ -1339,6 +1364,7 @@ function nchanFocusStop(banner=true) {
13391364
}
13401365
}
13411366
}
1367+
<?endif;?>
13421368
</script>
13431369
<uui-toaster rich-colors close-button position="<?= ($notify['position'] === 'center') ? 'top-center' : $notify['position'] ?>"></uui-toaster>
13441370
</body>

api/src/unraid-api/unraid-file-modifier/modifications/patches/default-page-layout.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Index: /usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php
8080
foreach ($buttons as $button) {
8181
annotate($button['file']);
8282
// include page specific stylesheets (if existing)
83-
@@ -937,26 +946,18 @@
83+
@@ -960,26 +969,18 @@
8484
case 'warning': bell2++; break;
8585
case 'normal' : bell3++; break;
8686
}
@@ -112,11 +112,11 @@ Index: /usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php
112112
});
113113

114114
<?if ($wlan0):?>
115-
@@ -1337,7 +1338,8 @@
116-
}
115+
@@ -1363,7 +1364,8 @@
117116
}
118117
}
119118
}
119+
<?endif;?>
120120
</script>
121121
+<uui-toaster rich-colors close-button position="<?= ($notify['position'] === 'center') ? 'top-center' : $notify['position'] ?>"></uui-toaster>
122122
</body>

0 commit comments

Comments
 (0)