feat: conf toegevoegd

This commit is contained in:
kodi
2026-03-14 15:12:35 +01:00
parent 8af4b1a6b0
commit 3fb8528b0e
10 changed files with 18 additions and 1 deletions
@@ -20,6 +20,7 @@ TEXT_EDIT_MAX_BYTES = 256 * 1024
TEXT_CONTENT_TYPES = {
".txt": "text/plain",
".log": "text/plain",
".conf": "text/plain",
".md": "text/markdown",
".yml": "text/yaml",
".yaml": "text/yaml",
Binary file not shown.
@@ -80,6 +80,19 @@ class EditApiGoldenTest(unittest.TestCase):
self.assertEqual(body["content_type"], "text/x-python")
self.assertEqual(body["content"], "print('hello')\n")
def test_edit_view_conf_success(self) -> None:
file_path = self.root / "app.conf"
file_path.write_text("enabled=true\n", encoding="utf-8")
response = self._request("GET", "/api/files/view", params={"path": "storage1/app.conf", "for_edit": "true"})
self.assertEqual(response.status_code, 200)
body = response.json()
self.assertEqual(body["path"], "storage1/app.conf")
self.assertEqual(body["name"], "app.conf")
self.assertEqual(body["content_type"], "text/plain")
self.assertEqual(body["content"], "enabled=true\n")
def test_save_success(self) -> None:
file_path = self.root / "notes.txt"
file_path.write_text("hello", encoding="utf-8")
@@ -303,6 +303,8 @@ class UiSmokeGoldenTest(unittest.TestCase):
self.assertIn('if (item.kind === "directory") {', app_js)
self.assertIn('return isImageSelection(item) || isVideoSelection(item);', app_js)
self.assertIn('const editableSingle = items.length === 1 && isEditableSelection(items[0]);', app_js)
self.assertIn('return [".txt", ".log", ".md", ".yml", ".yaml", ".json", ".js", ".py", ".css", ".html", ".conf"].some((suffix) => lower.endsWith(suffix));', app_js)
self.assertIn('if (!item || item.kind !== "file") {', app_js)
self.assertIn('elements.editButton.classList.toggle("hidden", isMulti || items.length !== 1 || items[0].kind !== "file");', app_js)
self.assertIn('elements.editButton.disabled = !editableSingle;', app_js)
self.assertIn('const downloadableSelection = items.length > 0;', app_js)
@@ -316,6 +318,7 @@ class UiSmokeGoldenTest(unittest.TestCase):
self.assertIn('elements.propertiesButton.disabled = items.length === 0;', app_js)
self.assertIn('openCurrentDirectory();', app_js)
self.assertIn('openEditor();', app_js)
self.assertIn('if (selectedItems.length !== 1 || !isEditableSelection(selectedItems[0])) {', app_js)
self.assertIn('const created = await createArchiveDownloadTask(selectedPaths);', app_js)
self.assertIn('const task = await waitForArchiveDownloadReady(created.task_id);', app_js)
self.assertIn('startArchiveDownload(task.id, task.destination);', app_js)
+1 -1
View File
@@ -1985,7 +1985,7 @@ function isEditableSelection(item) {
if (lower === "dockerfile" || lower === "containerfile") {
return true;
}
return [".txt", ".log", ".md", ".yml", ".yaml", ".json", ".js", ".py", ".css", ".html"].some((suffix) => lower.endsWith(suffix));
return [".txt", ".log", ".md", ".yml", ".yaml", ".json", ".js", ".py", ".css", ".html", ".conf"].some((suffix) => lower.endsWith(suffix));
}
function formatBinarySize(bytes) {