mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
fix: iframe for PDF display, exclude cover files from public loop, no session on media requests
This commit is contained in:
6
TODO.md
6
TODO.md
@@ -1,5 +1,11 @@
|
|||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
|
## TFE Public Page — File Display
|
||||||
|
|
||||||
|
- [x] Replace `<embed>` with `<iframe>` for PDF display (better cross-browser support)
|
||||||
|
- [x] Exclude `cover` file_type from public files loop (covers are banners, not content)
|
||||||
|
- [x] Move `App::boot()` in Dispatcher to after direct-response matching (no session on media requests)
|
||||||
|
|
||||||
## Dev / Debug Fixes
|
## Dev / Debug Fixes
|
||||||
|
|
||||||
- [x] Fix `serve` recipe: show all PHP output (errors, logs) except static assets/connection noise
|
- [x] Fix `serve` recipe: show all PHP output (errors, logs) except static assets/connection noise
|
||||||
|
|||||||
@@ -48,9 +48,6 @@ class Dispatcher {
|
|||||||
* execute the action, and render the view.
|
* execute the action, and render the view.
|
||||||
*/
|
*/
|
||||||
public function dispatch(): void {
|
public function dispatch(): void {
|
||||||
// Ensure session + CSRF token are initialised for all public requests
|
|
||||||
require_once APP_ROOT . '/src/App.php';
|
|
||||||
App::boot();
|
|
||||||
// 1. Direct-response endpoints (render their own output)
|
// 1. Direct-response endpoints (render their own output)
|
||||||
$direct = $this->matchDirect();
|
$direct = $this->matchDirect();
|
||||||
if ($direct) {
|
if ($direct) {
|
||||||
@@ -58,6 +55,10 @@ class Dispatcher {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure session + CSRF token are initialised for routed pages
|
||||||
|
require_once APP_ROOT . '/src/App.php';
|
||||||
|
App::boot();
|
||||||
|
|
||||||
// 2. Routed pages (controller + view)
|
// 2. Routed pages (controller + view)
|
||||||
$route = $this->matchRoute();
|
$route = $this->matchRoute();
|
||||||
if (!$route) {
|
if (!$route) {
|
||||||
|
|||||||
@@ -290,13 +290,18 @@
|
|||||||
<?php elseif (!empty($data['files'])): ?>
|
<?php elseif (!empty($data['files'])): ?>
|
||||||
<?php foreach ($data['files'] as $file): ?>
|
<?php foreach ($data['files'] as $file): ?>
|
||||||
<?php
|
<?php
|
||||||
$ext = strtolower(pathinfo($file['file_path'], PATHINFO_EXTENSION));
|
$ext = strtolower(pathinfo($file['file_path'], PATHINFO_EXTENSION));
|
||||||
|
$fileType = $file['file_type'] ?? '';
|
||||||
if ($ext === 'vtt') continue;
|
if ($ext === 'vtt') continue;
|
||||||
|
if ($fileType === 'cover') continue;
|
||||||
?>
|
?>
|
||||||
<figure>
|
<figure>
|
||||||
<?php if ($ext === 'pdf'): ?>
|
<?php if ($ext === 'pdf'): ?>
|
||||||
<embed src="/media?path=<?= urlencode($file['file_path']) ?>"
|
<iframe src="/media?path=<?= urlencode($file['file_path']) ?>"
|
||||||
type="application/pdf" width="100%" height="700px">
|
width="100%" height="700px"
|
||||||
|
style="border:none"
|
||||||
|
title="<?= htmlspecialchars($file['original_name'] ?? basename($file['file_path'])) ?>">
|
||||||
|
</iframe>
|
||||||
<p class="tfe-pdf-fallback">
|
<p class="tfe-pdf-fallback">
|
||||||
<a href="/media?path=<?= urlencode($file['file_path']) ?>&download=1">
|
<a href="/media?path=<?= urlencode($file['file_path']) ?>&download=1">
|
||||||
Télécharger le PDF
|
Télécharger le PDF
|
||||||
|
|||||||
Reference in New Issue
Block a user