fix: always download 7.1 versioned files for patching

This commit is contained in:
Eli Bosley
2025-05-20 09:05:56 -04:00
parent fcd6fbcdd4
commit edc0d1578b
9 changed files with 87 additions and 34 deletions

View File

@@ -1,5 +1,5 @@
[api]
version="4.7.0"
version="4.4.1"
extraOrigins="https://google.com,https://test.com"
[local]
sandbox="yes"

View File

@@ -769,7 +769,30 @@ unset($buttons,$button);
// Build page content
// Reload page every X minutes during extended viewing?
if (isset($myPage['Load']) && $myPage['Load'] > 0) echo "\n<script>timers.reload = setInterval(function(){if (nchanPaused === false)location.reload();},".($myPage['Load']*60000).");</script>\n";
if (isset($myPage['Load']) && $myPage['Load'] > 0) {
?>
<script>
function setTimerReload() {
timers.reload = setInterval(function(){
if (nchanPaused === false && ! dialogOpen() ) {
location.reload();
}
},<?=$myPage['Load']*60000?>);
}
$(document).click(function(e) {
clearInterval(timers.reload);
setTimerReload();
});
function dialogOpen() {
return ($('.sweet-alert').is(':visible') || $('.swal-overlay--show-modal').is(':visible') );
}
setTimerReload();
</script>
<?
}
echo "<div class='tabs'>";
$tab = 1;
$pages = [];
@@ -1265,39 +1288,41 @@ $('body').on('click','a,.ca_href', function(e) {
}
});
// Start & stop live updates when window loses focus
// Only include window focus/blur event handlers when live updates are disabled
// to prevent unnecessary page reloads when live updates are already handling data refreshes
// nchanPaused / blurTimer used elsewhere so need to always be defined
var nchanPaused = false;
var blurTimer = false;
<? if ( $display['liveUpdate'] == "no" ):?>
$(window).focus(function() {
nchanFocusStart();
});
// Stop nchan on loss of focus
<? if ( $display['liveUpdate'] == "no" ):?>
$(window).blur(function() {
blurTimer = setTimeout(function(){
nchanFocusStop();
},30000);
});
<?endif;?>
document.addEventListener("visibilitychange", (event) => {
<? if ( $display['liveUpdate'] == "no" ):?>
if (document.hidden) {
nchanFocusStop();
}
<?else:?>
if (document.hidden) {
nchanFocusStop();
} else {
<? if (isset($myPage['Load']) && $myPage['Load'] > 0):?>
window.location.reload();
if ( dialogOpen() ) {
clearInterval(timers.reload);
setTimerReload();
nchanFocusStart();
} else {
window.location.reload();
}
<?else:?>
nchanFocusStart();
<?endif;?>
}
<?endif;?>
});
function nchanFocusStart() {
@@ -1338,6 +1363,7 @@ function nchanFocusStop(banner=true) {
}
}
}
<?endif;?>
</script>
</body>
</html>

View File

@@ -26,24 +26,25 @@ const patchTestCases: ModificationTestCase[] = [
{
ModificationClass: DefaultPageLayoutModification,
fileUrl:
'https://github.com/unraid/webgui/raw/refs/heads/master/emhttp/plugins/dynamix/include/DefaultPageLayout.php',
'https://raw.githubusercontent.com/unraid/webgui/refs/heads/7.1/emhttp/plugins/dynamix/include/DefaultPageLayout.php',
fileName: 'DefaultPageLayout.php',
},
{
ModificationClass: NotificationsPageModification,
fileUrl:
'https://github.com/unraid/webgui/raw/refs/heads/master/emhttp/plugins/dynamix/Notifications.page',
'https://raw.githubusercontent.com/unraid/webgui/refs/heads/7.1/emhttp/plugins/dynamix/Notifications.page',
fileName: 'Notifications.page',
},
{
ModificationClass: SSOFileModification,
fileUrl:
'https://github.com/unraid/webgui/raw/refs/heads/master/emhttp/plugins/dynamix/include/.login.php',
'https://raw.githubusercontent.com/unraid/webgui/refs/heads/7.1/emhttp/plugins/dynamix/include/.login.php',
fileName: '.login.php',
},
{
ModificationClass: AuthRequestModification,
fileUrl: 'https://github.com/unraid/webgui/raw/refs/heads/master/emhttp/auth-request.php',
fileUrl:
'https://raw.githubusercontent.com/unraid/webgui/refs/heads/7.1/emhttp/auth-request.php',
fileName: 'auth-request.php',
},
];

