feat: Editor mit Zeilennummern und deutlich mehr Textformaten

- Zeilennummern in Ansicht und Editor, Statuszeile mit Zeile/Spalte,
  Zeilenanzahl, Kodierung, Zeilenende und Änderungsmarker.
- Tab/Umschalt+Tab rücken (auch mehrere Zeilen) ein/aus, Enter übernimmt
  die Einrückung, Strg+G springt zu einer Zeile.
- Vor dem Speichern: JSON muss gültig sein, YAML darf nicht mit Tabs
  eingerückt sein (mit Option, trotzdem zu speichern).
- Über 200 Endungen und typische Dateinamen (go, hosts, Dockerfile …);
  unbekannte Dateien werden am Inhalt als Text erkannt, "Als Text öffnen".
- Windows-1252-Dateien werden angezeigt und in ihrer Kodierung
  gespeichert (vorher leere Antwort); CRLF bleibt erhalten.
- Paket 2026.11.21.r006.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Mikei386andClaude Opus 5.5 committed 2026-11-21 13:45:05 +01:00
1 parent 0592a02c8e
commit 1ca0d5aaae
9 files changed
+457 -31

No files matched your search

+18
View File
@@ -179,6 +179,24 @@ check('raw svg is sandboxed', (bool)preg_grep('/^Content-Security-Policy: sandbo
$r = call('POST', 'config.php', ['favorites' => json_encode([$share, $outside, $share . '/missing'])]);
check('favorites keep only folders inside roots', ($r['json']['favorites'] ?? null) === [$share], json_encode($r['json']['favorites'] ?? null));
// text editor: types, sniffing, encodings
file_put_contents($share . '/go', "#!/bin/bash\n/usr/local/sbin/emhttp &\n");
$r = call('GET', 'preview.php?path=' . urlencode($share . '/go'));
check('file without extension opens as editable text', ($r['json']['type'] ?? '') === 'text' && ($r['json']['editable'] ?? false) === true);
file_put_contents($share . '/compose.yaml', "services:\n app:\n image: x\n");
$r = call('GET', 'preview.php?path=' . urlencode($share . '/compose.yaml'));
check('yaml is editable', ($r['json']['editable'] ?? false) === true);
file_put_contents($share . '/blob.dat', random_bytes(64) . "\0");
$r = call('GET', 'preview.php?path=' . urlencode($share . '/blob.dat'));
check('binary files are not opened as text', $r['status'] === 415);
file_put_contents($share . '/latin.cfg', "Gr\xfc\xdfe=1\r\n");
$r = call('GET', 'preview.php?path=' . urlencode($share . '/latin.cfg'));
check('windows-1252 is decoded for the editor', ($r['json']['content'] ?? '') === "Grüße=1\r\n" && ($r['json']['encoding'] ?? '') === 'windows-1252');
$r = call('POST', 'preview.php?path=' . urlencode($share . '/latin.cfg'), ['content' => "Grüße=2\r\n", 'revision' => $r['json']['revision']]);
check('windows-1252 is written back in its encoding', $r['status'] === 200 && file_get_contents($share . '/latin.cfg') === "Gr\xfc\xdfe=2\r\n");
$r = call('POST', 'preview.php?path=' . urlencode($share . '/latin.cfg'), ['content' => "€ ok, ✓ nicht\r\n", 'revision' => $r['json']['revision']]);
check('characters outside windows-1252 are refused', $r['status'] === 422 && file_get_contents($share . '/latin.cfg') === "Gr\xfc\xdfe=2\r\n");
// whole system root (opt-in)
$r = call('GET', 'list.php?path=/');
check('system root is hidden by default', $r['status'] === 403);