feat: Option „Ganzes System (ab /)“
- Neue Einstellung zeigt zusätzlich zu /mnt/user das Dateisystem ab / (Bestätigungsdialog beim Aktivieren, U_NAV_ROOTS hat Vorrang). - Geschützt vor Löschen/Verschieben/Rechteänderung: Wurzeln, Ordner direkt unter /, Mountpunkte unter /mnt. - /proc, /sys, /dev, /run: nur anzeigen; keine Jobs, Downloads, Vorschau oder Rekursion hinein. - Größe von Systemordnern nur auf Knopfdruck (weckt sonst alle Disks). - Pfade unter / ohne doppelten Schrägstrich; kaputte Symlinks erzeugen keine PHP-Warnungen mehr in der Antwort. - Paket 2026.11.21.r005. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a7e8325853
commit
0592a02c8e
17 files changed
+196
-43
No files matched your search
+47
-2
@@ -830,7 +830,18 @@ function renderProperties(body) {
|
||||
</dl>
|
||||
`;
|
||||
if (entry.type === 'directory') {
|
||||
ensureDirectorySize(entry);
|
||||
if (isSystemRootPath(entry.path)) {
|
||||
if (!state.sizeResults.has(entry.path) && !state.sizeJobs.has(entry.path)) {
|
||||
const sizeCell = body.querySelectorAll('dd')[3];
|
||||
sizeCell.innerHTML = '<button type="button" class="link-button" data-action="calc-size">Größe berechnen</button>';
|
||||
sizeCell.querySelector('button').addEventListener('click', () => {
|
||||
ensureDirectorySize(entry);
|
||||
updatePropertiesWindows();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
ensureDirectorySize(entry);
|
||||
}
|
||||
}
|
||||
ensureStorageInfo(entry.path);
|
||||
}
|
||||
@@ -1305,6 +1316,13 @@ function renderSettingsPanel() {
|
||||
</span>
|
||||
<input type="checkbox" data-setting="thumbnails" ${state.config?.thumbnails !== false ? 'checked' : ''} ${state.config?.thumbnailSupport === false ? 'disabled' : ''}>
|
||||
</label>
|
||||
<label class="setting-row">
|
||||
<span>
|
||||
<strong>Ganzes System (ab /)</strong>
|
||||
<small>${state.config?.rootsFromEnv ? 'Durch U_NAV_ROOTS fest vorgegeben' : 'Zusätzlich zu /mnt/user das komplette Dateisystem zeigen'}</small>
|
||||
</span>
|
||||
<input type="checkbox" data-setting="systemRoot" ${state.config?.systemRoot ? 'checked' : ''} ${state.config?.rootsFromEnv ? 'disabled' : ''}>
|
||||
</label>
|
||||
</div>
|
||||
`;
|
||||
if (!existing) {
|
||||
@@ -1329,6 +1347,27 @@ function renderSettingsPanel() {
|
||||
panel.querySelector('[data-setting="thumbnails"]').addEventListener('change', (event) => {
|
||||
saveSettings({ thumbnails: event.currentTarget.checked });
|
||||
});
|
||||
panel.querySelector('[data-setting="systemRoot"]').addEventListener('change', async (event) => {
|
||||
const input = event.currentTarget;
|
||||
if (input.checked) {
|
||||
const confirmed = await showConfirmDialog(
|
||||
'Ganzes System anzeigen',
|
||||
'Der Navigator zeigt dann zusätzlich das komplette Dateisystem ab "/" – mit Root-Rechten.',
|
||||
'Ordner direkt unter "/", /boot und die Mountpunkte unter /mnt bleiben vor Löschen, Verschieben und Rechteänderungen geschützt. Alles darunter lässt sich bei aktivem Schreibzugriff ändern – auch Systemdateien. /proc, /sys, /dev und /run werden nur angezeigt.',
|
||||
{ confirmLabel: 'Aktivieren', danger: true }
|
||||
);
|
||||
if (!confirmed) {
|
||||
input.checked = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
await saveSettings({ systemRoot: input.checked });
|
||||
if (!input.checked) {
|
||||
for (const win of state.windows.filter((item) => item.kind === 'explorer' && !rootForPath(item.data.path))) {
|
||||
loadExplorer(win, state.config.roots[0].path);
|
||||
}
|
||||
}
|
||||
});
|
||||
settingsButton.classList.add('active');
|
||||
settingsButton.setAttribute('aria-expanded', 'true');
|
||||
}
|
||||
@@ -1340,6 +1379,7 @@ async function saveSettings(changes) {
|
||||
body.set('readOnly', readOnly ? '1' : '0');
|
||||
body.set('debug', debug ? '1' : '0');
|
||||
body.set('thumbnails', (changes.thumbnails ?? state.config.thumbnails) ? '1' : '0');
|
||||
body.set('systemRoot', (changes.systemRoot ?? state.config.systemRoot) ? '1' : '0');
|
||||
appendCsrf(body);
|
||||
try {
|
||||
state.config = await api(apiUrl('config.php'), {
|
||||
@@ -3051,7 +3091,7 @@ function windowTitle(win) {
|
||||
|
||||
function parentPath(value) {
|
||||
const parts = String(value || '').split('/').filter(Boolean);
|
||||
if (parts.length <= 1) return value;
|
||||
if (parts.length <= 1) return '/';
|
||||
return `/${parts.slice(0, -1).join('/')}`;
|
||||
}
|
||||
|
||||
@@ -3101,6 +3141,11 @@ function formatBytes(bytes) {
|
||||
return `${(value / 1024 / 1024 / 1024).toFixed(1)} GB`;
|
||||
}
|
||||
|
||||
// Outside the user shares (system root) a size scan can wake every disk, so it only runs on request.
|
||||
function isSystemRootPath(path) {
|
||||
return normalizePath(rootForPath(path)?.path || '') === '/';
|
||||
}
|
||||
|
||||
function directorySizeLabel(entry) {
|
||||
const result = state.sizeResults.get(entry.path);
|
||||
if (!result) {
|
||||
|
||||
Reference in new issue
Block a user