From e79f08530d80fc56db214dea55e0f11c3b7a5491 Mon Sep 17 00:00:00 2001 From: Surillya Date: Fri, 20 Jun 2025 22:38:09 +0200 Subject: [PATCH] Added local fa, added file and folder creation --- api/create.php | 56 + explorer.html | 46 +- fa.css | 2849 +++++++++++++++++++++++++++++++++++++++ fa/fa-brands-400.eot | Bin 0 -> 98940 bytes fa/fa-brands-400.svg | 1011 ++++++++++++++ fa/fa-brands-400.ttf | Bin 0 -> 98704 bytes fa/fa-brands-400.woff | Bin 0 -> 63904 bytes fa/fa-brands-400.woff2 | Bin 0 -> 54684 bytes fa/fa-regular-400.eot | Bin 0 -> 30788 bytes fa/fa-regular-400.svg | 366 +++++ fa/fa-regular-400.ttf | Bin 0 -> 30560 bytes fa/fa-regular-400.woff | Bin 0 -> 14672 bytes fa/fa-regular-400.woff2 | Bin 0 -> 12224 bytes fa/fa-solid-900.eot | Bin 0 -> 115152 bytes fa/fa-solid-900.svg | 1644 ++++++++++++++++++++++ fa/fa-solid-900.ttf | Bin 0 -> 114932 bytes fa/fa-solid-900.woff | Bin 0 -> 55484 bytes fa/fa-solid-900.woff2 | Bin 0 -> 44004 bytes index.php | 2 +- 19 files changed, 5967 insertions(+), 7 deletions(-) create mode 100644 api/create.php create mode 100644 fa.css create mode 100644 fa/fa-brands-400.eot create mode 100644 fa/fa-brands-400.svg create mode 100644 fa/fa-brands-400.ttf create mode 100644 fa/fa-brands-400.woff create mode 100644 fa/fa-brands-400.woff2 create mode 100644 fa/fa-regular-400.eot create mode 100644 fa/fa-regular-400.svg create mode 100644 fa/fa-regular-400.ttf create mode 100644 fa/fa-regular-400.woff create mode 100644 fa/fa-regular-400.woff2 create mode 100644 fa/fa-solid-900.eot create mode 100644 fa/fa-solid-900.svg create mode 100644 fa/fa-solid-900.ttf create mode 100644 fa/fa-solid-900.woff create mode 100644 fa/fa-solid-900.woff2 diff --git a/api/create.php b/api/create.php new file mode 100644 index 0000000..cccae4a --- /dev/null +++ b/api/create.php @@ -0,0 +1,56 @@ + false, 'error' => 'Invalid type: must be "folder" or "file"']); + exit; +} + +if (strpos($dirV, '/.apps') === 0 || $dirV === '/.thos_state.json') { + echo json_encode(['success' => false, 'error' => 'Cannot create in system directories']); + exit; +} + +$realDir = resolve_path($dirV); +if (!is_dir($realDir)) { + die(json_encode(['success' => false, 'error' => 'Parent directory not found or invalid'])); +} + +$newPathReal = $realDir . '/' . $name; + +$invalidCharsRegex = '/[<>:"\/\\\\|?*\x00-\x1F]/'; +if (preg_match($invalidCharsRegex, $name)) { + die(json_encode(['success' => false, 'error' => 'Invalid filename: special characters not allowed'])); +} + +if ($type === 'folder') { + if (is_dir($newPathReal)) { + die(json_encode(['success' => false, 'error' => 'Folder with that name already exists'])); + } +} else { + if (file_exists($newPathReal)) { + die(json_encode(['success' => false, 'error' => 'File with that name already exists'])); + } +} + +if ($type === 'folder') { + if (!mkdir($newPathReal, 0777, true)) { + die(json_encode(['success' => false, 'error' => 'Failed to create folder'])); + } +} else { + if (!touch($newPathReal)) { + die(json_encode(['success' => false, 'error' => 'Failed to create file'])); + } +} + +echo json_encode([ + 'success' => true, + 'path' => virtualize_path($newPathReal), +]); diff --git a/explorer.html b/explorer.html index 186d892..5c81984 100644 --- a/explorer.html +++ b/explorer.html @@ -4,8 +4,8 @@ THOS Explorer - - + +