Skip to content

Commit ee39fc2

Browse files
committed
fix: disable file changes on Unraid 7.2
1 parent a5f48da commit ee39fc2

17 files changed

+269
-2652
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"

api/src/unraid-api/unraid-file-modifier/file-modification.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { access, readFile, unlink, writeFile } from 'fs/promises';
44
import { basename, dirname, join } from 'path';
55

66
import { applyPatch, createPatch, parsePatch, reversePatch } from 'diff';
7+
import { coerce, gte } from 'semver';
8+
9+
import { getUnraidVersion } from '@app/common/dashboard/get-unraid-version.js';
710

811
export interface ShouldApplyWithReason {
912
shouldApply: boolean;
@@ -236,4 +239,16 @@ export abstract class FileModification {
236239
});
237240
return patch;
238241
}
242+
243+
protected async isUnraidVersionGreaterThanOrEqualTo(
244+
version: string = '7.2.0',
245+
{ includePrerelease = true }: { includePrerelease?: boolean } = {}
246+
): Promise<boolean> {
247+
const unraidVersion = coerce(await getUnraidVersion(), { includePrerelease });
248+
const comparedVersion = coerce(version, { includePrerelease });
249+
if (!unraidVersion || !comparedVersion) {
250+
throw new Error('Failed to compare Unraid version');
251+
}
252+
return gte(unraidVersion, comparedVersion);
253+
}
239254
}

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,14 @@ function verifyUsernamePassword(string $username, string $password): bool
163163
$myCase = file_exists("$boot/$myFile") ? file_get_contents("$boot/$myFile") : false;
164164

165165
extract(parse_plugin_cfg('dynamix', true));
166-
$theme_dark = in_array($display['theme'], ['black', 'gray']);
166+
167+
require_once "$docroot/plugins/dynamix/include/ThemeHelper.php";
168+
$themeHelper = new ThemeHelper($display['theme']);
169+
$isDarkTheme = $themeHelper->isDarkTheme();
167170
?>
168171

169172
<!DOCTYPE html>
170-
<html lang="en">
173+
<html lang="en" class="<?= $themeHelper->getThemeHtmlClass() ?>">
171174
<head>
172175
<meta charset="utf-8">
173176
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
@@ -201,8 +204,8 @@ function verifyUsernamePassword(string $username, string $password): bool
201204
/
202205
/************************/
203206
body {
204-
background: <?=$theme_dark ? '#1C1B1B' : '#F2F2F2'?>;
205-
color: <?=$theme_dark ? '#fff' : '#1c1b1b'?>;
207+
background: <?=$isDarkTheme?'#1C1B1B':'#F2F2F2'?>;
208+
color: <?=$isDarkTheme?'#fff':'#1c1b1b'?>;
206209
font-family: clear-sans, sans-serif;
207210
font-size: .875rem;
208211
padding: 0;
@@ -286,7 +289,7 @@ function verifyUsernamePassword(string $username, string $password): bool
286289
width: 500px;
287290
margin: 6rem auto;
288291
border-radius: 10px;
289-
background: <?=$theme_dark ? '#2B2A29' : '#fff'?>;
292+
background: <?=$isDarkTheme?'#2B2A29':'#fff'?>;
290293
}
291294
#login::after {
292295
content: "";
@@ -378,7 +381,7 @@ function verifyUsernamePassword(string $username, string $password): bool
378381
/************************/
379382
@media (max-width: 500px) {
380383
body {
381-
background: <?=$theme_dark ? '#2B2A29' : '#fff'?>;
384+
background: <?=$isDarkTheme?'#2B2A29':'#fff'?>;
382385
}
383386
[type=email], [type=number], [type=password], [type=search], [type=tel], [type=text], [type=url], textarea {
384387
font-size: 16px; /* This prevents the mobile browser from zooming in on the input-field. */
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1745509523866
1+
1746754348187

0 commit comments

Comments
 (0)