Commit Graph

536 Commits

Author SHA1 Message Date
Pontoporeia
d9e4541749 Remove unused Parsedown.php (replaced by league/commonmark in Phase 1); update phpstan baseline 2026-05-20 01:21:47 +02:00
Pontoporeia
a0cda5b55d Phase 3: Replace SmtpRelay SMTP socket with PHPMailer 2026-05-20 01:17:44 +02:00
Pontoporeia
ba57820016 Phase 2: Replace PeerTubeService HTTP client with Guzzle 2026-05-20 01:07:41 +02:00
Pontoporeia
5e75cacad7 Phase 1: Replace Parsedown with league/commonmark (4 call sites) 2026-05-20 01:02:09 +02:00
Pontoporeia
4683ba4116 Add composer.json with league/commonmark, guzzlehttp/guzzle, phpmailer/phpmailer; wire autoloader into bootstrap; document de-librairisation strategy and PHP extension setup 2026-05-20 00:53:42 +02:00
Pontoporeia
728f05502c Combine phpstan, cs-check, cs-fix into lint-php recipe; fix lint issues + test failures + duplicate detection bug 2026-05-20 00:31:19 +02:00
Pontoporeia
2e75a3b35c Fix beforeunload dialog appearing on edit.php when no changes made 2026-05-19 23:59:07 +02:00
Pontoporeia
42222abe7c Récapitulatif admin: sections → fieldsets, fichiers en table, marges + pas de thumbnails 2026-05-19 23:58:51 +02:00
Pontoporeia
defc919cd0 cleanup modal: list stale files to remove; storage restructure: documents/ → {objet}/ 2026-05-19 23:58:51 +02:00
Pontoporeia
c6199525f9 add sticky thead to index, langues, and mots-clés tables 2026-05-19 23:58:51 +02:00
Pontoporeia
bcf3140aa2 edit submission: redirect to recapitulatif instead of edit 2026-05-19 23:58:51 +02:00
Pontoporeia
4da317de0a deploy: remove .env from generic file perm check, remove router.php check (dev-only file) 2026-05-19 23:58:51 +02:00
Pontoporeia
5bbf633295 Contenus: add Mots-clés fieldset mirroring Langues, keep dedicated page button as backup, add Annuler cancel button to both bulk action bars, limit both table wraps to max-height:50vh with overflow scroll 2026-05-19 23:58:51 +02:00
Pontoporeia
678f9fc804 Index page: remove Mots-clés button, move export to bulk selection, fix ZipArchive error, move DB export to paramètres, sticky thead
- Remove 'Mots-clés' button from toolbar (redundant with admin sidebar tags)
- Replace export dialog with 'Exporter CSV' + 'Exporter fichiers' buttons in bulk selection bar
- Export dispatcher now accepts ?ids=1,2,3 for per-selection export
- All ExportController/Database methods accept optional thesisIds array
- Graceful error message when ZipArchive extension is missing on server
- Move DB export (SQLite download) to paramètres → Maintenance section
- Sticky table column headers (position: sticky, top: 0, z-index: 5) for index page table
2026-05-19 23:58:51 +02:00
Pontoporeia
b484943128 Unnest header.css (native CSS nesting silently broken in browsers without support) 2026-05-19 23:58:51 +02:00
Pontoporeia
2cb8d71fe9 Fix dialog margins, add admin-dialog__body/styles, give trash page horizontal margins 2026-05-19 23:58:51 +02:00
Pontoporeia
d619d2f116 Update TODO after CSS refactoring fixes 2026-05-19 22:34:57 +02:00
Pontoporeia
7cf020c7bd Refactor CSS architecture per css-methodology-spec.md
Split CSS into named layers: reset → colors → typography → base →
components → utilities. Each component has one unique root class in
its own file. No cross-component overrides.

