Security: verwijder hardcoded wachtwoord, voeg random-wachtwoord-generator toe bij eerste installatie

This commit is contained in:
2026-08-27 08:57:05 +00:00
parent 6485f693dc
commit 74612aefbb
55 changed files with 6019 additions and 876 deletions
+28 -12
View File
@@ -5,11 +5,21 @@ CodePress uses a **tree view** (`/admin/content`) for content management: a file
## Content editor
### File browser sidebar
- Shows the nested file tree of `content/`
- Shows the nested file tree of `content/`, with a clickable **content** root at the top
- Hidden directories (`.bak`, `.git`) and dotfiles are skipped
- Click a file to open it in the CodeMirror editor
- Click a **file** to open it in the CodeMirror editor
- Click a **folder** (the folder name) to select it — the **folder detail pane** appears on the right
- The chevron (▶/▼) next to a folder expands/collapses it without selecting the folder
- Folders containing the active file are auto-expanded
- Per folder there are action buttons: new file, new folder, rename, delete
- Per folder there are action buttons: new file (plus icon), new folder (folder-plus icon) — they operate on the selected folder
- Per file there are action buttons: rename/move (pencil), delete (trash) — appear on hover
### Drag-and-drop
- Drag a file or folder onto another folder to move it
- Valid drop targets are highlighted during dragging
- The move is performed via an AJAX call — the page reloads automatically on success
- Security: a folder cannot be dropped into itself or a subfolder
- Path-traversal protection: all paths stay within the content directory
### Editable file types
`.md` (Markdown), `.php` (PHP), `.html` (HTML) — consistent with the existing content-edit page.
@@ -56,26 +66,32 @@ Existing `{:width=...}` values are shown in the prompts. The size attributes are
Images in `content/` are served via the `/-media/` endpoint (content/ lives outside the webroot). Markdown syntax `![alt](url)` with local URLs (relative like `image.jpg`, or absolute like `/content/_images/image.jpg`) is automatically rewritten to `/-media/...`. External URLs (`https://...`) are left untouched.
### Create a new file
- Click **New file** (at the top or per folder in the sidebar)
- Select the target folder in the sidebar (click the folder name), or use the root
- Click **New file** (in the folder-detail pane or at the top)
- Enter a path within content (e.g. `en.page` or `blog/en.post`)
- Choose the file type (Markdown/PHP/HTML)
- Subfolders are created automatically
- Frontmatter with `layout`, `created`, `edited` is auto-generated
- The new file is created in the selected folder
### Upload a file
- Click **Upload** to upload files to `content/`
- Select the target folder in the sidebar (click the folder name), or use the root
- Click **Upload** (in the folder-detail pane or at the top) to upload files to the selected folder
- Allowed: images, video, audio, PDF, ZIP, office docs, CSS, SCSS, JS, JSON, HTML, MD
- Path-traversal protection: target dir must stay within `content/`
- After the upload you return to the selected folder
### Move / delete a file
- In the file tree each file has a move button (arrows icon) and a delete button (trash)
- **Move**: choose a target folder from the dropdown listing all folders in content
- **Delete**: with confirmation
### Rename / delete a file
- Open the file in the editor (click the file name in the sidebar)
- **Rename**: edit the **Filename** field on the right above the editor and click Save — the file is renamed immediately
- **Delete**: click the delete button (trash) next to the file in the sidebar, with confirmation
### Folder management
- **New folder**: per folder in the sidebar or at the top
- **Rename folder**: pencil icon per folder
- **Delete folder**: trash icon per folder (only empty folders)
- Click a folder in the sidebar to open the **folder-detail pane** on the right
- **Rename folder**: edit the **Folder name** field in the folder-detail pane and click Save
- **New file / new folder / upload into this folder**: use the buttons in the folder-detail pane — they operate on the selected folder
- **Delete folder**: delete button in the folder-detail pane (only empty folders)
- The content root is also selectable (click "content" at the top of the tree) — shows the folder-detail pane for the root (rename disabled)
### Layout selection
On the editor page you can choose the layout from the layouts defined in `theme.json` (template mapping). The selected layout is stored in the frontmatter `layout:` key.
+42 -1
View File
@@ -27,4 +27,45 @@ Only active plugins are shown in the admin sidebar.
3. Edit the PHP file
4. Enable the plugin
New plugins are content-plugins by default. To create a system plugin, add `"type": "system"` to `plugin.json`.
New plugins are content-plugins by default. To create a system plugin, add `"type": "system"` to `plugin.json`.
## Plugin editor
Via **Edit** (pencil icon) in the plugin overview you open the plugin editor (`/admin/plugins-edit?plugin=<name>`). It works the same as the content and theme editors.
### File browser sidebar
- Shows the nested file tree of the plugin, with a clickable **plugin** root at the top
- Click a file to open it in the CodeMirror editor
- Click a folder to open the **folder detail pane** on the right (new file, new folder, upload, delete)
- Folders containing the active file are auto-expanded
- Per folder there are action buttons: new file, new folder — they operate on the selected folder
- Per file there are action buttons: rename/move (pencil), delete (trash) — appear on hover
### Drag-and-drop
- Drag a file or folder onto another folder to move it
- Valid drop targets are highlighted during dragging
- The move is performed via an AJAX call — the page reloads automatically on success
- Protected plugins (like Navigation) cannot be edited/moved
### Editable file types
`.php`, `.json`, `.md`, `.html`, `.css`, `.scss`, `.js`
### Create a new file / folder
- Select the target folder in the sidebar (click the folder name), or use the root
- Click **New file** or **New folder** (in the folder-detail pane or at the top)
- For a new file: enter a path within the plugin (e.g. `helper.php` or `assets/css/extra.css`)
- Subfolders are created automatically
### Move / delete a file
- **Move**: drag the file onto another folder (drag-and-drop), or click the pencil icon
- **Delete**: click the trash button next to the file in the sidebar, with confirmation
### Folder management
- Click a folder in the sidebar to open the **folder-detail pane** on the right
- **New file / new folder / upload into this folder**: use the buttons in the folder-detail pane
- **Delete folder**: delete button in the folder-detail pane (only empty folders)
### Security
- Protected plugins (Navigation) cannot be edited
- All actions require a CSRF token
- Path-traversal protection via `realpath()` + prefix check on the plugin dir
+22 -7
View File
@@ -21,17 +21,27 @@ In the theme overview you see per theme:
Via **Edit** (pencil icon) in the theme overview you open the theme editor (`/admin/theme-edit?theme=<name>`). It works the same as the plugin editor:
### File browser sidebar
- Shows the nested file tree of the theme
- Shows the nested file tree of the theme, with a clickable **theme** root at the top
- `assets/css_compiled/` is hidden (runtime artefact, read-only)
- Click a file to open it in the CodeMirror editor
- Click a folder to open the **folder detail pane** on the right (new file, new folder, upload, delete)
- Folders containing the active file are auto-expanded
- Per folder there are action buttons: new file, new folder — they operate on the selected folder
- Per file there are action buttons: rename/move (pencil), delete (trash) — appear on hover
### Drag-and-drop
- Drag a file or folder onto another folder to move it
- Valid drop targets are highlighted during dragging
- The move is performed via an AJAX call — the page reloads automatically on success
- `theme.json` cannot be moved
### Editable file types
`.twig`, `.json`, `.scss`, `.css`, `.js`, `.html`, `.md`, `.php`
### Create a new file
- Click **New file**
- Enter a path within the theme (e.g. `partials/header.twig` or `assets/scss/_variables.scss`)
### Create a new file / folder
- Select the target folder in the sidebar (click the folder name), or use the root
- Click **New file** or **New folder** (in the folder-detail pane or at the top)
- For a new file: enter a path within the theme (e.g. `partials/header.twig` or `assets/scss/_variables.scss`)
- Subfolders are created automatically
- Allowed: twig, json, scss, css, js, html, md, php
- A stub is auto-generated (e.g. `{% extends 'base.twig' %}` for `.twig`)
@@ -42,9 +52,14 @@ Via **Edit** (pencil icon) in the theme overview you open the theme editor (`/ad
- Path-traversal protection: target dir must stay within `assets/`
### Move / delete a file
- In the file tree each file has a move button (arrows icon) and a delete button (trash)
- **Move**: choose a target folder from the dropdown listing all folders in the theme
- **Delete**: with confirmation; `theme.json` cannot be deleted
- **Move**: drag the file onto another folder (drag-and-drop), or click the pencil icon next to the file to go to the move form
- **Delete**: click the trash button next to the file in the sidebar, with confirmation; `theme.json` cannot be deleted
### Folder management
- Click a folder in the sidebar to open the **folder-detail pane** on the right
- **New file / new folder / upload into this folder**: use the buttons in the folder-detail pane
- **Delete folder**: delete button in the folder-detail pane (only empty folders)
- The theme root is also selectable (click the theme name at the top of the tree)
### Compile SCSS from the editor
- At the top of the editor there is a **Compile SCSS** button (only if `assets/scss/theme.scss` exists)
+28 -12
View File
@@ -5,11 +5,21 @@ CodePress gebruikt een **boom weergave** (`/admin/content`) voor content-beheer:
## Content editor
### Bestandsbrowser zijbalk
- Toont de geneste bestandsboom van `content/`
- Toont de geneste bestandsboom van `content/`, met een klikbare **content** root bovenaan
- Verborgen mappen (`.bak`, `.git`) en dotfiles worden overgeslagen
- Klik op een bestand om het te openen in de CodeMirror editor
- Klik op een **bestand** om het te openen in de CodeMirror editor
- Klik op een **map** (mapnaam) om de map te selecteren — rechts verschijnt het **map detail paneel**
- De chevron (▶/▼) naast een map klapt deze in/uit zonder de map te selecteren
- Mappen die het actieve bestand bevatten zijn automatisch uitgeklapt
- Per map staan actie-knoppen: nieuw bestand, nieuwe map, hernoemen, verwijderen
- Per map staan actie-knoppen: nieuw bestand (plus-icoon), nieuwe map (map-plus-icoon) — deze opereren op de geselecteerde map
- Per bestand staan actie-knoppen: hernoemen/verplaatsen (potlood), verwijderen (prullenbak) — verschijnen bij hover
### Bestanden verslepen (drag-and-drop)
- Sleep een bestand of map naar een andere map om het te verplaatsen
- Tijdens het slepen worden geldige doel-mappen highlight getoond
- De verplaatsing gebeurt via een AJAX-call — de pagina herlaadt automatisch na succes
- Beveiliging: een map kan niet naar zichzelf of naar een submap verplaatst worden
- Path-traversal bescherming: alle paden blijven binnen de content map
### Bewerkbare bestandstypen
`.md` (Markdown), `.php` (PHP), `.html` (HTML) — consistent met de bestaande content-edit pagina.
@@ -56,26 +66,32 @@ Bestaande `{:width=...}` waarden worden in de prompts getoond. De grootte-attrib
Images in `content/` worden via de `/-media/` endpoint geserveerd (content/ staat buiten de webroot). De markdown syntax `![alt](url)` met lokale URLs (relatief zoals `image.jpg`, of absoluut zoals `/content/_images/image.jpg`) wordt automatisch herschreven naar `/-media/...`. Externe URLs (`https://...`) worden ongewijzigd gelaten.
### Nieuw bestand aanmaken
- Klik op **Nieuw bestand** (bovenaan of per map in de zijbalk)
- Selecteer de doelmap in de zijbalk (klik op de mapnaam), of gebruik de root
- Klik op **Nieuw bestand** (in het map-detail paneel of bovenaan)
- Geef een pad op binnen content (bijv. `nl.pagina` of `blog/nl.post`)
- Kies het bestandstype (Markdown/PHP/HTML)
- Submappen worden automatisch aangemaakt
- Frontmatter met `layout`, `created`, `edited` wordt automatisch gegenereerd
- Het nieuwe bestand wordt aangemaakt in de geselecteerde map
### Bestand uploaden
- Klik op **Upload** om bestanden naar `content/` te uploaden
- Selecteer de doelmap in de zijbalk (klik op de mapnaam), of gebruik de root
- Klik op **Upload** (in het map-detail paneel of bovenaan) om bestanden naar de geselecteerde map te uploaden
- Toegestaan: afbeeldingen, video, audio, PDF, ZIP, office docs, CSS, SCSS, JS, JSON, HTML, MD
- Path-traversal bescherming: doelmap moet binnen `content/` blijven
- Na de upload keer je terug naar de geselecteerde map
### Bestand verplaatsen / verwijderen
- In de bestandsboom heeft elk bestand een verplaats-knop (pijlen-icoon) en een verwijder-knop (prullenbak)
- **Verplaatsen**: kies een doelmap uit de dropdown met alle mappen in content
- **Verwijderen**: met bevestiging
### Bestand hernoemen / verwijderen
- Open het bestand in de editor (klik op de bestandsnaam in de zijbalk)
- **Hernoemen**: bewerk het **Bestandsnaam** veld rechts boven de editor en klik op Opslaan — het bestand wordt direct hernoemd
- **Verwijderen**: klik op de verwijder-knop (prullenbak) naast het bestand in de zijbalk, met bevestiging
### Mappen beheer
- **Nieuwe map**: per map in de zijbalk of bovenaan
- **Map hernoemen**: potlood-icoon per map
- **Map verwijderen**: prullenbak-icoon per map (alleen lege mappen)
- Klik op een map in de zijbalk om het **map-detail paneel** rechts te openen
- **Map hernoemen**: bewerk het **Mapnaam** veld in het map-detail paneel en klik op Opslaan
- **Nieuw bestand / Nieuwe map / Uploaden in deze map**: gebruik de knoppen in het map-detail paneel — ze opereren op de geselecteerde map
- **Map verwijderen**: verwijder-knop in het map-detail paneel (alleen lege mappen)
- De content-root is ook selecteerbaar (klik op "content" bovenaan de boom) — toont het map-detail paneel voor de root (hernoemen uitgeschakeld)
### Layout selectie
Op de editor-pagina kun je de layout kiezen uit de layouts gedefinieerd in `theme.json` (template mapping). De geselecteerde layout wordt opgeslagen in de frontmatter `layout:` key.
+42 -1
View File
@@ -27,4 +27,45 @@ Alleen actieve plugins worden getoond in de admin sidebar.
3. Bewerk het PHP-bestand
4. Activeer de plugin
Nieuwe plugins zijn standaard content-plugins. Wil je een systeem-plugin maken, voeg dan `"type": "system"` toe aan `plugin.json`.
Nieuwe plugins zijn standaard content-plugins. Wil je een systeem-plugin maken, voeg dan `"type": "system"` toe aan `plugin.json`.
## Plugin editor
Via **Bewerken** (potlood-icoon) in het plugin-overzicht open je de plugin-editor (`/admin/plugins-edit?plugin=<naam>`). Deze werkt hetzelfde als de content- en thema-editors.
### Bestandsbrowser zijbalk
- Toont de geneste bestandsboom van de plugin, met een klikbare **plugin** root bovenaan
- Klik op een bestand om het te openen in de CodeMirror editor
- Klik op een map om het **map detail paneel** rechts te openen (nieuw bestand, nieuwe map, uploaden, verwijderen)
- Mappen die het actieve bestand bevatten zijn automatisch uitgeklapt
- Per map staan actie-knoppen: nieuw bestand, nieuwe map — opereren op de geselecteerde map
- Per bestand staan actie-knoppen: hernoemen/verplaatsen (potlood), verwijderen (prullenbak) — verschijnen bij hover
### Bestanden verslepen (drag-and-drop)
- Sleep een bestand of map naar een andere map om het te verplaatsen
- Tijdens het slepen worden geldige doel-mappen highlight getoond
- De verplaatsing gebeurt via een AJAX-call — de pagina herlaadt automatisch na succes
- Beschermde plugins (zoals Navigation) kunnen niet bewerkt/verplaatst worden
### Bewerkbare bestandstypen
`.php`, `.json`, `.md`, `.html`, `.css`, `.scss`, `.js`
### Nieuw bestand / nieuwe map aanmaken
- Selecteer de doelmap in de zijbalk (klik op de mapnaam), of gebruik de root
- Klik op **Nieuw bestand** of **Nieuwe map** (in het map-detail paneel of bovenaan)
- Bij nieuw bestand: geef een pad op binnen de plugin (bijv. `helper.php` of `assets/css/extra.css`)
- Submappen worden automatisch aangemaakt
### Bestand verplaatsen / verwijderen
- **Verplaatsen**: sleep het bestand naar een andere map (drag-and-drop), of klik op het potlood-icoon
- **Verwijderen**: klik op de prullenbak-knop naast het bestand in de zijbalk, met bevestiging
### Mappen beheer
- Klik op een map in de zijbalk om het **map-detail paneel** rechts te openen
- **Nieuw bestand / Nieuwe map / Uploaden in deze map**: gebruik de knoppen in het map-detail paneel
- **Map verwijderen**: verwijder-knop in het map-detail paneel (alleen lege mappen)
### Beveiliging
- Beschermde plugins (Navigation) kunnen niet bewerkt worden
- Alle acties vereisen CSRF token
- Path-traversal bescherming via `realpath()` + prefix-check op de plugin-map
+22 -7
View File
@@ -21,17 +21,27 @@ In het thema-overzicht zie je per thema:
Via **Bewerken** (potlood-icoon) in het thema-overzicht open je de thema-editor (`/admin/theme-edit?theme=<naam>`). Deze werkt hetzelfde als de plugin-editor:
### Bestandsbrowser zijbalk
- Toont de geneste bestandsboom van het thema
- Toont de geneste bestandsboom van het thema, met een klikbare **thema** root bovenaan
- `assets/css_compiled/` wordt verborgen (runtime artefact, read-only)
- Klik op een bestand om het te openen in de CodeMirror editor
- Klik op een map om het **map detail paneel** rechts te openen (nieuw bestand, nieuwe map, uploaden, verwijderen)
- Mappen die het actieve bestand bevatten zijn automatisch uitgeklapt
- Per map staan actie-knoppen: nieuw bestand, nieuwe map — opereren op de geselecteerde map
- Per bestand staan actie-knoppen: hernoemen/verplaatsen (potlood), verwijderen (prullenbak) — verschijnen bij hover
### Bestanden verslepen (drag-and-drop)
- Sleep een bestand of map naar een andere map om het te verplaatsen
- Tijdens het slepen worden geldige doel-mappen highlight getoond
- De verplaatsing gebeurt via een AJAX-call — de pagina herlaadt automatisch na succes
- `theme.json` kan niet verplaatst worden
### Bewerkbare bestandstypen
`.twig`, `.json`, `.scss`, `.css`, `.js`, `.html`, `.md`, `.php`
### Nieuw bestand aanmaken
- Klik op **Nieuw bestand**
- Geef een pad op binnen het thema (bijv. `partials/header.twig` of `assets/scss/_variables.scss`)
### Nieuw bestand / nieuwe map aanmaken
- Selecteer de doelmap in de zijbalk (klik op de mapnaam), of gebruik de root
- Klik op **Nieuw bestand** of **Nieuwe map** (in het map-detail paneel of bovenaan)
- Bij nieuw bestand: geef een pad op binnen het thema (bijv. `partials/header.twig` of `assets/scss/_variables.scss`)
- Submappen worden automatisch aangemaakt
- Toegestaan: twig, json, scss, css, js, html, md, php
- Een stub wordt automatisch gegenereerd (bijv. `{% extends 'base.twig' %}` voor `.twig`)
@@ -42,9 +52,14 @@ Via **Bewerken** (potlood-icoon) in het thema-overzicht open je de thema-editor
- Path-traversal bescherming: doelmap moet binnen `assets/` blijven
### Bestand verplaatsen / verwijderen
- In de bestandsboom heeft elk bestand een verplaats-knop (pijlen-icoon) en een verwijder-knop (prullenbak)
- **Verplaatsen**: kies een doelmap uit de dropdown met alle mappen in het thema
- **Verwijderen**: met bevestiging; `theme.json` kan niet verwijderd worden
- **Verplaatsen**: sleep het bestand naar een andere map (drag-and-drop), of klik op het potlood-icoon naast het bestand om naar het verplaats-formulier te gaan
- **Verwijderen**: klik op de prullenbak-knop naast het bestand in de zijbalk, met bevestiging; `theme.json` kan niet verwijderd worden
### Mappen beheer
- Klik op een map in de zijbalk om het **map-detail paneel** rechts te openen
- **Nieuw bestand / Nieuwe map / Uploaden in deze map**: gebruik de knoppen in het map-detail paneel
- **Map verwijderen**: verwijder-knop in het map-detail paneel (alleen lege mappen)
- De thema-root is ook selecteerbaar (klik op de thema-naam bovenaan de boom)
### SCSS compileren vanuit de editor
- Bovenaan de editor staat een **SCSS compileren** knop (alleen als `assets/scss/theme.scss` bestaat)