View File

@@ -778,7 +778,30 @@ unset($buttons,$button);
// Build page content
// Reload page every X minutes during extended viewing?
if (isset($myPage['Load']) && $myPage['Load'] > 0) echo "\n<script>timers.reload = setInterval(function(){if (nchanPaused === false)location.reload();},".($myPage['Load']*60000).");</script>\n";
if (isset($myPage['Load']) && $myPage['Load'] > 0) {
?>
<script>
function setTimerReload() {
timers.reload = setInterval(function(){
if (nchanPaused === false && ! dialogOpen() ) {
location.reload();
}
},<?=$myPage['Load']*60000?>);
}
$(document).click(function(e) {
clearInterval(timers.reload);
setTimerReload();
});
function dialogOpen() {
return ($('.sweet-alert').is(':visible') || $('.swal-overlay--show-modal').is(':visible') );
}
setTimerReload();
</script>
<?
}
echo "<div class='tabs'>";
$tab = 1;
$pages = [];
@@ -1266,39 +1289,41 @@ $('body').on('click','a,.ca_href', function(e) {
}
});
// Start & stop live updates when window loses focus
// Only include window focus/blur event handlers when live updates are disabled
// to prevent unnecessary page reloads when live updates are already handling data refreshes
// nchanPaused / blurTimer used elsewhere so need to always be defined
var nchanPaused = false;
var blurTimer = false;
<? if ( $display['liveUpdate'] == "no" ):?>
$(window).focus(function() {
nchanFocusStart();
});
// Stop nchan on loss of focus
<? if ( $display['liveUpdate'] == "no" ):?>
$(window).blur(function() {
blurTimer = setTimeout(function(){
nchanFocusStop();
},30000);
});
<?endif;?>
document.addEventListener("visibilitychange", (event) => {
<? if ( $display['liveUpdate'] == "no" ):?>
if (document.hidden) {
nchanFocusStop();
}
<?else:?>
if (document.hidden) {
nchanFocusStop();
} else {
<? if (isset($myPage['Load']) && $myPage['Load'] > 0):?>
window.location.reload();
if ( dialogOpen() ) {
clearInterval(timers.reload);
setTimerReload();
nchanFocusStart();
} else {
window.location.reload();
}
<?else:?>
nchanFocusStart();
<?endif;?>
}
<?endif;?>
});
function nchanFocusStart() {
@@ -1339,6 +1364,7 @@ function nchanFocusStop(banner=true) {
}
}
}
<?endif;?>
</script>
<uui-toaster rich-colors close-button position="<?= ($notify['position'] === 'center') ? 'top-center' : $notify['position'] ?>"></uui-toaster>
</body>

View File

@@ -80,7 +80,7 @@ Index: /usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php
foreach ($buttons as $button) {
annotate($button['file']);
// include page specific stylesheets (if existing)
@@ -937,26 +946,18 @@
@@ -960,26 +969,18 @@
case 'warning': bell2++; break;
case 'normal' : bell3++; break;
}
@@ -112,11 +112,11 @@ Index: /usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php
});
<?if ($wlan0):?>
@@ -1337,7 +1338,8 @@
}
@@ -1363,7 +1364,8 @@
}
}
}
<?endif;?>
</script>
+<uui-toaster rich-colors close-button position="<?= ($notify['position'] === 'center') ? 'top-center' : $notify['position'] ?>"></uui-toaster>
</body>