forked from FWS/FWS-TEMPLATE-Website-OnePage
Compare commits
4
Commits
6adebf4c97
...
6b6b07aa83
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b6b07aa83 | ||
|
|
82168e2678 | ||
|
|
3b3127bb34 | ||
|
|
f8066c89fc |
No files matched your search
@@ -23,3 +23,6 @@ p/assets/img/packages/
|
|||||||
|
|
||||||
# Cache HTTP local du site (releases Gitea/GitHub, généré par inc/site.php)
|
# Cache HTTP local du site (releases Gitea/GitHub, généré par inc/site.php)
|
||||||
cache/
|
cache/
|
||||||
|
|
||||||
|
# Journal des erreurs PHP (filet de sécurité inc/errors.php)
|
||||||
|
api/bugs/data/php-errors.log
|
||||||
@@ -8,6 +8,25 @@ DirectoryIndex index.php page.php
|
|||||||
# Pas de listing de répertoires (ex : /p/, /api/, /admin/)
|
# Pas de listing de répertoires (ex : /p/, /api/, /admin/)
|
||||||
Options -Indexes
|
Options -Indexes
|
||||||
|
|
||||||
|
# ── Erreurs Apache « douces » ────────────────────────────────────────────────
|
||||||
|
# 403 (répertoire protégé, listing désactivé…) et 404 : jamais les pages
|
||||||
|
# Apache brutes. page.php sert la page 404 du site ; le statut HTTP reste
|
||||||
|
# correct (403/404) pour les navigateurs comme pour les clients d'API.
|
||||||
|
ErrorDocument 403 /page.php?__e=403
|
||||||
|
ErrorDocument 404 /page.php?__e=404
|
||||||
|
|
||||||
|
# ── Fichiers internes : traités comme introuvables ─────────────────────────
|
||||||
|
# Tout fichier PHP qui n'est pas un point d'entrée légitime (bibliothèques,
|
||||||
|
# corps de pages, config, logs…) répond 404 — on ne révèle même pas son
|
||||||
|
# existence avec un 403. Les accès directs aux corps restent sinon gérés par
|
||||||
|
# leurs shims de délégation vers page.php.
|
||||||
|
RedirectMatch 404 ^/?(inc|cache)/
|
||||||
|
RedirectMatch 404 ^/?api/bugs/(db|discord|config\.local)\.php$
|
||||||
|
RedirectMatch 404 ^/?admin/bugs/init\.php$
|
||||||
|
# Corps de pages et scripts internes sous p/ (hors assets). Les index.php
|
||||||
|
# sont exclus : ils sont résolus en interne par DirectoryIndex (ex /p/dl/).
|
||||||
|
RedirectMatch 404 ^/?p/(?!assets/)(?!.*index\.php$).*\.php$
|
||||||
|
|
||||||
# Types MIME manquants (selon la config Apache du conteneur)
|
# Types MIME manquants (selon la config Apache du conteneur)
|
||||||
<IfModule mod_mime.c>
|
<IfModule mod_mime.c>
|
||||||
AddType image/webp .webp
|
AddType image/webp .webp
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/* Filet de sécurité : aucune erreur PHP ne fuit jamais côté client
|
||||||
|
* (JSON sous /api/, page HTML discrète sinon). */
|
||||||
|
require_once dirname(__DIR__, 2) . '/inc/errors.php';
|
||||||
|
|
||||||
/* ───────────── UTF-8 (partagé avec inc/site.php, gardes function_exists) ── */
|
/* ───────────── UTF-8 (partagé avec inc/site.php, gardes function_exists) ── */
|
||||||
|
|
||||||
if (!function_exists('fws_utf8_str')) {
|
if (!function_exists('fws_utf8_str')) {
|
||||||
|
|||||||
+154
@@ -0,0 +1,154 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS — filet de sécurité des erreurs PHP.
|
||||||
|
*
|
||||||
|
* Inclu par inc/site.php (pages du site) et api/bugs/db.php (API + admin),
|
||||||
|
* donc actif partout. Garanties :
|
||||||
|
*
|
||||||
|
* 1. Aucune erreur PHP n'est jamais affichée au client (display_errors off) ;
|
||||||
|
* 2. Les erreurs sont journalisées dans api/bugs/data/php-errors.log
|
||||||
|
* (répertoire interdit au web et gitignoré) ;
|
||||||
|
* 3. Exception non interceptée ou erreur fatale → réponse propre :
|
||||||
|
* JSON sous /api/, page HTML discrète sinon (jamais de stack trace,
|
||||||
|
* jamais de chemin de fichier, jamais de message système).
|
||||||
|
*
|
||||||
|
* Idempotent : peut être inclus plusieurs fois sans risque.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/* ── 1/2. Journalisation locale, jamais d'affichage ────────────────────── */
|
||||||
|
|
||||||
|
ini_set('display_errors', '0');
|
||||||
|
ini_set('display_startup_errors', '0');
|
||||||
|
ini_set('log_errors', '1');
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
|
||||||
|
/* En CLI (scripts d'administration dans le conteneur), on affiche tout :
|
||||||
|
* c'est interactif, l'opérateur doit voir les problèmes. */
|
||||||
|
if (PHP_SAPI === 'cli') {
|
||||||
|
ini_set('display_errors', '1');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Journal : api/bugs/data/ (déjà interdit au web par .htaccess + gitigné). */
|
||||||
|
$fwsErrorLogDir = dirname(__DIR__) . '/api/bugs/data';
|
||||||
|
if (!is_dir($fwsErrorLogDir)) {
|
||||||
|
@mkdir($fwsErrorLogDir, 0770, true);
|
||||||
|
}
|
||||||
|
if (is_dir($fwsErrorLogDir) && is_writable($fwsErrorLogDir)) {
|
||||||
|
ini_set('error_log', $fwsErrorLogDir . '/php-errors.log');
|
||||||
|
}
|
||||||
|
unset($fwsErrorLogDir);
|
||||||
|
|
||||||
|
/* ── 3. Réponses d'erreur propres ──────────────────────────────────────── */
|
||||||
|
|
||||||
|
if (!function_exists('fws_error_wants_json')) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Le client attend-il du JSON ?
|
||||||
|
*
|
||||||
|
* Un navigateur (navigation réelle) demande explicitement du HTML
|
||||||
|
* (« Accept: text/html, … ») → il recevra une page visuelle.
|
||||||
|
* Tout le reste — curl (Accept générique), scripts, apps, appels fetch()
|
||||||
|
* ou clients qui annoncent du JSON — reçoit du JSON.
|
||||||
|
*/
|
||||||
|
function fws_error_wants_json(): bool
|
||||||
|
{
|
||||||
|
$accept = strtolower((string) ($_SERVER['HTTP_ACCEPT'] ?? ''));
|
||||||
|
if (str_contains($accept, 'text/html')) {
|
||||||
|
return false; /* navigateur → page visuelle */
|
||||||
|
}
|
||||||
|
return true; /* curl, scripts, API clients → JSON */
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Réponse d'erreur finale : JSON ou page HTML minimaliste, sans aucun
|
||||||
|
* détail technique. Ne fait rien si les en-têtes sont déjà partis.
|
||||||
|
*/
|
||||||
|
function fws_error_render(int $status, string $message): void
|
||||||
|
{
|
||||||
|
if (headers_sent()) {
|
||||||
|
return; /* trop tard pour propre : on referme silencieusement */
|
||||||
|
}
|
||||||
|
|
||||||
|
http_response_code($status);
|
||||||
|
|
||||||
|
if (fws_error_wants_json()) {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
header('X-Content-Type-Options: nosniff');
|
||||||
|
header('Cache-Control: no-store');
|
||||||
|
echo json_encode(['ok' => false, 'error' => $message], JSON_UNESCAPED_UNICODE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
header('Cache-Control: no-store');
|
||||||
|
$msg = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');
|
||||||
|
echo <<<HTML
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
<title>Erreur | FWS Linux</title>
|
||||||
|
<style>
|
||||||
|
body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;
|
||||||
|
font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
|
||||||
|
background:#0f172a;color:#e2e8f0}
|
||||||
|
main{text-align:center;padding:2rem}
|
||||||
|
h1{font-size:2.2rem;color:#38bdf8;margin:0 0 .5rem}
|
||||||
|
p{color:#94a3b8;margin:0 0 1.5rem}
|
||||||
|
a{color:#38bdf8;text-decoration:none;font-weight:500}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<h1>Oups…</h1>
|
||||||
|
<p>{$msg}</p>
|
||||||
|
<a href="/?p=index/">Retour à l'accueil</a>
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
HTML;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('fws_error_install')) {
|
||||||
|
|
||||||
|
/** Pose les handlers (une seule fois, jamais en CLI). */
|
||||||
|
function fws_error_install(): void
|
||||||
|
{
|
||||||
|
static $installed = false;
|
||||||
|
if ($installed || PHP_SAPI === 'cli') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$installed = true;
|
||||||
|
|
||||||
|
/* Exception non interceptée → 500 propre. */
|
||||||
|
set_exception_handler(static function (Throwable $e): void {
|
||||||
|
error_log('[fws] exception non interceptée : ' . $e->getMessage()
|
||||||
|
. ' — ' . $e->getFile() . ':' . $e->getLine());
|
||||||
|
fws_error_render(500, 'Une erreur inattendue est survenue. Merci de réessayer plus tard.');
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Erreur fatale (mémoire, parse, include manquant…) → 500 propre.
|
||||||
|
* NB : les warnings/notices restent simplement journalisés — on ne
|
||||||
|
* les transforme pas en exceptions pour ne pas casser les pages. */
|
||||||
|
register_shutdown_function(static function (): void {
|
||||||
|
$e = error_get_last();
|
||||||
|
if ($e === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$fatals = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR];
|
||||||
|
if (!in_array((int) $e['type'], $fatals, true)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
error_log('[fws] erreur fatale : ' . $e['message']
|
||||||
|
. ' — ' . $e['file'] . ':' . $e['line']);
|
||||||
|
fws_error_render(500, 'Une erreur inattendue est survenue. Merci de réessayer plus tard.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fws_error_install();
|
||||||
@@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
/* Filet de sécurité : aucune erreur PHP ne fuit jamais côté client. */
|
||||||
|
require_once __DIR__ . '/errors.php';
|
||||||
|
|
||||||
define('FWS_SITE_ROOT', dirname(__DIR__));
|
define('FWS_SITE_ROOT', dirname(__DIR__));
|
||||||
define('FWS_SITE_CACHE_DIR', FWS_SITE_ROOT . '/cache');
|
define('FWS_SITE_CACHE_DIR', FWS_SITE_ROOT . '/cache');
|
||||||
define('FWS_SITE_CACHE_TTL', 600); // 10 minutes
|
define('FWS_SITE_CACHE_TTL', 600); // 10 minutes
|
||||||
@@ -21,6 +24,18 @@ function e(?string $s): string
|
|||||||
return htmlspecialchars((string) $s, ENT_QUOTES, 'UTF-8');
|
return htmlspecialchars((string) $s, ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* URL d'un asset local avec version (…?v=<date du fichier>) : chaque mise
|
||||||
|
* à jour d'un CSS/JS est immédiatement re-téléchargée par les navigateurs,
|
||||||
|
* au lieu d'être bloquée par le cache « 7 jours » du .htaccess.
|
||||||
|
*/
|
||||||
|
function fws_asset(string $path): string
|
||||||
|
{
|
||||||
|
$abs = FWS_SITE_ROOT . $path;
|
||||||
|
$mtime = @filemtime($abs);
|
||||||
|
return $mtime ? $path . '?v=' . $mtime : $path;
|
||||||
|
}
|
||||||
|
|
||||||
/* fws_utf8_str / fws_utf8_arr sont définies dans api/bugs/db.php (chargé
|
/* fws_utf8_str / fws_utf8_arr sont définies dans api/bugs/db.php (chargé
|
||||||
ci-dessous via fws_site_db()) avec des gardes function_exists : elles
|
ci-dessous via fws_site_db()) avec des gardes function_exists : elles
|
||||||
sont donc disponibles quel que soit l'ordre d'inclusion. */
|
sont donc disponibles quel que soit l'ordre d'inclusion. */
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
(() => {
|
||||||
|
/* Une seule exécution, même si le script est chargé deux fois. */
|
||||||
|
if (window.__fwsPackagesUi) return;
|
||||||
|
window.__fwsPackagesUi = true;
|
||||||
|
|
||||||
|
/* ── « Voir plus » de l'historique (liste des paquets) ── */
|
||||||
|
document.addEventListener("click", (ev) => {
|
||||||
|
const btn = ev.target.closest("[data-toggle-timeline]");
|
||||||
|
if (!btn) return;
|
||||||
|
const timeline = btn.closest(".paquet-changelog")?.querySelector("[data-expandable]");
|
||||||
|
if (!timeline) return;
|
||||||
|
const expanded = btn.dataset.expanded === "true";
|
||||||
|
timeline.classList.toggle("is-expanded", !expanded);
|
||||||
|
btn.dataset.expanded = expanded ? "false" : "true";
|
||||||
|
btn.textContent = expanded ? (btn.dataset.label || "Voir plus") : "Voir moins";
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ── Popup central « aperçu de l'image » (page détail) ── */
|
||||||
|
const zoomables = Array.from(document.querySelectorAll("img[data-zoom]"));
|
||||||
|
if (zoomables.length === 0) return;
|
||||||
|
|
||||||
|
let overlay = null;
|
||||||
|
let imgEl = null;
|
||||||
|
let capEl = null;
|
||||||
|
let countEl = null;
|
||||||
|
let current = 0;
|
||||||
|
|
||||||
|
function buildOverlay() {
|
||||||
|
if (overlay) return;
|
||||||
|
overlay = document.createElement("div");
|
||||||
|
overlay.className = "pkg-lightbox";
|
||||||
|
overlay.setAttribute("role", "dialog");
|
||||||
|
overlay.setAttribute("aria-modal", "true");
|
||||||
|
overlay.setAttribute("aria-label", "Aperçu de l'image");
|
||||||
|
overlay.innerHTML =
|
||||||
|
'<button type="button" class="pkg-lightbox-close" data-lightbox-close aria-label="Fermer">×</button>' +
|
||||||
|
'<button type="button" class="pkg-lightbox-nav pkg-lightbox-prev" data-lightbox-prev aria-label="Image précédente">‹</button>' +
|
||||||
|
'<figure class="pkg-lightbox-figure">' +
|
||||||
|
'<img class="pkg-lightbox-img" alt="">' +
|
||||||
|
'<figcaption class="pkg-lightbox-figcap">' +
|
||||||
|
'<span class="pkg-lightbox-caption"></span>' +
|
||||||
|
'<span class="pkg-lightbox-count"></span>' +
|
||||||
|
"</figcaption>" +
|
||||||
|
"</figure>" +
|
||||||
|
'<button type="button" class="pkg-lightbox-nav pkg-lightbox-next" data-lightbox-next aria-label="Image suivante">›</button>';
|
||||||
|
document.body.appendChild(overlay);
|
||||||
|
|
||||||
|
imgEl = overlay.querySelector(".pkg-lightbox-img");
|
||||||
|
capEl = overlay.querySelector(".pkg-lightbox-caption");
|
||||||
|
countEl = overlay.querySelector(".pkg-lightbox-count");
|
||||||
|
|
||||||
|
/* Navigation clavier pendant que le popup est ouvert. */
|
||||||
|
document.addEventListener("keydown", (ev) => {
|
||||||
|
if (!overlay.classList.contains("is-open")) return;
|
||||||
|
if (ev.key === "Escape") {
|
||||||
|
ev.preventDefault();
|
||||||
|
closeOverlay();
|
||||||
|
} else if (ev.key === "ArrowLeft" && zoomables.length > 1) {
|
||||||
|
showImage(current - 1);
|
||||||
|
} else if (ev.key === "ArrowRight" && zoomables.length > 1) {
|
||||||
|
showImage(current + 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showImage(index) {
|
||||||
|
current = (index + zoomables.length) % zoomables.length;
|
||||||
|
const src = zoomables[current];
|
||||||
|
imgEl.src = src.currentSrc || src.src;
|
||||||
|
imgEl.alt = src.alt || "";
|
||||||
|
const caption = src.dataset.caption || "";
|
||||||
|
capEl.textContent = caption;
|
||||||
|
capEl.style.display = caption ? "" : "none";
|
||||||
|
countEl.textContent = (current + 1) + " / " + zoomables.length;
|
||||||
|
countEl.style.display = zoomables.length > 1 ? "" : "none";
|
||||||
|
|
||||||
|
/* Relance l'animation d'apparition à chaque changement d'image. */
|
||||||
|
const figure = overlay.querySelector(".pkg-lightbox-figure");
|
||||||
|
figure.classList.remove("is-animating");
|
||||||
|
void figure.offsetWidth; /* reflow : réinitialise l'animation CSS */
|
||||||
|
figure.classList.add("is-animating");
|
||||||
|
}
|
||||||
|
|
||||||
|
function openOverlay(index) {
|
||||||
|
buildOverlay();
|
||||||
|
showImage(index);
|
||||||
|
overlay.classList.add("is-open");
|
||||||
|
document.documentElement.classList.add("pkg-no-scroll");
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeOverlay() {
|
||||||
|
if (!overlay) return;
|
||||||
|
overlay.classList.remove("is-open");
|
||||||
|
document.documentElement.classList.remove("pkg-no-scroll");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Un seul gestionnaire délégué : clic sur une image → ouverture ;
|
||||||
|
clic sur croix / flèches / fond → action correspondante. */
|
||||||
|
document.addEventListener("click", (ev) => {
|
||||||
|
const zoom = ev.target.closest("img[data-zoom]");
|
||||||
|
if (zoom) {
|
||||||
|
const idx = zoomables.indexOf(zoom);
|
||||||
|
if (idx >= 0) {
|
||||||
|
ev.preventDefault();
|
||||||
|
openOverlay(idx);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!overlay || !overlay.classList.contains("is-open")) return;
|
||||||
|
|
||||||
|
if (ev.target.closest("[data-lightbox-close]")) {
|
||||||
|
closeOverlay();
|
||||||
|
} else if (ev.target.closest("[data-lightbox-prev]")) {
|
||||||
|
showImage(current - 1);
|
||||||
|
} else if (ev.target.closest("[data-lightbox-next]")) {
|
||||||
|
showImage(current + 1);
|
||||||
|
} else if (ev.target === overlay) {
|
||||||
|
closeOverlay(); /* clic sur le fond uniquement, pas sur l'image */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -357,6 +357,173 @@
|
|||||||
font-size: 0.75rem;
|
font-size: 0.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Historique limité (« Voir plus ») ── */
|
||||||
|
|
||||||
|
.paquet-timeline-item.paquet-timeline-extra {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-timeline.is-expanded .paquet-timeline-extra {
|
||||||
|
display: grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-more {
|
||||||
|
justify-self: start;
|
||||||
|
padding: 0.3rem 0.8rem;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: transparent;
|
||||||
|
color: var(--accent);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 140ms ease, color 140ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-more:hover {
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent-strong, var(--accent));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Images cliquables (page détail) ── */
|
||||||
|
|
||||||
|
.paquet-screens-grid img[data-zoom] {
|
||||||
|
cursor: zoom-in;
|
||||||
|
transition: opacity 140ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-screens-grid img[data-zoom]:hover {
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-zoom-hint {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.72rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Popup central « aperçu de l'image » ── */
|
||||||
|
|
||||||
|
html.pkg-no-scroll {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
z-index: 1000;
|
||||||
|
display: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 2rem;
|
||||||
|
background: rgba(2, 6, 23, 0.55);
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
-webkit-backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox.is-open {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-figure {
|
||||||
|
margin: 0;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.55rem;
|
||||||
|
max-width: min(1000px, 90vw);
|
||||||
|
animation: pkg-pop 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-figure.is-animating {
|
||||||
|
animation: pkg-pop 220ms cubic-bezier(0.2, 0.9, 0.3, 1.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pkg-pop {
|
||||||
|
from { opacity: 0; transform: scale(0.92); }
|
||||||
|
to { opacity: 1; transform: scale(1); }
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-img {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 78vh;
|
||||||
|
object-fit: contain;
|
||||||
|
border-radius: 0.8rem;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-figcap {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-caption {
|
||||||
|
color: #e2e8f0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-count {
|
||||||
|
color: #94a3b8;
|
||||||
|
font-size: 0.78rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-close {
|
||||||
|
position: absolute;
|
||||||
|
top: 1rem;
|
||||||
|
right: 1.2rem;
|
||||||
|
width: 2.5rem;
|
||||||
|
height: 2.5rem;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.4);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(15, 23, 42, 0.75);
|
||||||
|
color: #e2e8f0;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
line-height: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-close:hover {
|
||||||
|
border-color: #e2e8f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-nav {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
width: 2.8rem;
|
||||||
|
height: 2.8rem;
|
||||||
|
border: 1px solid rgba(148, 163, 184, 0.35);
|
||||||
|
border-radius: 999px;
|
||||||
|
background: rgba(15, 23, 42, 0.75);
|
||||||
|
color: #e2e8f0;
|
||||||
|
font-size: 1.6rem;
|
||||||
|
line-height: 1;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-prev { left: 1.2rem; }
|
||||||
|
.pkg-lightbox-next { right: 1.2rem; }
|
||||||
|
|
||||||
|
.pkg-lightbox-nav:hover {
|
||||||
|
border-color: #e2e8f0;
|
||||||
|
background: rgba(30, 41, 59, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
.pkg-lightbox {
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
.pkg-lightbox-nav {
|
||||||
|
top: auto;
|
||||||
|
bottom: 1.2rem;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
.pkg-lightbox-prev { left: auto; right: 4.2rem; }
|
||||||
|
.pkg-lightbox-next { right: 1.2rem; }
|
||||||
|
}
|
||||||
|
|
||||||
.paquet-links {
|
.paquet-links {
|
||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ if ($pkg === null) {
|
|||||||
|
|
||||||
$title = $pkg['name'] . ' | FWS Linux';
|
$title = $pkg['name'] . ' | FWS Linux';
|
||||||
$description = (string) ($pkg['tagline'] ?? '') !== '' ? (string) $pkg['tagline'] : (string) ($pkg['description'] ?? '');
|
$description = (string) ($pkg['tagline'] ?? '') !== '' ? (string) $pkg['tagline'] : (string) ($pkg['description'] ?? '');
|
||||||
|
$extraJs[] = '/p/assets/js/packages-ui.js';
|
||||||
|
|
||||||
$latest = $pkg['latest'] ?? null;
|
$latest = $pkg['latest'] ?? null;
|
||||||
?>
|
?>
|
||||||
@@ -83,9 +84,11 @@ $latest = $pkg['latest'] ?? null;
|
|||||||
<div class="paquet-screens-grid">
|
<div class="paquet-screens-grid">
|
||||||
<?php foreach ($pkg['screens'] as $screen): ?>
|
<?php foreach ($pkg['screens'] as $screen): ?>
|
||||||
<figure>
|
<figure>
|
||||||
<img src="<?= e((string) ($screen['src'] ?? '')) ?>" alt="<?= e((string) ($screen['alt'] ?? $pkg['name'])) ?>" loading="lazy">
|
<img src="<?= e((string) ($screen['src'] ?? '')) ?>" alt="<?= e((string) ($screen['alt'] ?? $pkg['name'])) ?>" loading="lazy" data-zoom<?php if (!empty($screen['caption'])): ?> data-caption="<?= e((string) $screen['caption']) ?>"<?php endif; ?>>
|
||||||
<?php if (!empty($screen['caption'])): ?>
|
<?php if (!empty($screen['caption'])): ?>
|
||||||
<figcaption><?= e((string) $screen['caption']) ?></figcaption>
|
<figcaption><?= e((string) $screen['caption']) ?> <span class="paquet-zoom-hint">— cliquez pour agrandir</span></figcaption>
|
||||||
|
<?php else: ?>
|
||||||
|
<figcaption><span class="paquet-zoom-hint">Cliquez pour agrandir</span></figcaption>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</figure>
|
</figure>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
|
|||||||
+29
-25
@@ -14,51 +14,53 @@ if (!defined('FWS_PAGE_SHELL')) {
|
|||||||
|
|
||||||
$title = 'Paquets | FWS Linux';
|
$title = 'Paquets | FWS Linux';
|
||||||
$description = 'Les outils développés pour FWS Linux — historique de chaque paquet, captures d\'écran et liens utiles.';
|
$description = 'Les outils développés pour FWS Linux — historique de chaque paquet, captures d\'écran et liens utiles.';
|
||||||
|
$extraJs[] = '/p/assets/js/packages-ui.js';
|
||||||
|
|
||||||
function fws_packages_empty(string $message): string
|
function fws_packages_empty(string $message): string
|
||||||
{
|
{
|
||||||
return '<p class="paquet-empty">' . e($message) . '</p>';
|
return '<p class="paquet-empty">' . e($message) . '</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function fws_packages_changelog(array $pkg): string
|
/**
|
||||||
|
* Historique du paquet. En liste ($limited) : seules les 3 dernières
|
||||||
|
* versions sont visibles, un bouton « Voir plus » affiche les autres.
|
||||||
|
*/
|
||||||
|
function fws_packages_changelog(array $pkg, bool $limited = false): string
|
||||||
{
|
{
|
||||||
$html = '<div class="paquet-changelog"><h3>Historique</h3>';
|
$html = '<div class="paquet-changelog"><h3>Historique</h3>';
|
||||||
if (empty($pkg['changelog'])) {
|
if (empty($pkg['changelog'])) {
|
||||||
$html .= fws_packages_empty('Historique en cours de rédaction.') . '</div>';
|
$html .= fws_packages_empty('Historique en cours de rédaction.') . '</div>';
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
$html .= '<ol class="paquet-timeline">';
|
$entries = array_values($pkg['changelog']);
|
||||||
foreach ($pkg['changelog'] as $entry) {
|
$total = count($entries);
|
||||||
$html .= '<li class="paquet-timeline-item">'
|
$extraCount = 0;
|
||||||
|
if ($limited && $total > 3) {
|
||||||
|
$extraCount = $total - 3;
|
||||||
|
}
|
||||||
|
$html .= '<ol class="paquet-timeline"';
|
||||||
|
if ($extraCount > 0) {
|
||||||
|
$html .= ' data-expandable';
|
||||||
|
}
|
||||||
|
$html .= '>';
|
||||||
|
foreach ($entries as $idx => $entry) {
|
||||||
|
$html .= '<li class="paquet-timeline-item' . ($idx >= 3 ? ' paquet-timeline-extra' : '') . '">'
|
||||||
. '<strong class="paquet-timeline-version">' . e((string) ($entry['version'] ?? '—')) . '</strong>'
|
. '<strong class="paquet-timeline-version">' . e((string) ($entry['version'] ?? '—')) . '</strong>'
|
||||||
. '<time class="paquet-timeline-date"' . (empty($entry['date']) ? '' : ' datetime="' . e((string) $entry['date']) . '"') . '>'
|
. '<time class="paquet-timeline-date"' . (empty($entry['date']) ? '' : ' datetime="' . e((string) $entry['date']) . '"') . '>'
|
||||||
. e(fws_format_date(isset($entry['date']) ? (string) $entry['date'] : null)) . '</time>'
|
. e(fws_format_date(isset($entry['date']) ? (string) $entry['date'] : null)) . '</time>'
|
||||||
. (!empty($entry['notes']) ? '<span class="paquet-timeline-notes">' . e((string) $entry['notes']) . '</span>' : '')
|
. (!empty($entry['notes']) ? '<span class="paquet-timeline-notes">' . e((string) $entry['notes']) . '</span>' : '')
|
||||||
. '</li>';
|
. '</li>';
|
||||||
}
|
}
|
||||||
$html .= '</ol></div>';
|
$html .= '</ol>';
|
||||||
|
if ($extraCount > 0) {
|
||||||
|
$html .= '<button type="button" class="paquet-more" data-toggle-timeline data-label="Voir plus (' . $extraCount . ')">Voir plus (' . $extraCount . ')</button>';
|
||||||
|
}
|
||||||
|
$html .= '</div>';
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fws_packages_screens(array $pkg): string
|
/* Les captures d'écran ne s'affichent que sur la page détail
|
||||||
{
|
(« Voir en grand ») : la liste reste compacte. */
|
||||||
$html = '<div class="paquet-screens"><h3>Captures d\'écran</h3>';
|
|
||||||
if (empty($pkg['screens'])) {
|
|
||||||
$html .= fws_packages_empty("Captures d'écran à venir.") . '</div>';
|
|
||||||
return $html;
|
|
||||||
}
|
|
||||||
$html .= '<div class="paquet-screens-grid">';
|
|
||||||
foreach ($pkg['screens'] as $screen) {
|
|
||||||
$html .= '<figure><img src="' . e((string) ($screen['src'] ?? '')) . '" alt="'
|
|
||||||
. e((string) ($screen['alt'] ?? ($pkg['name'] ?? ''))) . '" loading="lazy">';
|
|
||||||
if (!empty($screen['caption'])) {
|
|
||||||
$html .= '<figcaption>' . e((string) $screen['caption']) . '</figcaption>';
|
|
||||||
}
|
|
||||||
$html .= '</figure>';
|
|
||||||
}
|
|
||||||
$html .= '</div></div>';
|
|
||||||
return $html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fws_packages_links(array $pkg): string
|
function fws_packages_links(array $pkg): string
|
||||||
{
|
{
|
||||||
@@ -85,6 +87,8 @@ function fws_packages_card(array $pkg, int $position): string
|
|||||||
? 'Dernière release : ' . $latest['name'] . (!empty($latest['date']) ? ' — ' . fws_format_date((string) $latest['date']) : '')
|
? 'Dernière release : ' . $latest['name'] . (!empty($latest['date']) ? ' — ' . fws_format_date((string) $latest['date']) : '')
|
||||||
: 'Aucune release publiée pour le moment.';
|
: 'Aucune release publiée pour le moment.';
|
||||||
|
|
||||||
|
/* En liste : pas d'images (elles ne s'affichent que sur la page
|
||||||
|
« Voir en grand »), et seules les 3 dernières versions. */
|
||||||
$html = '<article class="paquet-card" id="paquet-' . e((string) $pkg['id']) . '">'
|
$html = '<article class="paquet-card" id="paquet-' . e((string) $pkg['id']) . '">'
|
||||||
. '<header class="paquet-head"><div class="paquet-title-row">'
|
. '<header class="paquet-head"><div class="paquet-title-row">'
|
||||||
. '<h2>' . e($pkg['name']) . '</h2>'
|
. '<h2>' . e($pkg['name']) . '</h2>'
|
||||||
@@ -96,7 +100,7 @@ function fws_packages_card(array $pkg, int $position): string
|
|||||||
. '<p class="paquet-latest">' . e($latestText) . '</p>'
|
. '<p class="paquet-latest">' . e($latestText) . '</p>'
|
||||||
. (!empty($pkg['description']) ? '<p class="paquet-description">' . e($pkg['description']) . '</p>' : '')
|
. (!empty($pkg['description']) ? '<p class="paquet-description">' . e($pkg['description']) . '</p>' : '')
|
||||||
. '</header>'
|
. '</header>'
|
||||||
. '<div class="paquet-body">' . fws_packages_changelog($pkg) . fws_packages_screens($pkg) . fws_packages_links($pkg) . '</div>'
|
. '<div class="paquet-body">' . fws_packages_changelog($pkg, true) . fws_packages_links($pkg) . '</div>'
|
||||||
. '</article>';
|
. '</article>';
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,25 @@ if (preg_match('/^paquets\/(\d+)$/', $route, $m)) {
|
|||||||
|
|
||||||
$is404 = $pageFile === null || !is_file($pageFile);
|
$is404 = $pageFile === null || !is_file($pageFile);
|
||||||
|
|
||||||
|
/* Erreurs Apache « douces » : les 403/404 déroutés ici via ErrorDocument
|
||||||
|
* (voir .htaccess) rendent la page 404 du site — jamais de page Apache
|
||||||
|
* brute, jamais de détail technique. */
|
||||||
|
if (in_array((int) ($_GET['__e'] ?? 0), [403, 404], true)) {
|
||||||
|
$pageFile = null;
|
||||||
|
$is404 = true;
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
header('Cache-Control: no-store');
|
||||||
|
/* Chemins API : JSON pour curl/scripts, page visuelle pour un navigateur
|
||||||
|
* (négociation via Accept, comme inc/errors.php). */
|
||||||
|
$reqPath = (string) (parse_url((string) ($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH) ?: '/');
|
||||||
|
if (str_starts_with($reqPath, '/api') && fws_error_wants_json()) {
|
||||||
|
http_response_code(404);
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
header('X-Content-Type-Options: nosniff');
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Ressource introuvable.'], JSON_UNESCAPED_UNICODE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Paquets : une seule lecture DB + cache Gitea pour toute la page
|
/* Paquets : une seule lecture DB + cache Gitea pour toute la page
|
||||||
(le corps ET la nav déroulante les consomment). */
|
(le corps ET la nav déroulante les consomment). */
|
||||||
$packages = fws_site_packages();
|
$packages = fws_site_packages();
|
||||||
@@ -129,10 +148,10 @@ function fws_site_active(string $route, string $prefix): string
|
|||||||
<meta property="og:image" content="/p/assets/img/logo.png" />
|
<meta property="og:image" content="/p/assets/img/logo.png" />
|
||||||
<meta property="og:locale" content="fr_FR" />
|
<meta property="og:locale" content="fr_FR" />
|
||||||
|
|
||||||
<link rel="stylesheet" href="/p/assets/styles/styles.css" />
|
<link rel="stylesheet" href="<?= e(fws_asset('/p/assets/styles/styles.css')) ?>" />
|
||||||
<link rel="stylesheet" href="/p/assets/styles/paquets.css" />
|
<link rel="stylesheet" href="<?= e(fws_asset('/p/assets/styles/paquets.css')) ?>" />
|
||||||
<?php foreach ($extraCss as $css): ?>
|
<?php foreach ($extraCss as $css): ?>
|
||||||
<link rel="stylesheet" href="<?= e($css) ?>" />
|
<link rel="stylesheet" href="<?= e(fws_asset($css)) ?>" />
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<link rel="icon" type="image/png" href="/p/assets/img/logo.png" />
|
<link rel="icon" type="image/png" href="/p/assets/img/logo.png" />
|
||||||
|
|
||||||
@@ -238,9 +257,9 @@ function fws_site_active(string $route, string $prefix): string
|
|||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="/p/assets/main-nav/nav.js"></script>
|
<script src="<?= e(fws_asset('/p/assets/main-nav/nav.js')) ?>"></script>
|
||||||
<?php foreach ($extraJs as $js): ?>
|
<?php foreach ($extraJs as $js): ?>
|
||||||
<script src="<?= e($js) ?>"></script>
|
<script src="<?= e(fws_asset($js)) ?>"></script>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user