New files:
- reset.css (modern-normalize base — matches project's prior reset)
- colors.css (all colour variables)
- typography.css (font faces, size/space scale, font-family vars)
- base.css (≤ 5 site-wide rules: layout, headings)
- utilities.css (sr-only, skip-link, reduced-motion)
- style.css (root @import file loading all layers)
- components/{links,focus,forms,tables,dialog,details,media,
  buttons,badges,toasts,pagination,header,search}.css

Existing files:
- variables.css → backward-compat wrapper (imports colors + typography)
- common.css → backward-compat wrapper (imports style.css)
- Page files (admin, public, form, tfe, apropos, repertoire, system,
  file-access) → removed redundant @import url(./variables.css)
- head.php → loads style.css instead of modern-normalize + common.css
- partage pages → load style.css

Fixes vs initial refactoring:
- reset.css: use modern-normalize base (not Tailwind Preflight) to
  avoid border/list/heading regressions from aggressive defaults
- components/search.css: restore !important flags on input styles
  (needed to override forms.css base input selectors)
- acces.php: add toast feedback on password copy button

Cleaned up duplicate status-badge/toast definitions from admin.css
(now live in components/badges.css and components/toast.css).
2026-05-19 16:55:32 +02:00
Pontoporeia
7c30d1c55d Fix relink: close modal + HTMX refresh for immediate pool update
- After relink, always close the modal (even if FilePond input not found,
  e.g. page refreshed by live-reload during the fetch).
- After closing, re-fetch #format-fichiers-block via HTMX from
  /admin/fragments/fichiers.php?_thesis_id=N which loads thesis files
  from DB and re-renders the fragment with pre-populated FilePond pools.
  The afterSwap handler auto-reinitializes FilePond instances.
- Updated admin/fragments/fichiers.php to accept _thesis_id, load
  existing files from DB, build per-queue-type JSON, and render in
  edit mode.
2026-05-19 01:32:34 +02:00
Pontoporeia
b77bc486e5 Fix relink: FilePond addFile API, yellow border, limbo type + await
- Fix addFile argument format: FilePond.addFile() takes (source, options)
  as two separate arguments, not a single {source, options} object.
- Change .filepond--file default border from accent-yellow to accent-green.
  Existing files loaded in edit mode have type 'local' and never reach
  processing-complete state, so they got the yellow border.
- Change relinked file add from type 'local' to 'limbo'. Limbo items
  go through DID_COMPLETE_ITEM_PROCESSING which triggers onprocessfile
  (ensures syncOrderInput runs with serverId available) and renders
  the green checkmark visual.
- Await addFile Promise and close modal in .then() instead of
  immediately, ensuring the item is created before cleanup.
- Remove duplicate modal.close() after the addFile block.
2026-05-19 01:13:17 +02:00
Pontoporeia
ae9a8a62c0 deploy: exclude storage/{tmp,documents,theses,triage,backups,logs} from rsync + fix .env perm check to 640 2026-05-19 00:33:28 +02:00
Pontoporeia
41eebf8a02 cleanup: squash commit history from 177 to 98 commits, resolve acces.php conflict markers 2026-05-19 00:09:15 +02:00
Pontoporeia
27e6abc7e4 feat: file browser + relink for orphaned files + htmx fix + header cleanup + fix relinked FilePond integration + resolve acces.php conflict markers 2026-05-19 00:08:06 +02:00
Pontoporeia
79eddf5d5a feat: fix file deletion on save + trash policy + documents/ prefix + relink browser
1. note_intention: Delete old file only when a genuinely new upload arrives
   (32-char hex file_id), not when the FilePond pool preserves an existing
   file by sending its DB integer ID.  Previously the DB integer ID
   triggered $hasNewNote=true, which deleted the existing note_intention
   from disk+DB, then handleFilePondSingleFile couldn't re-process it
   because the regex requires a hex pattern.  Same fix applied to cover.

2. All file deletions now use deleteThesisFileToTrash() which renames
   files to tmp/_trash/ instead of unlinking.  The trash preserves
   original filenames prefixed with DB id for traceability.  Skips
   website URLs and PeerTube refs (no disk file).

3. Storage prefix changed from theses/ to documents/ to reflect that
   the folder holds all document types (determined by file_type in DB).
   MediaController visibility gate supports both prefixes for backward
   compat with existing files.

4. File browser + relink feature for orphaned files:
   - /admin/fragments/file-browser.php — HTMX tree browser for
     storage/documents/ and storage/theses/
   - /admin/actions/filepond/relink.php — POST endpoint that inserts
     a thesis_files row pointing to existing on-disk file
   - Per-pool "📂 Relier" buttons (edit mode only)
   - JS: XamxamOpenFileBrowser / XamxamRelinkFile with FilePond integration
   - CSS: .relink-modal dialog + .file-browser tree styles
2026-05-19 00:08:06 +02:00
Pontoporeia
6f7a02244f maintenance: allow /partage through gate, fix fragment routing, add visibility table in admin
Extract shared filepond logic into src/FilepondHandler.php class.
Admin filepond endpoints delegate to the handler after AdminAuth check.
New partage filepond endpoints at /partage/actions/filepond/ verify
share_active session flag + CSRF token, no admin auth required.

JS reads filepond-base meta tag to determine endpoint path:
- Admin pages: /admin/actions/filepond (via head.php isAdmin check)
- Partage form: /partage/actions/filepond (explicit meta)

partage/index.php sets share_active = true on form render, cleans up on
successful submit. Partage process endpoint rate-limited to 30/5min per
session. No nginx changes needed — /partage/ location already handles
PHP without auth_basic.
2026-05-19 00:08:06 +02:00
Pontoporeia
da153fc604 Refactor HTMX fragment architecture: DRY split into auth endpoints + shared templates
- Created templates/partials/form/_licence.php (shared HTML, no auth logic)
- Created templates/partials/form/_format-website.php (shared HTML, no auth logic)
- Created src/FragmentRenderer.php helper for clean fragment rendering
- Created public/{admin,partage}/fragments/ subdirectories
- Created thin fragment endpoint files: auth guard + data fetch + render template
- Updated all hx-post references in templates to new fragments/ paths
- Updated partage/index.php routing for new fragments subdirectory
- Kept old fragment files as thin delegates for backward compat
- Updated nginx config: added PHP handler in /partage/ location block
2026-05-19 00:08:06 +02:00
Pontoporeia
2632730fa0 .gitignore ignore rate_limit and theses and logs.
Done. The .gitignore now ignores all files in app/storage/cache/rate_limit/* and app/storage/theses/* while   
 preserving their .gitkeep files via ! negation rules.
2026-05-19 00:08:06 +02:00
Pontoporeia
2f4ac22bcb Fix Interdit Info text 2026-05-19 00:08:06 +02:00
Pontoporeia
fdc301c20d fix: require Crypto.php in ShareLink.php 2026-05-19 00:08:06 +02:00
Pontoporeia
9152b120e8 feat: mandatory auto-generated passwords for share links + admin password copy/regeneration + password gate rate limiting 2026-05-19 00:08:06 +02:00
Pontoporeia
8bb0b3a1f2 refactor: unify FilePond edit previews + clean upload UI and shared fragments
* Move shared `fichiers-fragment.php` from `partage/` to `templates/partials/form/`
  and update all include/require references
* `.gitignore`: exclude SQLite WAL/SHM journal files
* FilePond UI:

  * change uploaded file block border state from yellow to green
  * restyle image previews to use site light-theme colors
* Edit mode:

  * remove custom existing-file preview list implementation
  * preload existing files directly into FilePond pools
  * include `cover` and `note_intention` assets in FilePond-managed state
* Remove obsolete upload progress bar UI and related JS includes
* Remove deprecated `Écriture` + `Image` format types from upload flow/configuration
2026-05-19 00:08:06 +02:00
Pontoporeia
6e7c0c00e3 refactor: merge video/audio FilePond pools into TFE input
- Remove separate video/audio/peertube_video/peertube_audio pools from UI
- TFE pool now accepts all file types including video/audio
- When PeerTube is enabled, video/audio dropped into TFE pool auto-upload
  to PeerTube (process.php detects MIME and uploads immediately)
- PeerTube return IDs now encode type: peertube:video:UUID or peertube:audio:UUID
- load.php returns placeholder SVG for PeerTube files so they appear in FilePond
- Edit mode: all existing files (including PeerTube) shown in TFE FilePond pool
- Remove legacy  video/audio/peertube_* handling from both controllers
- Remove unused vide/audio/peertube_* entries from JS QUEUE_CONFIG
2026-05-19 00:08:06 +02:00
Pontoporeia
1ff3c70ebe fix: track vendor JS files, add 'unsafe-inline' to public CSP, gitignore filepond tmp
- Track vendor JS files (filepond, htmx, overtype) that were moved
  to app/public/assets/js/vendor/ but never tracked → missing from deploys
- Add script-src 'self' 'unsafe-inline' to main CSP header so public
  pages (jury fieldset, repertoire, partage) can use inline scripts
  and onclick handlers
- Add storage/tmp/filepond/* to .gitignore with .gitkeep, and exclude
  from deploy rsync to avoid syncing local test uploads to production
2026-05-19 00:08:06 +02:00
Pontoporeia
2e9ebfc684 filepond: implement async server-ID upload architecture with nested queue support + PeerTube integration
Replace `storeAsFile:true` with a full async FilePond round-trip pipeline using opaque server-side file IDs.

* Added 4 new PHP endpoints under `/admin/actions/filepond/`:

  * `process.php` — upload/process single file and return opaque `file_id`
  * `revert.php` — delete pending tmp uploads before form submit
  * `load.php` — stream existing files by DB ID for FilePond preload
  * `remove.php` — soft-delete `thesis_files` rows
* `process.php` improvements:

  * accept arbitrary FilePond field names instead of hardcoded `file`
  * support PHP-nested multi-file queue inputs (`queue_file[tfe][]`)
  * explicit unwrapping of nested `$_FILES` structures
  * add `audio/mp3` to audio + `peertube_audio` MIME whitelists
  * immediate upload of `peertube_*` files to PeerTube, returning `peertube:{uuid}` IDs
  * extensive `error_log()` instrumentation for request, CSRF, MIME, upload, and save stages
* `revert.php` now accepts `peertube:` IDs without local cleanup
* `ThesisFileHandler`:

  * add `handleFilePondQueueFiles()` + `handleFilePondSingleFile()`
  * process async uploads from `storage/tmp/filepond/` via opaque `file_id`
  * inline handling of `peertube:{uuid}` IDs with direct `thesis_files` insertion
  * remove obsolete deferred PeerTube queue-processing flow
* `ThesisCreateController` + `ThesisEditController`:

  * gate async path behind `filepond_mode=1`
  * preserve legacy multipart flow as fallback
* `file-upload-filepond.js`:

  * remove `storeAsFile:true`
  * add `buildServerConfig()` for async endpoint wiring
  * fix `syncOrderInput()` to use `serverId`
  * add `onprocessfile` hook
  * add `fileValidateSizeFilterItem` for per-extension size caps
  * preload existing uploads via `data-existing-files` + `server.load`
  * replace static `INPUT_ID_TO_TYPE` map with `data-queue-type`
  * add extensive `console.log()` debugging across upload pipeline stages
* `upload-progress.js`:

  * block form submission while uploads are pending
  * update `collectFileNames()` to read processed FilePond items
* Templates/layout:

  * add `data-queue-type`
  * add `data-existing-files`
  * add global CSRF meta tag outside admin-only context
  * add `filepond_mode` hidden input
  * add CSRF token/meta support for partage pages
  * move website URL field below file upload block
* `.gitignore`: exclude `storage/tmp/` from version control
2026-05-19 00:08:06 +02:00
Pontoporeia
b56d073210 refactor: extract inline JS into app/ modules, remove dead overtype-webcomponent
- Remove overtype-webcomponent.min.js (zero references)
- Extract copyLogContent + fallbackCopy + HTMX tab-updater → app/admin-logs.js
  (removes duplicate from both system.php and parametres.php)
- Extract copyUrl → app/clipboard.js (shared by acces.php)
- Extract tag/language pill-search logic → app/pill-search.js
  Generalized with data-pill-search attributes, auto-inits via
  DOMContentLoaded + htmx:afterSwap
- Extract access-request form handler → app/access-request.js
  (was inline in templates/public/tfe.php)

Files created: admin-logs.js, clipboard.js, pill-search.js, access-request.js
Files modified: 9 templates/controllers to drop inline scripts and
  reference external JS files
2026-05-19 00:08:06 +02:00
Pontoporeia
04094d802d fix: harden security based on pentest scan findings
- Add Content-Security-Policy to main nginx server block (was only on /admin/)
- Add Cross-Origin-Opener-Policy and Cross-Origin-Resource-Policy headers
- Add includeSubDomains to HSTS header
- Set HttpOnly, Secure, SameSite=Lax session cookie params on public pages
  (AdminAuth already hardens the /admin session with SameSite=Strict)
- Update xamxam.conf.reference and SECURITY_HEADERS.md to match
2026-05-19 00:08:06 +02:00
Pontoporeia
4717b4d67e feat: add passive pentest scanner script with PEP 723 uv metadata 2026-05-19 00:08:06 +02:00
Pontoporeia
df12af8423 fix: validation error messages hidden by generic fallback in ErrorHandler::userMessage
ErrorHandler::userMessage only handled RuntimeException, but all validation
throws in ThesisCreateController and ThesisEditController use plain Exception.
This caused user-friendly messages like 'Le champ Nom/Prénom/Pseudo est requis'
to fall through to the 'Une erreur inattendue est survenue…' generic message.

Fix: add Exception check (after PDOException, since PDOException extends it)
so all validation exceptions pass their message through.
2026-05-19 00:08:06 +02:00
Pontoporeia
c3f6e8a033 fix: upload progress bar not visible — collectFileNames checks FilePond instances; remove admin auth from progress poll endpoint 2026-05-19 00:08:06 +02:00
Pontoporeia
d873a7f09e fix: add upload-progress.js to partage form (progress bar was missing on public submissions) 2026-05-19 00:08:06 +02:00
Pontoporeia
e5e76cfb70 add migration 033 to deduplicate format_types, fix 019 to use INSERT OR IGNORE 2026-05-19 00:08:06 +02:00
Pontoporeia
3ae22cd427 add system dependency checks (php-curl, sqlite3) to deploy-server.sh step 0 2026-05-19 00:08:06 +02:00
Pontoporeia
31ccbd195b add syntaqlite SQL validation to migrate.sh before applying schema.sql 2026-05-19 00:08:06 +02:00
Pontoporeia
cb6394e119 add incremental migration runner to deploy recipe — execute whole SQL files (not semicolon-split), catch 'no such column' for idempotent re-runs, merge into migrate.sh 2026-05-19 00:08:06 +02:00
Pontoporeia
c1960d224b fix deploy: multiple deploy recipe fixes — upload xamxam.conf before deploy-server.sh, sudo rsync for chown, migrate.sh via sqlite3, chmod WAL/SHM sidecar files, deploy-verify-permissions awk fix, .env sudo perms 2026-05-19 00:08:06 +02:00
Pontoporeia
206a6427e7 style: unify recap+edit file figure styling — two-column grid dl, vertical spacing, admin-back-btn sizing, standardise file display and delete-to-trash SVG icons 2026-05-19 00:08:06 +02:00
Pontoporeia
230555a4c4 exhaustive recap: all fields, figures for files, PeerTube ID display, same in edit form 2026-05-19 00:08:06 +02:00
Pontoporeia
8bf95f4e14 feat: refactor licence fragment — Libre→CC2r+licence, Interne→opt-in want_license, Interdit→none, add details/summary to license UI 2026-05-19 00:08:06 +02:00
Pontoporeia
927ee2fe2a feat: upload progress bar — fieldset layout, accent colors, file name display, completion animation, 800ms redirect delay; decorelate formats from fichiers; server-side poll via token; bump PeerTube embed audio player 2026-05-19 00:08:06 +02:00
Pontoporeia
cdec3e96a6 fix PeerTube upload: final working solution — simple multipart POST with CURLFile; iterated through Google-resumable PATCH protocol debugging (HTTP version negotiation, chunk body encoding, off-by-one fixes) before settling on simpler POST approach 2026-05-19 00:08:06 +02:00