forked from FWS/FWS-TEMPLATE-Website-OnePage
Compare commits
25
Commits
34b3f1cf3c
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
458adb2abd | ||
|
|
5a52191599
|
||
|
|
2e3d7b6425
|
||
|
|
2650462767
|
||
|
|
b524ae91d3
|
||
|
|
7cd7f5c8fa | ||
|
|
ffc80f619b | ||
|
|
db19393985 | ||
|
|
5660aa1e35
|
||
|
|
43dd17f988
|
||
|
|
803b74c1fb
|
||
|
|
8233c591c3
|
||
|
|
5cb4987fb9
|
||
|
|
e099e06614
|
||
|
|
f2b8c9c5e6
|
||
|
|
83933d0621
|
||
|
|
ae472fe30a
|
||
|
|
da74767843
|
||
|
|
6b6b07aa83 | ||
|
|
82168e2678 | ||
|
|
3b3127bb34 | ||
|
|
f8066c89fc | ||
|
|
6adebf4c97 | ||
|
|
8a7e83cd01 | ||
|
|
1775adceaa |
No files matched your search
+10
@@ -1,6 +1,7 @@
|
|||||||
# Dossiers locaux / outils (jamais commités)
|
# Dossiers locaux / outils (jamais commités)
|
||||||
.freebuff/
|
.freebuff/
|
||||||
gestionnaire/
|
gestionnaire/
|
||||||
|
FWS-Website/
|
||||||
|
|
||||||
# ── Secrets locaux ─────────────────────────────────────────────────────────
|
# ── Secrets locaux ─────────────────────────────────────────────────────────
|
||||||
# Webhook Discord / config locale de l'API bugs (jamais commiter)
|
# Webhook Discord / config locale de l'API bugs (jamais commiter)
|
||||||
@@ -17,3 +18,12 @@ api/bugs/data/*.db-shm
|
|||||||
*.sqlite
|
*.sqlite
|
||||||
*.sqlite-wal
|
*.sqlite-wal
|
||||||
*.sqlite-shm
|
*.sqlite-shm
|
||||||
|
|
||||||
|
# Images des paquets envoyées via l'admin (données hébergées, pas du code)
|
||||||
|
p/assets/img/packages/
|
||||||
|
|
||||||
|
# Cache HTTP local du site (releases Gitea/GitHub, généré par inc/site.php)
|
||||||
|
cache/
|
||||||
|
|
||||||
|
# Journal des erreurs PHP (filet de sécurité inc/errors.php)
|
||||||
|
api/bugs/data/php-errors.log
|
||||||
@@ -1,8 +1,32 @@
|
|||||||
# ── FWS Linux — .htaccess (performance + sécurité) ──────────────────────────
|
# ── FWS Linux — .htaccess (performance + sécurité) ──────────────────────────
|
||||||
|
|
||||||
|
# Le site est rendu côté serveur : page.php est le point d'entrée unique.
|
||||||
|
# (Les sous-dossiers avec leur propre index.php — admin/bugs, api — restent
|
||||||
|
# prioritaires via l'ordre de DirectoryIndex.)
|
||||||
|
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
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
# AGENTS.md — Instructions pour les agents IA
|
||||||
|
|
||||||
|
> Fichier de référence pour les agents IA (Codebuff, Cursor, Claude Code, GitHub Copilot…) qui travaillent sur un dépôt de l'organisation **FWS**. Un agent doit lire ce fichier en premier : il contient les instructions à respecter. Le `README.md` présente l'organisation et le `CONTRIBUTING.md` détaille les conventions de collaboration.
|
||||||
|
|
||||||
|
## Contexte
|
||||||
|
|
||||||
|
- **FWS** est une organisation open source multi-projets : chaque projet choisit librement sa stack technique (sans restriction de langage).
|
||||||
|
- Projet principal : **FWS ISO** — une distribution Linux basée sur Arch Linux, pensée pour simplifier l'installation et l'usage au quotidien.
|
||||||
|
- Conventions détaillées : `CONTRIBUTING.md` (FR) / `CONTRIBUTING.en.md` (EN).
|
||||||
|
|
||||||
|
## Règles à respecter
|
||||||
|
|
||||||
|
### Commits
|
||||||
|
|
||||||
|
- Messages en **anglais**, format **Conventional Commits** : `<type>(<portée>): <description>`.
|
||||||
|
- Types autorisés : `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`.
|
||||||
|
- Titre court et impératif ; un corps n'est ajouté que pour expliquer le **pourquoi**, pas le comment.
|
||||||
|
|
||||||
|
### Nommage
|
||||||
|
|
||||||
|
- Branches : `type/description` (ex. `feat/login`, `fix/typo`).
|
||||||
|
- Fichiers : **kebab-case** (ex. `my-component.ts`).
|
||||||
|
- Identifiants (variables, fonctions, classes) : **anglais**.
|
||||||
|
|
||||||
|
### Code & commentaires
|
||||||
|
|
||||||
|
- Commentaires en **anglais**, style « pourquoi » : pas de commentaire si le code est explicite ; documenter le non-évident (choix d'implémentation, compromis, cas limites).
|
||||||
|
- Respecter la stack technique et les conventions existantes du dépôt avant d'ajouter de nouvelles dépendances.
|
||||||
|
|
||||||
|
### Fichiers sensibles (`.gitignore`)
|
||||||
|
|
||||||
|
- Ne **jamais** versionner : fichiers d'environnement (`.env*`), données d'assistants de développement (`.freebuff/`), artefacts compilés (`dist/`, `build/`, `target/`, `__pycache__/`…), dépendances (`node_modules/`), secrets.
|
||||||
|
- Un `.gitignore` doit exister à la racine de chaque dépôt.
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
- Fichiers de test : `*.test.*` ; noms de tests `describe` / `it` en anglais.
|
||||||
|
- Vérifier que les tests (et le typecheck / lint quand ils existent) passent avant de considérer une tâche terminée.
|
||||||
|
|
||||||
|
### Issues & signalement de bugs
|
||||||
|
|
||||||
|
- Les bugs et demandes sont suivis via les **issues** et, lorsqu'il existe, le tableau Kanban du projet.
|
||||||
|
- Une pull request qui corrige un bug référence l'issue dans son titre ou sa description (`Fixes #123`).
|
||||||
|
- Ne pas fermer ni modifier une issue sans demande explicite de l'utilisateur.
|
||||||
|
|
||||||
|
### Commits demandés par l'utilisateur
|
||||||
|
|
||||||
|
- Lorsque l'utilisateur demande explicitement de créer un commit, l'IA doit le faire après avoir vérifié les changements et les contrôles disponibles, sans attendre une confirmation supplémentaire.
|
||||||
|
- Le titre et le corps du commit ne doivent jamais mentionner l'IA, l'assistant, Codebuff ou l'outil utilisé.
|
||||||
|
- Ne pas ajouter l'IA comme auteur ou co-auteur dans le message du commit.
|
||||||
|
|
||||||
|
## Bonnes pratiques pour un agent
|
||||||
|
|
||||||
|
- Lire `AGENTS.md`, le `README.md` et le `CONTRIBUTING.md` avant d'éditer du code.
|
||||||
|
- Les commits doivent être signés.
|
||||||
|
- Faire les changements les plus petits possibles qui répondent à la demande.
|
||||||
|
- Ne pas pousser, fusionner ni publier sans demande explicite de l'utilisateur.
|
||||||
|
- Suivre les cartes du tableau Kanban lorsqu'il existe pour organiser le travail.
|
||||||
|
- En cas de doute, demander plutôt que de deviner.
|
||||||
+47
-173
@@ -1,183 +1,57 @@
|
|||||||
# Fonctionnement du JavaScript
|
# Fonctionnement du site (PHP)
|
||||||
|
|
||||||
Ce projet fonctionne comme un site statique avec un seul point d'entrée HTML. Le JavaScript sert à lire l'URL, charger le bon fichier dans `p/`, injecter son contenu dans le `main`, et reprendre aussi les styles définis dans le `<head>` de la page chargée.
|
Le site est **entièrement rendu côté serveur (PHP)**. Il n'y a plus de routeur
|
||||||
|
JavaScript : chaque URL sert une page HTML complète. Les seuls scripts restants
|
||||||
|
sont des améliorations progressives (carrousel, menu déroulant, « Voir plus »).
|
||||||
|
|
||||||
## Principe général
|
## Architecture
|
||||||
|
|
||||||
1. `index.html` garde le header, le footer et le conteneur principal.
|
1. **`page.php`** (racine) est le point d'entrée unique. Il lit la route dans
|
||||||
2. Chaque page vit dans un dossier sous `p/`.
|
l'URL (`?p/dl/`, `?p=dl`, `?p/paquets/1/`…), inclut le corps de page
|
||||||
3. Le script lit la route demandée dans l'URL.
|
correspondant, puis assemble la coquille (header/nav/footer).
|
||||||
4. Le script charge `p/<route>/index.html` avec `fetch`.
|
2. **`inc/site.php`** contient les helpers : connexion SQLite partagée,
|
||||||
5. Le contenu de la page est injecté dans le `main`.
|
paquets (base + fusion des releases Gitea), fetch HTTP avec cache fichier
|
||||||
6. Les styles déclarés dans le `head` de cette page sont copiés dans le `head` du document courant.
|
(`cache/`, gitignoré), rendu Markdown (portage PHP de l'ancien
|
||||||
|
`downloads.js`), dates en français, troncature HTML.
|
||||||
|
3. **`p/<route>/index.php`** (et `p/paquets/detail.php` pour `/?p/paquets/N/`)
|
||||||
|
contiennent le corps de chaque page. Ils définissent `$title`,
|
||||||
|
`$description`, `$extraCss[]` et `$extraJs[]` avant l'affichage.
|
||||||
|
4. `index.php` à la racine délègue à `page.php` (DirectoryIndex Apache).
|
||||||
|
|
||||||
|
## Données
|
||||||
|
|
||||||
|
- **Paquets** : table SQLite `packages` (base `api/bugs/data/fws_bugs.sqlite`,
|
||||||
|
partagée avec le panneau d'admin). Éditables dans `/admin/bugs` (onglet
|
||||||
|
📦 Paquets) + bouton 🔄 Gitea qui synchronise `latest` et l'historique depuis
|
||||||
|
l'API Gitea du dépôt lié. Repli automatique sur `p/paquets/packages.json`
|
||||||
|
si la base est vide. API publique conservée : `/api/packages.php`.
|
||||||
|
- **Téléchargements** : releases ISO rendues serveur — Gitea `FWS/ISO` s'il
|
||||||
|
existe, sinon GitHub (cache 10 min dans `cache/`).
|
||||||
|
- **Équipe** : rendu serveur depuis `p/equipe/creators.json`.
|
||||||
|
|
||||||
## Fichiers impliqués
|
## Fichiers impliqués
|
||||||
|
|
||||||
- [index.html](../index.html) contient le chrome global du site.
|
- [page.php](../page.php) — front controller + coquille HTML.
|
||||||
- [.htaccess](../.htaccess) contient la configuration Apache (`Options +Indexes`).
|
- [inc/site.php](../inc/site.php) — helpers (DB, Gitea/GitHub, Markdown…).
|
||||||
- [p/assets/main-nav/app.js](../p/assets/main-nav/app.js) contient le routeur JavaScript.
|
- [index.php](../index.php) — shim vers `page.php`.
|
||||||
- [p/index/index.html](../p/index/index.html) contient la page principale.
|
- `p/index|dl|paquets|equipe|contact/index.php`, `p/paquets/detail.php`,
|
||||||
- [p/dl/index.html](../p/dl/index.html) contient la page DL.
|
`p/404.php` — corps de pages.
|
||||||
- [p/contact/index.html](../p/contact/index.html) contient la page contact.
|
- [p/assets/main-nav/nav.js](../p/assets/main-nav/nav.js) — ouverture du menu
|
||||||
|
déroulant Paquets.
|
||||||
|
- [p/assets/js/note-toggle.js](../p/assets/js/note-toggle.js) — « Voir plus /
|
||||||
|
Voir moins » de la note de release.
|
||||||
|
- [p/assets/js/hero-carousel.js](../p/assets/js/hero-carousel.js) — carrousel
|
||||||
|
de l'accueil.
|
||||||
|
|
||||||
## Comment le script lit l'URL
|
## Supprimés (devenus inutiles avec le rendu serveur)
|
||||||
|
|
||||||
La fonction `routeFromLocation()` lit la route courante depuis plusieurs formes possibles d'URL.
|
- `index.html` (racine), tous les `p/**/index.html`
|
||||||
|
- `p/assets/main-nav/app.js` (routeur SPA)
|
||||||
|
- `p/assets/js/packages.js`, `downloads.js`, `creators-loader.js`
|
||||||
|
|
||||||
Exemples reconnus:
|
## Panneau admin & API (inchangés dans leur principe)
|
||||||
|
|
||||||
- `/?p/index/`
|
- `admin/bugs/index.php` — signalements, invitations/comptes, paquets.
|
||||||
- `/?p/dl/`
|
- `admin/bugs/build.php` — onglet « Build ISO » (réservé au compte admin).
|
||||||
- `/?p=contact`
|
- `api/bugs.php` — réception des signalements (`curl` ou navigateur).
|
||||||
- `/p/about/`
|
- `api/packages.php` — paquets au format JSON (consommé par des tiers).
|
||||||
|
|
||||||
La fonction `normalizeRoute(value)` nettoie ensuite la valeur pour obtenir une route simple comme `index`, `dl` ou `contact`.
|
|
||||||
|
|
||||||
## Chargement du contenu
|
|
||||||
|
|
||||||
La fonction `loadRoute(route)` fait le chargement réel.
|
|
||||||
|
|
||||||
### Route principale
|
|
||||||
|
|
||||||
Pour la route `index`, le script charge:
|
|
||||||
|
|
||||||
```text
|
|
||||||
p/index/index.html
|
|
||||||
```
|
|
||||||
|
|
||||||
### Autres routes
|
|
||||||
|
|
||||||
Pour une route comme `dl`, le script charge:
|
|
||||||
|
|
||||||
```text
|
|
||||||
p/dl/index.html
|
|
||||||
```
|
|
||||||
|
|
||||||
Le fichier chargé doit contenir un bloc avec `data-page-content`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<main data-page-content>
|
|
||||||
...
|
|
||||||
</main>
|
|
||||||
```
|
|
||||||
|
|
||||||
Le script n'injecte pas tout le document dans la page courante. Il prend seulement le contenu à l'intérieur de cet élément.
|
|
||||||
|
|
||||||
## Injection des styles du head
|
|
||||||
|
|
||||||
Le routeur copie maintenant aussi les balises suivantes depuis le `head` de la page chargée:
|
|
||||||
|
|
||||||
- `link rel="stylesheet"`
|
|
||||||
- `style`
|
|
||||||
|
|
||||||
Ces balises sont clonées dans le `head` du document principal avec un attribut de suivi `data-page-style`.
|
|
||||||
|
|
||||||
Avant d'ajouter les nouveaux styles, le script supprime les styles injectés par la route précédente pour éviter les doublons et les conflits.
|
|
||||||
|
|
||||||
Exemple dans une page custom:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="./page.css" />
|
|
||||||
<style>
|
|
||||||
.hero {
|
|
||||||
background: black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
```
|
|
||||||
|
|
||||||
Si cette page est chargée, le CSS est repris automatiquement.
|
|
||||||
|
|
||||||
## Mise à jour de l'URL
|
|
||||||
|
|
||||||
Après le chargement, le script met à jour l'URL avec l'API History.
|
|
||||||
|
|
||||||
Exemples:
|
|
||||||
|
|
||||||
- `index` devient `/?p/index/`
|
|
||||||
- `dl` devient `/?p/dl/`
|
|
||||||
|
|
||||||
Le navigateur garde donc une URL partageable, sans recharger complètement la page.
|
|
||||||
|
|
||||||
## Navigation au clic
|
|
||||||
|
|
||||||
Le script écoute les clics sur les liens qui possèdent `data-route`.
|
|
||||||
|
|
||||||
Quand tu cliques sur un lien:
|
|
||||||
|
|
||||||
1. il bloque la navigation normale avec `event.preventDefault()`;
|
|
||||||
2. il lit `data-route`;
|
|
||||||
3. il appelle `render(route)`;
|
|
||||||
4. il charge la page correspondante dans le `main`;
|
|
||||||
5. il applique aussi ses styles de page.
|
|
||||||
|
|
||||||
## Retour arrière du navigateur
|
|
||||||
|
|
||||||
Le script écoute l'événement `popstate`.
|
|
||||||
|
|
||||||
Cela permet de revenir en arrière ou d'avancer dans l'historique tout en rechargeant la bonne route et les bons styles.
|
|
||||||
|
|
||||||
## Ajouter une nouvelle page
|
|
||||||
|
|
||||||
Pour ajouter une page, crée un nouveau dossier sous `p/`.
|
|
||||||
|
|
||||||
Exemple pour une page contact:
|
|
||||||
|
|
||||||
```text
|
|
||||||
p/contact/index.html
|
|
||||||
```
|
|
||||||
|
|
||||||
Puis ajoute éventuellement un fichier CSS dans cette page via son `head`.
|
|
||||||
|
|
||||||
Enfin, ajoute un lien dans `index.html`:
|
|
||||||
|
|
||||||
```html
|
|
||||||
<a href="/?p/contact/" data-route="contact">Contact</a>
|
|
||||||
```
|
|
||||||
|
|
||||||
Le JavaScript n'a pas besoin d'être modifié tant que la structure reste la même.
|
|
||||||
|
|
||||||
## Ce que ce système n'utilise pas
|
|
||||||
|
|
||||||
Ce projet n'utilise pas:
|
|
||||||
|
|
||||||
- Node.js,
|
|
||||||
- un bundler,
|
|
||||||
- un framework front,
|
|
||||||
- des fichiers `.html` séparés dans la racine pour chaque page.
|
|
||||||
|
|
||||||
Tout repose sur un site statique et un routeur JavaScript léger.
|
|
||||||
|
|
||||||
## Point important
|
|
||||||
|
|
||||||
Le chargement via `fetch` fonctionne mieux quand le site est servi par un serveur statique, comme Five Server.
|
|
||||||
|
|
||||||
Si tu ouvres le fichier en `file://`, le navigateur peut bloquer l'accès aux fichiers internes pour des raisons de sécurité.
|
|
||||||
|
|
||||||
## Fichier .htaccess
|
|
||||||
|
|
||||||
Le fichier [.htaccess](../.htaccess) à la racine contient la directive Apache suivante :
|
|
||||||
|
|
||||||
```apache
|
|
||||||
Options +Indexes
|
|
||||||
```
|
|
||||||
|
|
||||||
Cela active l'**indexation des répertoires** : si un dossier ne contient pas de fichier `index.html`, Apache affiche automatiquement la liste de son contenu.
|
|
||||||
|
|
||||||
### Points à noter
|
|
||||||
|
|
||||||
- Cette option ne fonctionne que si le serveur Apache a `AllowOverride Options` (ou `AllowOverride All`) activé dans sa configuration.
|
|
||||||
- En production, il peut être préférable de désactiver les indexes pour des raisons de sécurité. Remplacez par `Options -Indexes` si besoin.
|
|
||||||
- Le fichier `.htaccess` est placé à la racine du projet pour couvrir tous les sous-dossiers.
|
|
||||||
|
|
||||||
## Structure de la documentation
|
|
||||||
|
|
||||||
La documentation du projet est dans le dossier `Doc/` et rédigée en Markdown :
|
|
||||||
|
|
||||||
```
|
|
||||||
Doc/
|
|
||||||
└── fonctionnement-onepage.md # Ce fichier
|
|
||||||
```
|
|
||||||
|
|
||||||
Chaque fichier `.md` documente un aspect du projet. Le README à la racine (`README.md`) donne une vue d'ensemble rapide.
|
|
||||||
@@ -1,44 +1,75 @@
|
|||||||
Site statique one-page.
|
Site du projet FWS Linux, rendu côté serveur en PHP.
|
||||||
|
|
||||||
Le projet ne dépend pas de Node.js, ni d'un build, ni d'un bundler.
|
Aucune dépendance Node.js, aucun build, aucun bundler : `page.php` est le point
|
||||||
|
d'entrée unique et assemble chaque page (header, nav, contenu, footer).
|
||||||
|
|
||||||
## Utilisation
|
## Lancer le site en local
|
||||||
|
|
||||||
1. Ouvrir `index.html` dans un navigateur, ou
|
Prérequis : **PHP 8** (avec les extensions `pdo_sqlite` et `sqlite3` pour les
|
||||||
2. Le servir avec n'importe quel serveur statique local, comme Five Server.
|
paquets ; le site reste fonctionnel sans elles, avec un repli sur
|
||||||
|
`p/paquets/packages.json`).
|
||||||
|
|
||||||
> **Note Apache :** Le projet inclut un fichier `.htaccess` à la racine. Il active l'indexation des répertoires (`Options +Indexes`). Lors du déploiement sur un serveur Apache, assurez-vous que `AllowOverride` est activé pour que cette directive soit prise en compte.
|
```bash
|
||||||
|
bash tools/serve.sh # http://127.0.0.1:8080
|
||||||
|
HOST=0.0.0.0 PORT=8080 bash tools/serve.sh # accessible depuis le réseau
|
||||||
|
```
|
||||||
|
|
||||||
|
Sous Windows (cmd / PowerShell) :
|
||||||
|
|
||||||
|
```bat
|
||||||
|
tools\serve.cmd
|
||||||
|
```
|
||||||
|
|
||||||
|
Ou directement, sans script :
|
||||||
|
|
||||||
|
```bash
|
||||||
|
php -S 127.0.0.1:8080 tools/router.php
|
||||||
|
```
|
||||||
|
|
||||||
|
`tools/router.php` reproduit le comportement du `.htaccess` de production
|
||||||
|
(URLs propres, page 404 du site, assets, API, admin) : ce que vous voyez en
|
||||||
|
local est identique au serveur. Un simple `php -S 127.0.0.1:8080` fonctionne
|
||||||
|
aussi pour les routes `?p/…`, mais sans la page 404 personnalisée.
|
||||||
|
|
||||||
|
> **Apache (WAMP/XAMPP, production) :** déployer le contenu du dépôt dans la
|
||||||
|
> racine web et activer `AllowOverride All` pour que `.htaccess` s'applique.
|
||||||
|
> Le site fonctionne aussi dans un sous-dossier (`/FWS-Website/`) : les URLs
|
||||||
|
> sont calculées à partir de la requête.
|
||||||
|
|
||||||
## Navigation
|
## Navigation
|
||||||
|
|
||||||
- `/?p/index/` charge `p/index/index.html` dans le `main`
|
- `/?p/index/` — accueil
|
||||||
- `/?p/dl/` charge `p/dl/index.html` dans le `main`
|
- `/?p/dl/` — téléchargements
|
||||||
- Chaque sous-dossier de `p/` peut devenir une route, par exemple `p/contact/index.html` pour `/?p/contact/`
|
- `/?p/paquets/`, `/?p/paquets/1/…` — paquets
|
||||||
- Les balises `link rel="stylesheet"` et `style` placées dans le `head` d'une page sont injectées automatiquement
|
- `/?p/equipe/`, `/?p/contact/` — équipe, contact
|
||||||
- Le header et le footer restent communs à toutes les vues
|
- `/?p/mentions-legales/`, `/?p/conditions/`, `/?p/confidentialite/` — légal
|
||||||
|
- Toute autre route (ou erreur Apache 403/404) affiche la **page 404 animée**,
|
||||||
|
avec Tux qui débranche un câble RJ45 d'un switch.
|
||||||
|
|
||||||
|
Les deux formes d'URL marchent : `?p=route` et `?p/route/`.
|
||||||
|
|
||||||
## Structure du projet
|
## Structure du projet
|
||||||
|
|
||||||
```
|
```
|
||||||
.
|
.
|
||||||
├── .htaccess # Config Apache (Options +Indexes)
|
├── .htaccess # Config Apache (routing, cache, sécurité)
|
||||||
├── index.html # Point d'entrée unique (shell du site)
|
├── index.php # Point d'entrée alternatif → page.php
|
||||||
├── README.md # Ce fichier
|
├── page.php # Front controller : coquille + résolution des routes
|
||||||
├── Doc/ # Documentation du projet (Markdown)
|
├── inc/ # Bibliothèque du site (données, erreurs, markdown)
|
||||||
│ └── fonctionnement-onepage.md # Fonctionnement du routeur JS
|
├── p/ # Pages du site
|
||||||
└── p/ # Pages du site (chargées dynamiquement)
|
│ ├── 404.php # Page 404 (scène Tux + switch)
|
||||||
├── index/index.html # Page d'accueil
|
│ ├── index/ dl/ … # Corps de chaque page (rendu serveur)
|
||||||
├── dl/index.html # Page téléchargements
|
│ └── assets/ # CSS, JS, images (img/, styles/, main-nav/, js/)
|
||||||
├── contact/index.html # Page contact
|
├── api/bugs/ # API des signalements (SQLite)
|
||||||
└── assets/ # Ressources partagées
|
├── admin/bugs/ # Panneau d'administration
|
||||||
├── img/ # Images (logo, hero, etc.)
|
├── cache/ # Cache HTTP local (généré, gitignoré)
|
||||||
├── main-nav/ # Routeur JavaScript (app.js)
|
├── tools/ # Outils de développement (serveur local, routeur)
|
||||||
├── styles/ # Feuilles de style globales
|
└── Doc/ # Documentation du projet (Markdown)
|
||||||
└── js/ # Scripts spécifiques aux pages
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
La documentation du projet est écrite en Markdown dans le dossier `Doc/` :
|
La documentation du projet est écrite en Markdown dans le dossier `Doc/` :
|
||||||
|
|
||||||
- [`Doc/fonctionnement-onepage.md`](Doc/fonctionnement-onepage.md) — explique comment le routeur JS fonctionne (lecture d'URL, fetch, injection du contenu et des styles, gestion de l'historique).
|
- [`Doc/fonctionnement-onepage.md`](Doc/fonctionnement-onepage.md) — historique
|
||||||
|
du routeur côté client (le rendu est désormais côté serveur).
|
||||||
@@ -0,0 +1,558 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS — Onglet « Build ISO » du panneau admin des signalements.
|
||||||
|
*
|
||||||
|
* URL : admin/bugs/build.php
|
||||||
|
*
|
||||||
|
* Réservé aux comptes autorisés (voir fws_bugs_can_build() dans
|
||||||
|
* api/bugs/db.php, par défaut : « admin »). Lance le pipeline
|
||||||
|
* admin/bugs/run-build.sh dans un process détaché (nohup) et expose un
|
||||||
|
* mini-terminal : les logs sont lus en direct par polling (act=tail) et les
|
||||||
|
* actions start / stop / clear sont protégées par CSRF comme le reste du
|
||||||
|
* panneau.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require_once __DIR__ . '/../../api/bugs/db.php';
|
||||||
|
|
||||||
|
session_set_cookie_params([
|
||||||
|
'httponly' => true,
|
||||||
|
'samesite' => 'Lax',
|
||||||
|
'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https'),
|
||||||
|
]);
|
||||||
|
session_start();
|
||||||
|
|
||||||
|
function h_build(string $s): string
|
||||||
|
{
|
||||||
|
return htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
function current_user_build(): ?array
|
||||||
|
{
|
||||||
|
return isset($_SESSION['admin_user_id']) ? [
|
||||||
|
'id' => (int) $_SESSION['admin_user_id'],
|
||||||
|
'name' => (string) $_SESSION['admin_username'],
|
||||||
|
] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function csrf_token_build(): string
|
||||||
|
{
|
||||||
|
if (empty($_SESSION['csrf'])) {
|
||||||
|
$_SESSION['csrf'] = bin2hex(random_bytes(32));
|
||||||
|
}
|
||||||
|
return $_SESSION['csrf'];
|
||||||
|
}
|
||||||
|
|
||||||
|
function csrf_ok_build(): bool
|
||||||
|
{
|
||||||
|
return hash_equals($_SESSION['csrf'] ?? '', $_POST['csrf'] ?? '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Lecture du token Gitea stocké localement (api/bugs/data/build/git-auth.env, jamais commité). */
|
||||||
|
function build_gitea_auth_build(): array
|
||||||
|
{
|
||||||
|
global $DATA;
|
||||||
|
$f = $DATA . '/git-auth.env';
|
||||||
|
$out = ['username' => '', 'token' => ''];
|
||||||
|
if (is_file($f)) {
|
||||||
|
$s = (string) file_get_contents($f);
|
||||||
|
if (preg_match("/^FWS_GIT_USER='([^']*)'$/m", $s, $m) === 1) {
|
||||||
|
$out['username'] = $m[1];
|
||||||
|
}
|
||||||
|
if (preg_match("/^FWS_GIT_TOKEN='([^']*)'$/m", $s, $m) === 1) {
|
||||||
|
$out['token'] = $m[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Écriture du token Gitea (token vide → fichier retiré). */
|
||||||
|
function build_save_gitea_auth_build(string $username, string $token): void
|
||||||
|
{
|
||||||
|
global $DATA;
|
||||||
|
if (!is_dir($DATA)) {
|
||||||
|
@mkdir($DATA, 0775, true);
|
||||||
|
}
|
||||||
|
$f = $DATA . '/git-auth.env';
|
||||||
|
if ($token === '') {
|
||||||
|
@unlink($f);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$sq = static fn(string $v): string => str_replace(["\\", "'"], ["\\\\", "\\'"], $v);
|
||||||
|
file_put_contents(
|
||||||
|
$f,
|
||||||
|
"FWS_GIT_USER='" . $sq($username !== '' ? $username : 'fws') . "'\n" .
|
||||||
|
"FWS_GIT_TOKEN='" . $sq($token) . "'\n",
|
||||||
|
LOCK_EX
|
||||||
|
);
|
||||||
|
@chmod($f, 0600);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Chemins (sous api/bugs/data/, jamais commité) ── */
|
||||||
|
|
||||||
|
$DATA = __DIR__ . '/../../api/bugs/data/build';
|
||||||
|
$LOG = $DATA . '/build.log';
|
||||||
|
$PIDF = $DATA . '/build.pid';
|
||||||
|
$RUN = __DIR__ . '/run-build.sh';
|
||||||
|
|
||||||
|
$user = current_user_build();
|
||||||
|
|
||||||
|
/** PID du process de build s'il tourne encore, sinon false. */
|
||||||
|
function build_running_build(): int|false
|
||||||
|
{
|
||||||
|
global $PIDF;
|
||||||
|
$pid = is_file($PIDF) ? trim((string) file_get_contents($PIDF)) : '';
|
||||||
|
if ($pid === '' || !ctype_digit($pid)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
exec('kill -0 ' . (int) $pid . ' 2>/dev/null', $out, $rc);
|
||||||
|
return $rc === 0 ? (int) $pid : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Dernier code de sortie du pipeline lu dans le log (null si pas encore terminé). */
|
||||||
|
function build_last_rc_build(): ?int
|
||||||
|
{
|
||||||
|
global $LOG;
|
||||||
|
if (!is_file($LOG) || filesize($LOG) === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$tail = (string) file_get_contents($LOG, false, null, max(0, filesize($LOG) - 4096));
|
||||||
|
if (preg_match('/Fin du pipeline \(code (-?\d+)\)/', $tail, $m) === 1) {
|
||||||
|
return (int) $m[1];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ───────────────────────── API (act=…) ───────────────────────── */
|
||||||
|
|
||||||
|
$act = $_GET['act'] ?? $_POST['act'] ?? '';
|
||||||
|
$isApi = $act !== '';
|
||||||
|
|
||||||
|
if ($isApi) {
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
header('Cache-Control: no-store');
|
||||||
|
|
||||||
|
if ($user === null) {
|
||||||
|
http_response_code(401);
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Non connecté.']));
|
||||||
|
}
|
||||||
|
if (!fws_bugs_can_build($user['name'])) {
|
||||||
|
http_response_code(403);
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Ce compte n’est pas autorisé à lancer des builds.']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$running = build_running_build();
|
||||||
|
|
||||||
|
if ($act === 'state') {
|
||||||
|
echo json_encode(['ok' => true, 'running' => $running !== false, 'pid' => $running]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($act === 'auth_status') {
|
||||||
|
$a = build_gitea_auth_build();
|
||||||
|
echo json_encode(['ok' => true, 'configured' => $a['token'] !== '', 'username' => $a['username']]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($act === 'tail') {
|
||||||
|
$pos = max(-1, (int) ($_GET['pos'] ?? 0));
|
||||||
|
$size = is_file($LOG) ? (int) filesize($LOG) : 0;
|
||||||
|
$start = 0;
|
||||||
|
if ($pos === -1) {
|
||||||
|
// Premier chargement : ne ramener que la fin d'un éventuel vieux log.
|
||||||
|
$start = max(0, $size - 150000);
|
||||||
|
} elseif ($pos > 0 && $pos <= $size) {
|
||||||
|
$start = $pos;
|
||||||
|
}
|
||||||
|
$text = '';
|
||||||
|
if ($size > $start) {
|
||||||
|
$fh = fopen($LOG, 'rb');
|
||||||
|
if ($fh !== false) {
|
||||||
|
if ($start > 0) {
|
||||||
|
fseek($fh, $start);
|
||||||
|
}
|
||||||
|
$raw = (string) stream_get_contents($fh);
|
||||||
|
fclose($fh);
|
||||||
|
// Nettoyage : codes ANSI retirés, octets invalides ignorés.
|
||||||
|
$text = (string) preg_replace('/\x1B\[[0-9;?]*[ -\/]*[@-~]/', '', $raw);
|
||||||
|
$text = (string) preg_replace('/\x1B\][^\x07\x1B]*(\x07|\x1B\\)/', '', $text);
|
||||||
|
$text = iconv('UTF-8', 'UTF-8//IGNORE', $text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$running = build_running_build();
|
||||||
|
echo json_encode([
|
||||||
|
'ok' => true,
|
||||||
|
'running' => $running !== false,
|
||||||
|
'pos' => (int) $size,
|
||||||
|
'rc' => build_last_rc_build(),
|
||||||
|
'text' => $text,
|
||||||
|
]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST' || !csrf_ok_build()) {
|
||||||
|
http_response_code(403);
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Jeton de sécurité invalide.']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($act === 'start') {
|
||||||
|
if ($running !== false) {
|
||||||
|
http_response_code(409);
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Un build est déjà en cours.']));
|
||||||
|
}
|
||||||
|
exec('timeout 8 docker info >/dev/null 2>&1', $out, $drc);
|
||||||
|
if ($drc !== 0) {
|
||||||
|
http_response_code(503);
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Moteur Docker injoignable (Docker Desktop arrêté ?).']));
|
||||||
|
}
|
||||||
|
if (!is_dir($DATA) && !@mkdir($DATA, 0775, true)) {
|
||||||
|
http_response_code(500);
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Impossible de créer ' . $DATA]));
|
||||||
|
}
|
||||||
|
@unlink($LOG);
|
||||||
|
@unlink($PIDF);
|
||||||
|
$cmd = 'nohup bash ' . escapeshellarg($RUN) . ' </dev/null >> ' . escapeshellarg($LOG) . ' 2>&1 & echo $!';
|
||||||
|
exec($cmd, $out2, $src);
|
||||||
|
$pid = (int) ($out2[0] ?? 0);
|
||||||
|
if ($pid > 0) {
|
||||||
|
file_put_contents($PIDF, (string) $pid);
|
||||||
|
}
|
||||||
|
echo json_encode(['ok' => $src === 0 && $pid > 0, 'pid' => $pid]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($act === 'stop') {
|
||||||
|
exec('docker rm -f fws-iso-build >/dev/null 2>&1', $o1, $rc1);
|
||||||
|
$stopped = $running;
|
||||||
|
if ($running !== false) {
|
||||||
|
exec('kill ' . $running . ' 2>/dev/null');
|
||||||
|
@unlink($PIDF);
|
||||||
|
}
|
||||||
|
echo json_encode(['ok' => true, 'stopped' => $stopped !== false || $rc1 === 0]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($act === 'clear') {
|
||||||
|
if ($running !== false) {
|
||||||
|
http_response_code(409);
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Arrêtez d’abord le build en cours.']));
|
||||||
|
}
|
||||||
|
@unlink($LOG);
|
||||||
|
@unlink($PIDF);
|
||||||
|
echo json_encode(['ok' => true]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($act === 'save_auth') {
|
||||||
|
build_save_gitea_auth_build(
|
||||||
|
trim((string) ($_POST['username'] ?? '')),
|
||||||
|
trim((string) ($_POST['token'] ?? ''))
|
||||||
|
);
|
||||||
|
$a = build_gitea_auth_build();
|
||||||
|
echo json_encode(['ok' => true, 'configured' => $a['token'] !== '', 'username' => $a['username']]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
http_response_code(400);
|
||||||
|
exit(json_encode(['ok' => false, 'error' => 'Action inconnue.']));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ───────────────────────── PAGES ───────────────────────── */
|
||||||
|
|
||||||
|
if ($user === null) {
|
||||||
|
header('Location: index.php');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$allowed = fws_bugs_can_build($user['name']);
|
||||||
|
|
||||||
|
header('Content-Type: text/html; charset=utf-8');
|
||||||
|
?><!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>Build ISO — FWS Linux</title>
|
||||||
|
<style>
|
||||||
|
:root { color-scheme: dark; }
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body {
|
||||||
|
margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
||||||
|
background: #0b1120; color: #e2e8f0; line-height: 1.5;
|
||||||
|
}
|
||||||
|
.wrap { max-width: 1000px; margin: 0 auto; padding: 24px 16px 80px; }
|
||||||
|
header.top {
|
||||||
|
display: flex; align-items: center; justify-content: space-between;
|
||||||
|
gap: 12px; padding: 14px 0; border-bottom: 1px solid #1e293b; margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
header.top h1 { font-size: 1.15rem; margin: 0; }
|
||||||
|
header.top .sub { font-size: .8rem; color: #94a3b8; }
|
||||||
|
a { color: #38bdf8; text-decoration: none; }
|
||||||
|
a:hover { text-decoration: underline; }
|
||||||
|
.btn {
|
||||||
|
display: inline-block; border: 1px solid #334155; background: #1e293b; color: #e2e8f0;
|
||||||
|
padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: .85rem;
|
||||||
|
text-decoration: none; line-height: 1.4;
|
||||||
|
}
|
||||||
|
.btn:hover { background: #334155; text-decoration: none; }
|
||||||
|
.btn.primary { background: #0284c7; border-color: #0284c7; color: #fff; }
|
||||||
|
.btn.danger { background: transparent; border-color: #7f1d1d; color: #f87171; }
|
||||||
|
.btn.danger:hover { background: #7f1d1d; color: #fff; }
|
||||||
|
.btn:disabled { opacity: .45; cursor: not-allowed; }
|
||||||
|
.card {
|
||||||
|
background: #111a2e; border: 1px solid #1e293b; border-radius: 12px;
|
||||||
|
padding: 16px; margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.card h3 { margin: 0 0 4px; font-size: 1rem; }
|
||||||
|
.card .meta { font-size: .78rem; color: #94a3b8; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 8px; }
|
||||||
|
.navtabs { display: flex; gap: 8px; margin: 0 0 16px; }
|
||||||
|
.navtabs a { border: 1px solid #334155; padding: 5px 14px; border-radius: 99px; font-size: .85rem; text-decoration: none; color: #cbd5e1; }
|
||||||
|
.navtabs a.active { background: #0284c7; border-color: #0284c7; color: #fff; }
|
||||||
|
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: .9rem; }
|
||||||
|
.flash.err { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
|
||||||
|
.status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
|
||||||
|
.dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; flex: none; }
|
||||||
|
.dot.run { background: #4ade80; animation: pulse 1.2s ease-in-out infinite; }
|
||||||
|
@keyframes pulse { 50% { opacity: .25; } }
|
||||||
|
pre.term {
|
||||||
|
background: #020617; border: 1px solid #1e293b; border-radius: 8px;
|
||||||
|
padding: 12px; overflow: auto; max-height: 62vh; font-size: .76rem; line-height: 1.45;
|
||||||
|
white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Consolas, "Cascadia Mono", monospace;
|
||||||
|
color: #bae6fd;
|
||||||
|
}
|
||||||
|
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
|
||||||
|
.hint { font-size: .78rem; color: #64748b; margin-top: 10px; }
|
||||||
|
.hint code { background: #0b1120; border: 1px solid #1e293b; padding: 1px 5px; border-radius: 6px; }
|
||||||
|
#authForm { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-top: 6px; }
|
||||||
|
#authForm label { font-size: .78rem; color: #94a3b8; display: block; margin-bottom: 2px; }
|
||||||
|
#authForm input[type=text], #authForm input[type=password] {
|
||||||
|
width: 230px; padding: 7px 9px; background: #0b1120; border: 1px solid #334155;
|
||||||
|
border-radius: 8px; color: #e2e8f0; font-size: .9rem;
|
||||||
|
}
|
||||||
|
#authState { font-size: .8rem; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrap">
|
||||||
|
|
||||||
|
<header class="top">
|
||||||
|
<div>
|
||||||
|
<h1>🔨 Build ISO</h1>
|
||||||
|
<div class="sub">Connecté : <?= h_build($user['name']) ?> · dépôt : <code>D:\FWS-ISO</code> (branche main)</div>
|
||||||
|
</div>
|
||||||
|
<form method="post" action="index.php">
|
||||||
|
<input type="hidden" name="action" value="logout">
|
||||||
|
<input type="hidden" name="csrf" value="<?= h_build(csrf_token_build()) ?>">
|
||||||
|
<button class="btn" type="submit">Déconnexion</button>
|
||||||
|
</form>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="navtabs">
|
||||||
|
<a href="index.php">🐞 Signalements</a>
|
||||||
|
<a href="index.php?view=invites">👥 Invitations & comptes</a>
|
||||||
|
<a href="build.php" class="active">🔨 Build ISO</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php if (!$allowed): ?>
|
||||||
|
<div class="card">
|
||||||
|
<h3>Accès restreint</h3>
|
||||||
|
<p>Votre compte (<strong><?= h_build($user['name']) ?></strong>) n'est pas autorisé à lancer des builds.
|
||||||
|
Seul le compte <code>admin</code> le peut (voir <code>fws_bugs_can_build()</code> dans <code>api/bugs/db.php</code>).</p>
|
||||||
|
<a class="btn" href="index.php">← Retour aux signalements</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php else: ?>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h3>🔑 Accès Gitea (pour le git pull)</h3>
|
||||||
|
<p style="font-size:.82rem;color:#cbd5e1;margin:6px 0 2px">
|
||||||
|
Le dépôt <code>D:\FWS-ISO</code> est privé et le build tourne dans un conteneur sans tes identifiants
|
||||||
|
Windows : crée un token dans Gitea (<em>Settings → Applications → Generate New Token</em>, lecture du dépôt)
|
||||||
|
puis enregistre-le ici. Il n'est stocké que sur ce serveur — jamais commité, jamais affiché dans les logs.
|
||||||
|
</p>
|
||||||
|
<span id="authState">…</span>
|
||||||
|
<form id="authForm">
|
||||||
|
<div>
|
||||||
|
<label for="gUser">Utilisateur Gitea (défaut : fws)</label>
|
||||||
|
<input type="text" id="gUser" name="username" autocomplete="off">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="gToken">Token</label>
|
||||||
|
<input type="password" id="gToken" name="token" autocomplete="off" placeholder="token de lecture">
|
||||||
|
</div>
|
||||||
|
<button class="btn primary" type="submit">Enregistrer</button>
|
||||||
|
<button class="btn danger" type="button" id="gClear">Retirer</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h3>🖥️ Terminal du build</h3>
|
||||||
|
<div class="meta">
|
||||||
|
<span id="stateLabel">État : inconnu…</span>
|
||||||
|
<span>· Git Bash lancerait ici : <code style="font-size:.95em">git checkout main && git pull && bash build.sh</code></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<pre class="term" id="term">Chargement du terminal…</pre>
|
||||||
|
|
||||||
|
<div class="actions">
|
||||||
|
<button class="btn primary" id="btnStart" type="button">▶ Lancer le build</button>
|
||||||
|
<button class="btn danger" id="btnStop" type="button">⏹ Arrêter</button>
|
||||||
|
<button class="btn" id="btnClear" type="button">🗑 Effacer le log</button>
|
||||||
|
<span id="rcLabel"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="hint">
|
||||||
|
Le build se déroule dans un conteneur <code>archlinux</code> jetable (via Docker Desktop, comme
|
||||||
|
<code>build.sh</code> à la main) : passage sur <code>main</code> → <code>git pull</code> → <code>bash build.sh</code> ;
|
||||||
|
en cas d'échec de build, <code>bash setup-aur.sh</code> est lancé puis <code>build.sh</code> est relancé.
|
||||||
|
Si le checkout de <code>main</code> est bloqué par des modifications locales non commitées dans
|
||||||
|
<code>D:\FWS-ISO</code>, le build s'arrête proprement sans rien toucher. L'ISO sort dans
|
||||||
|
<code>D:\FWS-ISO\out\</code>. Peut prendre 30 min et plus — laissez l'onglet ouvert, les logs défilent en direct.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
(() => {
|
||||||
|
const allowed = <?= $allowed ? 'true' : 'false' ?>;
|
||||||
|
if (!allowed) return;
|
||||||
|
|
||||||
|
const CSRF = <?= json_encode(csrf_token_build()) ?>;
|
||||||
|
const term = document.getElementById('term');
|
||||||
|
const btnS = document.getElementById('btnStart');
|
||||||
|
const btnT = document.getElementById('btnStop');
|
||||||
|
const btnC = document.getElementById('btnClear');
|
||||||
|
const stateL = document.getElementById('stateLabel');
|
||||||
|
const rcL = document.getElementById('rcLabel');
|
||||||
|
const csrfP = new URLSearchParams();
|
||||||
|
csrfP.set('csrf', CSRF);
|
||||||
|
|
||||||
|
let pos = -1;
|
||||||
|
let running = null;
|
||||||
|
let finishedRc = null;
|
||||||
|
|
||||||
|
const authState = document.getElementById('authState');
|
||||||
|
const authForm = document.getElementById('authForm');
|
||||||
|
const gUser = document.getElementById('gUser');
|
||||||
|
const gToken = document.getElementById('gToken');
|
||||||
|
const gClear = document.getElementById('gClear');
|
||||||
|
|
||||||
|
async function refreshAuth() {
|
||||||
|
const r = await api('auth_status');
|
||||||
|
if (r.json && r.json.ok) {
|
||||||
|
authState.textContent = r.json.configured
|
||||||
|
? '✅ Token Gitea enregistré' + (r.json.username ? ' (compte : ' + r.json.username + ')' : '')
|
||||||
|
: '⚠️ Aucun token Gitea : le git pull échouera (dépôt privé).';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
authForm.addEventListener('submit', async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const p = new URLSearchParams(csrfP);
|
||||||
|
p.set('username', gUser.value.trim());
|
||||||
|
p.set('token', gToken.value);
|
||||||
|
const r = await api('save_auth', p);
|
||||||
|
if (r.json && r.json.ok) {
|
||||||
|
gUser.value = gToken.value = '';
|
||||||
|
await refreshAuth();
|
||||||
|
} else {
|
||||||
|
alert(r.json && r.json.error ? r.json.error : 'Erreur.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
gClear.addEventListener('click', async () => {
|
||||||
|
if (!confirm('Retirer le token Gitea enregistré ?')) return;
|
||||||
|
const p = new URLSearchParams(csrfP);
|
||||||
|
p.set('username', '');
|
||||||
|
p.set('token', '');
|
||||||
|
const r = await api('save_auth', p);
|
||||||
|
if (r.json && r.json.ok) await refreshAuth();
|
||||||
|
});
|
||||||
|
|
||||||
|
function stick() {
|
||||||
|
const near = term.scrollHeight - term.scrollTop - term.clientHeight < 90;
|
||||||
|
if (near || running !== false) term.scrollTop = term.scrollHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setUI() {
|
||||||
|
btnS.disabled = running === true;
|
||||||
|
btnT.disabled = running !== true;
|
||||||
|
btnC.disabled = running === true;
|
||||||
|
const dot = document.querySelector('.status-line .dot') ||
|
||||||
|
(() => { const d = document.createElement('span'); d.className = 'dot'; stateL.prepend(d); return d; })();
|
||||||
|
dot.className = 'dot' + (running ? ' run' : '');
|
||||||
|
if (running === true) {
|
||||||
|
stateL.textContent = 'État : build en cours… ';
|
||||||
|
} else if (running === false) {
|
||||||
|
stateL.textContent = 'État : inactif. ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function api(act, body) {
|
||||||
|
const opt = body
|
||||||
|
? { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: body }
|
||||||
|
: { method: 'GET' };
|
||||||
|
const r = await fetch('build.php?act=' + encodeURIComponent(act), opt);
|
||||||
|
return { status: r.status, json: await r.json().catch(() => null) };
|
||||||
|
}
|
||||||
|
|
||||||
|
async function poll() {
|
||||||
|
try {
|
||||||
|
const r = await fetch('build.php?act=tail&pos=' + pos);
|
||||||
|
const j = await r.json();
|
||||||
|
if (!j || j.ok !== true) return;
|
||||||
|
if (j.text && j.text !== '') {
|
||||||
|
const wasEmpty = term.textContent === 'Chargement du terminal…';
|
||||||
|
if (wasEmpty) term.textContent = '';
|
||||||
|
const atEnd = term.scrollHeight - term.scrollTop - term.clientHeight < 90;
|
||||||
|
term.textContent += j.text;
|
||||||
|
if (running !== false || atEnd) term.scrollTop = term.scrollHeight;
|
||||||
|
}
|
||||||
|
pos = j.pos;
|
||||||
|
if (j.running !== running) {
|
||||||
|
running = j.running;
|
||||||
|
if (!running && j.rc !== null) {
|
||||||
|
finishedRc = j.rc;
|
||||||
|
rcL.textContent = 'Code de sortie : ' + j.rc + (j.rc === 0 ? ' ✅' : ' ❌');
|
||||||
|
}
|
||||||
|
if (running) { rcL.textContent = ''; finishedRc = null; }
|
||||||
|
setUI();
|
||||||
|
}
|
||||||
|
} catch (e) { /* requête interrompue (navigation…) : on réessaie au prochain tick */ }
|
||||||
|
}
|
||||||
|
|
||||||
|
btnS.addEventListener('click', async () => {
|
||||||
|
if (running === true) return;
|
||||||
|
if (!confirm('Lancer le build ISO ?\n\nPassage sur main → git pull → bash build.sh'
|
||||||
|
+ ' (repli setup-aur.sh en cas d' + '\u2019échec).\nLe dépôt D:\\FWS-ISO ne doit pas être utilisé ailleurs pendant le build.')) return;
|
||||||
|
const p = new URLSearchParams(csrfP); p.set('act', 'start');
|
||||||
|
const r = await api('start', p);
|
||||||
|
if (r.json && r.json.ok) { pos = -1; await poll(); } else { alert(r.json && r.json.error ? r.json.error : 'Erreur au démarrage.'); }
|
||||||
|
});
|
||||||
|
|
||||||
|
btnT.addEventListener('click', async () => {
|
||||||
|
if (running !== true) return;
|
||||||
|
if (!confirm('Arrêter le build en cours ?')) return;
|
||||||
|
const p = new URLSearchParams(csrfP); p.set('act', 'stop');
|
||||||
|
const r = await api('stop', p);
|
||||||
|
if (r.json && r.json.ok) { await poll(); } else { alert(r.json && r.json.error ? r.json.error : 'Erreur à l' + '\u2019arrêt.'); }
|
||||||
|
});
|
||||||
|
|
||||||
|
btnC.addEventListener('click', async () => {
|
||||||
|
if (running === true) return;
|
||||||
|
const p = new URLSearchParams(csrfP); p.set('act', 'clear');
|
||||||
|
const r = await api('clear', p);
|
||||||
|
if (r.json && r.json.ok) { term.textContent = ''; pos = -1; rcL.textContent = ''; } else { alert(r.json && r.json.error ? r.json.error : 'Erreur.'); }
|
||||||
|
});
|
||||||
|
|
||||||
|
setUI();
|
||||||
|
refreshAuth();
|
||||||
|
poll();
|
||||||
|
setInterval(poll, 1000);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+689
-3
@@ -81,11 +81,179 @@ function excerpt(string $s, int $len = 140): string
|
|||||||
return mb_substr($s, 0, $len - 1) . '…';
|
return mb_substr($s, 0, $len - 1) . '…';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Paquets : parsing / formatage des champs « une ligne par entrée » ── */
|
||||||
|
|
||||||
|
function parse_pipe_lines(string $raw, int $fields): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach (preg_split('/\r?\n/', $raw) as $line) {
|
||||||
|
$line = trim($line);
|
||||||
|
if ($line === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$parts = array_map('trim', explode('|', $line));
|
||||||
|
$parts = array_pad($parts, $fields, '');
|
||||||
|
$out[] = array_slice($parts, 0, $fields);
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function links_from_lines(string $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach (parse_pipe_lines($raw, 2) as $pair) {
|
||||||
|
[$label, $url] = $pair;
|
||||||
|
if ($url === '') {
|
||||||
|
$url = $label;
|
||||||
|
$label = '';
|
||||||
|
}
|
||||||
|
if ($url === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$out[] = ['label' => $label !== '' ? $label : $url, 'url' => $url];
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function changelog_from_lines(string $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach (parse_pipe_lines($raw, 3) as $parts) {
|
||||||
|
[$version, $date, $notes] = $parts;
|
||||||
|
if ($version === '' && $date === '' && $notes === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$out[] = ['version' => $version, 'date' => $date !== '' ? $date : null, 'notes' => $notes];
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
function screens_from_lines(string $raw): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach (parse_pipe_lines($raw, 3) as $parts) {
|
||||||
|
[$src, $alt, $caption] = $parts;
|
||||||
|
if ($src === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$out[] = ['src' => $src, 'alt' => $alt !== '' ? $alt : null, 'caption' => $caption !== '' ? $caption : null];
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Paquets : images (max 5, stockées sous p/assets/img/packages/) ── */
|
||||||
|
|
||||||
|
define('FWS_PKG_IMG_MAX', 5);
|
||||||
|
|
||||||
|
function fws_admin_packages_img_dir(): string
|
||||||
|
{
|
||||||
|
/* __DIR__ = admin/bugs → racine du site = deux niveaux au-dessus. */
|
||||||
|
return dirname(__DIR__, 2) . '/p/assets/img/packages';
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Src web « /p/assets/img/packages/… » si l'image est dans le dossier géré, sinon null. */
|
||||||
|
function fws_admin_managed_img_web(string $src): ?string
|
||||||
|
{
|
||||||
|
$prefix = '/p/assets/img/packages/';
|
||||||
|
if (strncmp($src, $prefix, strlen($prefix)) !== 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$name = basename($src);
|
||||||
|
if ($name === '' || str_contains($name, '..')) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $prefix . $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Supprime une image gérée si plus aucun paquet ne la référence. */
|
||||||
|
function fws_admin_delete_img_if_unused(PDO $pdo, string $src): void
|
||||||
|
{
|
||||||
|
$web = fws_admin_managed_img_web($src);
|
||||||
|
if ($web === null) {
|
||||||
|
return; /* image hors du dossier géré (chemin manuel) : on n'y touche pas */
|
||||||
|
}
|
||||||
|
$st = $pdo->prepare('SELECT COUNT(*) FROM packages WHERE screens LIKE :pat');
|
||||||
|
$st->execute([':pat' => '%' . $web . '%']);
|
||||||
|
if ((int) $st->fetchColumn() > 0) {
|
||||||
|
return; /* encore utilisée par un autre paquet */
|
||||||
|
}
|
||||||
|
$abs = dirname(__DIR__, 2) . $web;
|
||||||
|
if (is_file($abs)) {
|
||||||
|
@unlink($abs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Valide et stocke un upload d'image de paquet. Renvoie le src web.
|
||||||
|
* Lance RuntimeException avec un message clair si le fichier est refusé. */
|
||||||
|
function fws_admin_store_screen_upload(array $file, string $slug): string
|
||||||
|
{
|
||||||
|
if (($file['error'] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_OK) {
|
||||||
|
throw new RuntimeException('Envoi impossible (code ' . (string) ($file['error'] ?? '?') . ').');
|
||||||
|
}
|
||||||
|
if (($file['size'] ?? 0) <= 0 || ($file['size'] ?? 0) > 2 * 1024 * 1024) {
|
||||||
|
throw new RuntimeException('« ' . (string) ($file['name'] ?? '?') . ' » dépasse 2 Mo.');
|
||||||
|
}
|
||||||
|
$ext = strtolower(pathinfo((string) ($file['name'] ?? ''), PATHINFO_EXTENSION));
|
||||||
|
$allowed = ['jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'webp' => 'image/webp', 'gif' => 'image/gif'];
|
||||||
|
if (!isset($allowed[$ext])) {
|
||||||
|
throw new RuntimeException('« ' . (string) ($file['name'] ?? '?') . ' » : format non supporté (jpg, png, webp, gif).');
|
||||||
|
}
|
||||||
|
$info = @getimagesize((string) ($file['tmp_name'] ?? ''));
|
||||||
|
if ($info === false || ($info['mime'] ?? '') !== $allowed[$ext]) {
|
||||||
|
throw new RuntimeException('« ' . (string) ($file['name'] ?? '?') . ' » n\'est pas une image valide.');
|
||||||
|
}
|
||||||
|
$dir = fws_admin_packages_img_dir();
|
||||||
|
if (!is_dir($dir) && !@mkdir($dir, 0775, true) && !is_dir($dir)) {
|
||||||
|
throw new RuntimeException('Impossible de créer le dossier des images.');
|
||||||
|
}
|
||||||
|
@chmod($dir, 0777); /* bind-mount Docker : tout appartient à root */
|
||||||
|
$base = trim(preg_replace('/[^a-zA-Z0-9-]+/', '-', $slug) ?? '', '-');
|
||||||
|
if ($base === '') {
|
||||||
|
$base = 'paquet';
|
||||||
|
}
|
||||||
|
$name = $base . '-' . bin2hex(random_bytes(8)) . '.' . $ext;
|
||||||
|
if (!@move_uploaded_file((string) ($file['tmp_name'] ?? ''), $dir . '/' . $name)) {
|
||||||
|
throw new RuntimeException('Échec de l\'enregistrement de « ' . (string) ($file['name'] ?? '?') . ' ».');
|
||||||
|
}
|
||||||
|
@chmod($dir . '/' . $name, 0644);
|
||||||
|
return '/p/assets/img/packages/' . $name;
|
||||||
|
}
|
||||||
|
|
||||||
|
function lines_from_links(array $links): string
|
||||||
|
{
|
||||||
|
$lines = [];
|
||||||
|
foreach ($links as $l) {
|
||||||
|
$lines[] = ($l['label'] ?? '') . ' | ' . ($l['url'] ?? '');
|
||||||
|
}
|
||||||
|
return implode("\n", $lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
function lines_from_changelog(array $cl): string
|
||||||
|
{
|
||||||
|
$lines = [];
|
||||||
|
foreach ($cl as $e) {
|
||||||
|
$lines[] = ($e['version'] ?? '') . ' | ' . ($e['date'] ?? '') . ' | ' . ($e['notes'] ?? '');
|
||||||
|
}
|
||||||
|
return implode("\n", $lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
function lines_from_screens(array $s): string
|
||||||
|
{
|
||||||
|
$lines = [];
|
||||||
|
foreach ($s as $e) {
|
||||||
|
$lines[] = ($e['src'] ?? '') . ' | ' . ($e['alt'] ?? '') . ' | ' . ($e['caption'] ?? '');
|
||||||
|
}
|
||||||
|
return implode("\n", $lines);
|
||||||
|
}
|
||||||
|
|
||||||
/* ───────────────────────── actions POST ───────────────────────── */
|
/* ───────────────────────── actions POST ───────────────────────── */
|
||||||
|
|
||||||
$error = null;
|
$error = null;
|
||||||
$notice = null;
|
$notice = null;
|
||||||
$freshInvite = '';
|
$freshInvite = '';
|
||||||
|
/* Message ponctuel d'une action précédente (stocké en session pour la redirection) */
|
||||||
|
$flash = $_SESSION['flash'] ?? null;
|
||||||
|
unset($_SESSION['flash']);
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
$action = $_POST['action'] ?? '';
|
$action = $_POST['action'] ?? '';
|
||||||
@@ -197,12 +365,227 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$up->execute([':h' => password_hash($new, PASSWORD_DEFAULT), ':id' => $uid]);
|
$up->execute([':h' => password_hash($new, PASSWORD_DEFAULT), ':id' => $uid]);
|
||||||
$notice = 'Mot de passe modifié avec succès.';
|
$notice = 'Mot de passe modifié avec succès.';
|
||||||
}
|
}
|
||||||
|
} elseif ($action === 'pkg_save') {
|
||||||
|
$name = trim((string) ($_POST['name'] ?? ''));
|
||||||
|
if ($name === '') {
|
||||||
|
$error = 'Le nom du paquet est obligatoire.';
|
||||||
|
} else {
|
||||||
|
$pdo = fws_bugs_db();
|
||||||
|
|
||||||
|
/* Captures d'écran : existantes conservées (avec légendes
|
||||||
|
éditées) + nouveaux envois, 5 maximum par paquet. */
|
||||||
|
$pkgIdPost = (int) ($_POST['pkg_id'] ?? 0);
|
||||||
|
$oldRow = null;
|
||||||
|
if ($pkgIdPost > 0) {
|
||||||
|
$stOld = $pdo->prepare('SELECT screens FROM packages WHERE id = :id');
|
||||||
|
$stOld->execute([':id' => $pkgIdPost]);
|
||||||
|
$oldRow = $stOld->fetch() ?: null;
|
||||||
|
}
|
||||||
|
$oldScreens = $oldRow !== null
|
||||||
|
? (array) (json_decode((string) $oldRow['screens'], true) ?: [])
|
||||||
|
: [];
|
||||||
|
|
||||||
|
$keep = array_fill_keys((array) ($_POST['keep_screens'] ?? []), true);
|
||||||
|
$captions = (array) ($_POST['captions'] ?? []);
|
||||||
|
$screens = [];
|
||||||
|
$removedSrcs = [];
|
||||||
|
foreach ($oldScreens as $os) {
|
||||||
|
$src = (string) ($os['src'] ?? '');
|
||||||
|
if ($src === '' || !isset($keep[$src])) {
|
||||||
|
/* Décochée : le fichier sera supprimé APRÈS la mise à
|
||||||
|
jour en base (sinon elle le compte encore en usage). */
|
||||||
|
if ($src !== '') {
|
||||||
|
$removedSrcs[] = $src;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$cap = isset($captions[$src]) ? trim((string) $captions[$src]) : '';
|
||||||
|
$screens[] = [
|
||||||
|
'src' => $src,
|
||||||
|
'alt' => ($os['alt'] ?? '') !== '' ? (string) $os['alt'] : $name,
|
||||||
|
'caption' => $cap !== '' ? $cap : null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$newFiles = (array) ($_FILES['new_screens'] ?? []);
|
||||||
|
$countNew = is_array($newFiles['name'] ?? null) ? count($newFiles['name']) : 0;
|
||||||
|
|
||||||
|
/* Indices des fichiers réellement envoyés (pas les slots vides). */
|
||||||
|
$uploadIdx = [];
|
||||||
|
for ($i = 0; $i < $countNew; $i++) {
|
||||||
|
if ((int) ($newFiles['error'][$i] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_NO_FILE
|
||||||
|
|| (string) ($newFiles['name'][$i] ?? '') !== '') {
|
||||||
|
$uploadIdx[] = $i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Limite vérifiée AVANT tout stockage : refus clair, rien n'est
|
||||||
|
écrit (ni base ni fichiers) si le total dépasse la limite. */
|
||||||
|
if (count($screens) + count($uploadIdx) > FWS_PKG_IMG_MAX) {
|
||||||
|
$error = 'Maximum ' . FWS_PKG_IMG_MAX . ' images par paquet : '
|
||||||
|
. count($screens) . ' conservée(s) + ' . count($uploadIdx)
|
||||||
|
. ' envoyée(s). Retirez-en d\'abord.';
|
||||||
|
} else {
|
||||||
|
$slugPost = trim((string) ($_POST['slug'] ?? ''));
|
||||||
|
if ($slugPost === '') {
|
||||||
|
$slugPost = trim(preg_replace('/[^a-zA-Z0-9]+/', '-', $name) ?? '', '-');
|
||||||
|
}
|
||||||
|
$storedThisRequest = [];
|
||||||
|
foreach ($uploadIdx as $i) {
|
||||||
|
try {
|
||||||
|
$src = fws_admin_store_screen_upload([
|
||||||
|
'name' => (string) $newFiles['name'][$i],
|
||||||
|
'type' => (string) ($newFiles['type'][$i] ?? ''),
|
||||||
|
'tmp_name' => (string) ($newFiles['tmp_name'][$i] ?? ''),
|
||||||
|
'error' => (int) ($newFiles['error'][$i] ?? UPLOAD_ERR_NO_FILE),
|
||||||
|
'size' => (int) ($newFiles['size'][$i] ?? 0),
|
||||||
|
], $slugPost);
|
||||||
|
$storedThisRequest[] = $src;
|
||||||
|
$screens[] = ['src' => $src, 'alt' => $name, 'caption' => null];
|
||||||
|
} catch (RuntimeException $ex) {
|
||||||
|
/* Un fichier invalide annule tout : on ne garde pas
|
||||||
|
des images déjà stockées mais non enregistrées. */
|
||||||
|
foreach ($storedThisRequest as $tmpSrc) {
|
||||||
|
@unlink(dirname(__DIR__, 2) . $tmpSrc);
|
||||||
|
}
|
||||||
|
$error = $ex->getMessage();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($error === null) {
|
||||||
|
fws_packages_save($pdo, [
|
||||||
|
'id' => $pkgIdPost,
|
||||||
|
'slug' => (string) ($_POST['slug'] ?? ''),
|
||||||
|
'name' => $name,
|
||||||
|
'tagline' => (string) ($_POST['tagline'] ?? ''),
|
||||||
|
'description' => (string) ($_POST['description'] ?? ''),
|
||||||
|
'since' => (string) ($_POST['since'] ?? ''),
|
||||||
|
'since_label' => (string) ($_POST['since_label'] ?? ''),
|
||||||
|
'latest_name' => (string) ($_POST['latest_name'] ?? ''),
|
||||||
|
'latest_date' => (string) ($_POST['latest_date'] ?? ''),
|
||||||
|
'links' => links_from_lines((string) ($_POST['links'] ?? '')),
|
||||||
|
'screens' => $screens,
|
||||||
|
'changelog' => changelog_from_lines((string) ($_POST['changelog'] ?? '')),
|
||||||
|
]);
|
||||||
|
/* La base est à jour : on peut maintenant supprimer les
|
||||||
|
fichiers décochés devenus orphelins. */
|
||||||
|
foreach ($removedSrcs as $rsrc) {
|
||||||
|
fws_admin_delete_img_if_unused($pdo, $rsrc);
|
||||||
|
}
|
||||||
|
$wasEdit = $pkgIdPost > 0;
|
||||||
|
$_SESSION['flash'] = ['ok' => $wasEdit
|
||||||
|
? "Paquet « $name » mis à jour."
|
||||||
|
: "Paquet « $name » créé."];
|
||||||
|
header('Location: index.php?view=packages');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif ($action === 'pkg_delete') {
|
||||||
|
$pkgId = (int) ($_POST['pkg_id'] ?? 0);
|
||||||
|
$pdo = fws_bugs_db();
|
||||||
|
/* On note les images du paquet, on supprime la ligne, puis on
|
||||||
|
nettoie les fichiers devenus orphelins (la base ne doit plus
|
||||||
|
les référencer au moment de la vérification). */
|
||||||
|
$stDel = $pdo->prepare('SELECT screens FROM packages WHERE id = :id');
|
||||||
|
$stDel->execute([':id' => $pkgId]);
|
||||||
|
$rowDel = $stDel->fetch();
|
||||||
|
$orphanSrcs = [];
|
||||||
|
if ($rowDel !== false) {
|
||||||
|
foreach ((array) (json_decode((string) $rowDel['screens'], true) ?: []) as $os) {
|
||||||
|
$s = (string) ($os['src'] ?? '');
|
||||||
|
if ($s !== '') {
|
||||||
|
$orphanSrcs[] = $s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fws_packages_delete($pdo, $pkgId);
|
||||||
|
foreach ($orphanSrcs as $osrc) {
|
||||||
|
fws_admin_delete_img_if_unused($pdo, $osrc);
|
||||||
|
}
|
||||||
|
$_SESSION['flash'] = ['ok' => "Paquet #$pkgId supprimé."];
|
||||||
|
header('Location: index.php?view=packages');
|
||||||
|
exit;
|
||||||
|
} elseif ($action === 'pkg_sync_gitea') {
|
||||||
|
/* Rafraîchit latest + historique d'un paquet depuis l'API Gitea
|
||||||
|
(le dépôt est déduit de ses liens « Gitea » / « Releases »). */
|
||||||
|
$pkgId = (int) ($_POST['pkg_id'] ?? 0);
|
||||||
|
$pdo = fws_bugs_db();
|
||||||
|
$st = $pdo->prepare('SELECT * FROM packages WHERE id = :id');
|
||||||
|
$st->execute([':id' => $pkgId]);
|
||||||
|
$row = $st->fetch();
|
||||||
|
if ($row === false) {
|
||||||
|
$_SESSION['flash'] = ['err' => "Paquet #$pkgId introuvable."];
|
||||||
|
header('Location: index.php?view=packages');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$links = json_decode((string) $row['links'], true) ?: [];
|
||||||
|
$repo = null;
|
||||||
|
foreach ($links as $link) {
|
||||||
|
if (preg_match('~^https?://gitea\.nocode-var\.tech/([^/]+)/([^/]+)/?$~i', (string) ($link['url'] ?? ''), $m)) {
|
||||||
|
$repo = ['owner' => $m[1], 'name' => $m[2]];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($repo === null) {
|
||||||
|
$_SESSION['flash'] = ['err' => 'Aucun lien Gitea (gitea.nocode-var.tech) dans ce paquet : synchronisation impossible.'];
|
||||||
|
header('Location: index.php?view=packages');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
require_once __DIR__ . '/../../inc/site.php';
|
||||||
|
$releases = fws_site_gitea_releases($repo['owner'], $repo['name']);
|
||||||
|
if ($releases === []) {
|
||||||
|
$_SESSION['flash'] = ['err' => 'Gitea ne renvoie aucune release pour ' . $repo['owner'] . '/' . $repo['name'] . '.'];
|
||||||
|
header('Location: index.php?view=packages');
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$first = $releases[0];
|
||||||
|
$changelog = [];
|
||||||
|
foreach ($releases as $rel) {
|
||||||
|
$notes = trim(strip_tags((string) fws_markdown((string) ($rel['body'] ?? ''))));
|
||||||
|
if (mb_strlen($notes) > 200) {
|
||||||
|
$notes = rtrim(mb_substr($notes, 0, 200)) . '…';
|
||||||
|
}
|
||||||
|
$changelog[] = [
|
||||||
|
'version' => (string) ($rel['tag_name'] ?? ''),
|
||||||
|
'date' => isset($rel['published_at']) ? substr((string) $rel['published_at'], 0, 10) : null,
|
||||||
|
'notes' => $notes,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
fws_packages_save($pdo, [
|
||||||
|
'id' => $pkgId,
|
||||||
|
'slug' => (string) $row['slug'],
|
||||||
|
'name' => (string) $row['name'],
|
||||||
|
'tagline' => (string) $row['tagline'],
|
||||||
|
'description' => (string) $row['description'],
|
||||||
|
'since' => (string) ($row['since'] ?? ''),
|
||||||
|
'since_label' => (string) $row['since_label'],
|
||||||
|
'latest_name' => (string) ($first['tag_name'] ?? ''),
|
||||||
|
'latest_date' => isset($first['published_at']) ? substr((string) $first['published_at'], 0, 10) : '',
|
||||||
|
'links' => $links,
|
||||||
|
'screens' => json_decode((string) $row['screens'], true) ?: [],
|
||||||
|
'changelog' => $changelog,
|
||||||
|
]);
|
||||||
|
$_SESSION['flash'] = ['ok' => 'Paquet « ' . $row['name'] . ' » synchronisé depuis Gitea (' . count($releases) . ' releases).'];
|
||||||
|
header('Location: index.php?view=packages');
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = current_user();
|
$user = current_user();
|
||||||
|
|
||||||
|
/* Message ponctuel laissé par une action (après redirection) */
|
||||||
|
if ($flash !== null) {
|
||||||
|
if (!empty($flash['err'])) {
|
||||||
|
$error = (string) $flash['err'];
|
||||||
|
}
|
||||||
|
if (!empty($flash['ok'])) {
|
||||||
|
$notice = (string) $flash['ok'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ───────────────────────── routage vues ───────────────────────── */
|
/* ───────────────────────── routage vues ───────────────────────── */
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -214,6 +597,8 @@ try {
|
|||||||
|
|
||||||
$view_id = (int) ($_GET['id'] ?? 0);
|
$view_id = (int) ($_GET['id'] ?? 0);
|
||||||
$view_invites = ($_GET['view'] ?? '') === 'invites' && $view_id === 0;
|
$view_invites = ($_GET['view'] ?? '') === 'invites' && $view_id === 0;
|
||||||
|
$view_packages = ($_GET['view'] ?? '') === 'packages' && $view_id === 0;
|
||||||
|
$edit_pkg_id = $view_packages ? (int) ($_GET['edit'] ?? 0) : 0;
|
||||||
|
|
||||||
/* Compteurs pour les filtres */
|
/* Compteurs pour les filtres */
|
||||||
$counts = ['tous' => 0];
|
$counts = ['tous' => 0];
|
||||||
@@ -293,10 +678,70 @@ form.inline { display: inline; }
|
|||||||
.login-box { max-width: 380px; margin: 12vh auto; }
|
.login-box { max-width: 380px; margin: 12vh auto; }
|
||||||
.login-box .card { padding: 28px; }
|
.login-box .card { padding: 28px; }
|
||||||
.login-box h1 { font-size: 1.25rem; margin-top: 0; }
|
.login-box h1 { font-size: 1.25rem; margin-top: 0; }
|
||||||
input[type=text], input[type=password] {
|
input[type=text], input[type=password], input[type=date], textarea {
|
||||||
width: 100%; padding: 9px 11px; margin: 6px 0 14px;
|
width: 100%; padding: 9px 11px; margin: 6px 0 14px;
|
||||||
background: #0b1120; border: 1px solid #334155; border-radius: 8px; color: #e2e8f0; font-size: .95rem;
|
background: #0b1120; border: 1px solid #334155; border-radius: 8px; color: #e2e8f0; font-size: .95rem;
|
||||||
|
font-family: inherit;
|
||||||
}
|
}
|
||||||
|
textarea { resize: vertical; min-height: 70px; }
|
||||||
|
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
|
||||||
|
|
||||||
|
/* ── Picker d'images des paquets ── */
|
||||||
|
.pkg-screens-picker {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
||||||
|
gap: 10px;
|
||||||
|
margin: 4px 0 6px;
|
||||||
|
}
|
||||||
|
.pkg-shot {
|
||||||
|
margin: 0;
|
||||||
|
border: 1px solid #1e293b;
|
||||||
|
border-radius: 10px;
|
||||||
|
overflow: hidden;
|
||||||
|
background: #0f172a;
|
||||||
|
display: grid;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 6px;
|
||||||
|
}
|
||||||
|
.pkg-shot img {
|
||||||
|
width: 100%;
|
||||||
|
height: 70px;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.pkg-shot-keep {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
font-size: .72rem;
|
||||||
|
color: #94a3b8;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.pkg-shot-keep input { accent-color: #0284c7; }
|
||||||
|
.pkg-shot input[type="text"] {
|
||||||
|
font-size: .75rem;
|
||||||
|
padding: 3px 6px;
|
||||||
|
}
|
||||||
|
.pkg-shot-add {
|
||||||
|
display: grid;
|
||||||
|
place-content: center;
|
||||||
|
justify-items: center;
|
||||||
|
gap: 2px;
|
||||||
|
min-height: 118px;
|
||||||
|
border-style: dashed;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.pkg-shot-add:hover { border-color: #0284c7; }
|
||||||
|
.pkg-shot-plus { font-size: 1.6rem; color: #38bdf8; cursor: pointer; }
|
||||||
|
.pkg-shot-label {
|
||||||
|
font-size: .75rem;
|
||||||
|
color: #94a3b8;
|
||||||
|
text-align: center;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.pkg-shot-label small { color: #64748b; }
|
||||||
|
.pkg-shot label { color: inherit; }
|
||||||
label { font-size: .85rem; color: #cbd5e1; }
|
label { font-size: .85rem; color: #cbd5e1; }
|
||||||
.back { margin-bottom: 12px; display: inline-block; }
|
.back { margin-bottom: 12px; display: inline-block; }
|
||||||
.pager { display: flex; gap: 8px; margin-top: 16px; }
|
.pager { display: flex; gap: 8px; margin-top: 16px; }
|
||||||
@@ -312,6 +757,49 @@ table.list { width: 100%; border-collapse: collapse; font-size: .88rem; }
|
|||||||
table.list th, table.list td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #1e293b; vertical-align: middle; }
|
table.list th, table.list td { text-align: left; padding: 7px 8px; border-bottom: 1px solid #1e293b; vertical-align: middle; }
|
||||||
table.list th { color: #94a3b8; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
|
table.list th { color: #94a3b8; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
|
||||||
.login-register { text-align: center; margin-top: 14px; font-size: .85rem; }
|
.login-register { text-align: center; margin-top: 14px; font-size: .85rem; }
|
||||||
|
|
||||||
|
/* ── Mobile : l'admin reste utilisable au doigt ── */
|
||||||
|
@media (max-width: 720px) {
|
||||||
|
.wrap { padding: 16px 10px 60px; }
|
||||||
|
|
||||||
|
header.top {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navtabs {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navtabs a {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
text-align: center;
|
||||||
|
padding: 6px 10px;
|
||||||
|
font-size: .8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Les tableaux défilent localement au lieu de casser la mise en page */
|
||||||
|
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
|
||||||
|
table.list { min-width: 34rem; }
|
||||||
|
|
||||||
|
.grid2 { grid-template-columns: 1fr; }
|
||||||
|
|
||||||
|
.invite-form { align-items: stretch; }
|
||||||
|
.invite-form .btn { width: 100%; }
|
||||||
|
|
||||||
|
.invite-box { flex-direction: column; align-items: flex-start; gap: 8px; }
|
||||||
|
|
||||||
|
.status-row { align-items: stretch; flex-direction: column; }
|
||||||
|
.status-row .btn { text-align: center; }
|
||||||
|
|
||||||
|
.filters a { flex: 1 1 auto; text-align: center; }
|
||||||
|
|
||||||
|
.pager { flex-wrap: wrap; }
|
||||||
|
|
||||||
|
.pkg-screens-picker { grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); }
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -347,7 +835,7 @@ table.list th { color: #94a3b8; font-size: .72rem; text-transform: uppercase; le
|
|||||||
<header class="top">
|
<header class="top">
|
||||||
<div>
|
<div>
|
||||||
<h1>🐞 Signalements de bugs</h1>
|
<h1>🐞 Signalements de bugs</h1>
|
||||||
<div class="sub">Connecté : <?= h($user['name']) ?> · Base SQLite · <a href="../../api/bugs.php" target="_blank">tester l'API</a></div>
|
<div class="sub">Connecté : <?= h($user['name']) ?> · Base SQLite · <a href="<?= h(fws_url('/api/bugs.php')) ?>" target="_blank">tester l'API</a></div>
|
||||||
</div>
|
</div>
|
||||||
<form class="inline" method="post">
|
<form class="inline" method="post">
|
||||||
<input type="hidden" name="action" value="logout">
|
<input type="hidden" name="action" value="logout">
|
||||||
@@ -357,8 +845,10 @@ table.list th { color: #94a3b8; font-size: .72rem; text-transform: uppercase; le
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="navtabs">
|
<div class="navtabs">
|
||||||
<a href="index.php" class="<?= $view_invites ? '' : 'active' ?>">🐞 Signalements</a>
|
<a href="index.php" class="<?= ($view_invites || $view_packages) ? '' : 'active' ?>">🐞 Signalements</a>
|
||||||
<a href="index.php?view=invites" class="<?= $view_invites ? 'active' : '' ?>">👥 Invitations & comptes</a>
|
<a href="index.php?view=invites" class="<?= $view_invites ? 'active' : '' ?>">👥 Invitations & comptes</a>
|
||||||
|
<a href="index.php?view=packages" class="<?= $view_packages ? 'active' : '' ?>">📦 Paquets</a>
|
||||||
|
<?php if (fws_bugs_can_build($user['name'])): ?><a href="build.php">🔨 Build ISO</a><?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if ($error): ?><div class="flash err"><?= h($error) ?></div><?php endif; ?>
|
<?php if ($error): ?><div class="flash err"><?= h($error) ?></div><?php endif; ?>
|
||||||
@@ -479,6 +969,7 @@ table.list th { color: #94a3b8; font-size: .72rem; text-transform: uppercase; le
|
|||||||
<?php if (!$invites): ?>
|
<?php if (!$invites): ?>
|
||||||
<p class="empty">Aucun code pour l'instant.</p>
|
<p class="empty">Aucun code pour l'instant.</p>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
|
<div class="table-scroll">
|
||||||
<table class="list">
|
<table class="list">
|
||||||
<tr><th>Code</th><th>Créé</th><th>Expire</th><th>Statut</th><th>Utilisé par</th><th></th></tr>
|
<tr><th>Code</th><th>Créé</th><th>Expire</th><th>Statut</th><th>Utilisé par</th><th></th></tr>
|
||||||
<?php foreach ($invites as $inv):
|
<?php foreach ($invites as $inv):
|
||||||
@@ -511,6 +1002,7 @@ table.list th { color: #94a3b8; font-size: .72rem; text-transform: uppercase; le
|
|||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -548,6 +1040,143 @@ table.list th { color: #94a3b8; font-size: .72rem; text-transform: uppercase; le
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?php elseif ($view_packages): /* ─────────── PAQUETS ─────────── */
|
||||||
|
|
||||||
|
$pkgRows = $pdo->query('SELECT * FROM packages ORDER BY id ASC')->fetchAll();
|
||||||
|
$editing = null;
|
||||||
|
if ($edit_pkg_id > 0) {
|
||||||
|
foreach ($pkgRows as $pr) {
|
||||||
|
if ((int) $pr['id'] === $edit_pkg_id) {
|
||||||
|
$editing = $pr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($editing === null) {
|
||||||
|
$edit_pkg_id = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$form = $editing !== null ? $editing : [
|
||||||
|
'id' => 0, 'slug' => '', 'name' => '', 'tagline' => '', 'description' => '',
|
||||||
|
'since' => null, 'since_label' => 'FWS', 'latest_name' => '', 'latest_date' => null,
|
||||||
|
'links' => '[]', 'screens' => '[]', 'changelog' => '[]',
|
||||||
|
];
|
||||||
|
$fLinks = lines_from_links((array) (json_decode((string) $form['links'], true) ?: []));
|
||||||
|
/* Captures actuelles du paquet (picker d'images). */
|
||||||
|
$formScreensData = [];
|
||||||
|
foreach ((array) (json_decode((string) $form['screens'], true) ?: []) as $fsd) {
|
||||||
|
if (is_array($fsd) && (string) ($fsd['src'] ?? '') !== '') {
|
||||||
|
$formScreensData[] = $fsd;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$fChangelog = lines_from_changelog((array) (json_decode((string) $form['changelog'], true) ?: []));
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h3><?= $editing !== null ? '✏️ Modifier « ' . h($editing['name']) . ' »' : '➕ Nouveau paquet' ?></h3>
|
||||||
|
<?php if ($editing !== null): ?><p style="font-size:.85rem;color:#94a3b8"><a href="index.php?view=packages">← Annuler la modification</a></p><?php endif; ?>
|
||||||
|
<p style="font-size:.85rem;color:#94a3b8">Les champs « une ligne par entrée » utilisent le format <code>Label | URL</code> (liens),
|
||||||
|
<code>Version | Date | Notes</code> (historique) et <code>src | alt | légende</code> (captures).</p>
|
||||||
|
<form method="post" enctype="multipart/form-data" style="display:grid;gap:2px;max-width:680px">
|
||||||
|
<input type="hidden" name="action" value="pkg_save">
|
||||||
|
<input type="hidden" name="csrf" value="<?= h(csrf_token()) ?>">
|
||||||
|
<input type="hidden" name="pkg_id" value="<?= (int) $form['id'] ?>">
|
||||||
|
<div class="grid2">
|
||||||
|
<div>
|
||||||
|
<label for="pkg_name">Nom *</label>
|
||||||
|
<input type="text" id="pkg_name" name="name" required value="<?= h($form['name']) ?>">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="pkg_slug">Slug / id (vide = auto)</label>
|
||||||
|
<input type="text" id="pkg_slug" name="slug" value="<?= h($form['slug']) ?>" placeholder="ex. fws-pacmanage">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label for="pkg_tagline">Tagline</label>
|
||||||
|
<input type="text" id="pkg_tagline" name="tagline" value="<?= h($form['tagline']) ?>">
|
||||||
|
<label for="pkg_desc">Description</label>
|
||||||
|
<textarea id="pkg_desc" name="description" rows="3"><?= h($form['description']) ?></textarea>
|
||||||
|
<div class="grid2">
|
||||||
|
<div>
|
||||||
|
<label for="pkg_since">Disponible depuis (date)</label>
|
||||||
|
<input type="date" id="pkg_since" name="since" value="<?= h((string) ($form['since'] ?? '')) ?>">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="pkg_since_label">Badge « depuis »</label>
|
||||||
|
<input type="text" id="pkg_since_label" name="since_label" value="<?= h($form['since_label']) ?>" placeholder="V1.0.0 / En développement">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="pkg_latest_name">Dernière release (nom)</label>
|
||||||
|
<input type="text" id="pkg_latest_name" name="latest_name" value="<?= h($form['latest_name']) ?>" placeholder="V1.2.1">
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label for="pkg_latest_date">Date de la release</label>
|
||||||
|
<input type="date" id="pkg_latest_date" name="latest_date" value="<?= h((string) ($form['latest_date'] ?? '')) ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label for="pkg_links">Liens utiles — une ligne par lien : <code>Label | URL</code></label>
|
||||||
|
<textarea id="pkg_links" name="links" rows="3" placeholder="Gitea | https://gitea.nocode-var.tech/FWS/FWS-PacManage"><?= h($fLinks) ?></textarea>
|
||||||
|
<label for="pkg_changelog">Historique — une ligne par version : <code>Version | Date | Notes</code></label>
|
||||||
|
<textarea id="pkg_changelog" name="changelog" rows="5" placeholder="V1.2.1 | 2026-08-29 | Correction de bugs"><?= h($fChangelog) ?></textarea>
|
||||||
|
<label>Captures d'écran (<?= count($formScreensData) ?>/<?= FWS_PKG_IMG_MAX ?>) — décochez pour retirer</label>
|
||||||
|
<div class="pkg-screens-picker">
|
||||||
|
<?php $remaining = FWS_PKG_IMG_MAX - count($formScreensData); foreach ($formScreensData as $fs): $src = (string) ($fs['src'] ?? ''); if ($src === '') continue; ?>
|
||||||
|
<figure class="pkg-shot">
|
||||||
|
<img src="<?= h(function_exists('fws_url') ? fws_url($src) : $src) ?>" alt="">
|
||||||
|
<label class="pkg-shot-keep"><input type="checkbox" name="keep_screens[]" value="<?= h($src) ?>" checked> garder</label>
|
||||||
|
<input type="text" name="captions[<?= h($src) ?>]" value="<?= h((string) ($fs['caption'] ?? '')) ?>" placeholder="Légende (optionnelle)">
|
||||||
|
</figure>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php if ($remaining > 0): ?>
|
||||||
|
<figure class="pkg-shot pkg-shot-add">
|
||||||
|
<label for="pkg_new_screens" class="pkg-shot-plus" title="Ajouter des images">+</label>
|
||||||
|
<input type="file" id="pkg_new_screens" name="new_screens[]" accept="image/png,image/jpeg,image/webp,image/gif" multiple style="display:none">
|
||||||
|
<label for="pkg_new_screens" class="pkg-shot-label">Ajouter…<br><small><?= $remaining ?> restante(s)</small></label>
|
||||||
|
</figure>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<small id="pkg-new-hint" style="color:#94a3b8;font-size:.78rem">JPG / PNG / WebP / GIF — 2 Mo max par image, <?= FWS_PKG_IMG_MAX ?> images max par paquet. Elles sont servies sur tout le site (cartes, page détail, menu).</small>
|
||||||
|
<button class="btn primary" type="submit" style="justify-self:start;margin-top:4px">💾 Enregistrer</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<h3>📦 Paquets (<?= count($pkgRows) ?>)</h3>
|
||||||
|
<?php if (!$pkgRows): ?>
|
||||||
|
<p class="empty">Aucun paquet. Créez le premier avec le formulaire ci-dessus.</p>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="table-scroll">
|
||||||
|
<table class="list">
|
||||||
|
<tr><th>#</th><th>Nom</th><th>Dernière release</th><th></th></tr>
|
||||||
|
<?php foreach ($pkgRows as $pr): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?= (int) $pr['id'] ?></td>
|
||||||
|
<td>
|
||||||
|
<strong><?= h($pr['name']) ?></strong>
|
||||||
|
<?php if ($pr['slug'] !== ''): ?><br><span style="font-size:.75rem;color:#64748b"><?= h($pr['slug']) ?></span><?php endif; ?>
|
||||||
|
<?php if ($pr['tagline'] !== ''): ?><br><span style="font-size:.8rem;color:#94a3b8"><?= h($pr['tagline']) ?></span><?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td><?= h($pr['latest_name'] !== '' ? $pr['latest_name'] . ($pr['latest_date'] !== null ? ' — ' . $pr['latest_date'] : '') : '—') ?></td>
|
||||||
|
<td style="text-align:right;white-space:nowrap">
|
||||||
|
<a class="btn small" href="index.php?view=packages&edit=<?= (int) $pr['id'] ?>">✏️ Modifier</a>
|
||||||
|
<form class="inline" method="post" onsubmit="return confirm('Synchroniser « <?= h($pr['name']) ?> » depuis Gitea ? (latest + historique)')">
|
||||||
|
<input type="hidden" name="action" value="pkg_sync_gitea">
|
||||||
|
<input type="hidden" name="csrf" value="<?= h(csrf_token()) ?>">
|
||||||
|
<input type="hidden" name="pkg_id" value="<?= (int) $pr['id'] ?>">
|
||||||
|
<button class="btn small" type="submit" title="Rafraîchit la dernière release et l'historique depuis Gitea">🔄 Gitea</button>
|
||||||
|
</form>
|
||||||
|
<form class="inline" method="post" onsubmit="return confirm('Supprimer le paquet « <?= h($pr['name']) ?> » ?')">
|
||||||
|
<input type="hidden" name="action" value="pkg_delete">
|
||||||
|
<input type="hidden" name="csrf" value="<?= h(csrf_token()) ?>">
|
||||||
|
<input type="hidden" name="pkg_id" value="<?= (int) $pr['id'] ?>">
|
||||||
|
<button class="btn small danger" type="submit">🗑 Supprimer</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
<?php else: /* ─────────── LISTE ─────────── */
|
<?php else: /* ─────────── LISTE ─────────── */
|
||||||
|
|
||||||
$filter = $_GET['status'] ?? 'tous';
|
$filter = $_GET['status'] ?? 'tous';
|
||||||
@@ -623,5 +1252,62 @@ table.list th { color: #94a3b8; font-size: .72rem; text-transform: uppercase; le
|
|||||||
<?php endif; /* fin espace admin */ ?>
|
<?php endif; /* fin espace admin */ ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/* Picker d'images des paquets : aperçu immédiat des fichiers choisis,
|
||||||
|
limite dure au nombre maximum autorisé. */
|
||||||
|
(function () {
|
||||||
|
var picker = document.querySelector('.pkg-screens-picker');
|
||||||
|
var input = document.getElementById('pkg_new_screens');
|
||||||
|
if (!picker || !input) return;
|
||||||
|
|
||||||
|
var addFigure = input.closest('.pkg-shot-add');
|
||||||
|
var existing = picker.querySelectorAll('.pkg-shot:not(.pkg-shot-add)').length;
|
||||||
|
var max = <?= (int) FWS_PKG_IMG_MAX ?>;
|
||||||
|
var hint = document.getElementById('pkg-new-hint');
|
||||||
|
var hintText = hint ? hint.textContent : '';
|
||||||
|
|
||||||
|
input.addEventListener('change', function () {
|
||||||
|
var room = max - existing;
|
||||||
|
var files = Array.prototype.slice.call(input.files || []);
|
||||||
|
if (files.length > room) {
|
||||||
|
alert('Maximum ' + max + ' images par paquet (' + room + ' restante(s)).');
|
||||||
|
input.value = '';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* Retire l'ancien aperçu puis montre les nouveaux. */
|
||||||
|
picker.querySelectorAll('.pkg-shot-preview').forEach(function (n) { n.remove(); });
|
||||||
|
files.forEach(function (f) {
|
||||||
|
var fig = document.createElement('figure');
|
||||||
|
fig.className = 'pkg-shot pkg-shot-preview';
|
||||||
|
var img = document.createElement('img');
|
||||||
|
img.alt = f.name;
|
||||||
|
img.style.opacity = '0.85';
|
||||||
|
var cap = document.createElement('div');
|
||||||
|
cap.style.cssText = 'font-size:.7rem;color:#64748b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap';
|
||||||
|
cap.textContent = f.name;
|
||||||
|
fig.appendChild(img);
|
||||||
|
fig.appendChild(cap);
|
||||||
|
picker.insertBefore(fig, addFigure);
|
||||||
|
if (URL && URL.createObjectURL) {
|
||||||
|
var url = URL.createObjectURL(f);
|
||||||
|
img.src = url;
|
||||||
|
fig.addEventListener('remove', function () { URL.revokeObjectURL(url); });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/* On désactive proprement le champ si l'utilisateur décoche des images
|
||||||
|
existantes (le nombre maximal est vérifié côté serveur de toute façon). */
|
||||||
|
if (hint) {
|
||||||
|
picker.addEventListener('change', function (ev) {
|
||||||
|
var cb = ev.target.closest('input[type=checkbox]');
|
||||||
|
if (!cb) return;
|
||||||
|
var fig = cb.closest('.pkg-shot');
|
||||||
|
if (fig) fig.style.opacity = cb.checked ? '1' : '0.35';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -89,7 +89,8 @@ if ($ok) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$baseUrl = 'https://' . ($_SERVER['HTTP_HOST'] ?? 'fwslinux.fr');
|
$fwsScheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
||||||
|
$baseUrl = $fwsScheme . '://' . ($_SERVER['HTTP_HOST'] ?? 'fwslinux.fr');
|
||||||
$codeValue = $submitted ? $code : '';
|
$codeValue = $submitted ? $code : '';
|
||||||
$userValue = $submitted ? $username : '';
|
$userValue = $submitted ? $username : '';
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# =============================================================================
|
||||||
|
# FWS — Pipeline « Build ISO » déclenché depuis le panneau admin
|
||||||
|
# (admin/bugs/build.php → process détaché, logs dans le terminal).
|
||||||
|
#
|
||||||
|
# Exécuté DANS le conteneur web (fws-files), qui pilote le moteur Docker
|
||||||
|
# Desktop via /var/run/docker.sock. Toutes les étapes se déroulent dans un
|
||||||
|
# conteneur archlinux jetable (--privileged, exigé par mkarchiso), le dépôt
|
||||||
|
# Windows D:\FWS-ISO étant monté sur /fws — exactement le repli Docker que
|
||||||
|
# font build.sh / setup-aur.sh quand on les lance depuis Git Bash sans WSL.
|
||||||
|
#
|
||||||
|
# Étapes :
|
||||||
|
# 1. passage sur la branche « main » (abandon propre si des modifications
|
||||||
|
# locales non commitées empêchent le checkout — rien n'est jamais perdu)
|
||||||
|
# 2. git pull origin main
|
||||||
|
# 3. bash build.sh
|
||||||
|
# 4. si build.sh échoue → bash setup-aur.sh, puis relance de build.sh
|
||||||
|
# =============================================================================
|
||||||
|
set -u
|
||||||
|
|
||||||
|
# ── Token Gitea (optionnel) : déposé par build.php dans
|
||||||
|
# api/bugs/data/build/git-auth.env (jamais commité, jamais affiché).
|
||||||
|
# Transmis au conteneur en variable d'environnement → git l'utilise pour
|
||||||
|
# le pull sans qu'aucune donnée d'auth n'apparaisse dans les logs.
|
||||||
|
AUTH_ENV="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../../api/bugs/data/build/git-auth.env"
|
||||||
|
GIT_AUTH=()
|
||||||
|
if [ -f "$AUTH_ENV" ]; then
|
||||||
|
. "$AUTH_ENV"
|
||||||
|
fi
|
||||||
|
if [ -n "${FWS_GIT_TOKEN:-}" ]; then
|
||||||
|
AUTH64="$(printf '%s:%s' "${FWS_GIT_USER:-fws}" "$FWS_GIT_TOKEN" | base64 -w0 2>/dev/null || printf '%s:%s' "${FWS_GIT_USER:-fws}" "$FWS_GIT_TOKEN" | base64)"
|
||||||
|
GIT_AUTH=(
|
||||||
|
-e GIT_CONFIG_COUNT=1
|
||||||
|
-e GIT_CONFIG_KEY_0=http.extraheader
|
||||||
|
-e "GIT_CONFIG_VALUE_0=AUTHORIZATION: basic ${AUTH64}"
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
|
IMG="docker.io/library/archlinux:latest"
|
||||||
|
NAME="fws-iso-build"
|
||||||
|
REPO_WIN='D:\FWS-ISO' # chemin Windows résolu par le moteur Docker Desktop
|
||||||
|
|
||||||
|
now() { date '+%H:%M:%S'; }
|
||||||
|
|
||||||
|
echo "[$(now)] ════════════ FWS — Build ISO ════════════"
|
||||||
|
echo "[$(now)] Pipeline lancé depuis le panneau admin (conteneur web)."
|
||||||
|
|
||||||
|
rc=0
|
||||||
|
|
||||||
|
echo "[$(now)] docker pull ${IMG}…"
|
||||||
|
if ! docker pull "$IMG"; then
|
||||||
|
echo "[$(now)] ÉCHEC : pull de l'image archlinux impossible (Docker Desktop arrêté ou réseau coupé ?)."
|
||||||
|
rc=70
|
||||||
|
else
|
||||||
|
# Nettoie un éventuel build précédent resté vivant (arrêt brutal).
|
||||||
|
docker rm -f "$NAME" >/dev/null 2>&1
|
||||||
|
|
||||||
|
echo "[$(now)] Conteneur Arch : checkout main → pull → build.sh (repli setup-aur.sh)."
|
||||||
|
docker run --rm --privileged --name "$NAME" \
|
||||||
|
-e FWS_IN_CONTAINER=1 \
|
||||||
|
"${GIT_AUTH[@]}" \
|
||||||
|
-v fws-pacman-cache:/var/cache/pacman/pkg \
|
||||||
|
-v "${REPO_WIN}:/fws" \
|
||||||
|
-w /fws \
|
||||||
|
"$IMG" \
|
||||||
|
bash -lc '
|
||||||
|
set -u
|
||||||
|
cd /fws || { echo "==> /fws introuvable : le montage D:\FWS-ISO est-il actif ?"; exit 81; }
|
||||||
|
|
||||||
|
echo "==> Installation de git dans le conteneur (image fraîche sans git)…"
|
||||||
|
pacman -Sy --noconfirm git >/dev/null 2>&1 \
|
||||||
|
|| { echo "==> ÉCHEC : pacman -Sy git (réseau du conteneur ?)."; exit 80; }
|
||||||
|
|
||||||
|
echo "==> Branche actuelle : $(git branch --show-current)"
|
||||||
|
echo "==> Passage sur main…"
|
||||||
|
git checkout main 2>&1 || {
|
||||||
|
echo
|
||||||
|
echo "!! Impossible de passer sur main : des modifications locales non commitées"
|
||||||
|
echo "!! dans D:\FWS-ISO empêchent le checkout (voir « git status »)."
|
||||||
|
echo "!! Committe ou stash ces modifications, puis relance le build."
|
||||||
|
exit 90
|
||||||
|
}
|
||||||
|
echo "==> git pull (origin main)…"
|
||||||
|
GIT_TERMINAL_PROMPT=0 git pull --ff-only origin main || {
|
||||||
|
echo "!! git pull a échoué (réseau, droits, ou conflit ?)."
|
||||||
|
exit 91
|
||||||
|
}
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "==> bash build.sh"
|
||||||
|
if bash build.sh; then
|
||||||
|
echo "==> ✅ build.sh terminé sans erreur."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "!! build.sh a échoué → lancement de setup-aur.sh, puis nouvel essai de build.sh"
|
||||||
|
if ! bash setup-aur.sh; then
|
||||||
|
echo "!! setup-aur.sh a échoué."
|
||||||
|
exit 92
|
||||||
|
fi
|
||||||
|
echo "==> bash build.sh (2e tentative)…"
|
||||||
|
if bash build.sh; then
|
||||||
|
echo "==> ✅ build.sh (2e tentative) terminé sans erreur."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "!! Nouvel échec de build.sh."
|
||||||
|
exit 93
|
||||||
|
'
|
||||||
|
rc=$?
|
||||||
|
docker rm -f "$NAME" >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[$(now)] ════════════ Fin du pipeline (code ${rc}) ════════════"
|
||||||
|
exit "$rc"
|
||||||
+15
-14
@@ -5,6 +5,10 @@
|
|||||||
* POST https://fwslinux.fr/api/bugs.php (JSON ou formulaire)
|
* POST https://fwslinux.fr/api/bugs.php (JSON ou formulaire)
|
||||||
* GET https://fwslinux.fr/api/bugs.php (petite page de test dans le navigateur)
|
* GET https://fwslinux.fr/api/bugs.php (petite page de test dans le navigateur)
|
||||||
*
|
*
|
||||||
|
* Aucun plafond de taille ni de débit : l'API est faite pour curl/scripts
|
||||||
|
* (envoi de logs volumineux) et les seuls garde-fous restants sont le champ
|
||||||
|
* piège « website » et le contrôle de contenu vide.
|
||||||
|
*
|
||||||
* CORS ouvert : on accepte les requêtes de n'importe quelle origine
|
* CORS ouvert : on accepte les requêtes de n'importe quelle origine
|
||||||
* (curl, app d'installation, script, site…).
|
* (curl, app d'installation, script, site…).
|
||||||
*/
|
*/
|
||||||
@@ -81,14 +85,16 @@ $fields = [
|
|||||||
'logs' => strval($data['logs'] ?? $data['log'] ?? $data['journal'] ?? ''),
|
'logs' => strval($data['logs'] ?? $data['log'] ?? $data['journal'] ?? ''),
|
||||||
];
|
];
|
||||||
|
|
||||||
$title = mb_substr(trim($fields['title']), 0, 200);
|
/* Aucun plafond sur les champs : les logs d'installation peuvent peser
|
||||||
$description = mb_substr(trim($fields['description']), 0, 20000);
|
très lourd et un client curl doit pouvoir tout envoyer. */
|
||||||
$logs = mb_substr(trim($fields['logs']), 0, 150000);
|
$title = trim($fields['title']);
|
||||||
$app = mb_substr(trim($fields['app']), 0, 100);
|
$description = trim($fields['description']);
|
||||||
$version = mb_substr(trim($fields['version']), 0, 100);
|
$logs = trim($fields['logs']);
|
||||||
$email = mb_substr(trim($fields['email']), 0, 200);
|
$app = trim($fields['app']);
|
||||||
$systemInfo = mb_substr(trim($fields['system_info']), 0, 4000);
|
$version = trim($fields['version']);
|
||||||
$type = mb_substr(trim($fields['type']), 0, 50);
|
$email = trim($fields['email']);
|
||||||
|
$systemInfo = trim($fields['system_info']);
|
||||||
|
$type = trim($fields['type']);
|
||||||
|
|
||||||
/* Un signalement doit contenir au moins un peu de contenu utile */
|
/* Un signalement doit contenir au moins un peu de contenu utile */
|
||||||
if ($title === '' && $description === '' && $logs === '') {
|
if ($title === '' && $description === '' && $logs === '') {
|
||||||
@@ -100,7 +106,7 @@ if ($title === '' && $description === '' && $logs === '') {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Anti-flood léger : 25 signalements / heure / IP */
|
/* Connexion à la base (aucun anti-flood : l'API est ouverte par design) */
|
||||||
try {
|
try {
|
||||||
$pdo = fws_bugs_db();
|
$pdo = fws_bugs_db();
|
||||||
} catch (Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
@@ -111,11 +117,6 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ip = fws_bugs_client_ip();
|
$ip = fws_bugs_client_ip();
|
||||||
if (fws_bugs_count_recent_for_ip($pdo, $ip) >= 25) {
|
|
||||||
http_response_code(429);
|
|
||||||
echo json_encode(['ok' => false, 'error' => 'Trop de signalements depuis cette adresse, réessayez plus tard.'], JSON_UNESCAPED_UNICODE);
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Insertion — l'id repart de 1 et saute ceux déjà pris */
|
/* Insertion — l'id repart de 1 et saute ceux déjà pris */
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* FWS Linux — configuration locale des notifications Discord.
|
* FWS Linux — configuration locale des notifications Discord + build ISO.
|
||||||
*
|
*
|
||||||
* Copie ce fichier en « config.local.php » et remplis-le :
|
* Copie ce fichier en « config.local.php » et remplis-le :
|
||||||
*
|
*
|
||||||
@@ -22,12 +22,21 @@
|
|||||||
* (Activer le mode développeur Discord → réseau du navigateur, ou via un
|
* (Activer le mode développeur Discord → réseau du navigateur, ou via un
|
||||||
* outil type Discord API avec le bot).
|
* outil type Discord API avec le bot).
|
||||||
*
|
*
|
||||||
|
* 4) gitea_token (requis pour l'onglet « Build ISO ») : le dépôt
|
||||||
|
* D:\FWS-ISO est privé sur gitea.nocode-var.tech, et le build tourne dans
|
||||||
|
* un conteneur qui n'a pas tes identifiants Windows. Génère un token dans
|
||||||
|
* Gitea → Settings → Applications → Generate New Token (scope : lecture
|
||||||
|
* du dépôt / read:repository), puis colle-le ici.
|
||||||
|
* Le token n'est JAMAIS commité, ni affiché dans les logs du build.
|
||||||
|
*
|
||||||
* config.local.php n'est PAS commité (secret) — il est dans .gitignore.
|
* config.local.php n'est PAS commité (secret) — il est dans .gitignore.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
'webhook_url' => 'https://discord.com/api/webhooks/REMPLACE_PAR_ID/REMPLACE_PAR_TOKEN',
|
'webhook_url' => 'https://discord.com/api/webhooks/REMPLACE_PAR_ID/REMPLACE_PAR_TOKEN',
|
||||||
'bot_token' => '',
|
'bot_token' => '',
|
||||||
'tags' => [
|
'gitea_username' => '', // optionnel : nom du compte Gitea (défaut « fws »)
|
||||||
|
'gitea_token' => '', // token Gitea (lecture dépôt) pour le build ISO
|
||||||
|
'tags' => [
|
||||||
'nouveau' => '',
|
'nouveau' => '',
|
||||||
'en_cours' => '',
|
'en_cours' => '',
|
||||||
'resolu' => '',
|
'resolu' => '',
|
||||||
|
|||||||
@@ -2,3 +2,7 @@
|
|||||||
*.sqlite
|
*.sqlite
|
||||||
*.sqlite-wal
|
*.sqlite-wal
|
||||||
*.sqlite-shm
|
*.sqlite-shm
|
||||||
|
fws_bugs.sqlite
|
||||||
|
|
||||||
|
# Logs / états de l'onglet « Build ISO » (admin/bugs/build.php)
|
||||||
|
/build/
|
||||||
+223
-15
@@ -6,6 +6,40 @@
|
|||||||
|
|
||||||
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) ── */
|
||||||
|
|
||||||
|
if (!function_exists('fws_utf8_str')) {
|
||||||
|
/** UTF-8 valide obligatoire : les octets invalides (Windows-1252…) sont
|
||||||
|
* convertis, sinon json_encode échoue et casse tout l'appelant. */
|
||||||
|
function fws_utf8_str(string $s): string
|
||||||
|
{
|
||||||
|
if (mb_check_encoding($s, 'UTF-8')) {
|
||||||
|
return $s;
|
||||||
|
}
|
||||||
|
$conv = @mb_convert_encoding($s, 'UTF-8', 'Windows-1252');
|
||||||
|
return is_string($conv) ? $conv : (string) mb_convert_encoding($s, 'UTF-8', 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
function fws_utf8_arr(array $a): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ($a as $k => $v) {
|
||||||
|
if (is_array($v)) {
|
||||||
|
$out[$k] = fws_utf8_arr($v);
|
||||||
|
} elseif (is_string($v)) {
|
||||||
|
$out[$k] = fws_utf8_str($v);
|
||||||
|
} else {
|
||||||
|
$out[$k] = $v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function fws_bugs_db(): PDO
|
function fws_bugs_db(): PDO
|
||||||
{
|
{
|
||||||
static $pdo = null;
|
static $pdo = null;
|
||||||
@@ -18,7 +52,18 @@ function fws_bugs_db(): PDO
|
|||||||
mkdir($dir, 0775, true);
|
mkdir($dir, 0775, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pdo = new PDO('sqlite:' . $dir . '/fws_bugs.sqlite');
|
try {
|
||||||
|
$pdo = new PDO('sqlite:' . $dir . '/fws_bugs.sqlite');
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
/* Driver PDO SQLite absent (cas fréquent : WAMP/XAMPP où pdo_sqlite
|
||||||
|
et sqlite3 sont à activer dans php.ini). Message clair au lieu d'un
|
||||||
|
crash avec stack trace. */
|
||||||
|
throw new RuntimeException(
|
||||||
|
'Extension PDO SQLite indisponible : activez "extension=pdo_sqlite" et "extension=sqlite3" dans php.ini.',
|
||||||
|
0,
|
||||||
|
$e
|
||||||
|
);
|
||||||
|
}
|
||||||
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
$pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
@@ -98,6 +143,25 @@ function fws_bugs_schema(PDO $pdo): void
|
|||||||
)'
|
)'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/* Paquets du site (données gérées depuis le panneau admin) */
|
||||||
|
$pdo->exec(
|
||||||
|
'CREATE TABLE IF NOT EXISTS packages (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
slug TEXT NOT NULL DEFAULT \'\',
|
||||||
|
name TEXT NOT NULL DEFAULT \'\',
|
||||||
|
tagline TEXT NOT NULL DEFAULT \'\',
|
||||||
|
description TEXT NOT NULL DEFAULT \'\',
|
||||||
|
since TEXT,
|
||||||
|
since_label TEXT NOT NULL DEFAULT \'FWS\',
|
||||||
|
latest_name TEXT NOT NULL DEFAULT \'\',
|
||||||
|
latest_date TEXT,
|
||||||
|
links TEXT NOT NULL DEFAULT \'[]\',
|
||||||
|
screens TEXT NOT NULL DEFAULT \'[]\',
|
||||||
|
changelog TEXT NOT NULL DEFAULT \'[]\',
|
||||||
|
updated_at TEXT NOT NULL DEFAULT (datetime(\'now\'))
|
||||||
|
)'
|
||||||
|
);
|
||||||
|
|
||||||
/* Schéma (re)créé : s'assurer que le fichier reste inscriptible par Apache */
|
/* Schéma (re)créé : s'assurer que le fichier reste inscriptible par Apache */
|
||||||
@chmod(__DIR__ . '/data/fws_bugs.sqlite', 0666);
|
@chmod(__DIR__ . '/data/fws_bugs.sqlite', 0666);
|
||||||
}
|
}
|
||||||
@@ -108,7 +172,7 @@ function fws_bugs_schema(PDO $pdo): void
|
|||||||
*/
|
*/
|
||||||
function fws_bugs_next_id(PDO $pdo, string $table): int
|
function fws_bugs_next_id(PDO $pdo, string $table): int
|
||||||
{
|
{
|
||||||
if (!in_array($table, ['bug_reports', 'admin_users', 'invite_codes'], true)) {
|
if (!in_array($table, ['bug_reports', 'admin_users', 'invite_codes', 'packages'], true)) {
|
||||||
throw new InvalidArgumentException('Table inconnue : ' . $table);
|
throw new InvalidArgumentException('Table inconnue : ' . $table);
|
||||||
}
|
}
|
||||||
$used = [];
|
$used = [];
|
||||||
@@ -172,19 +236,6 @@ function fws_bugs_save_discord_info(PDO $pdo, int $id, string $threadId, string
|
|||||||
$st->execute([':t' => $threadId, ':u' => $postUrl, ':id' => $id]);
|
$st->execute([':t' => $threadId, ':u' => $postUrl, ':id' => $id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Nombre de signalements pour une IP sur la dernière heure (anti-flood).
|
|
||||||
*/
|
|
||||||
function fws_bugs_count_recent_for_ip(PDO $pdo, string $ip): int
|
|
||||||
{
|
|
||||||
$st = $pdo->prepare(
|
|
||||||
"SELECT COUNT(*) FROM bug_reports
|
|
||||||
WHERE ip = :ip AND created_at > datetime('now', '-1 hour')"
|
|
||||||
);
|
|
||||||
$st->execute([':ip' => $ip]);
|
|
||||||
return (int) $st->fetchColumn();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IP réelle en tenant compte du proxy (X-Forwarded-For).
|
* IP réelle en tenant compte du proxy (X-Forwarded-For).
|
||||||
*/
|
*/
|
||||||
@@ -200,3 +251,160 @@ function fws_bugs_client_ip(): string
|
|||||||
}
|
}
|
||||||
return substr((string) ($_SERVER['REMOTE_ADDR'] ?? ''), 0, 64);
|
return substr((string) ($_SERVER['REMOTE_ADDR'] ?? ''), 0, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Comptes autorisés à lancer un build ISO (onglet « Build ISO » du panneau).
|
||||||
|
* Le build pilote le moteur Docker : à n'accorder qu'aux comptes de confiance.
|
||||||
|
*/
|
||||||
|
function fws_bugs_can_build(string $username): bool
|
||||||
|
{
|
||||||
|
return in_array(strtolower(trim($username)), ['admin'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ───────────────────────── paquets du site ───────────────────────── */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convertit une ligne brute de la table `packages` au format JSON
|
||||||
|
* utilisé par le site (identique à l'ancien packages.json).
|
||||||
|
*/
|
||||||
|
function fws_packages_row_to_json(array $r): array
|
||||||
|
{
|
||||||
|
$latest = null;
|
||||||
|
if ((string) ($r['latest_name'] ?? '') !== '') {
|
||||||
|
$latest = [
|
||||||
|
'name' => fws_utf8_str((string) $r['latest_name']),
|
||||||
|
'date' => ($r['latest_date'] ?? null) !== null ? fws_utf8_str((string) $r['latest_date']) : null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return fws_utf8_arr([
|
||||||
|
'id' => (string) $r['slug'],
|
||||||
|
'name' => (string) $r['name'],
|
||||||
|
'tagline' => (string) $r['tagline'],
|
||||||
|
'description' => (string) $r['description'],
|
||||||
|
'since' => ($r['since'] ?? null) !== null ? (string) $r['since'] : null,
|
||||||
|
'sinceLabel' => (string) ($r['since_label'] ?? 'FWS'),
|
||||||
|
'latest' => $latest,
|
||||||
|
'links' => json_decode((string) $r['links'], true) ?: [],
|
||||||
|
'screens' => json_decode((string) $r['screens'], true) ?: [],
|
||||||
|
'changelog' => json_decode((string) $r['changelog'], true) ?: [],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tous les paquets, ordonnés par id (l'ordre = la position sur le site,
|
||||||
|
* ex : /?p/paquets/1/ est l'id 1).
|
||||||
|
*/
|
||||||
|
function fws_packages_all(PDO $pdo): array
|
||||||
|
{
|
||||||
|
$out = [];
|
||||||
|
foreach ($pdo->query('SELECT * FROM packages ORDER BY id ASC') as $r) {
|
||||||
|
$out[] = fws_packages_row_to_json($r);
|
||||||
|
}
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enregistre un paquet (insert si id = 0, sinon update).
|
||||||
|
* Les colonnes JSON (links, screens, changelog) sont passées en tableaux PHP.
|
||||||
|
*/
|
||||||
|
function fws_packages_save(PDO $pdo, array $d): int
|
||||||
|
{
|
||||||
|
$id = (int) ($d['id'] ?? 0);
|
||||||
|
$slug = trim((string) ($d['slug'] ?? ''));
|
||||||
|
if ($slug === '') {
|
||||||
|
$slug = trim(preg_replace('/[^a-zA-Z0-9]+/', '-', (string) ($d['name'] ?? '')) ?? '', '-');
|
||||||
|
}
|
||||||
|
$sinceLabel = trim((string) ($d['since_label'] ?? ''));
|
||||||
|
if ($sinceLabel === '') {
|
||||||
|
$sinceLabel = 'FWS';
|
||||||
|
}
|
||||||
|
$data = [
|
||||||
|
':slug' => fws_utf8_str($slug),
|
||||||
|
':name' => fws_utf8_str(trim((string) ($d['name'] ?? ''))),
|
||||||
|
':tagline' => fws_utf8_str(trim((string) ($d['tagline'] ?? ''))),
|
||||||
|
':description' => fws_utf8_str(trim((string) ($d['description'] ?? ''))),
|
||||||
|
':since' => ($d['since'] ?? '') !== '' ? (string) $d['since'] : null,
|
||||||
|
':since_label' => fws_utf8_str($sinceLabel),
|
||||||
|
':latest_name' => fws_utf8_str(trim((string) ($d['latest_name'] ?? ''))),
|
||||||
|
':latest_date' => ($d['latest_date'] ?? '') !== '' ? (string) $d['latest_date'] : null,
|
||||||
|
':links' => (string) json_encode(fws_utf8_arr((array) ($d['links'] ?? [])), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
|
||||||
|
/* 5 captures maximum par paquet (gardée de force côté serveur). */
|
||||||
|
':screens' => (string) json_encode(array_slice(fws_utf8_arr((array) ($d['screens'] ?? [])), 0, 5), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
|
||||||
|
':changelog' => (string) json_encode(fws_utf8_arr((array) ($d['changelog'] ?? [])), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($id > 0) {
|
||||||
|
$data[':id'] = $id;
|
||||||
|
$st = $pdo->prepare(
|
||||||
|
'UPDATE packages SET slug = :slug, name = :name, tagline = :tagline,
|
||||||
|
description = :description, since = :since, since_label = :since_label,
|
||||||
|
latest_name = :latest_name, latest_date = :latest_date,
|
||||||
|
links = :links, screens = :screens, changelog = :changelog,
|
||||||
|
updated_at = datetime(\'now\') WHERE id = :id'
|
||||||
|
);
|
||||||
|
$st->execute($data);
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$id = fws_bugs_next_id($pdo, 'packages');
|
||||||
|
$data[':id'] = $id;
|
||||||
|
$st = $pdo->prepare(
|
||||||
|
'INSERT INTO packages (id, slug, name, tagline, description, since, since_label,
|
||||||
|
latest_name, latest_date, links, screens, changelog)
|
||||||
|
VALUES (:id, :slug, :name, :tagline, :description, :since, :since_label,
|
||||||
|
:latest_name, :latest_date, :links, :screens, :changelog)'
|
||||||
|
);
|
||||||
|
$st->execute($data);
|
||||||
|
return $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supprime un paquet (l'id pourra être réutilisé ensuite).
|
||||||
|
*/
|
||||||
|
function fws_packages_delete(PDO $pdo, int $id): void
|
||||||
|
{
|
||||||
|
$st = $pdo->prepare('DELETE FROM packages WHERE id = :id');
|
||||||
|
$st->execute([':id' => $id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import initial : si la table `packages` est vide et que l'ancien
|
||||||
|
* packages.json existe toujours, on l'importe une seule fois.
|
||||||
|
*/
|
||||||
|
function fws_packages_seed_if_empty(PDO $pdo): int
|
||||||
|
{
|
||||||
|
$count = (int) $pdo->query('SELECT COUNT(*) FROM packages')->fetchColumn();
|
||||||
|
if ($count > 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
$file = dirname(__DIR__) . '/../p/paquets/packages.json';
|
||||||
|
if (!is_file($file)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
$data = json_decode((string) file_get_contents($file), true);
|
||||||
|
if (!is_array($data)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
$n = 0;
|
||||||
|
foreach ($data as $p) {
|
||||||
|
if (!is_array($p)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
fws_packages_save($pdo, [
|
||||||
|
'id' => 0,
|
||||||
|
'slug' => (string) ($p['id'] ?? ''),
|
||||||
|
'name' => (string) ($p['name'] ?? ''),
|
||||||
|
'tagline' => (string) ($p['tagline'] ?? ''),
|
||||||
|
'description' => (string) ($p['description'] ?? ''),
|
||||||
|
'since' => (string) ($p['since'] ?? ''),
|
||||||
|
'since_label' => (string) ($p['sinceLabel'] ?? 'FWS'),
|
||||||
|
'latest_name' => (string) ($p['latest']['name'] ?? ''),
|
||||||
|
'latest_date' => (string) ($p['latest']['date'] ?? ''),
|
||||||
|
'links' => $p['links'] ?? [],
|
||||||
|
'screens' => $p['screens'] ?? [],
|
||||||
|
'changelog' => $p['changelog'] ?? [],
|
||||||
|
]);
|
||||||
|
$n++;
|
||||||
|
}
|
||||||
|
return $n;
|
||||||
|
}
|
||||||
+31
-22
@@ -207,6 +207,21 @@ function fws_bugs_discord_ensure_tags(): array
|
|||||||
return $tags;
|
return $tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Envoie un morceau de logs dans le fil, encadré pour rester sous la limite
|
||||||
|
* Discord. Renvoie false si Discord refuse.
|
||||||
|
*/
|
||||||
|
function fws_bugs_discord_send_log_chunk(string $msgUrl, string $chunk): bool
|
||||||
|
{
|
||||||
|
/* Pas d'en-tête « Logs (N/M) » : chaque message aligne la suite
|
||||||
|
des logs, ce qui donne un fil continu dans le post. */
|
||||||
|
$body = str_contains($chunk, '```') ? $chunk : "```\n" . $chunk . "\n```";
|
||||||
|
if (mb_strlen($body) > 1990) {
|
||||||
|
$body = mb_substr($body, 0, 1990);
|
||||||
|
}
|
||||||
|
return fws_bugs_discord_api('POST', $msgUrl, ['content' => $body]) !== null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Crée le post dans le canal forum et y envoie le résumé + les logs.
|
* Crée le post dans le canal forum et y envoie le résumé + les logs.
|
||||||
* Best-effort : ne renvoie jamais d'erreur.
|
* Best-effort : ne renvoie jamais d'erreur.
|
||||||
@@ -282,33 +297,27 @@ function fws_bugs_discord_notify(array $bug): ?array
|
|||||||
/* ── Logs par morceaux (1900 car. max, 12 messages max) ── */
|
/* ── Logs par morceaux (1900 car. max, 12 messages max) ── */
|
||||||
$logs = trim((string) ($bug['logs'] ?? ''));
|
$logs = trim((string) ($bug['logs'] ?? ''));
|
||||||
if ($logs !== '') {
|
if ($logs !== '') {
|
||||||
$chunks = [];
|
/* L'API accepte des logs de taille illimitée : on découpe donc à la
|
||||||
$cur = '';
|
volée et on s'arrête dès que le quota de messages est atteint, au
|
||||||
|
lieu de construire le tableau complet en mémoire. */
|
||||||
|
$msgUrl = $base . '?thread_id=' . $threadId;
|
||||||
|
$maxMsgs = 12;
|
||||||
|
$sent = 0;
|
||||||
|
$cur = '';
|
||||||
foreach (preg_split('/\r?\n/', $logs) as $line) {
|
foreach (preg_split('/\r?\n/', $logs) as $line) {
|
||||||
if ($cur !== '' && mb_strlen($cur) + mb_strlen($line) + 1 > 1850) {
|
if ($cur !== '' && mb_strlen($cur) + mb_strlen($line) + 1 > 1850) {
|
||||||
$chunks[] = $cur;
|
if (!fws_bugs_discord_send_log_chunk($msgUrl, $cur)) {
|
||||||
$cur = '';
|
break; // Discord refuse → on s'arrête proprement
|
||||||
|
}
|
||||||
|
$cur = '';
|
||||||
|
if (++$sent >= $maxMsgs) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$cur .= ($cur === '' ? '' : "\n") . $line;
|
$cur .= ($cur === '' ? '' : "\n") . $line;
|
||||||
}
|
}
|
||||||
if ($cur !== '') {
|
if ($cur !== '' && $sent < $maxMsgs) {
|
||||||
$chunks[] = $cur;
|
fws_bugs_discord_send_log_chunk($msgUrl, $cur);
|
||||||
}
|
|
||||||
|
|
||||||
$msgUrl = $base . '?thread_id=' . $threadId;
|
|
||||||
$maxMsgs = 12;
|
|
||||||
foreach (array_slice($chunks, 0, $maxMsgs) as $chunk) {
|
|
||||||
/* Pas d'en-tête « Logs (N/M) » : chaque message aligne la suite
|
|
||||||
des logs, ce qui donne un fil continu dans le post. */
|
|
||||||
$body = str_contains($chunk, '```')
|
|
||||||
? $chunk
|
|
||||||
: "```\n" . $chunk . "\n```";
|
|
||||||
if (mb_strlen($body) > 1990) {
|
|
||||||
$body = mb_substr($body, 0, 1990);
|
|
||||||
}
|
|
||||||
if (fws_bugs_discord_api('POST', $msgUrl, ['content' => $body]) === null) {
|
|
||||||
break; // Discord refuse → on s'arrête proprement
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — API publique des paquets.
|
||||||
|
*
|
||||||
|
* GET /api/packages.php → liste des paquets au même format que
|
||||||
|
* l'ancien p/paquets/packages.json (consommée par packages.js).
|
||||||
|
*
|
||||||
|
* Les données sont stockées dans la base SQLite partagée (api/bugs/data/)
|
||||||
|
* et modifiables depuis le panneau admin (admin/bugs/index.php?view=packages).
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require __DIR__ . '/bugs/db.php';
|
||||||
|
|
||||||
|
try {
|
||||||
|
$pdo = fws_bugs_db();
|
||||||
|
/* Premier démarrage : la table est vide → on importe packages.json une fois. */
|
||||||
|
fws_packages_seed_if_empty($pdo);
|
||||||
|
$packages = fws_packages_all($pdo);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
error_log('[fws-packages] ' . $e->getMessage());
|
||||||
|
http_response_code(500);
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
echo json_encode(['ok' => false, 'error' => 'Erreur base de données.']);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
echo json_encode($packages, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
|
||||||
+243
@@ -0,0 +1,243 @@
|
|||||||
|
<?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);
|
||||||
|
|
||||||
|
/* ── Base URL (Windows : WAMP/XAMPP servent le site depuis un sous-dossier de
|
||||||
|
* www, ex /FWS-Website/ ; Linux : racine du domaine). Calculée une fois,
|
||||||
|
* depuis SCRIPT_NAME — indépendant du point d'entrée (page.php, index.php,
|
||||||
|
* /p/dl/, admin/…). Toutes les URLs du site passent par fws_url()/fws_asset().
|
||||||
|
*/
|
||||||
|
if (!function_exists('fws_base_url')) {
|
||||||
|
function fws_base_url(): string
|
||||||
|
{
|
||||||
|
static $base = null;
|
||||||
|
if ($base !== null) {
|
||||||
|
return $base;
|
||||||
|
}
|
||||||
|
$script = str_replace('\\', '/', (string) ($_SERVER['SCRIPT_NAME'] ?? ''));
|
||||||
|
$dir = rtrim(str_replace('\\', '/', (string) dirname($script)), '/');
|
||||||
|
/* Le site est déployé à la racine du domaine : les dossiers sensibles
|
||||||
|
(inc, api, admin, cache, p/<route>) sont forcément à la racine.
|
||||||
|
Sinon, on est servi depuis un sous-dossier (WAMP : /FWS-Website). */
|
||||||
|
if (preg_match('~/((?:inc|api|admin|cache)|p/(?:index|dl|paquets|equipe|contact|assets))(?:/|$)~', $dir, $m)) {
|
||||||
|
$base = substr($dir, 0, (int) strrpos($dir, $m[0]));
|
||||||
|
} else {
|
||||||
|
$base = $dir;
|
||||||
|
}
|
||||||
|
return $base;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!function_exists('fws_url')) {
|
||||||
|
/** URL d'une route ou d'un asset local, préfixée par la base URL. */
|
||||||
|
function fws_url(string $path): string
|
||||||
|
{
|
||||||
|
if ($path === '' || preg_match('~^(?:[a-z][a-z0-9+.-]*:|//)~i', $path)) {
|
||||||
|
return $path; /* absolu, mailto:, tel:, //… : inchangé */
|
||||||
|
}
|
||||||
|
$base = fws_base_url();
|
||||||
|
if ($base !== '' && ($path === $base || str_starts_with($path, $base . '/'))) {
|
||||||
|
return $path; /* déjà préfixé (idempotence) */
|
||||||
|
}
|
||||||
|
return $base . '/' . ltrim($path, '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Portabilité : polyfills mbstring ──────────────────────────────────────
|
||||||
|
* L'extension mbstring est absente de certaines installations PHP de Windows
|
||||||
|
* (et de quelques images Docker minimales). Le site doit tourner quand même :
|
||||||
|
* on fournit des équivalents UTF-8 corrects pour les 4 fonctions mb_* du
|
||||||
|
* projet. Si mbstring est présente (cas Linux standard), on n'y touche pas.
|
||||||
|
*/
|
||||||
|
if (!function_exists('mb_strlen')) {
|
||||||
|
function fws_mb_chars(string $s): array
|
||||||
|
{
|
||||||
|
$c = preg_split('//u', $s, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
return is_array($c) ? $c : ((str_split($s) === false) ? [] : str_split($s));
|
||||||
|
}
|
||||||
|
function mb_strlen(string $s, ?string $enc = null): int
|
||||||
|
{
|
||||||
|
return count(fws_mb_chars($s));
|
||||||
|
}
|
||||||
|
function mb_substr(string $s, int $start, ?int $len = null, ?string $enc = null): string
|
||||||
|
{
|
||||||
|
$c = fws_mb_chars($s);
|
||||||
|
$n = count($c);
|
||||||
|
if ($start < 0) {
|
||||||
|
$start = max(0, $n + $start);
|
||||||
|
}
|
||||||
|
if ($len === null) {
|
||||||
|
$len = $n;
|
||||||
|
} elseif ($len < 0) {
|
||||||
|
$len = max(0, $n - $start + $len);
|
||||||
|
}
|
||||||
|
return implode('', array_slice($c, $start, $len));
|
||||||
|
}
|
||||||
|
function mb_check_encoding(string $s, ?string $enc = null): bool
|
||||||
|
{
|
||||||
|
return (bool) preg_match('//u', $s);
|
||||||
|
}
|
||||||
|
function mb_convert_encoding(string $s, string $to, ?string $from = null): string
|
||||||
|
{
|
||||||
|
if (function_exists('iconv') && strcasecmp($to, 'UTF-8') === 0) {
|
||||||
|
$conv = @iconv((string) $from, 'UTF-8//TRANSLIT//IGNORE', $s);
|
||||||
|
if (is_string($conv)) {
|
||||||
|
return $conv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Dernier recours : on retire les octets qui cassent l'UTF-8. */
|
||||||
|
$clean = preg_replace('/[\x80-\xFF]+/', '?', $s);
|
||||||
|
return is_string($clean) ? $clean : $s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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();
|
||||||
+625
@@ -0,0 +1,625 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — bibliothèque du site.
|
||||||
|
*
|
||||||
|
* Tout est rendu côté serveur (PHP) : les pages sont de vraies pages HTML.
|
||||||
|
* Les données viennent de la base SQLite (paquets, modifiables dans
|
||||||
|
* /admin/bugs) et des API Gitea / GitHub (releases, avec cache fichier).
|
||||||
|
*/
|
||||||
|
|
||||||
|
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_CACHE_DIR', FWS_SITE_ROOT . '/cache');
|
||||||
|
define('FWS_SITE_CACHE_TTL', 600); // 10 minutes
|
||||||
|
|
||||||
|
/* ───────────────────────── utilitaires ───────────────────────── */
|
||||||
|
|
||||||
|
/** Échappement HTML. */
|
||||||
|
function e(?string $s): string
|
||||||
|
{
|
||||||
|
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 fws_url($path) . ($mtime ? '?v=' . $mtime : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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
|
||||||
|
sont donc disponibles quel que soit l'ordre d'inclusion. */
|
||||||
|
|
||||||
|
/** Date ISO → « 29 août 2026 » (ou la valeur brute si non parsable). */
|
||||||
|
function fws_format_date(?string $iso): string
|
||||||
|
{
|
||||||
|
if ($iso === null || trim($iso) === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
static $mois = [
|
||||||
|
1 => 'janvier', 'février', 'mars', 'avril', 'mai', 'juin',
|
||||||
|
'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre',
|
||||||
|
];
|
||||||
|
try {
|
||||||
|
$d = new DateTimeImmutable($iso);
|
||||||
|
return trim($d->format('j')) . ' ' . $mois[(int) $d->format('n')] . ' ' . $d->format('Y');
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
return $iso;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ───────────────────────── paquets (base SQLite) ───────────────────────── */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connexion à la base du site (celle des bugs, partagée). Renvoie null si la
|
||||||
|
* base n'est pas disponible : le site doit rester fonctionnel sans DB.
|
||||||
|
*/
|
||||||
|
function fws_site_db(): ?PDO
|
||||||
|
{
|
||||||
|
static $pdo = null;
|
||||||
|
static $failed = false;
|
||||||
|
if ($pdo instanceof PDO || $failed) {
|
||||||
|
return $failed ? null : $pdo;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
require_once __DIR__ . '/../api/bugs/db.php';
|
||||||
|
$pdo = fws_bugs_db();
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
error_log('[fws-site] base indisponible : ' . $e->getMessage());
|
||||||
|
$failed = true;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return $pdo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Paquets du site : base SQLite (source de vérité, éditable dans /admin/bugs)
|
||||||
|
* avec repli sur p/paquets/packages.json si la base est vide ou absente.
|
||||||
|
* Chaque entrée est nettoyée (UTF-8 valide) pour ne jamais casser json_encode
|
||||||
|
* ni le rendu HTML.
|
||||||
|
*/
|
||||||
|
function fws_site_packages(): array
|
||||||
|
{
|
||||||
|
static $cache = null;
|
||||||
|
if ($cache !== null) {
|
||||||
|
return $cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
$out = [];
|
||||||
|
|
||||||
|
$pdo = fws_site_db();
|
||||||
|
if ($pdo !== null) {
|
||||||
|
try {
|
||||||
|
$has = $pdo->query(
|
||||||
|
"SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='packages'"
|
||||||
|
)->fetchColumn();
|
||||||
|
if ((int) $has > 0) {
|
||||||
|
foreach ($pdo->query('SELECT * FROM packages ORDER BY id ASC') as $r) {
|
||||||
|
$out[] = fws_site_package_row($r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
error_log('[fws-site] lecture paquets : ' . $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Repli : l'ancien fichier JSON (avant la DB, ou base vide). */
|
||||||
|
if ($out === []) {
|
||||||
|
/* dbId = 0 : les URLs /?p/paquets/N/ se rabattent sur la position. */
|
||||||
|
$file = FWS_SITE_ROOT . '/p/paquets/packages.json';
|
||||||
|
if (is_file($file)) {
|
||||||
|
$data = json_decode((string) file_get_contents($file), true);
|
||||||
|
if (is_array($data)) {
|
||||||
|
foreach ($data as $p) {
|
||||||
|
if (is_array($p)) {
|
||||||
|
$out[] = fws_site_package_shape($p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Release + historique tirés de Gitea (URL des liens du paquet). */
|
||||||
|
foreach ($out as $i => $pkg) {
|
||||||
|
$out[$i] = fws_site_package_with_releases($pkg);
|
||||||
|
}
|
||||||
|
|
||||||
|
$cache = $out;
|
||||||
|
return $cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Normalise un paquet quelconque (JSON ou DB) vers la forme du site.
|
||||||
|
* « dbId » = identifiant en base (0 si venant du fichier JSON de repli) :
|
||||||
|
* c'est lui qui pilote les URLs /?p/paquets/N/. */
|
||||||
|
function fws_site_package_shape(array $p): array
|
||||||
|
{
|
||||||
|
return fws_utf8_arr([
|
||||||
|
'id' => (string) ($p['id'] ?? ''),
|
||||||
|
'name' => (string) ($p['name'] ?? ''),
|
||||||
|
'tagline' => (string) ($p['tagline'] ?? ''),
|
||||||
|
'description' => (string) ($p['description'] ?? ''),
|
||||||
|
'since' => (string) ($p['since'] ?? '') !== '' ? (string) $p['since'] : null,
|
||||||
|
'sinceLabel' => (string) ($p['sinceLabel'] ?? 'FWS'),
|
||||||
|
'latest' => isset($p['latest']) && is_array($p['latest'])
|
||||||
|
? [
|
||||||
|
'name' => (string) ($p['latest']['name'] ?? ''),
|
||||||
|
'date' => (string) ($p['latest']['date'] ?? '') !== '' ? (string) $p['latest']['date'] : null,
|
||||||
|
]
|
||||||
|
: null,
|
||||||
|
'links' => is_array($p['links'] ?? null) ? array_values($p['links']) : [],
|
||||||
|
'screens' => is_array($p['screens'] ?? null) ? array_values($p['screens']) : [],
|
||||||
|
'changelog' => is_array($p['changelog'] ?? null) ? array_values($p['changelog']) : [],
|
||||||
|
'dbId' => (int) ($p['dbId'] ?? 0),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Ligne brute DB → forme du site (même format que l'ancien packages.json). */
|
||||||
|
function fws_site_package_row(array $r): array
|
||||||
|
{
|
||||||
|
return fws_site_package_shape([
|
||||||
|
'dbId' => (int) ($r['id'] ?? 0),
|
||||||
|
'id' => $r['slug'] ?? '',
|
||||||
|
'name' => $r['name'] ?? '',
|
||||||
|
'tagline' => $r['tagline'] ?? '',
|
||||||
|
'description' => $r['description'] ?? '',
|
||||||
|
'since' => $r['since'] ?? null,
|
||||||
|
'sinceLabel' => $r['since_label'] ?? 'FWS',
|
||||||
|
'latest' => [
|
||||||
|
'name' => $r['latest_name'] ?? '',
|
||||||
|
'date' => $r['latest_date'] ?? '',
|
||||||
|
],
|
||||||
|
'links' => json_decode((string) ($r['links'] ?? '[]'), true) ?: [],
|
||||||
|
'screens' => json_decode((string) ($r['screens'] ?? '[]'), true) ?: [],
|
||||||
|
'changelog' => json_decode((string) ($r['changelog'] ?? '[]'), true) ?: [],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enrichit un paquet avec les releases Gitea (à partir de l'URL « Releases »
|
||||||
|
* ou « Gitea » de ses liens) : latest + changelog réels, en cache fichier.
|
||||||
|
*/
|
||||||
|
function fws_site_package_with_releases(array $pkg): array
|
||||||
|
{
|
||||||
|
$repo = fws_site_gitea_repo_from_links($pkg['links'] ?? []);
|
||||||
|
if ($repo === null) {
|
||||||
|
return $pkg;
|
||||||
|
}
|
||||||
|
|
||||||
|
$releases = fws_site_gitea_releases($repo['owner'], $repo['name']);
|
||||||
|
if ($releases === []) {
|
||||||
|
/* Pas de release Gitea : on garde latest/changelog de la DB. */
|
||||||
|
return $pkg;
|
||||||
|
}
|
||||||
|
|
||||||
|
$first = $releases[0];
|
||||||
|
$pkg['latest'] = [
|
||||||
|
'name' => (string) ($first['tag_name'] ?? ''),
|
||||||
|
'date' => isset($first['published_at']) ? substr((string) $first['published_at'], 0, 10) : null,
|
||||||
|
];
|
||||||
|
|
||||||
|
$changelog = [];
|
||||||
|
foreach ($releases as $rel) {
|
||||||
|
$notes = trim(strip_tags((string) fws_markdown((string) ($rel['body'] ?? ''))));
|
||||||
|
if (mb_strlen($notes) > 200) {
|
||||||
|
$notes = rtrim(mb_substr($notes, 0, 200)) . '…';
|
||||||
|
}
|
||||||
|
$changelog[] = [
|
||||||
|
'version' => (string) ($rel['tag_name'] ?? ''),
|
||||||
|
'date' => isset($rel['published_at']) ? substr((string) $rel['published_at'], 0, 10) : null,
|
||||||
|
'notes' => $notes !== '' ? $notes : '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$pkg['changelog'] = $changelog;
|
||||||
|
|
||||||
|
return $pkg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Trouve owner/name du dépôt Gitea dans les liens d'un paquet (null sinon). */
|
||||||
|
function fws_site_gitea_repo_from_links(array $links): ?array
|
||||||
|
{
|
||||||
|
foreach ($links as $link) {
|
||||||
|
$url = (string) ($link['url'] ?? '');
|
||||||
|
if (preg_match('~^https?://gitea\.nocode-var\.tech/([^/]+)/([^/]+)/?$~i', $url, $m)) {
|
||||||
|
return ['owner' => $m[1], 'name' => $m[2]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ───────────────────────── HTTP + cache fichier ───────────────────────── */
|
||||||
|
|
||||||
|
/** GET JSON avec cache fichier (cache/ gitignoré) ; [] en cas d'échec. */
|
||||||
|
function fws_site_fetch_json(string $url, array $headers = []): array
|
||||||
|
{
|
||||||
|
$key = 'http_' . sha1($url);
|
||||||
|
$file = FWS_SITE_CACHE_DIR . '/' . $key . '.json';
|
||||||
|
|
||||||
|
if (is_file($file) && (time() - (int) filemtime($file)) < FWS_SITE_CACHE_TTL) {
|
||||||
|
$data = json_decode((string) file_get_contents($file), true);
|
||||||
|
if (is_array($data)) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cacheOk = is_dir(FWS_SITE_CACHE_DIR) || @mkdir(FWS_SITE_CACHE_DIR, 0777, true);
|
||||||
|
if ($cacheOk && !is_writable(FWS_SITE_CACHE_DIR)) {
|
||||||
|
@chmod(FWS_SITE_CACHE_DIR, 0777);
|
||||||
|
$cacheOk = is_writable(FWS_SITE_CACHE_DIR);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data = [];
|
||||||
|
if (function_exists('curl_init')) {
|
||||||
|
$ch = curl_init($url);
|
||||||
|
$allHeaders = ['Accept: application/json', 'User-Agent: FWS-Linux-Website'];
|
||||||
|
foreach ($headers as $h) {
|
||||||
|
$allHeaders[] = $h;
|
||||||
|
}
|
||||||
|
curl_setopt_array($ch, [
|
||||||
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
|
CURLOPT_TIMEOUT => 8,
|
||||||
|
CURLOPT_CONNECTTIMEOUT => 4,
|
||||||
|
CURLOPT_HTTPHEADER => $allHeaders,
|
||||||
|
CURLOPT_FOLLOWLOCATION => true,
|
||||||
|
]);
|
||||||
|
$body = curl_exec($ch);
|
||||||
|
$code = (int) curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
|
||||||
|
curl_close($ch);
|
||||||
|
if (is_string($body) && $code >= 200 && $code < 300) {
|
||||||
|
$decoded = json_decode($body, true);
|
||||||
|
if (is_array($decoded)) {
|
||||||
|
$data = $decoded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$cacheOk) {
|
||||||
|
/* Répertoire de cache non accessible (droits) : on répond quand même,
|
||||||
|
simplement sans persistance entre les requêtes. */
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($data !== []) {
|
||||||
|
@file_put_contents($file, json_encode($data, JSON_UNESCAPED_UNICODE), LOCK_EX);
|
||||||
|
} elseif (is_file($file)) {
|
||||||
|
/* API injoignable : on sert le dernier cache connu (périmé mais mieux que rien). */
|
||||||
|
$data = json_decode((string) file_get_contents($file), true) ?: [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Releases d'un dépôt Gitea (les plus récentes d'abord). */
|
||||||
|
function fws_site_gitea_releases(string $owner, string $name): array
|
||||||
|
{
|
||||||
|
static $memo = [];
|
||||||
|
$key = $owner . '/' . $name;
|
||||||
|
if (isset($memo[$key])) {
|
||||||
|
return $memo[$key];
|
||||||
|
}
|
||||||
|
$url = 'https://gitea.nocode-var.tech/api/v1/repos/'
|
||||||
|
. rawurlencode($owner) . '/' . rawurlencode($name) . '/releases?limit=10';
|
||||||
|
$data = fws_site_fetch_json($url);
|
||||||
|
$out = [];
|
||||||
|
/* L'API renvoie un tableau, ou {message:...} si le dépôt n'existe pas. */
|
||||||
|
if (isset($data[0]) && is_array($data[0]) && isset($data[0]['tag_name'])) {
|
||||||
|
foreach ($data as $rel) {
|
||||||
|
if (is_array($rel) && isset($rel['tag_name'])) {
|
||||||
|
$out[] = $rel;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$memo[$key] = $out;
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ───────────────────────── releases ISO (page Téléchargements) ─────────── */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Releases de l'ISO pour la page Téléchargements : Gitea FWS/ISO s'il existe,
|
||||||
|
* sinon GitHub (comme avant). Renvoie ['mode' => 'gitea'|'github'|'none', 'items' => [...]].
|
||||||
|
*/
|
||||||
|
function fws_site_iso_releases(): array
|
||||||
|
{
|
||||||
|
$gitea = fws_site_gitea_releases('FWS', 'ISO');
|
||||||
|
if ($gitea !== []) {
|
||||||
|
return ['mode' => 'gitea', 'items' => $gitea];
|
||||||
|
}
|
||||||
|
|
||||||
|
$gh = fws_site_fetch_json(
|
||||||
|
'https://api.github.com/repos/You-re-like-Windows-a-bitch/ISO/releases?per_page=6',
|
||||||
|
['Accept: application/vnd.github+json']
|
||||||
|
);
|
||||||
|
if (isset($gh[0]) && is_array($gh[0]) && isset($gh[0]['tag_name'])) {
|
||||||
|
return ['mode' => 'github', 'items' => $gh];
|
||||||
|
}
|
||||||
|
|
||||||
|
$tags = fws_site_fetch_json(
|
||||||
|
'https://api.github.com/repos/You-re-like-Windows-a-bitch/ISO/tags?per_page=6',
|
||||||
|
['Accept: application/vnd.github+json']
|
||||||
|
);
|
||||||
|
if (isset($tags[0]) && is_array($tags[0]) && isset($tags[0]['name'])) {
|
||||||
|
return ['mode' => 'tags', 'items' => $tags];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ['mode' => 'none', 'items' => []];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Libellé d'une release (Gitea : « name » sinon tag ; GitHub : idem). */
|
||||||
|
function fws_site_release_label(array $rel): string
|
||||||
|
{
|
||||||
|
$name = trim((string) ($rel['name'] ?? ''));
|
||||||
|
$tag = (string) ($rel['tag_name'] ?? ($rel['ref'] ?? ''));
|
||||||
|
return $name !== '' ? $name : ($tag !== '' ? $tag : 'Sans nom');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** URL de téléchargement directe d'une release (asset .iso sinon page). */
|
||||||
|
function fws_site_release_download_url(array $rel): string
|
||||||
|
{
|
||||||
|
$assets = $rel['assets'] ?? [];
|
||||||
|
if (is_array($assets)) {
|
||||||
|
foreach ($assets as $asset) {
|
||||||
|
if (is_array($asset)
|
||||||
|
&& preg_match('/\.iso$/i', (string) ($asset['name'] ?? ''))
|
||||||
|
&& isset($asset['browser_download_url'])) {
|
||||||
|
return (string) $asset['browser_download_url'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($assets as $asset) {
|
||||||
|
if (is_array($asset) && isset($asset['browser_download_url'])) {
|
||||||
|
return (string) $asset['browser_download_url'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (string) ($rel['html_url'] ?? ($rel['zipball_url'] ?? '#'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Date de publication d'une release (date ISO brute, sans l'heure). */
|
||||||
|
function fws_site_release_date(array $rel): ?string
|
||||||
|
{
|
||||||
|
foreach (['published_at', 'created_at'] as $k) {
|
||||||
|
if (!empty($rel[$k])) {
|
||||||
|
return substr((string) $rel[$k], 0, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ───────────────────────── Markdown (portage PHP de downloads.js) ──────── */
|
||||||
|
|
||||||
|
function fws_md_escape(string $t): string
|
||||||
|
{
|
||||||
|
return htmlspecialchars($t, ENT_NOQUOTES, 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
function fws_md_inline(string $t): string
|
||||||
|
{
|
||||||
|
$t = fws_md_escape($t);
|
||||||
|
$t = preg_replace('/\*\*\*(.+?)\*\*\*/s', '<strong><em>$1</em></strong>', $t) ?? $t;
|
||||||
|
$t = preg_replace('/\*\*(.+?)\*\*/s', '<strong>$1</strong>', $t) ?? $t;
|
||||||
|
$t = preg_replace('/\*(.+?)\*/s', '<em>$1</em>', $t) ?? $t;
|
||||||
|
$t = preg_replace('/`([^`]+)`/', '<code>$1</code>', $t) ?? $t;
|
||||||
|
$t = preg_replace('/!\[([^\]]*)\]\(([^)\s]+)\)/', '<img alt="$1" src="$2" loading="lazy">', $t) ?? $t;
|
||||||
|
$t = preg_replace('/\[([^\]]+)\]\(([^)\s]+)\)/', '<a href="$2" target="_blank" rel="noreferrer">$1</a>', $t) ?? $t;
|
||||||
|
return $t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Rendu Markdown minimal (titres, listes, tables, citations, code…) + sanitisé. */
|
||||||
|
function fws_markdown(string $md): string
|
||||||
|
{
|
||||||
|
if (trim($md) === '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$lines = preg_split('/\r?\n/', $md) ?: [];
|
||||||
|
$html = '';
|
||||||
|
$inCode = false;
|
||||||
|
$code = '';
|
||||||
|
$codeLang = '';
|
||||||
|
$listBuf = '';
|
||||||
|
$listKind = '';
|
||||||
|
$tableRows = [];
|
||||||
|
$tableHeader = true;
|
||||||
|
$quoteBuf = '';
|
||||||
|
|
||||||
|
$flushList = function () use (&$html, &$listBuf, &$listKind) {
|
||||||
|
if ($listBuf !== '') {
|
||||||
|
$html .= '<' . $listKind . ">\n" . $listBuf . '</' . $listKind . ">\n";
|
||||||
|
$listBuf = '';
|
||||||
|
$listKind = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$flushTable = function () use (&$html, &$tableRows, &$tableHeader) {
|
||||||
|
if ($tableRows !== []) {
|
||||||
|
$html .= "<table>\n" . implode("\n", $tableRows) . "\n</table>\n";
|
||||||
|
$tableRows = [];
|
||||||
|
$tableHeader = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$flushQuote = function () use (&$html, &$quoteBuf) {
|
||||||
|
if ($quoteBuf !== '') {
|
||||||
|
$html .= '<blockquote>' . $quoteBuf . "</blockquote>\n";
|
||||||
|
$quoteBuf = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$flushAll = function () use ($flushList, $flushTable, $flushQuote) {
|
||||||
|
$flushList();
|
||||||
|
$flushTable();
|
||||||
|
$flushQuote();
|
||||||
|
};
|
||||||
|
$cells = function (string $line): array {
|
||||||
|
$line = preg_replace('/^\|/', '', $line) ?? $line;
|
||||||
|
$line = preg_replace('/\|$/', '', $line) ?? $line;
|
||||||
|
return array_map('trim', explode('|', $line));
|
||||||
|
};
|
||||||
|
$isSep = function (string $line): bool {
|
||||||
|
return (bool) preg_match('/^\|?[\s|:\-]+\|?$/', $line) && strpos($line, '-') !== false;
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
if (strncmp($line, '```', 3) === 0) {
|
||||||
|
$flushAll();
|
||||||
|
if ($inCode) {
|
||||||
|
$langAttr = $codeLang !== '' ? ' class="language-' . e($codeLang) . '"' : '';
|
||||||
|
$html .= '<pre><code' . $langAttr . '>' . fws_md_escape(trim($code)) . "</code></pre>\n";
|
||||||
|
$code = '';
|
||||||
|
$codeLang = '';
|
||||||
|
$inCode = false;
|
||||||
|
} else {
|
||||||
|
$inCode = true;
|
||||||
|
$codeLang = trim(substr($line, 3));
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($inCode) {
|
||||||
|
$code .= ($code !== '' ? "\n" : '') . $line;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (trim($line) === '') {
|
||||||
|
$flushAll();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/^(#{1,6})\s+(.+)$/', $line, $m)) {
|
||||||
|
$flushAll();
|
||||||
|
$lvl = strlen($m[1]);
|
||||||
|
$html .= '<h' . $lvl . '>' . fws_md_inline($m[2]) . '</h' . $lvl . ">\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/^[-*_]{3,}\s*$/', trim($line))) {
|
||||||
|
$flushAll();
|
||||||
|
$html .= "<hr>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp(ltrim($line), '>', 1) === 0) {
|
||||||
|
$flushList();
|
||||||
|
$flushTable();
|
||||||
|
$quoteBuf .= '<p>' . fws_md_inline((string) preg_replace('/^>\s?/', '', $line)) . '</p>';
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$flushQuote();
|
||||||
|
|
||||||
|
if (strpos($line, '|') !== false && !$isSep($line)) {
|
||||||
|
$flushList();
|
||||||
|
$tag = $tableHeader ? 'th' : 'td';
|
||||||
|
$row = '<tr>';
|
||||||
|
foreach ($cells($line) as $c) {
|
||||||
|
$row .= '<' . $tag . '>' . fws_md_inline($c) . '</' . $tag . '>';
|
||||||
|
}
|
||||||
|
$row .= '</tr>';
|
||||||
|
$tableRows[] = $row;
|
||||||
|
$tableHeader = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isSep($line)) {
|
||||||
|
$tableHeader = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/^(\s*)[-*+]\s+(.+)$/', $line, $m)) {
|
||||||
|
$flushTable();
|
||||||
|
if ($listKind !== 'ul') {
|
||||||
|
$flushList();
|
||||||
|
$listKind = 'ul';
|
||||||
|
}
|
||||||
|
$listBuf .= '<li>' . fws_md_inline($m[2]) . "</li>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/^(\s*)\d+\.\s+(.+)$/', $line, $m)) {
|
||||||
|
$flushTable();
|
||||||
|
if ($listKind !== 'ol') {
|
||||||
|
$flushList();
|
||||||
|
$listKind = 'ol';
|
||||||
|
}
|
||||||
|
$listBuf .= '<li>' . fws_md_inline($m[2]) . "</li>\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($listBuf !== '' && preg_match('/^\s{2,}/', $line)) {
|
||||||
|
$listBuf = (string) preg_replace('/<\/li>\n$/', ' ' . fws_md_inline(trim($line)) . "</li>\n", $listBuf);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$flushList();
|
||||||
|
$flushTable();
|
||||||
|
$html .= '<p>' . fws_md_inline($line) . "</p>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$flushAll();
|
||||||
|
if ($inCode) {
|
||||||
|
$langAttr = $codeLang !== '' ? ' class="language-' . e($codeLang) . '"' : '';
|
||||||
|
$html .= '<pre><code' . $langAttr . '>' . fws_md_escape(trim($code)) . "</code></pre>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
return fws_sanitize_html($html);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Retire scripts/événements/URL javascript: du HTML généré côté serveur. */
|
||||||
|
function fws_sanitize_html(string $html): string
|
||||||
|
{
|
||||||
|
$html = (string) preg_replace('#<\s*(script|iframe|object|embed|link|style)\b[^>]*>.*?<\s*/\s*\1\s*>#is', '', $html);
|
||||||
|
$html = (string) preg_replace('#<\s*(script|iframe|object|embed|link|style)\b[^>]*/?>#i', '', $html);
|
||||||
|
$html = (string) preg_replace_callback(
|
||||||
|
'/\son\w+\s*=\s*("[^"]*"|\'[^\']*\'|[^\s>]+)/i',
|
||||||
|
static function ($m) {
|
||||||
|
return '';
|
||||||
|
},
|
||||||
|
$html
|
||||||
|
);
|
||||||
|
$html = (string) preg_replace('/(href|src)\s*=\s*(["\'])\s*javascript:[^"\']*\2/i', '$1="#"', $html);
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tronque un rendu HTML vers ~N caractères de texte (portage de truncateHtml),
|
||||||
|
* sans couper au milieu d'une balise : on retire les blocs entiers en trop.
|
||||||
|
* Renvoie ['html' => …, 'truncated' => bool].
|
||||||
|
*/
|
||||||
|
function fws_truncate_html(string $html, int $limit = 600): array
|
||||||
|
{
|
||||||
|
$text = trim((string) preg_replace('/\s+/u', ' ', strip_tags($html)));
|
||||||
|
if (mb_strlen($text) <= $limit) {
|
||||||
|
return ['html' => $html, 'truncated' => false];
|
||||||
|
}
|
||||||
|
|
||||||
|
$blocks = preg_split('/(?=<)/', $html) ?: [$html];
|
||||||
|
$acc = '';
|
||||||
|
$count = 0;
|
||||||
|
$out = '';
|
||||||
|
foreach ($blocks as $block) {
|
||||||
|
if ($block === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$blockText = trim((string) preg_replace('/\s+/u', ' ', strip_tags($block)));
|
||||||
|
/* On ne coupe qu'avant un bloc porteur de texte : les blocs vides
|
||||||
|
(fermetures </p>, </div>…) suivent toujours leur ouverture, sinon
|
||||||
|
on produirait du HTML non fermé. */
|
||||||
|
if ($blockText !== '' && $count > 0 && $count + mb_strlen($blockText) > $limit) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$out .= $block;
|
||||||
|
if ($blockText !== '') {
|
||||||
|
$count += mb_strlen($blockText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($out === '') {
|
||||||
|
$out = '<p>' . e(mb_substr($text, 0, $limit)) . '…</p>';
|
||||||
|
return ['html' => $out, 'truncated' => true];
|
||||||
|
}
|
||||||
|
return ['html' => $out, 'truncated' => true];
|
||||||
|
}
|
||||||
-110
@@ -1,110 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="fr">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<title>Accueil | FWS Linux</title>
|
|
||||||
<meta name="description" content="FWS Linux — distribution open-source basée sur Arch Linux. Installation simplifiée, léger, respectueux de la vie privée, compatible Windows grâce à Wine et Winboat." />
|
|
||||||
<meta name="robots" content="index, follow" />
|
|
||||||
<link rel="canonical" href="https://fwslinux.fr/?p/index/" />
|
|
||||||
|
|
||||||
<!-- Open Graph -->
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta property="og:title" content="Accueil | FWS Linux" />
|
|
||||||
<meta property="og:description" content="Distribution open-source basée sur Arch Linux. Installation simplifiée, léger, compatible Windows." />
|
|
||||||
<meta property="og:image" content="/p/assets/img/logo.png" />
|
|
||||||
<meta property="og:locale" content="fr_FR" />
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="p/assets/styles/styles.css" />
|
|
||||||
<link rel="stylesheet" href="p/assets/styles/paquets.css" />
|
|
||||||
<link rel="icon" type="image/png" href="/p/assets/img/logo.png" />
|
|
||||||
|
|
||||||
<!-- Réseau : la page Téléchargements interroge l'API GitHub -->
|
|
||||||
<link rel="preconnect" href="https://api.github.com" crossorigin />
|
|
||||||
<link rel="dns-prefetch" href="https://api.github.com" />
|
|
||||||
<link rel="dns-prefetch" href="https://github.com" />
|
|
||||||
<link rel="dns-prefetch" href="https://objects.githubusercontent.com" />
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<a class="skip-link" href="#app-main">Aller au contenu principal</a>
|
|
||||||
|
|
||||||
<div class="page-shell">
|
|
||||||
<header class="site-header" role="banner">
|
|
||||||
<div class="header-brand-block">
|
|
||||||
<a class="brand" href="/?p/index/" data-route="index" aria-label="FWS Linux — Retour à l'accueil">
|
|
||||||
<img class="brand-mark" src="p/assets/img/logo.png" alt="" width="44" height="44" />
|
|
||||||
<span class="brand-text">
|
|
||||||
<strong>FWS Linux</strong>
|
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
<nav class="site-nav" aria-label="Navigation principale">
|
|
||||||
<a href="/?p/index/" data-route="index">Accueil</a>
|
|
||||||
<a href="/?p/dl/" data-route="dl">Téléchargements</a>
|
|
||||||
|
|
||||||
<div class="nav-dropdown" data-nav-dropdown>
|
|
||||||
<button type="button" class="nav-dropdown-toggle" aria-expanded="false" aria-haspopup="true" aria-controls="nav-paquets-panel">
|
|
||||||
Paquets
|
|
||||||
<span class="nav-dropdown-caret" aria-hidden="true"></span>
|
|
||||||
</button>
|
|
||||||
<div class="nav-dropdown-panel" id="nav-paquets-panel" role="group" aria-label="Liste des paquets">
|
|
||||||
<div class="nav-dropdown-panel-inner" data-packages-nav></div>
|
|
||||||
<a class="nav-dropdown-all" href="/?p/paquets/" data-route="paquets">Voir tous les paquets →</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<main id="app-main" class="site-main" aria-live="polite">
|
|
||||||
<noscript>Activez JavaScript pour naviguer sur ce site.</noscript>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<footer class="site-footer" role="contentinfo">
|
|
||||||
<div class="footer-content">
|
|
||||||
<div class="footer-brand-row">
|
|
||||||
<div class="footer-brand-block">
|
|
||||||
<img class="footer-brand-mark" src="p/assets/img/logo.png" alt="" width="40" height="40" />
|
|
||||||
<div>
|
|
||||||
<strong>FWS Linux</strong>
|
|
||||||
<p>Un système léger, libre et compatible</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="footer-links-grid">
|
|
||||||
<nav aria-label="Navigation secondaire">
|
|
||||||
<h2>Navigation</h2>
|
|
||||||
<a href="/?p/index/" data-route="index">Accueil</a>
|
|
||||||
<a href="/?p/dl/" data-route="dl">Téléchargements</a>
|
|
||||||
<a href="/?p/paquets/" data-route="paquets">Paquets</a>
|
|
||||||
<a href="/?p/equipe/" data-route="equipe">Équipe</a>
|
|
||||||
</nav>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>Contact</h2>
|
|
||||||
<a href="/?p/contact/" data-route="contact">Page de contact</a>
|
|
||||||
<a href="/?p/equipe/" data-route="equipe">Équipe</a>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
|
||||||
<h2>Réseaux</h2>
|
|
||||||
<a href="https://github.com/You-re-like-Windows-a-bitch/ISO" target="_blank" rel="noopener noreferrer">GitHub</a>
|
|
||||||
<a href="https://discord.gg/6mnpPr2jq4" target="_blank" rel="noopener noreferrer">Discord</a>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="footer-bottom">
|
|
||||||
<p>© <span id="footer-year">2026</span> FWS Linux</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="p/assets/main-nav/app.js"></script>
|
|
||||||
<script src="p/assets/js/packages.js"></script>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — point d'entrée alternatif (/index.php) : délègue à page.php.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require __DIR__ . '/page.php';
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page 404 (incluse par page.php avec http_response_code(404)).
|
||||||
|
*
|
||||||
|
* La scène (Tux qui débranche le câble RJ45 d'un switch) est un SVG statique
|
||||||
|
* dans son état « branché » ; p/assets/js/not-found.js anime ensuite Tux, le
|
||||||
|
* connecteur et le câble (physique à ressort, câble recalculé chaque image).
|
||||||
|
* Sans JavaScript, la scène reste propre et immobile.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!isset($title, $extraCss, $extraJs)) {
|
||||||
|
http_response_code(404);
|
||||||
|
exit('Page introuvable.');
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = 'Page introuvable | FWS Linux';
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/404.css');
|
||||||
|
$extraJs[] = fws_url('/p/assets/js/not-found.js');
|
||||||
|
?>
|
||||||
|
<section class="notfound" aria-labelledby="notfound-title">
|
||||||
|
<div class="notfound-copy">
|
||||||
|
<p class="notfound-code" aria-hidden="true">404</p>
|
||||||
|
<h1 class="notfound-title" id="notfound-title">Cette page a été débranchée</h1>
|
||||||
|
<p class="notfound-lead">Tux a tiré un peu fort sur le câble RJ45… La page demandée n'existe pas ou a été déplacée. Le reste du réseau tient bon.</p>
|
||||||
|
<div class="notfound-actions">
|
||||||
|
<a class="button button-primary" href="<?= e(fws_url('/?p/index/')) ?>">Retour à l'accueil</a>
|
||||||
|
<a class="button button-secondary" href="<?= e(fws_url('/?p/contact/')) ?>">Signaler un lien cassé</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="notfound-visual" aria-hidden="true">
|
||||||
|
<svg class="nf-scene" viewBox="0 0 720 440" xmlns="http://www.w3.org/2000/svg" focusable="false">
|
||||||
|
<defs>
|
||||||
|
<linearGradient id="nf-switch-body" x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop offset="0" stop-color="#3a4a68" />
|
||||||
|
<stop offset="1" stop-color="#202b3e" />
|
||||||
|
</linearGradient>
|
||||||
|
<radialGradient id="nf-ambient" cx="50%" cy="50%" r="50%">
|
||||||
|
<stop offset="0" stop-color="rgba(56,189,248,0.15)" />
|
||||||
|
<stop offset="1" stop-color="rgba(56,189,248,0)" />
|
||||||
|
</radialGradient>
|
||||||
|
<radialGradient id="nf-ground-shadow" cx="50%" cy="50%" r="50%">
|
||||||
|
<stop offset="0" stop-color="rgba(3,7,15,0.55)" />
|
||||||
|
<stop offset="0.55" stop-color="rgba(3,7,15,0.26)" />
|
||||||
|
<stop offset="1" stop-color="rgba(3,7,15,0)" />
|
||||||
|
</radialGradient>
|
||||||
|
<radialGradient id="nf-tux-glow" cx="50%" cy="50%" r="50%">
|
||||||
|
<stop offset="0" stop-color="rgba(125,211,252,0.22)" />
|
||||||
|
<stop offset="1" stop-color="rgba(125,211,252,0)" />
|
||||||
|
</radialGradient>
|
||||||
|
<linearGradient id="nf-body" gradientUnits="userSpaceOnUse" x1="140" y1="96" x2="300" y2="370">
|
||||||
|
<stop offset="0" stop-color="#26334a" />
|
||||||
|
<stop offset="0.5" stop-color="#0d1420" />
|
||||||
|
<stop offset="1" stop-color="#05080e" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="nf-body-light" gradientUnits="userSpaceOnUse" x1="265" y1="236" x2="320" y2="270">
|
||||||
|
<stop offset="0" stop-color="#1d2739" />
|
||||||
|
<stop offset="1" stop-color="#080d15" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="nf-web" gradientUnits="userSpaceOnUse" x1="112" y1="326" x2="316" y2="384">
|
||||||
|
<stop offset="0" stop-color="#fcd34d" />
|
||||||
|
<stop offset="1" stop-color="#ef8f16" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="nf-belly" x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop offset="0" stop-color="#ffffff" />
|
||||||
|
<stop offset="1" stop-color="#dae2ec" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="nf-beak" x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop offset="0" stop-color="#fcd34d" />
|
||||||
|
<stop offset="1" stop-color="#f59e0b" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient id="nf-plug" x1="0" y1="0" x2="0" y2="1">
|
||||||
|
<stop offset="0" stop-color="#e2e8f0" />
|
||||||
|
<stop offset="1" stop-color="#b6c2d1" />
|
||||||
|
</linearGradient>
|
||||||
|
<clipPath id="nf-body-clip">
|
||||||
|
<path d="M 215 96 C 172 96 145 124 143 164 C 142 192 155 212 157 232 C 145 258 134 294 134 322 C 134 354 167 370 215 370 C 263 370 296 354 296 322 C 296 294 285 258 273 232 C 275 212 288 192 287 164 C 285 124 258 96 215 96 Z" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<!-- Ambiance -->
|
||||||
|
<ellipse cx="420" cy="330" rx="340" ry="130" fill="url(#nf-ambient)" />
|
||||||
|
<ellipse cx="212" cy="252" rx="190" ry="200" fill="url(#nf-tux-glow)" />
|
||||||
|
|
||||||
|
<!-- ── Switch ──────────────────────────────────────────────────────── -->
|
||||||
|
<g id="nf-switch">
|
||||||
|
<ellipse cx="515" cy="304" rx="196" ry="18" fill="url(#nf-ground-shadow)" />
|
||||||
|
<rect x="326" y="196" width="16" height="40" rx="4" fill="#1b2434" />
|
||||||
|
<rect x="688" y="196" width="16" height="40" rx="4" fill="#1b2434" />
|
||||||
|
<rect x="340" y="120" width="350" height="172" rx="20" fill="url(#nf-switch-body)" stroke="rgba(148,163,184,0.28)" stroke-width="2" />
|
||||||
|
<rect x="344" y="124" width="342" height="42" rx="16" fill="rgba(226,232,240,0.06)" />
|
||||||
|
<circle cx="668" cy="146" r="7" fill="#22c55e" opacity="0.2" />
|
||||||
|
<circle cx="668" cy="146" r="3.5" fill="#22c55e" />
|
||||||
|
<text x="364" y="152" fill="rgba(226,232,240,0.75)" font-family="'Segoe UI', system-ui, sans-serif" font-size="16" font-weight="600">SW-FWS-01</text>
|
||||||
|
|
||||||
|
<!-- Pastille « link down » -->
|
||||||
|
<g id="nf-badge" opacity="0">
|
||||||
|
<circle cx="648" cy="150" r="18" fill="#ef4444" />
|
||||||
|
<circle cx="648" cy="150" r="18" fill="none" stroke="rgba(255,255,255,0.35)" stroke-width="2" />
|
||||||
|
<rect x="645.5" y="140" width="5" height="12" rx="2.5" fill="#ffffff" />
|
||||||
|
<circle cx="648" cy="158" r="3" fill="#ffffff" />
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- Bandeau des ports -->
|
||||||
|
<rect x="356" y="196" width="318" height="68" rx="12" fill="#141d2b" stroke="rgba(15,23,42,0.6)" />
|
||||||
|
|
||||||
|
<?php foreach ([372, 414, 456, 498, 540, 582] as $i => $px): ?>
|
||||||
|
<g>
|
||||||
|
<rect x="<?= $px ?>" y="216" width="34" height="26" rx="5" fill="#0b1220" stroke="rgba(148,163,184,0.3)" />
|
||||||
|
<rect x="<?= $px + 5 ?>" y="221" width="24" height="16" rx="3" fill="#070d18" />
|
||||||
|
<rect x="<?= $px + 12 ?>" y="214" width="10" height="5" rx="2" fill="#2b3a52" />
|
||||||
|
<?php foreach ([8, 13, 18, 23] as $g): ?>
|
||||||
|
<rect x="<?= $px + $g ?>" y="230" width="2.5" height="5" rx="1" fill="rgba(245,158,11,0.55)" />
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<text x="<?= $px + 17 ?>" y="259" text-anchor="middle" fill="rgba(148,163,184,0.45)" font-family="'Segoe UI', system-ui, sans-serif" font-size="10"><?= $i + 1 ?></text>
|
||||||
|
</g>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
<!-- Anneau du port utilisé -->
|
||||||
|
<rect x="538" y="213" width="38" height="32" rx="7" fill="none" stroke="rgba(56,189,248,0.45)" />
|
||||||
|
|
||||||
|
<!-- LED du port utilisé -->
|
||||||
|
<circle class="nf-led-green" cx="557" cy="186" r="12" fill="#22c55e" opacity="0.18" />
|
||||||
|
<circle class="nf-led-green" cx="557" cy="186" r="6" fill="#22c55e" />
|
||||||
|
<circle class="nf-led-red" cx="557" cy="186" r="12" fill="#ef4444" opacity="0" />
|
||||||
|
<circle class="nf-led-red" cx="557" cy="186" r="6" fill="#ef4444" opacity="0" />
|
||||||
|
|
||||||
|
<!-- LED des autres ports -->
|
||||||
|
<?php foreach ([389, 431, 473, 515, 599] as $lx): ?>
|
||||||
|
<circle cx="<?= $lx ?>" cy="186" r="5" fill="#22c55e" opacity="0.32" />
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- Étincelle de débranchement -->
|
||||||
|
<g id="nf-spark" opacity="0" transform="translate(557 228) scale(0.7) translate(-557 -228)">
|
||||||
|
<g stroke="#fde68a" stroke-width="2.5" stroke-linecap="round">
|
||||||
|
<line x1="557" y1="212" x2="557" y2="198" />
|
||||||
|
<line x1="541" y1="216" x2="530" y2="206" />
|
||||||
|
<line x1="573" y1="216" x2="584" y2="206" />
|
||||||
|
<line x1="536" y1="232" x2="520" y2="232" />
|
||||||
|
<line x1="578" y1="232" x2="594" y2="232" />
|
||||||
|
</g>
|
||||||
|
<circle cx="557" cy="205" r="3" fill="#fef3c7" />
|
||||||
|
<circle cx="534" cy="212" r="2.4" fill="#fef3c7" />
|
||||||
|
<circle cx="581" cy="213" r="2.4" fill="#fef3c7" />
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- ── Tux ─────────────────────────────────────────────────────────── -->
|
||||||
|
<!-- L'ombre est posée à plat au sol, hors du groupe #nf-tux : c'est le JS
|
||||||
|
qui la tasse et la décale quand Tux se retrouve assis. -->
|
||||||
|
<ellipse id="nf-shadow" cx="215" cy="376" rx="96" ry="17" fill="url(#nf-ground-shadow)" />
|
||||||
|
|
||||||
|
<g id="nf-tux">
|
||||||
|
<!-- Aileron arrière -->
|
||||||
|
<ellipse cx="132" cy="268" rx="19" ry="58" transform="rotate(12 132 268)" fill="url(#nf-body)" stroke="rgba(125,211,252,0.22)" stroke-width="2" />
|
||||||
|
|
||||||
|
<!-- Corps -->
|
||||||
|
<path d="M 215 96 C 172 96 145 124 143 164 C 142 192 155 212 157 232 C 145 258 134 294 134 322 C 134 354 167 370 215 370 C 263 370 296 354 296 322 C 296 294 285 258 273 232 C 275 212 288 192 287 164 C 285 124 258 96 215 96 Z"
|
||||||
|
fill="url(#nf-body)" stroke="rgba(125,211,252,0.32)" stroke-width="2" />
|
||||||
|
|
||||||
|
<g clip-path="url(#nf-body-clip)">
|
||||||
|
<path d="M 215 200 C 178 200 162 240 160 286 C 158 320 178 340 215 340 C 252 340 272 320 270 286 C 268 240 252 200 215 200 Z" fill="url(#nf-belly)" />
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<g id="nf-eyes">
|
||||||
|
<ellipse cx="190" cy="150" rx="27" ry="31" fill="#f8fafc" />
|
||||||
|
<ellipse cx="238" cy="150" rx="27" ry="31" fill="#f8fafc" />
|
||||||
|
<circle cx="194" cy="153" r="14" fill="#0b1220" />
|
||||||
|
<circle cx="234" cy="153" r="14" fill="#0b1220" />
|
||||||
|
<circle cx="188" cy="146" r="4.5" fill="#ffffff" />
|
||||||
|
<circle cx="228" cy="146" r="4.5" fill="#ffffff" />
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- Bec -->
|
||||||
|
<path d="M 209 168 C 240 170 266 180 280 193 C 268 212 240 220 211 217 C 189 214 175 202 177 189 C 180 176 192 168 209 168 Z"
|
||||||
|
fill="url(#nf-beak)" stroke="rgba(120,53,15,0.25)" stroke-width="1.5" />
|
||||||
|
<path d="M 186 197 C 208 204 242 200 264 191" fill="none" stroke="rgba(120,53,15,0.45)" stroke-width="2.5" stroke-linecap="round" />
|
||||||
|
|
||||||
|
<!-- Pattes palmées (devant le corps pour rester visibles) -->
|
||||||
|
<g id="nf-foot-l">
|
||||||
|
<g transform="translate(168 346) rotate(-16) scale(-0.82 0.7)">
|
||||||
|
<path d="M -8 -18 C 8 -24 26 -22 38 -14 C 48 -7 49 6 40 16 C 30 26 12 30 -4 26 C -12 18 -14 -6 -8 -18 Z" fill="url(#nf-web)" />
|
||||||
|
<circle cx="48" cy="-16" r="12.5" fill="url(#nf-web)" />
|
||||||
|
<circle cx="49" cy="6" r="12.5" fill="url(#nf-web)" />
|
||||||
|
<circle cx="36" cy="27" r="12.5" fill="url(#nf-web)" />
|
||||||
|
</g>
|
||||||
|
<path d="M 158 342 C 150 343 141 344 133 346 M 156 346 C 150 352 142 357 134 360" fill="none" stroke="rgba(146,64,14,0.45)" stroke-width="2" stroke-linecap="round" />
|
||||||
|
</g>
|
||||||
|
<g id="nf-foot-r">
|
||||||
|
<g transform="translate(262 346) rotate(16) scale(0.82 0.7)">
|
||||||
|
<path d="M -8 -18 C 8 -24 26 -22 38 -14 C 48 -7 49 6 40 16 C 30 26 12 30 -4 26 C -12 18 -14 -6 -8 -18 Z" fill="url(#nf-web)" />
|
||||||
|
<circle cx="48" cy="-16" r="12.5" fill="url(#nf-web)" />
|
||||||
|
<circle cx="49" cy="6" r="12.5" fill="url(#nf-web)" />
|
||||||
|
<circle cx="36" cy="27" r="12.5" fill="url(#nf-web)" />
|
||||||
|
</g>
|
||||||
|
<path d="M 272 342 C 280 343 289 344 297 346 M 274 346 C 280 352 288 357 296 360" fill="none" stroke="rgba(146,64,14,0.45)" stroke-width="2" stroke-linecap="round" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- ── Câble (recalculé par le JS) ─────────────────────────────────── -->
|
||||||
|
<path class="nf-cable" d="M 534 236 C 466 328, 372 328, 304 256" fill="none" stroke="#38bdf8" stroke-width="13" stroke-linecap="round" stroke-linejoin="round" opacity="0.12" />
|
||||||
|
<path class="nf-cable" d="M 534 236 C 466 328, 372 328, 304 256" fill="none" stroke="#475569" stroke-width="9" stroke-linecap="round" stroke-linejoin="round" />
|
||||||
|
<path class="nf-cable" d="M 534 236 C 466 328, 372 328, 304 256" fill="none" stroke="#94a3b8" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" opacity="0.5" />
|
||||||
|
|
||||||
|
<!-- ── Aileron avant (tient le câble) ──────────────────────────────── -->
|
||||||
|
<g id="nf-arm">
|
||||||
|
<ellipse cx="285" cy="253" rx="25" ry="14.5" transform="rotate(6.5 285 253)" fill="url(#nf-body-light)" stroke="rgba(125,211,252,0.3)" stroke-width="2" />
|
||||||
|
<ellipse cx="304" cy="256" rx="14.5" ry="12.5" fill="url(#nf-body-light)" stroke="rgba(125,211,252,0.3)" stroke-width="2" />
|
||||||
|
</g>
|
||||||
|
|
||||||
|
<!-- ── Connecteur RJ45 ─────────────────────────────────────────────── -->
|
||||||
|
<g id="nf-connector">
|
||||||
|
<rect x="524" y="229" width="12" height="14" rx="3" fill="#475569" />
|
||||||
|
<rect x="534" y="223" width="32" height="22" rx="4" fill="url(#nf-plug)" stroke="#94a3b8" stroke-width="1.5" />
|
||||||
|
<rect x="540" y="216" width="14" height="9" rx="2" fill="#94a3b8" />
|
||||||
|
<rect x="534" y="227" width="9" height="3" rx="1.5" fill="#f59e0b" />
|
||||||
|
<rect x="534" y="232" width="9" height="3" rx="1.5" fill="#f59e0b" />
|
||||||
|
<rect x="534" y="237" width="9" height="3" rx="1.5" fill="#f59e0b" />
|
||||||
|
<rect x="546" y="226" width="14" height="3" rx="1.5" fill="rgba(255,255,255,0.6)" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
(() => {
|
|
||||||
function formatDate(iso) {
|
|
||||||
if (!iso) return null;
|
|
||||||
try {
|
|
||||||
const d = new Date(iso);
|
|
||||||
return d.toLocaleDateString("fr-FR", {
|
|
||||||
year: "numeric",
|
|
||||||
month: "long",
|
|
||||||
day: "numeric",
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function createCreatorCard(creator) {
|
|
||||||
const card = document.createElement("article");
|
|
||||||
card.className = "creator-card";
|
|
||||||
|
|
||||||
if (creator.avatar) {
|
|
||||||
const img = document.createElement("img");
|
|
||||||
img.className = "creator-avatar";
|
|
||||||
img.src = creator.avatar;
|
|
||||||
img.alt = creator.name || creator.role || "";
|
|
||||||
img.loading = "lazy";
|
|
||||||
card.appendChild(img);
|
|
||||||
}
|
|
||||||
|
|
||||||
const info = document.createElement("div");
|
|
||||||
info.className = "creator-info";
|
|
||||||
|
|
||||||
if (creator.name) {
|
|
||||||
const name = document.createElement("h3");
|
|
||||||
name.className = "creator-name";
|
|
||||||
name.textContent = creator.name;
|
|
||||||
info.appendChild(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (creator.role) {
|
|
||||||
const role = document.createElement("span");
|
|
||||||
role.className = "creator-role";
|
|
||||||
role.textContent = creator.role;
|
|
||||||
info.appendChild(role);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (creator.joined) {
|
|
||||||
const joined = document.createElement("span");
|
|
||||||
joined.className = "creator-joined";
|
|
||||||
joined.textContent = "A rejoint le " + formatDate(creator.joined);
|
|
||||||
info.appendChild(joined);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (creator.email) {
|
|
||||||
const email = document.createElement("a");
|
|
||||||
email.className = "creator-email";
|
|
||||||
email.href = "mailto:" + creator.email;
|
|
||||||
email.textContent = creator.email;
|
|
||||||
info.appendChild(email);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (creator.links && creator.links.length > 0) {
|
|
||||||
const links = document.createElement("div");
|
|
||||||
links.className = "creator-links";
|
|
||||||
for (const link of creator.links) {
|
|
||||||
const a = document.createElement("a");
|
|
||||||
a.className = "creator-link";
|
|
||||||
a.href = link.url;
|
|
||||||
a.target = "_blank";
|
|
||||||
a.rel = "noopener noreferrer";
|
|
||||||
a.textContent = link.label || link.url;
|
|
||||||
links.appendChild(a);
|
|
||||||
}
|
|
||||||
info.appendChild(links);
|
|
||||||
}
|
|
||||||
|
|
||||||
card.appendChild(info);
|
|
||||||
return card;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadCreators() {
|
|
||||||
const containers = document.querySelectorAll("[data-creators-src]");
|
|
||||||
for (const container of containers) {
|
|
||||||
const src = container.getAttribute("data-creators-src");
|
|
||||||
if (!src) continue;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch(src, { cache: "no-store" });
|
|
||||||
if (!response.ok) throw new Error("Erreur " + response.status);
|
|
||||||
const creators = await response.json();
|
|
||||||
|
|
||||||
const grid = document.createElement("div");
|
|
||||||
grid.className = "creators-grid";
|
|
||||||
|
|
||||||
for (const creator of creators) {
|
|
||||||
grid.appendChild(createCreatorCard(creator));
|
|
||||||
}
|
|
||||||
|
|
||||||
container.innerHTML = "";
|
|
||||||
container.appendChild(grid);
|
|
||||||
} catch (err) {
|
|
||||||
container.innerHTML =
|
|
||||||
'<p class="creators-error">Impossible de charger les données des créateurs.</p>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loadCreators();
|
|
||||||
})();
|
|
||||||
@@ -1,461 +0,0 @@
|
|||||||
(() => {
|
|
||||||
const OWNER = "You-re-like-Windows-a-bitch";
|
|
||||||
const REPO = "ISO";
|
|
||||||
const RELEASES_URL = `https://api.github.com/repos/${OWNER}/${REPO}/releases?per_page=5`;
|
|
||||||
const TAGS_URL = `https://api.github.com/repos/${OWNER}/${REPO}/tags?per_page=5`;
|
|
||||||
const REPO_URL = `https://github.com/${OWNER}/${REPO}`;
|
|
||||||
|
|
||||||
const currentVersionNode = document.querySelector("[data-current-version]");
|
|
||||||
const currentVersionDateNode = document.querySelector("[data-current-version-date]");
|
|
||||||
const currentReleaseNoteNode = document.querySelector("[data-current-release-note]");
|
|
||||||
const latestDownloadNode = document.querySelector("[data-latest-download]");
|
|
||||||
const viewMoreNode = document.querySelector("[data-view-more]");
|
|
||||||
const versionsListNode = document.querySelector("[data-versions-list]");
|
|
||||||
const toggleNoteNode = document.querySelector("[data-toggle-release-note]");
|
|
||||||
|
|
||||||
let fullReleaseBodyHtml = "";
|
|
||||||
const TRUNCATE_LENGTH = 600;
|
|
||||||
|
|
||||||
function formatDate(value) {
|
|
||||||
if (!value) return "";
|
|
||||||
const date = new Date(value);
|
|
||||||
if (Number.isNaN(date.getTime())) return "";
|
|
||||||
return date.toLocaleDateString("fr-FR", {
|
|
||||||
year: "numeric",
|
|
||||||
month: "long",
|
|
||||||
day: "numeric",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getReleaseLabel(entry) {
|
|
||||||
return entry?.name || entry?.tag_name || entry?.ref || "Sans nom";
|
|
||||||
}
|
|
||||||
|
|
||||||
function getReleasePageUrl(entry, mode) {
|
|
||||||
if (mode === "releases") {
|
|
||||||
return pickDirectDownloadUrl(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry?.name) {
|
|
||||||
return `${REPO_URL}/releases/tag/${encodeURIComponent(entry.name)}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return REPO_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
function escapeHtml(text) {
|
|
||||||
return text
|
|
||||||
.replace(/&/g, "&")
|
|
||||||
.replace(/</g, "<")
|
|
||||||
.replace(/>/g, ">");
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseInline(text) {
|
|
||||||
let result = escapeHtml(text);
|
|
||||||
result = result.replace(/\*\*\*(.+?)\*\*\*/g, "<strong><em>$1</em></strong>");
|
|
||||||
result = result.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>");
|
|
||||||
result = result.replace(/\*(.+?)\*/g, "<em>$1</em>");
|
|
||||||
result = result.replace(/`([^`]+)`/g, "<code>$1</code>");
|
|
||||||
result = result.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, '<img alt="$1" src="$2" loading="lazy">');
|
|
||||||
result = result.replace(/\[([^\]]+)\]\(([^)]+)\)/g, '<a href="$2" target="_blank" rel="noreferrer">$1</a>');
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderMarkdown(md) {
|
|
||||||
if (!md) return "";
|
|
||||||
|
|
||||||
var lines = md.split(/\r?\n/);
|
|
||||||
var html = "";
|
|
||||||
var inCodeBlock = false;
|
|
||||||
var codeBlockContent = "";
|
|
||||||
var codeBlockLang = "";
|
|
||||||
var listBuffer = "";
|
|
||||||
var listKind = "";
|
|
||||||
var tableRows = [];
|
|
||||||
var tableHeader = true;
|
|
||||||
var blockquoteBuffer = "";
|
|
||||||
|
|
||||||
function flushList() {
|
|
||||||
if (listBuffer) {
|
|
||||||
html += "<" + listKind + ">\n" + listBuffer + "</" + listKind + ">\n";
|
|
||||||
listBuffer = "";
|
|
||||||
listKind = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function flushTable() {
|
|
||||||
if (tableRows.length) {
|
|
||||||
html += "<table>\n" + tableRows.join("\n") + "\n</table>\n";
|
|
||||||
tableRows = [];
|
|
||||||
tableHeader = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function flushBlockquote() {
|
|
||||||
if (blockquoteBuffer) {
|
|
||||||
html += "<blockquote>" + blockquoteBuffer + "</blockquote>\n";
|
|
||||||
blockquoteBuffer = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseTableCells(line) {
|
|
||||||
var trimmed = line.replace(/^\|/, "").replace(/\|$/, "");
|
|
||||||
return trimmed.split("|").map(function (c) { return c.trim(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
function isTableSep(line) {
|
|
||||||
return /^\|?[\s|:\-]+\|?$/.test(line) && line.indexOf("-") !== -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < lines.length; i++) {
|
|
||||||
var line = lines[i];
|
|
||||||
|
|
||||||
if (line.startsWith("```")) {
|
|
||||||
flushBlockquote();
|
|
||||||
flushList();
|
|
||||||
flushTable();
|
|
||||||
if (inCodeBlock) {
|
|
||||||
var langAttr = codeBlockLang ? " class=\"language-" + escapeHtml(codeBlockLang) + "\"" : "";
|
|
||||||
html += "<pre><code" + langAttr + ">" + escapeHtml(codeBlockContent.trim()) + "</code></pre>\n";
|
|
||||||
codeBlockContent = "";
|
|
||||||
codeBlockLang = "";
|
|
||||||
inCodeBlock = false;
|
|
||||||
} else {
|
|
||||||
inCodeBlock = true;
|
|
||||||
codeBlockLang = line.slice(3).trim();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inCodeBlock) {
|
|
||||||
codeBlockContent += (codeBlockContent ? "\n" : "") + line;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.trim() === "") {
|
|
||||||
flushBlockquote();
|
|
||||||
flushList();
|
|
||||||
flushTable();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var hMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
||||||
if (hMatch) {
|
|
||||||
flushBlockquote();
|
|
||||||
flushList();
|
|
||||||
flushTable();
|
|
||||||
var level = hMatch[1].length;
|
|
||||||
html += "<h" + level + ">" + parseInline(hMatch[2]) + "</h" + level + ">\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (/^[-*_]{3,}\s*$/.test(line.trim())) {
|
|
||||||
flushBlockquote();
|
|
||||||
flushList();
|
|
||||||
flushTable();
|
|
||||||
html += "<hr>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.startsWith("> ") || line.startsWith(">")) {
|
|
||||||
flushList();
|
|
||||||
flushTable();
|
|
||||||
var content = line.replace(/^>\s?/, "");
|
|
||||||
blockquoteBuffer += "<p>" + parseInline(content) + "</p>";
|
|
||||||
continue;
|
|
||||||
} else {
|
|
||||||
flushBlockquote();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.includes("|") && !isTableSep(line)) {
|
|
||||||
flushList();
|
|
||||||
var cells = parseTableCells(line);
|
|
||||||
var tag = tableHeader ? "th" : "td";
|
|
||||||
tableRows.push("<tr>" + cells.map(function (c) { return "<" + tag + ">" + parseInline(c) + "</" + tag + ">"; }).join("") + "</tr>");
|
|
||||||
if (tableHeader) tableHeader = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isTableSep(line)) {
|
|
||||||
tableHeader = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line.includes("|")) {
|
|
||||||
flushTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
var ulMatch = line.match(/^(\s*)[-*+]\s+(.+)$/);
|
|
||||||
if (ulMatch) {
|
|
||||||
flushTable();
|
|
||||||
if (listKind !== "ul") {
|
|
||||||
flushList();
|
|
||||||
listKind = "ul";
|
|
||||||
}
|
|
||||||
listBuffer += "<li>" + parseInline(ulMatch[2]) + "</li>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var olMatch = line.match(/^(\s*)\d+\.\s+(.+)$/);
|
|
||||||
if (olMatch) {
|
|
||||||
flushTable();
|
|
||||||
if (listKind !== "ol") {
|
|
||||||
flushList();
|
|
||||||
listKind = "ol";
|
|
||||||
}
|
|
||||||
listBuffer += "<li>" + parseInline(olMatch[2]) + "</li>\n";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listBuffer && /^\s{2,}/.test(line)) {
|
|
||||||
listBuffer = listBuffer.replace(/<\/li>\n$/, " " + parseInline(line.trim()) + "</li>\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
flushList();
|
|
||||||
flushTable();
|
|
||||||
html += "<p>" + parseInline(line) + "</p>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
flushBlockquote();
|
|
||||||
flushList();
|
|
||||||
flushTable();
|
|
||||||
if (inCodeBlock) {
|
|
||||||
var langAttr2 = codeBlockLang ? " class=\"language-" + escapeHtml(codeBlockLang) + "\"" : "";
|
|
||||||
html += "<pre><code" + langAttr2 + ">" + escapeHtml(codeBlockContent.trim()) + "</code></pre>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sanitizeRenderedHtml(rawHtml) {
|
|
||||||
const wrapper = document.createElement("div");
|
|
||||||
wrapper.innerHTML = rawHtml;
|
|
||||||
|
|
||||||
wrapper.querySelectorAll("script, iframe, object, embed, link, style").forEach(function (node) { node.remove(); });
|
|
||||||
wrapper.querySelectorAll("*").forEach(function (node) {
|
|
||||||
Array.from(node.attributes).forEach(function (attribute) {
|
|
||||||
var name = attribute.name.toLowerCase();
|
|
||||||
var value = attribute.value || "";
|
|
||||||
if (name.startsWith("on")) { node.removeAttribute(attribute.name); return; }
|
|
||||||
if ((name === "href" || name === "src") && /^javascript:/i.test(value)) { node.removeAttribute(attribute.name); }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
return wrapper.innerHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
function truncateHtml(fullHtml) {
|
|
||||||
var temp = document.createElement("div");
|
|
||||||
temp.innerHTML = fullHtml;
|
|
||||||
var text = temp.textContent || "";
|
|
||||||
|
|
||||||
if (text.length <= TRUNCATE_LENGTH) {
|
|
||||||
return { html: fullHtml, truncated: false };
|
|
||||||
}
|
|
||||||
|
|
||||||
var acc = "";
|
|
||||||
var count = 0;
|
|
||||||
var truncatedHtml = "";
|
|
||||||
var children = Array.from(temp.childNodes);
|
|
||||||
|
|
||||||
for (var ci = 0; ci < children.length; ci++) {
|
|
||||||
var child = children[ci];
|
|
||||||
var childText = child.textContent || "";
|
|
||||||
|
|
||||||
if (count + childText.length > TRUNCATE_LENGTH && count > 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (child.nodeType === Node.ELEMENT_NODE) {
|
|
||||||
truncatedHtml += child.outerHTML;
|
|
||||||
} else {
|
|
||||||
var remaining = TRUNCATE_LENGTH - count;
|
|
||||||
if (childText.length > remaining) {
|
|
||||||
truncatedHtml += escapeHtml(childText.slice(0, remaining)) + "…";
|
|
||||||
count = TRUNCATE_LENGTH;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
truncatedHtml += escapeHtml(childText);
|
|
||||||
}
|
|
||||||
count += childText.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
return { html: truncatedHtml, truncated: true };
|
|
||||||
}
|
|
||||||
|
|
||||||
function setupToggle() {
|
|
||||||
if (!toggleNoteNode || !currentReleaseNoteNode) return;
|
|
||||||
|
|
||||||
toggleNoteNode.addEventListener("click", function () {
|
|
||||||
var expanded = toggleNoteNode.dataset.expanded === "true";
|
|
||||||
if (expanded) {
|
|
||||||
var result = truncateHtml(fullReleaseBodyHtml);
|
|
||||||
currentReleaseNoteNode.innerHTML = result.html;
|
|
||||||
toggleNoteNode.textContent = "Voir plus";
|
|
||||||
toggleNoteNode.dataset.expanded = "false";
|
|
||||||
} else {
|
|
||||||
currentReleaseNoteNode.innerHTML = fullReleaseBodyHtml;
|
|
||||||
toggleNoteNode.textContent = "Voir moins";
|
|
||||||
toggleNoteNode.dataset.expanded = "true";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setupToggle();
|
|
||||||
|
|
||||||
function pickDirectDownloadUrl(release) {
|
|
||||||
const assets = Array.isArray(release?.assets) ? release.assets : [];
|
|
||||||
const isoAsset = assets.find((asset) => /\.iso$/i.test(asset?.name || ""));
|
|
||||||
const directAsset = isoAsset || assets[0];
|
|
||||||
|
|
||||||
if (directAsset) {
|
|
||||||
return directAsset.browser_download_url || release.html_url || REPO_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return release?.zipball_url || release?.html_url || REPO_URL;
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderEmptyState(title, message) {
|
|
||||||
if (!versionsListNode) return;
|
|
||||||
versionsListNode.innerHTML = `
|
|
||||||
<li class="version-item version-item-empty">
|
|
||||||
<div class="version-main">
|
|
||||||
<strong>${title}</strong>
|
|
||||||
<span>${message}</span>
|
|
||||||
</div>
|
|
||||||
<div class="version-side">
|
|
||||||
<a class="button button-secondary" href="${REPO_URL}" target="_blank" rel="noreferrer">Voir le repo</a>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderList(items, mode) {
|
|
||||||
if (!versionsListNode) return;
|
|
||||||
versionsListNode.innerHTML = "";
|
|
||||||
|
|
||||||
const visibleItems = items.slice(1, 6);
|
|
||||||
|
|
||||||
if (!visibleItems.length) {
|
|
||||||
if (items.length === 0) {
|
|
||||||
renderEmptyState("Aucune release trouvée", "Le dépôt n'expose pas encore de release ou les releases ne sont pas accessibles.");
|
|
||||||
} else {
|
|
||||||
renderEmptyState(
|
|
||||||
mode === "releases" ? "Aucune release précédente trouvée" : "Aucun tag précédent trouvé",
|
|
||||||
mode === "releases"
|
|
||||||
? "Il n'y a qu'une seule release publiée pour le moment."
|
|
||||||
: "Il n'y a qu'un seul tag disponible pour le moment."
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
visibleItems.forEach((entry) => {
|
|
||||||
const li = document.createElement("li");
|
|
||||||
li.className = "version-item";
|
|
||||||
|
|
||||||
const label = getReleaseLabel(entry);
|
|
||||||
const downloadUrl = getReleasePageUrl(entry, mode);
|
|
||||||
const published = formatDate(entry.published_at || entry.commit?.committer?.date);
|
|
||||||
|
|
||||||
li.innerHTML = `
|
|
||||||
<div class="version-main">
|
|
||||||
<strong>${label}</strong>
|
|
||||||
<span>${published ? `Publié le ${published}` : mode === "releases" ? "Date inconnue" : "Tag GitHub"}</span>
|
|
||||||
</div>
|
|
||||||
<div class="version-side">
|
|
||||||
<a class="button button-secondary" href="${downloadUrl}" target="_blank" rel="noreferrer">Télécharger</a>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
versionsListNode.appendChild(li);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchJson(url) {
|
|
||||||
const response = await fetch(url, {
|
|
||||||
headers: { Accept: "application/vnd.github+json" },
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(`GitHub API ${response.status}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return response.json();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadReleases() {
|
|
||||||
if (currentVersionNode) currentVersionNode.textContent = "Chargement...";
|
|
||||||
if (currentVersionDateNode) currentVersionDateNode.textContent = "";
|
|
||||||
if (currentReleaseNoteNode) currentReleaseNoteNode.textContent = "";
|
|
||||||
if (latestDownloadNode) latestDownloadNode.href = REPO_URL;
|
|
||||||
if (viewMoreNode) viewMoreNode.href = `${REPO_URL}/releases`;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const releases = await fetchJson(RELEASES_URL);
|
|
||||||
|
|
||||||
if (Array.isArray(releases) && releases.length > 0) {
|
|
||||||
const latest = releases[0];
|
|
||||||
const latestLabel = getReleaseLabel(latest);
|
|
||||||
const latestDownloadUrl = pickDirectDownloadUrl(latest);
|
|
||||||
const latestDate = formatDate(latest.published_at);
|
|
||||||
|
|
||||||
if (currentVersionNode) currentVersionNode.textContent = latestLabel;
|
|
||||||
if (currentVersionDateNode) currentVersionDateNode.textContent = latestDate ? ` · ${latestDate}` : "";
|
|
||||||
if (currentReleaseNoteNode) {
|
|
||||||
fullReleaseBodyHtml = sanitizeRenderedHtml(renderMarkdown(latest.body || ""));
|
|
||||||
var result = truncateHtml(fullReleaseBodyHtml);
|
|
||||||
currentReleaseNoteNode.innerHTML = result.html || "<p>Release GitHub la plus récente.</p>";
|
|
||||||
if (toggleNoteNode) {
|
|
||||||
toggleNoteNode.style.display = result.truncated ? "inline-block" : "none";
|
|
||||||
toggleNoteNode.dataset.expanded = "false";
|
|
||||||
toggleNoteNode.textContent = "Voir plus";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (latestDownloadNode) latestDownloadNode.href = latestDownloadUrl;
|
|
||||||
|
|
||||||
renderList(releases, "releases");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Erreur fetch releases:", error.message);
|
|
||||||
// On tente le fallback tags ci-dessous.
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const tags = await fetchJson(TAGS_URL);
|
|
||||||
|
|
||||||
if (Array.isArray(tags) && tags.length > 0) {
|
|
||||||
const latestTag = tags[0];
|
|
||||||
const latestLabel = getReleaseLabel(latestTag);
|
|
||||||
const latestDownloadUrl = `${REPO_URL}/releases/tag/${encodeURIComponent(latestTag.name)}`;
|
|
||||||
|
|
||||||
if (currentVersionNode) currentVersionNode.textContent = `${latestLabel} (tag)`;
|
|
||||||
if (currentVersionDateNode) currentVersionDateNode.textContent = "";
|
|
||||||
if (currentReleaseNoteNode) {
|
|
||||||
currentReleaseNoteNode.textContent = "Aucune release GitHub publiée pour le moment, affichage des tags du dépôt.";
|
|
||||||
}
|
|
||||||
if (latestDownloadNode) latestDownloadNode.href = latestDownloadUrl;
|
|
||||||
|
|
||||||
renderList(tags, "tags");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (currentVersionNode) currentVersionNode.textContent = "Aucune release trouvée";
|
|
||||||
if (currentReleaseNoteNode) {
|
|
||||||
currentReleaseNoteNode.textContent = "Le dépôt ne renvoie ni release ni tag public.";
|
|
||||||
}
|
|
||||||
renderEmptyState("Aucune release trouvée", "Le dépôt ne renvoie ni release ni tag public.");
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Erreur fetch tags:", error.message);
|
|
||||||
if (currentVersionNode) currentVersionNode.textContent = "Impossible de charger les releases";
|
|
||||||
if (currentReleaseNoteNode) {
|
|
||||||
currentReleaseNoteNode.textContent = `Erreur: ${error.message}. Vérifie que le repo GitHub est public et qu'il expose des releases ou des tags.`;
|
|
||||||
}
|
|
||||||
renderEmptyState("Impossible de charger les releases", "Ouvre le repo GitHub pour vérifier les releases ou les tags.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
loadReleases();
|
|
||||||
})();
|
|
||||||
@@ -0,0 +1,372 @@
|
|||||||
|
/**
|
||||||
|
* FWS Linux — animation de la page 404.
|
||||||
|
*
|
||||||
|
* Une seule fois, puis on s'arrête sur l'image finale : Tux s'approche du switch,
|
||||||
|
* saisit le câble RJ45 et tire (le connecteur sort du port, la LED passe au
|
||||||
|
* rouge, une pastille « link down » apparaît). Le coup de fil le déséquilibre :
|
||||||
|
* il tombe en arrière sur le fesse et reste assis, le câble toujours dans la
|
||||||
|
* main, tandis que le connecteur finit au sol au pied du switch.
|
||||||
|
*
|
||||||
|
* Tant qu'il est branché, le connecteur suit sa cible via un ressort
|
||||||
|
* sous-amorti ; une fois débranché il devient un point libre soumis à la gravité
|
||||||
|
* (rebond, frottement, torsion jusqu'à l'arrêt à plat). Le tracé du câble est
|
||||||
|
* recalculé à chaque image : le mou, le balancement et la traînée au sol en
|
||||||
|
* découlent.
|
||||||
|
*
|
||||||
|
* Sans JavaScript, la scène reste dans son état « branché » défini dans le SVG.
|
||||||
|
*/
|
||||||
|
(function () {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var svg = document.querySelector('.nf-scene');
|
||||||
|
if (!svg) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var el = {
|
||||||
|
switchBox: svg.querySelector('#nf-switch'),
|
||||||
|
shadow: svg.querySelector('#nf-shadow'),
|
||||||
|
tux: svg.querySelector('#nf-tux'),
|
||||||
|
arm: svg.querySelector('#nf-arm'),
|
||||||
|
connector: svg.querySelector('#nf-connector'),
|
||||||
|
cables: svg.querySelectorAll('.nf-cable'),
|
||||||
|
ledGreen: svg.querySelectorAll('.nf-led-green'),
|
||||||
|
ledRed: svg.querySelectorAll('.nf-led-red'),
|
||||||
|
badge: svg.querySelector('#nf-badge'),
|
||||||
|
spark: svg.querySelector('#nf-spark'),
|
||||||
|
footL: svg.querySelector('#nf-foot-l'),
|
||||||
|
footR: svg.querySelector('#nf-foot-r'),
|
||||||
|
eyes: svg.querySelector('#nf-eyes')
|
||||||
|
};
|
||||||
|
|
||||||
|
if (!el.tux || !el.arm || !el.connector || !el.cables.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Géométrie — doit rester synchronisée avec le dessin dans p/404.php. */
|
||||||
|
var G = {
|
||||||
|
walk: [215, 358], // pivot de la marche, entre les deux pattes
|
||||||
|
hip: [215, 322], // fesse : pivot de la chute en arrière
|
||||||
|
shoulder: [265, 250],
|
||||||
|
hand: [304, 256],
|
||||||
|
footL: [168, 346], // chevilles : pivot de la contre-rotation des pattes
|
||||||
|
footR: [262, 346],
|
||||||
|
plugPivot: [555, 236],
|
||||||
|
connAttach: [534, 236],
|
||||||
|
ground: 374
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Pose finale : assis, dos voûté, câble toujours en main. Les valeurs sont
|
||||||
|
calées pour que le bas du corps touche le sol et que la tête reste dans le
|
||||||
|
cadre (viewBox 0 0 720 440). */
|
||||||
|
var SIT = { deg: -32, x: -20, y: -10, arm: -24, foot: 50, footDropL: 6, footDropR: 62 };
|
||||||
|
|
||||||
|
/* Timeline (ms) : tout se joue une fois, puis l'image finale reste. */
|
||||||
|
var APPROACH_A = 700, APPROACH_B = 1500;
|
||||||
|
var PULL_A = 1800;
|
||||||
|
/* La chute part exactement du décrochage : plus de temps mort entre les deux. */
|
||||||
|
var RELEASE = 2900, FALL_A = RELEASE, FALL_B = 4050;
|
||||||
|
var TOTAL = 5500;
|
||||||
|
|
||||||
|
var APPROACH_X = 14, PULL_X = 22, STUMBLE_X = 18;
|
||||||
|
var GRAVITY = 1600;
|
||||||
|
|
||||||
|
/* ── Helpers ─────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
function clamp01(x) { return x < 0 ? 0 : (x > 1 ? 1 : x); }
|
||||||
|
function lerp(a, b, k) { return a + (b - a) * k; }
|
||||||
|
function smoothstep(e0, e1, x) {
|
||||||
|
var t = clamp01((x - e0) / (e1 - e0));
|
||||||
|
return t * t * (3 - 2 * t);
|
||||||
|
}
|
||||||
|
function easeInOut(t) {
|
||||||
|
return t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
function mul(A, B) {
|
||||||
|
return [
|
||||||
|
A[0] * B[0] + A[2] * B[1],
|
||||||
|
A[1] * B[0] + A[3] * B[1],
|
||||||
|
A[0] * B[2] + A[2] * B[3],
|
||||||
|
A[1] * B[2] + A[3] * B[3],
|
||||||
|
A[0] * B[4] + A[2] * B[5] + A[4],
|
||||||
|
A[1] * B[4] + A[3] * B[5] + A[5]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
function tr(x, y) { return [1, 0, 0, 1, x, y]; }
|
||||||
|
function rot(deg, cx, cy) {
|
||||||
|
var r = deg * Math.PI / 180, c = Math.cos(r), s = Math.sin(r);
|
||||||
|
return [c, s, -s, c, cx - c * cx + s * cy, cy - s * cx - c * cy];
|
||||||
|
}
|
||||||
|
function apply(m, x, y) { return [m[0] * x + m[2] * y + m[4], m[1] * x + m[3] * y + m[5]]; }
|
||||||
|
function tx(x, y, deg, px, py) {
|
||||||
|
return 'translate(' + x.toFixed(2) + ' ' + y.toFixed(2) + ')'
|
||||||
|
+ (deg ? ' rotate(' + deg.toFixed(2) + ' ' + px.toFixed(1) + ' ' + py.toFixed(1) + ')' : '');
|
||||||
|
}
|
||||||
|
function setOpacity(list, value) {
|
||||||
|
for (var i = 0; i < list.length; i++) {
|
||||||
|
list[i].setAttribute('opacity', value.toFixed(3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function setCable(d) {
|
||||||
|
for (var i = 0; i < el.cables.length; i++) {
|
||||||
|
el.cables[i].setAttribute('d', d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── État persistant ─────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
var springX = 0, springV = 0; // connecteur tant qu'il est dans le port
|
||||||
|
var gait = 0;
|
||||||
|
var released = false; // le connecteur est-il tombé ?
|
||||||
|
var plug = { x: 0, y: 0, vx: 0, vy: 0, rest: false };
|
||||||
|
var connDeg = 0, connDegV = 0;
|
||||||
|
|
||||||
|
function springStep(pos, vel, target, k, d, dt) {
|
||||||
|
var acc = -k * (pos - target) - d * vel;
|
||||||
|
vel += acc * dt;
|
||||||
|
pos += vel * dt;
|
||||||
|
return [pos, vel];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Chute du connecteur : gravité, rebond amorti, frottement au sol. */
|
||||||
|
function fallPoint(pt, dt) {
|
||||||
|
if (pt.rest) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
pt.vy += GRAVITY * dt;
|
||||||
|
pt.vx *= 0.995;
|
||||||
|
pt.x += pt.vx * dt;
|
||||||
|
pt.y += pt.vy * dt;
|
||||||
|
if (pt.y >= G.ground) {
|
||||||
|
pt.y = G.ground;
|
||||||
|
if (pt.vy > 40) {
|
||||||
|
pt.vy = -pt.vy * 0.34; // rebond
|
||||||
|
pt.vx *= 0.55;
|
||||||
|
} else {
|
||||||
|
pt.vy = 0;
|
||||||
|
}
|
||||||
|
pt.vx *= 0.84; // frottement
|
||||||
|
if (Math.abs(pt.vx) < 7 && Math.abs(pt.vy) < 1) {
|
||||||
|
pt.vx = 0;
|
||||||
|
pt.rest = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Un pas d'animation ──────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
function advance(t, dt) {
|
||||||
|
var approach = smoothstep(APPROACH_A, APPROACH_B, t);
|
||||||
|
|
||||||
|
/* Courbe de traction : Tux tire, puis se laisse retomber en arrière. */
|
||||||
|
var pull;
|
||||||
|
if (t <= PULL_A) {
|
||||||
|
pull = 0;
|
||||||
|
} else if (t < RELEASE) {
|
||||||
|
pull = easeInOut((t - PULL_A) / (RELEASE - PULL_A));
|
||||||
|
} else if (t < FALL_A) {
|
||||||
|
pull = 1;
|
||||||
|
} else {
|
||||||
|
pull = 1 - 0.5 * clamp01((t - FALL_A) / (FALL_B - FALL_A));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Chute : de la station debout à la pose assise. Courbe rapide au départ
|
||||||
|
(il perd l'équilibre dès que le câble lâche), puis amortie à l'arrivée. */
|
||||||
|
var fall = 1 - Math.pow(1 - clamp01((t - FALL_A) / (FALL_B - FALL_A)), 2.4);
|
||||||
|
|
||||||
|
var sinceRel = (t - RELEASE) / 1000;
|
||||||
|
var yank = 0, yankRot = 0;
|
||||||
|
if (t >= RELEASE) {
|
||||||
|
yank = -11 * Math.sin(sinceRel * 27) * Math.exp(-sinceRel * 6.5);
|
||||||
|
yankRot = 3.4 * Math.sin(sinceRel * 27) * Math.exp(-sinceRel * 6.5);
|
||||||
|
}
|
||||||
|
/* Rebond d'assise : petit amorti au moment où le fesse touche le sol. */
|
||||||
|
var sinceSit = (t - FALL_B) / 1000;
|
||||||
|
var settle = t > FALL_B ? 2 * Math.sin(sinceSit * 32) * Math.exp(-sinceSit * 4.5) : 0;
|
||||||
|
|
||||||
|
var bob = Math.sin(t / 520) * 1.3 * (1 - fall);
|
||||||
|
/* L'élan : il se met à reculer pendant la traction, atteint son maximum à
|
||||||
|
l'instant du décrochage, puis s'amortit. C'est ce recul qui bascule le
|
||||||
|
poids du corps et déclenche la chute. */
|
||||||
|
var slip = clamp01(1 - (t - RELEASE) / 900);
|
||||||
|
var standX = APPROACH_X * approach - PULL_X * pull - STUMBLE_X * slip + yank;
|
||||||
|
var standRot = 4 * approach - 11 * pull - 9 * slip + yankRot;
|
||||||
|
var standY = -1.5 * approach - 2 * pull + bob;
|
||||||
|
|
||||||
|
/* Démarche : la phase avance avec la vitesse de déplacement. */
|
||||||
|
var walk = smoothstep(APPROACH_A - 120, APPROACH_A + 260, t)
|
||||||
|
* (1 - smoothstep(APPROACH_B - 140, APPROACH_B + 200, t))
|
||||||
|
* (1 - fall);
|
||||||
|
gait += dt * 8.5 * walk;
|
||||||
|
var swing = Math.sin(gait) * 8.5 * walk;
|
||||||
|
var liftL = Math.max(0, Math.sin(gait)) * 5.5 * walk;
|
||||||
|
var liftR = Math.max(0, Math.sin(gait + Math.PI)) * 5.5 * walk;
|
||||||
|
|
||||||
|
/* Assis, les deux pattes sont posées à plat au sol devant le corps : on
|
||||||
|
compense la rotation du corps pour les remettre de niveau, et on les
|
||||||
|
descend d'autant pour qu'elles touchent terre. */
|
||||||
|
var footSpin = SIT.foot * fall;
|
||||||
|
el.footL.setAttribute('transform',
|
||||||
|
tx(swing * 0.5, -liftL + SIT.footDropL * fall, footSpin, G.footL[0], G.footL[1]));
|
||||||
|
el.footR.setAttribute('transform',
|
||||||
|
tx(-swing * 0.5, -liftR + SIT.footDropR * fall, footSpin, G.footR[0], G.footR[1]));
|
||||||
|
|
||||||
|
/* Corps : on interpole le pivot (pattes → fesse), l'angle et le décalage. */
|
||||||
|
var pvX = lerp(G.walk[0], G.hip[0], fall);
|
||||||
|
var pvY = lerp(G.walk[1], G.hip[1], fall);
|
||||||
|
var ang = lerp(standRot, SIT.deg, fall) + settle;
|
||||||
|
var ox = lerp(standX, SIT.x, fall);
|
||||||
|
var oy = lerp(standY, SIT.y, fall);
|
||||||
|
var bodyTf = tx(ox, oy, ang, pvX, pvY);
|
||||||
|
|
||||||
|
el.tux.setAttribute('transform', bodyTf);
|
||||||
|
|
||||||
|
/* Aileron avant : tend le bras, puis garde le câble en l'air en s'asseyant. */
|
||||||
|
var armRot = (16 * approach - 26 * pull) * (1 - fall) + SIT.arm * fall;
|
||||||
|
el.arm.setAttribute('transform',
|
||||||
|
bodyTf + ' rotate(' + armRot.toFixed(2) + ' ' + G.shoulder[0] + ' ' + G.shoulder[1] + ')');
|
||||||
|
|
||||||
|
/* L'ombre s'aplatit et se décale vers la fesse quand Tux se pose. */
|
||||||
|
if (el.shadow) {
|
||||||
|
el.shadow.setAttribute('transform',
|
||||||
|
'translate(' + (215 - 40 * fall).toFixed(1) + ' 376)'
|
||||||
|
+ ' scale(1 ' + (1 - 0.5 * fall).toFixed(3) + ')'
|
||||||
|
+ ' translate(-215 -376)');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Regard : vers le connecteur pendant la traction, vers le câble au sol
|
||||||
|
une fois assis. */
|
||||||
|
var gx = 0, gy = 0;
|
||||||
|
if (t >= FALL_B) { gx = 3; gy = 2.5; }
|
||||||
|
else if (t >= RELEASE) { gx = 1.5; gy = -0.5; }
|
||||||
|
else if (t >= PULL_A) { gx = -1; gy = 0; }
|
||||||
|
if (el.eyes) {
|
||||||
|
el.eyes.setAttribute('transform', 'translate(' + gx + ' ' + gy + ')');
|
||||||
|
}
|
||||||
|
|
||||||
|
var bodyM = mul(tr(ox, oy), rot(ang, pvX, pvY));
|
||||||
|
var armM = mul(bodyM, rot(armRot, G.shoulder[0], G.shoulder[1]));
|
||||||
|
var hand = apply(armM, G.hand[0], G.hand[1]);
|
||||||
|
|
||||||
|
/* Connecteur : ressort vers sa cible tant qu'il est dans le port. */
|
||||||
|
var sp = springStep(springX, springV, -34 * pull, 190, 15, dt);
|
||||||
|
springX = sp[0];
|
||||||
|
springV = sp[1];
|
||||||
|
var seated = [G.connAttach[0] + springX, G.connAttach[1]];
|
||||||
|
|
||||||
|
/* Point A = extrémité « connecteur » du câble ; point B = main de Tux.
|
||||||
|
Après le débranchement, A devient un point libre et B reste dans la main
|
||||||
|
jusqu'à la fin : c'est ce qui fait que Tux retombe en gardant le câble. */
|
||||||
|
var A, B, deg;
|
||||||
|
if (t < RELEASE) {
|
||||||
|
A = seated;
|
||||||
|
B = hand;
|
||||||
|
deg = 0;
|
||||||
|
released = false;
|
||||||
|
} else {
|
||||||
|
if (!released) {
|
||||||
|
released = true;
|
||||||
|
plug.x = seated[0];
|
||||||
|
plug.y = seated[1];
|
||||||
|
plug.vx = springV * 0.4 - 150;
|
||||||
|
plug.vy = -30;
|
||||||
|
connDeg = 0;
|
||||||
|
connDegV = -140;
|
||||||
|
}
|
||||||
|
fallPoint(plug, dt);
|
||||||
|
connDegV += (-(connDeg - 6) * 95 - connDegV * 11) * dt;
|
||||||
|
connDeg += connDegV * dt;
|
||||||
|
A = [plug.x, plug.y];
|
||||||
|
B = hand;
|
||||||
|
deg = connDeg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Connecteur : translation calculée pour amener son point d'attache en A. */
|
||||||
|
var R = rot(deg, G.plugPivot[0], G.plugPivot[1]);
|
||||||
|
var ar = apply(R, G.connAttach[0], G.connAttach[1]);
|
||||||
|
el.connector.setAttribute('transform',
|
||||||
|
'translate(' + (A[0] - ar[0]).toFixed(2) + ' ' + (A[1] - ar[1]).toFixed(2) + ')'
|
||||||
|
+ ' rotate(' + deg.toFixed(2) + ' ' + G.plugPivot[0] + ' ' + G.plugPivot[1] + ')');
|
||||||
|
|
||||||
|
/* Câble : affaissement réduit quand il se tend, jamais sous le sol. */
|
||||||
|
var dx = A[0] - B[0], dy = A[1] - B[1];
|
||||||
|
var taut = clamp01((Math.sqrt(dx * dx + dy * dy) - 210) / 240);
|
||||||
|
var velWorld = released ? plug.vx : springV;
|
||||||
|
var wob = Math.max(-16, Math.min(16, velWorld * 0.05));
|
||||||
|
var sway = 5 * Math.sin(t / 620) + 2 * Math.sin(t / 370 + 1.3);
|
||||||
|
var sag = 96 * (1 - 0.5 * taut) + (released ? 0 : sway);
|
||||||
|
var lim = G.ground - 3;
|
||||||
|
|
||||||
|
var c1x = A[0] - 48 - 18 * taut;
|
||||||
|
var c1y = Math.min(lim, A[1] + sag);
|
||||||
|
var c2x = B[0] + (released ? 52 : 64);
|
||||||
|
var c2y = Math.min(lim, Math.min(lim, B[1] + sag * 0.85) + wob);
|
||||||
|
setCable('M ' + A[0].toFixed(2) + ' ' + A[1].toFixed(2)
|
||||||
|
+ ' C ' + c1x.toFixed(2) + ' ' + c1y.toFixed(2)
|
||||||
|
+ ', ' + c2x.toFixed(2) + ' ' + c2y.toFixed(2)
|
||||||
|
+ ', ' + B[0].toFixed(2) + ' ' + B[1].toFixed(2));
|
||||||
|
|
||||||
|
/* LED : vert au départ, rouge clignotant une fois débranché */
|
||||||
|
var greenA = clamp01(1 - smoothstep(RELEASE - 60, RELEASE + 40, t));
|
||||||
|
var redA = (1 - greenA) * (0.55 + 0.45 * Math.abs(Math.sin(t / 90)));
|
||||||
|
setOpacity(el.ledGreen, greenA);
|
||||||
|
setOpacity(el.ledRed, redA);
|
||||||
|
|
||||||
|
/* Pastille « link down » */
|
||||||
|
var badgeA = smoothstep(RELEASE, RELEASE + 220, t);
|
||||||
|
el.badge.setAttribute('opacity', badgeA.toFixed(3));
|
||||||
|
el.badge.setAttribute('transform',
|
||||||
|
'translate(648 150) scale(' + (0.55 + 0.45 * badgeA).toFixed(3) + ') translate(-648 -150)');
|
||||||
|
|
||||||
|
/* Étincelle de débranchement */
|
||||||
|
var sparkA = (t >= RELEASE && sinceRel < 0.55) ? Math.exp(-sinceRel * 7) : 0;
|
||||||
|
el.spark.setAttribute('opacity', sparkA.toFixed(3));
|
||||||
|
el.spark.setAttribute('transform',
|
||||||
|
'translate(557 228) scale(' + (0.7 + sinceRel * 1.6).toFixed(3) + ') translate(-557 -228)');
|
||||||
|
|
||||||
|
/* Secousse du switch */
|
||||||
|
var jx = 0, jr = 0;
|
||||||
|
if (t >= RELEASE) {
|
||||||
|
jx = 4 * Math.sin(sinceRel * 32) * Math.exp(-sinceRel * 7);
|
||||||
|
jr = 0.55 * Math.sin(sinceRel * 32) * Math.exp(-sinceRel * 7);
|
||||||
|
}
|
||||||
|
el.switchBox.setAttribute('transform', tx(jx, 0, jr, 515, 206));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Lancement ───────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
var reduceMotion = window.matchMedia
|
||||||
|
&& window.matchMedia('(prefers-reduced-motion: reduce)').matches;
|
||||||
|
|
||||||
|
if (reduceMotion || typeof window.requestAnimationFrame !== 'function') {
|
||||||
|
/* Accessibilité / vieux navigateurs : on saute directement à l'image finale. */
|
||||||
|
var step = 1000 / 60;
|
||||||
|
for (var sim = 0; sim < TOTAL; sim += step) {
|
||||||
|
advance(sim, step / 1000);
|
||||||
|
}
|
||||||
|
advance(TOTAL, step / 1000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var start = null;
|
||||||
|
var last = 0;
|
||||||
|
|
||||||
|
function frame(now) {
|
||||||
|
if (start === null) {
|
||||||
|
start = now;
|
||||||
|
last = now;
|
||||||
|
}
|
||||||
|
var t = now - start;
|
||||||
|
var dt = Math.min(0.05, (now - last) / 1000) || 0.016;
|
||||||
|
last = now;
|
||||||
|
if (t >= TOTAL) {
|
||||||
|
advance(TOTAL, dt); // image finale, puis on s'arrête
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
advance(t, dt);
|
||||||
|
window.requestAnimationFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.requestAnimationFrame(frame);
|
||||||
|
})();
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
(() => {
|
||||||
|
const note = document.querySelector("[data-current-release-note]");
|
||||||
|
const toggle = document.querySelector("[data-toggle-release-note]");
|
||||||
|
if (!note || !toggle) return;
|
||||||
|
|
||||||
|
const fullTemplate = note.querySelector("template[data-note-full]");
|
||||||
|
if (!fullTemplate) return;
|
||||||
|
const fullHtml = fullTemplate.innerHTML;
|
||||||
|
const truncatedHtml = note.innerHTML;
|
||||||
|
|
||||||
|
toggle.addEventListener("click", () => {
|
||||||
|
const expanded = toggle.dataset.expanded === "true";
|
||||||
|
if (expanded) {
|
||||||
|
note.innerHTML = truncatedHtml;
|
||||||
|
toggle.textContent = "Voir plus";
|
||||||
|
toggle.dataset.expanded = "false";
|
||||||
|
} else {
|
||||||
|
note.innerHTML = fullHtml;
|
||||||
|
toggle.textContent = "Voir moins";
|
||||||
|
toggle.dataset.expanded = "true";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -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 */
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -1,487 +0,0 @@
|
|||||||
(() => {
|
|
||||||
const PACKAGES_SRC = "/p/paquets/packages.json";
|
|
||||||
|
|
||||||
let packagesPromise = null;
|
|
||||||
|
|
||||||
function fetchPackages() {
|
|
||||||
if (!packagesPromise) {
|
|
||||||
packagesPromise = fetch(PACKAGES_SRC, { cache: "no-store" })
|
|
||||||
.then((response) => {
|
|
||||||
if (!response.ok) throw new Error("Erreur " + response.status);
|
|
||||||
return response.json();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return packagesPromise;
|
|
||||||
}
|
|
||||||
|
|
||||||
function formatDate(iso) {
|
|
||||||
if (!iso) return null;
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("fr-FR", {
|
|
||||||
year: "numeric",
|
|
||||||
month: "long",
|
|
||||||
day: "numeric",
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Menu déroulant de la barre de navigation ── */
|
|
||||||
|
|
||||||
function initNavDropdown() {
|
|
||||||
const root = document.querySelector("[data-nav-dropdown]");
|
|
||||||
if (!root) return;
|
|
||||||
// Le script est chargé aussi dans la page « Paquets » (injection SPA) :
|
|
||||||
// on ne câble le menu qu'une seule fois.
|
|
||||||
if (root.dataset.navReady === "1") return;
|
|
||||||
root.dataset.navReady = "1";
|
|
||||||
|
|
||||||
const toggle = root.querySelector(".nav-dropdown-toggle");
|
|
||||||
const panel = root.querySelector(".nav-dropdown-panel");
|
|
||||||
if (!toggle || !panel) return;
|
|
||||||
|
|
||||||
function setOpen(open) {
|
|
||||||
root.classList.toggle("is-open", open);
|
|
||||||
toggle.setAttribute("aria-expanded", open ? "true" : "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeIfOutside(event) {
|
|
||||||
if (!root.contains(event.target)) setOpen(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
toggle.addEventListener("click", (event) => {
|
|
||||||
event.stopPropagation();
|
|
||||||
setOpen(!root.classList.contains("is-open"));
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener("click", closeIfOutside);
|
|
||||||
document.addEventListener("keydown", (event) => {
|
|
||||||
if (event.key === "Escape" && root.classList.contains("is-open")) {
|
|
||||||
setOpen(false);
|
|
||||||
toggle.focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Refermer le menu quand on navigue vers une autre page et
|
|
||||||
// réévaluer l'état actif une fois l'URL SPA réécrite.
|
|
||||||
document.addEventListener("page:before-route-change", () => {
|
|
||||||
setOpen(false);
|
|
||||||
setTimeout(markActiveRoute, 300);
|
|
||||||
});
|
|
||||||
|
|
||||||
function markActiveRoute() {
|
|
||||||
const search = window.location.search || "";
|
|
||||||
const active = search.includes("p=paquets") || search.includes("p/paquets");
|
|
||||||
if (active) {
|
|
||||||
toggle.setAttribute("aria-current", "page");
|
|
||||||
} else {
|
|
||||||
toggle.removeAttribute("aria-current");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
window.addEventListener("popstate", markActiveRoute);
|
|
||||||
markActiveRoute();
|
|
||||||
|
|
||||||
const list = panel.querySelector("[data-packages-nav]");
|
|
||||||
if (!list) return;
|
|
||||||
|
|
||||||
fetchPackages()
|
|
||||||
.then((packages) => {
|
|
||||||
list.innerHTML = "";
|
|
||||||
packages.forEach((pkg, index) => {
|
|
||||||
const item = document.createElement("a");
|
|
||||||
item.className = "nav-dropdown-item";
|
|
||||||
item.href = "/?p/paquets/" + (index + 1) + "/";
|
|
||||||
item.dataset.route = "paquets/" + (index + 1);
|
|
||||||
|
|
||||||
const name = document.createElement("strong");
|
|
||||||
name.textContent = pkg.name;
|
|
||||||
|
|
||||||
if (pkg.latest && pkg.latest.name) {
|
|
||||||
const version = document.createElement("span");
|
|
||||||
version.className = "nav-dropdown-version";
|
|
||||||
version.textContent = pkg.latest.name;
|
|
||||||
name.appendChild(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
const tagline = document.createElement("small");
|
|
||||||
tagline.textContent = pkg.tagline || "";
|
|
||||||
|
|
||||||
item.appendChild(name);
|
|
||||||
item.appendChild(tagline);
|
|
||||||
|
|
||||||
item.addEventListener("click", () => setOpen(false));
|
|
||||||
|
|
||||||
list.appendChild(item);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
list.innerHTML = '<p class="nav-dropdown-error">Impossible de charger les paquets.</p>';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Page « Paquets » ── */
|
|
||||||
|
|
||||||
function createEmptyState(message) {
|
|
||||||
const p = document.createElement("p");
|
|
||||||
p.className = "paquet-empty";
|
|
||||||
p.textContent = message;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createChangelog(pkg) {
|
|
||||||
const wrapper = document.createElement("div");
|
|
||||||
wrapper.className = "paquet-changelog";
|
|
||||||
|
|
||||||
const title = document.createElement("h3");
|
|
||||||
title.textContent = "Historique";
|
|
||||||
wrapper.appendChild(title);
|
|
||||||
|
|
||||||
if (!pkg.changelog || pkg.changelog.length === 0) {
|
|
||||||
wrapper.appendChild(createEmptyState("Historique en cours de rédaction."));
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
const timeline = document.createElement("ol");
|
|
||||||
timeline.className = "paquet-timeline";
|
|
||||||
|
|
||||||
for (const entry of pkg.changelog) {
|
|
||||||
const li = document.createElement("li");
|
|
||||||
li.className = "paquet-timeline-item";
|
|
||||||
|
|
||||||
const version = document.createElement("strong");
|
|
||||||
version.className = "paquet-timeline-version";
|
|
||||||
version.textContent = entry.version || "—";
|
|
||||||
|
|
||||||
const date = document.createElement("time");
|
|
||||||
date.className = "paquet-timeline-date";
|
|
||||||
date.textContent = formatDate(entry.date) || "";
|
|
||||||
if (entry.date) date.dateTime = entry.date;
|
|
||||||
|
|
||||||
const notes = document.createElement("span");
|
|
||||||
notes.className = "paquet-timeline-notes";
|
|
||||||
notes.textContent = entry.notes || "";
|
|
||||||
|
|
||||||
li.appendChild(version);
|
|
||||||
li.appendChild(date);
|
|
||||||
if (entry.notes) li.appendChild(notes);
|
|
||||||
timeline.appendChild(li);
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapper.appendChild(timeline);
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createScreens(pkg) {
|
|
||||||
const wrapper = document.createElement("div");
|
|
||||||
wrapper.className = "paquet-screens";
|
|
||||||
|
|
||||||
const title = document.createElement("h3");
|
|
||||||
title.textContent = "Captures d'écran";
|
|
||||||
wrapper.appendChild(title);
|
|
||||||
|
|
||||||
if (!pkg.screens || pkg.screens.length === 0) {
|
|
||||||
wrapper.appendChild(createEmptyState("Captures d'écran à venir."));
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
const grid = document.createElement("div");
|
|
||||||
grid.className = "paquet-screens-grid";
|
|
||||||
|
|
||||||
for (const screen of pkg.screens) {
|
|
||||||
const figure = document.createElement("figure");
|
|
||||||
const img = document.createElement("img");
|
|
||||||
img.src = screen.src;
|
|
||||||
img.alt = screen.alt || pkg.name;
|
|
||||||
img.loading = "lazy";
|
|
||||||
figure.appendChild(img);
|
|
||||||
if (screen.caption) {
|
|
||||||
const figcaption = document.createElement("figcaption");
|
|
||||||
figcaption.textContent = screen.caption;
|
|
||||||
figure.appendChild(figcaption);
|
|
||||||
}
|
|
||||||
grid.appendChild(figure);
|
|
||||||
}
|
|
||||||
|
|
||||||
wrapper.appendChild(grid);
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createLinks(pkg) {
|
|
||||||
const wrapper = document.createElement("div");
|
|
||||||
wrapper.className = "paquet-links";
|
|
||||||
|
|
||||||
const title = document.createElement("h3");
|
|
||||||
title.textContent = "Liens utiles";
|
|
||||||
wrapper.appendChild(title);
|
|
||||||
|
|
||||||
if (!pkg.links || pkg.links.length === 0) {
|
|
||||||
wrapper.appendChild(createEmptyState("Aucun lien pour le moment."));
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const link of pkg.links) {
|
|
||||||
const a = document.createElement("a");
|
|
||||||
a.className = "button button-secondary";
|
|
||||||
a.href = link.url;
|
|
||||||
const external = /^https?:\/\//i.test(link.url);
|
|
||||||
if (external) {
|
|
||||||
a.target = "_blank";
|
|
||||||
a.rel = "noopener noreferrer";
|
|
||||||
}
|
|
||||||
a.textContent = link.label || link.url;
|
|
||||||
wrapper.appendChild(a);
|
|
||||||
}
|
|
||||||
|
|
||||||
return wrapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createPackageCard(pkg, position) {
|
|
||||||
const card = document.createElement("article");
|
|
||||||
card.className = "paquet-card";
|
|
||||||
card.id = "paquet-" + pkg.id;
|
|
||||||
|
|
||||||
const head = document.createElement("header");
|
|
||||||
head.className = "paquet-head";
|
|
||||||
|
|
||||||
const titleRow = document.createElement("div");
|
|
||||||
titleRow.className = "paquet-title-row";
|
|
||||||
|
|
||||||
const title = document.createElement("h2");
|
|
||||||
title.textContent = pkg.name;
|
|
||||||
|
|
||||||
const badge = document.createElement("span");
|
|
||||||
badge.className = "paquet-since";
|
|
||||||
badge.textContent = pkg.sinceLabel || "FWS";
|
|
||||||
if (pkg.since) {
|
|
||||||
badge.title = "Depuis le " + formatDate(pkg.since);
|
|
||||||
}
|
|
||||||
|
|
||||||
const detailLink = document.createElement("a");
|
|
||||||
detailLink.className = "paquet-detail-link";
|
|
||||||
detailLink.href = "/?p/paquets/" + position + "/";
|
|
||||||
detailLink.dataset.route = "paquets/" + position;
|
|
||||||
detailLink.textContent = "Voir en grand";
|
|
||||||
|
|
||||||
titleRow.appendChild(title);
|
|
||||||
titleRow.appendChild(badge);
|
|
||||||
titleRow.appendChild(detailLink);
|
|
||||||
head.appendChild(titleRow);
|
|
||||||
|
|
||||||
if (pkg.tagline) {
|
|
||||||
const tagline = document.createElement("p");
|
|
||||||
tagline.className = "paquet-tagline";
|
|
||||||
tagline.textContent = pkg.tagline;
|
|
||||||
head.appendChild(tagline);
|
|
||||||
}
|
|
||||||
|
|
||||||
const latest = document.createElement("p");
|
|
||||||
latest.className = "paquet-latest";
|
|
||||||
if (pkg.latest && pkg.latest.name) {
|
|
||||||
latest.textContent =
|
|
||||||
"Dernière release : " +
|
|
||||||
pkg.latest.name +
|
|
||||||
(pkg.latest.date ? " — " + formatDate(pkg.latest.date) : "");
|
|
||||||
} else {
|
|
||||||
latest.textContent = "Aucune release publiée pour le moment.";
|
|
||||||
}
|
|
||||||
head.appendChild(latest);
|
|
||||||
|
|
||||||
if (pkg.description) {
|
|
||||||
const description = document.createElement("p");
|
|
||||||
description.className = "paquet-description";
|
|
||||||
description.textContent = pkg.description;
|
|
||||||
head.appendChild(description);
|
|
||||||
}
|
|
||||||
|
|
||||||
card.appendChild(head);
|
|
||||||
|
|
||||||
const body = document.createElement("div");
|
|
||||||
body.className = "paquet-body";
|
|
||||||
body.appendChild(createChangelog(pkg));
|
|
||||||
body.appendChild(createScreens(pkg));
|
|
||||||
body.appendChild(createLinks(pkg));
|
|
||||||
card.appendChild(body);
|
|
||||||
|
|
||||||
return card;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initPackagesPage(container) {
|
|
||||||
fetchPackages()
|
|
||||||
.then((packages) => {
|
|
||||||
container.innerHTML = "";
|
|
||||||
packages.forEach((pkg, index) => {
|
|
||||||
container.appendChild(createPackageCard(pkg, index + 1));
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
container.innerHTML = "";
|
|
||||||
container.appendChild(
|
|
||||||
createEmptyState("Impossible de charger les paquets. Réessayez plus tard.")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Page détail « Paquets / N » ── */
|
|
||||||
|
|
||||||
function packageIndexFromLocation() {
|
|
||||||
const haystack = window.location.search + window.location.pathname;
|
|
||||||
const match = haystack.match(/paquets\/(\d+)/);
|
|
||||||
return match ? parseInt(match[1], 10) : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createDetailNav(nav, position, total) {
|
|
||||||
if (position > 1) {
|
|
||||||
const prev = document.createElement("a");
|
|
||||||
prev.className = "paquet-detail-prev";
|
|
||||||
prev.href = "/?p/paquets/" + (position - 1) + "/";
|
|
||||||
prev.dataset.route = "paquets/" + (position - 1);
|
|
||||||
prev.textContent = "← Paquet précédent";
|
|
||||||
nav.appendChild(prev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (position < total) {
|
|
||||||
const next = document.createElement("a");
|
|
||||||
next.className = "paquet-detail-next";
|
|
||||||
next.href = "/?p/paquets/" + (position + 1) + "/";
|
|
||||||
next.dataset.route = "paquets/" + (position + 1);
|
|
||||||
next.textContent = "Paquet suivant →";
|
|
||||||
nav.appendChild(next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderPackageDetail(container, pkg, position, total) {
|
|
||||||
const back = document.createElement("a");
|
|
||||||
back.className = "paquet-detail-back";
|
|
||||||
back.href = "/?p/paquets/";
|
|
||||||
back.dataset.route = "paquets";
|
|
||||||
back.textContent = "← Tous les paquets";
|
|
||||||
container.appendChild(back);
|
|
||||||
|
|
||||||
const hero = document.createElement("div");
|
|
||||||
hero.className = "paquet-detail-hero";
|
|
||||||
|
|
||||||
const badge = document.createElement("span");
|
|
||||||
badge.className = "paquet-since";
|
|
||||||
badge.textContent = pkg.sinceLabel || "FWS";
|
|
||||||
if (pkg.since) {
|
|
||||||
badge.title = "Depuis le " + formatDate(pkg.since);
|
|
||||||
}
|
|
||||||
hero.appendChild(badge);
|
|
||||||
|
|
||||||
const title = document.createElement("h1");
|
|
||||||
title.textContent = pkg.name;
|
|
||||||
hero.appendChild(title);
|
|
||||||
|
|
||||||
if (pkg.tagline) {
|
|
||||||
const tagline = document.createElement("p");
|
|
||||||
tagline.className = "paquet-tagline";
|
|
||||||
tagline.textContent = pkg.tagline;
|
|
||||||
hero.appendChild(tagline);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pkg.description) {
|
|
||||||
const description = document.createElement("p");
|
|
||||||
description.className = "paquet-description";
|
|
||||||
description.textContent = pkg.description;
|
|
||||||
hero.appendChild(description);
|
|
||||||
}
|
|
||||||
|
|
||||||
const latest = document.createElement("div");
|
|
||||||
latest.className = "paquet-detail-latest";
|
|
||||||
if (pkg.latest && pkg.latest.name) {
|
|
||||||
const version = document.createElement("span");
|
|
||||||
version.className = "paquet-detail-version";
|
|
||||||
version.textContent = pkg.latest.name;
|
|
||||||
latest.appendChild(version);
|
|
||||||
|
|
||||||
if (pkg.latest.date) {
|
|
||||||
const date = document.createElement("span");
|
|
||||||
date.className = "paquet-detail-date";
|
|
||||||
date.textContent = "Publiée le " + formatDate(pkg.latest.date);
|
|
||||||
latest.appendChild(date);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
latest.textContent = "Aucune release publiée pour le moment.";
|
|
||||||
latest.classList.add("paquet-detail-latest-empty");
|
|
||||||
}
|
|
||||||
hero.appendChild(latest);
|
|
||||||
|
|
||||||
container.appendChild(hero);
|
|
||||||
|
|
||||||
const body = document.createElement("div");
|
|
||||||
body.className = "paquet-detail-body";
|
|
||||||
body.appendChild(createChangelog(pkg));
|
|
||||||
body.appendChild(createScreens(pkg));
|
|
||||||
container.appendChild(body);
|
|
||||||
|
|
||||||
container.appendChild(createLinks(pkg));
|
|
||||||
|
|
||||||
const nav = document.createElement("nav");
|
|
||||||
nav.className = "paquet-detail-nav";
|
|
||||||
nav.setAttribute("aria-label", "Parcourir les paquets");
|
|
||||||
createDetailNav(nav, position, total);
|
|
||||||
if (nav.childNodes.length > 0) {
|
|
||||||
container.appendChild(nav);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function initPackageDetail(container) {
|
|
||||||
const position = packageIndexFromLocation();
|
|
||||||
|
|
||||||
fetchPackages()
|
|
||||||
.then((packages) => {
|
|
||||||
container.innerHTML = "";
|
|
||||||
const pkg = packages[position - 1];
|
|
||||||
if (!pkg) {
|
|
||||||
container.appendChild(
|
|
||||||
createEmptyState("Ce paquet n'existe pas (il y en a " + packages.length + ").")
|
|
||||||
);
|
|
||||||
const back = document.createElement("a");
|
|
||||||
back.className = "paquet-detail-back";
|
|
||||||
back.href = "/?p/paquets/";
|
|
||||||
back.dataset.route = "paquets";
|
|
||||||
back.textContent = "← Tous les paquets";
|
|
||||||
container.appendChild(back);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderPackageDetail(container, pkg, position, packages.length);
|
|
||||||
// Le routeur SPA applique le titre et le scroll après le rendu :
|
|
||||||
// on force le vrai nom du paquet un peu plus tard.
|
|
||||||
setTimeout(() => {
|
|
||||||
document.title = pkg.name + " | FWS Linux";
|
|
||||||
}, 150);
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
container.innerHTML = "";
|
|
||||||
container.appendChild(
|
|
||||||
createEmptyState("Impossible de charger le paquet. Réessayez plus tard.")
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Initialisation ── */
|
|
||||||
|
|
||||||
function init() {
|
|
||||||
const hasNav = document.querySelector("[data-nav-dropdown]") !== null;
|
|
||||||
const hasPage = document.querySelector("[data-packages-page]") !== null;
|
|
||||||
const hasDetail = document.querySelector("[data-package-detail]") !== null;
|
|
||||||
if (!hasNav && !hasPage && !hasDetail) return;
|
|
||||||
|
|
||||||
initNavDropdown();
|
|
||||||
|
|
||||||
const pageContainers = document.querySelectorAll("[data-packages-page]");
|
|
||||||
pageContainers.forEach(initPackagesPage);
|
|
||||||
|
|
||||||
const detailContainers = document.querySelectorAll("[data-package-detail]");
|
|
||||||
detailContainers.forEach(initPackageDetail);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.readyState === "loading") {
|
|
||||||
document.addEventListener("DOMContentLoaded", init);
|
|
||||||
} else {
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
@@ -1,222 +0,0 @@
|
|||||||
(() => {
|
|
||||||
const main = document.getElementById("app-main");
|
|
||||||
const footerYear = document.getElementById("footer-year");
|
|
||||||
const pageStyleSelectors = "[data-page-style='true']";
|
|
||||||
const pageScriptSelectors = "script[data-page-script='true']";
|
|
||||||
|
|
||||||
const links = Array.from(document.querySelectorAll("[data-route]"));
|
|
||||||
|
|
||||||
if (footerYear) {
|
|
||||||
footerYear.textContent = new Date().getFullYear().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearInjectedPageStyles() {
|
|
||||||
document.querySelectorAll(pageStyleSelectors).forEach((node) => node.remove());
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearInjectedPageScripts() {
|
|
||||||
document.dispatchEvent(new CustomEvent("page:before-route-change"));
|
|
||||||
document.querySelectorAll(pageScriptSelectors).forEach((node) => node.remove());
|
|
||||||
}
|
|
||||||
|
|
||||||
function injectPageStyles(parsedDocument, sourceUrl) {
|
|
||||||
clearInjectedPageStyles();
|
|
||||||
|
|
||||||
const head = parsedDocument.head;
|
|
||||||
if (!head) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const styleNodes = Array.from(head.querySelectorAll("link[rel='stylesheet'], style"));
|
|
||||||
|
|
||||||
styleNodes.forEach((node) => {
|
|
||||||
const clonedNode = node.cloneNode(true);
|
|
||||||
clonedNode.setAttribute("data-page-style", "true");
|
|
||||||
|
|
||||||
if (clonedNode.tagName === "LINK") {
|
|
||||||
const href = clonedNode.getAttribute("href");
|
|
||||||
if (href) {
|
|
||||||
clonedNode.href = new URL(href, sourceUrl).toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.head.appendChild(clonedNode);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async function injectPageScripts(parsedDocument, sourceUrl) {
|
|
||||||
clearInjectedPageScripts();
|
|
||||||
|
|
||||||
const scriptNodes = Array.from(parsedDocument.querySelectorAll("script"));
|
|
||||||
|
|
||||||
for (const node of scriptNodes) {
|
|
||||||
const scriptElement = document.createElement("script");
|
|
||||||
scriptElement.setAttribute("data-page-script", "true");
|
|
||||||
|
|
||||||
const src = node.getAttribute("src");
|
|
||||||
if (src) {
|
|
||||||
scriptElement.src = new URL(src, sourceUrl).toString();
|
|
||||||
scriptElement.async = false;
|
|
||||||
if (node.defer) {
|
|
||||||
scriptElement.defer = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
await new Promise((resolve, reject) => {
|
|
||||||
scriptElement.onload = () => resolve();
|
|
||||||
scriptElement.onerror = () => reject(new Error(`Impossible de charger le script: ${src}`));
|
|
||||||
document.body.appendChild(scriptElement);
|
|
||||||
});
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
scriptElement.textContent = node.textContent;
|
|
||||||
document.body.appendChild(scriptElement);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeRoute(value) {
|
|
||||||
const raw = (value ?? "").toString().trim().toLowerCase();
|
|
||||||
if (!raw || raw === "/" || raw === "home" || raw === "index" || raw === "accueil") {
|
|
||||||
return "index";
|
|
||||||
}
|
|
||||||
return raw.replace(/^\/+|\/+$/g, "") || "index";
|
|
||||||
}
|
|
||||||
|
|
||||||
function routeFromLocation() {
|
|
||||||
const params = new URLSearchParams(window.location.search);
|
|
||||||
|
|
||||||
if (params.has("p")) {
|
|
||||||
return normalizeRoute(params.get("p"));
|
|
||||||
}
|
|
||||||
|
|
||||||
const rawSearch = window.location.search.replace(/^\?/, "");
|
|
||||||
if (rawSearch.startsWith("p/")) {
|
|
||||||
return normalizeRoute(rawSearch.slice(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rawSearch.startsWith("p=")) {
|
|
||||||
return normalizeRoute(rawSearch.slice(2));
|
|
||||||
}
|
|
||||||
|
|
||||||
const path = window.location.pathname.replace(/^\/+|\/+$/g, "");
|
|
||||||
if (path) {
|
|
||||||
if (path.endsWith(".html")) {
|
|
||||||
return "index";
|
|
||||||
}
|
|
||||||
|
|
||||||
const parts = path.split("/");
|
|
||||||
if (parts[0] === "p" && parts[1]) {
|
|
||||||
return normalizeRoute(parts.slice(1).join("/"));
|
|
||||||
}
|
|
||||||
return normalizeRoute(parts[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "index";
|
|
||||||
}
|
|
||||||
|
|
||||||
function setActiveRoute(route) {
|
|
||||||
links.forEach((link) => {
|
|
||||||
const isActive = link.dataset.route === route;
|
|
||||||
if (isActive) {
|
|
||||||
link.setAttribute("aria-current", "page");
|
|
||||||
} else {
|
|
||||||
link.removeAttribute("aria-current");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function setCanonicalUrl(route, replace = false) {
|
|
||||||
const url = route === "index" ? "/?p/index/" : `/?p/${route}/`;
|
|
||||||
if (replace) {
|
|
||||||
history.replaceState({ route }, "", url);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
history.pushState({ route }, "", url);
|
|
||||||
}
|
|
||||||
|
|
||||||
function routeToSource(route) {
|
|
||||||
// Les routes « paquets/N » affichent le détail (grand format) du paquet N.
|
|
||||||
if (/^paquets\/\d+$/.test(route)) {
|
|
||||||
return "p/paquets/_detail/index.html";
|
|
||||||
}
|
|
||||||
return `p/${route}/index.html`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function routeToTitle(route) {
|
|
||||||
if (route === "index") {
|
|
||||||
return "Accueil | FWS Linux";
|
|
||||||
}
|
|
||||||
|
|
||||||
const label = route
|
|
||||||
.split("/")
|
|
||||||
.filter(Boolean)
|
|
||||||
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
||||||
.join(" / ");
|
|
||||||
|
|
||||||
return `${label} | FWS Linux`;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadRoute(route) {
|
|
||||||
clearInjectedPageScripts();
|
|
||||||
|
|
||||||
const source = routeToSource(route);
|
|
||||||
// On laisse le cache HTTP faire son travail (revalidation 304) :
|
|
||||||
// le .htaccess renvoie « Cache-Control: no-cache » sur le HTML,
|
|
||||||
// donc on revalide à chaque navigation sans re-télécharger le corps.
|
|
||||||
const response = await fetch(source);
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(`Impossible de charger ${source} (${response.status})`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const html = await response.text();
|
|
||||||
const parsed = new DOMParser().parseFromString(html, "text/html");
|
|
||||||
injectPageStyles(parsed, response.url);
|
|
||||||
const injected = parsed.querySelector("[data-page-content]") ?? parsed.body;
|
|
||||||
main.innerHTML = injected.innerHTML.trim();
|
|
||||||
await injectPageScripts(parsed, response.url);
|
|
||||||
// Update document title from the fetched page if present, otherwise use generated title
|
|
||||||
const pageTitleEl = parsed.querySelector("title");
|
|
||||||
if (pageTitleEl && pageTitleEl.textContent && pageTitleEl.textContent.trim()) {
|
|
||||||
document.title = pageTitleEl.textContent.trim();
|
|
||||||
} else {
|
|
||||||
document.title = routeToTitle(route);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function render(route, { replaceHistory = false } = {}) {
|
|
||||||
const safeRoute = route || "index";
|
|
||||||
|
|
||||||
loadRoute(safeRoute)
|
|
||||||
.then(() => {
|
|
||||||
setActiveRoute(safeRoute);
|
|
||||||
setCanonicalUrl(safeRoute, replaceHistory);
|
|
||||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
main.innerHTML = `<section class="hero"><h1>Erreur de chargement</h1><p class="lead">${error.message}</p></section>`;
|
|
||||||
setActiveRoute("index");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener("click", (event) => {
|
|
||||||
const link = event.target.closest("[data-route]");
|
|
||||||
if (!link) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const route = normalizeRoute(link.dataset.route);
|
|
||||||
if (!route) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.preventDefault();
|
|
||||||
render(route);
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener("popstate", () => {
|
|
||||||
render(routeFromLocation(), { replaceHistory: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
render(routeFromLocation(), { replaceHistory: true });
|
|
||||||
})();
|
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
(() => {
|
||||||
|
/* Menu déroulant « Paquets » de la barre de navigation.
|
||||||
|
Le reste (contenu, données, états actifs) est rendu côté serveur. */
|
||||||
|
const root = document.querySelector("[data-nav-dropdown]");
|
||||||
|
const burger = document.querySelector(".nav-burger");
|
||||||
|
const nav = document.getElementById("app-nav");
|
||||||
|
|
||||||
|
/* Burger mobile : plie/déplie le panneau de navigation */
|
||||||
|
if (burger && nav) {
|
||||||
|
burger.addEventListener("click", () => {
|
||||||
|
const open = nav.classList.toggle("is-open");
|
||||||
|
burger.setAttribute("aria-expanded", open ? "true" : "false");
|
||||||
|
burger.setAttribute("aria-label", open ? "Fermer le menu de navigation" : "Ouvrir le menu de navigation");
|
||||||
|
});
|
||||||
|
|
||||||
|
/* Navigation choisie → le panneau se referme */
|
||||||
|
nav.querySelectorAll("a").forEach((link) => {
|
||||||
|
link.addEventListener("click", () => {
|
||||||
|
nav.classList.remove("is-open");
|
||||||
|
burger.setAttribute("aria-expanded", "false");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!root) return;
|
||||||
|
|
||||||
|
const toggle = root.querySelector(".nav-dropdown-toggle");
|
||||||
|
const panel = root.querySelector(".nav-dropdown-panel");
|
||||||
|
if (!toggle || !panel) return;
|
||||||
|
|
||||||
|
function setOpen(open) {
|
||||||
|
root.classList.toggle("is-open", open);
|
||||||
|
toggle.setAttribute("aria-expanded", open ? "true" : "false");
|
||||||
|
}
|
||||||
|
|
||||||
|
toggle.addEventListener("click", (event) => {
|
||||||
|
event.stopPropagation();
|
||||||
|
setOpen(!root.classList.contains("is-open"));
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("click", (event) => {
|
||||||
|
if (!root.contains(event.target)) setOpen(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
document.addEventListener("keydown", (event) => {
|
||||||
|
if (event.key === "Escape" && root.classList.contains("is-open")) {
|
||||||
|
setOpen(false);
|
||||||
|
toggle.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
panel.querySelectorAll("a").forEach((link) => {
|
||||||
|
link.addEventListener("click", () => setOpen(false));
|
||||||
|
});
|
||||||
|
})();
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
@import "./var.css";
|
||||||
|
|
||||||
|
/* ── 404 — Tux débranche le câble réseau ─────────────────────────────────────
|
||||||
|
Mise en page uniquement : le mouvement (Tux, connecteur, câble) est piloté
|
||||||
|
par p/assets/js/not-found.js. Le SVG est livré dans son état « branché »,
|
||||||
|
donc la page reste propre même sans JavaScript. */
|
||||||
|
|
||||||
|
.notfound {
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
|
||||||
|
align-items: center;
|
||||||
|
gap: clamp(1.5rem, 4vw, 3rem);
|
||||||
|
padding: clamp(1.75rem, 4vw, 3.25rem);
|
||||||
|
border-radius: 1.25rem;
|
||||||
|
background: var(--surface);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
box-shadow: var(--shadow-lg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
inset: -35% -10% auto;
|
||||||
|
height: 70%;
|
||||||
|
background: radial-gradient(60% 100% at 78% 0%, rgba(56, 189, 248, 0.16), transparent 70%);
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-copy {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-code {
|
||||||
|
margin: 0 0 0.35rem;
|
||||||
|
font-family: "Georgia", "Palatino Linotype", serif;
|
||||||
|
font-size: clamp(3.5rem, 11vw, 6.5rem);
|
||||||
|
line-height: 0.9;
|
||||||
|
letter-spacing: -0.04em;
|
||||||
|
color: transparent;
|
||||||
|
background: linear-gradient(180deg, var(--accent-soft), var(--accent-strong));
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-title {
|
||||||
|
margin: 0 0 0.75rem;
|
||||||
|
font-family: "Georgia", "Palatino Linotype", serif;
|
||||||
|
font-size: clamp(1.6rem, 3.6vw, 2.6rem);
|
||||||
|
line-height: 1.1;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-lead {
|
||||||
|
margin: 0 0 1.5rem;
|
||||||
|
max-width: 46ch;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 1.7;
|
||||||
|
text-wrap: pretty;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-actions {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-visual {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nf-scene {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
overflow: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Responsive ───────────────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.notfound {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-visual {
|
||||||
|
order: 2;
|
||||||
|
max-width: 34rem;
|
||||||
|
margin: 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-lead {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notfound-actions {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.notfound-actions .button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -89,6 +89,10 @@ main section a:not(.button):focus-visible {
|
|||||||
color: var(--accent-soft);
|
color: var(--accent-soft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main section a.button {
|
||||||
|
width: fit-content;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
.contact-header {
|
.contact-header {
|
||||||
padding-top: 2rem;
|
padding-top: 2rem;
|
||||||
@@ -105,5 +109,13 @@ main section a:not(.button):focus-visible {
|
|||||||
|
|
||||||
main section a.button {
|
main section a.button {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Très petits écrans : texte du hero resserré */
|
||||||
|
@media (max-width: 380px) {
|
||||||
|
.contact-header h1 {
|
||||||
|
font-size: clamp(1.6rem, 8vw, 2rem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
.creator-card {
|
.creator-card {
|
||||||
flex: 1 1 280px;
|
flex: 1 1 280px;
|
||||||
max-width: 400px;
|
max-width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding: 1.25rem;
|
padding: 1.25rem;
|
||||||
@@ -108,4 +108,23 @@
|
|||||||
flex: 1 1 100%;
|
flex: 1 1 100%;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Carte en pile : avatar au-dessus des infos, rien ne déborde */
|
||||||
|
.creator-card {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.creator-info {
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.creator-links {
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.creator-email {
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -198,3 +198,38 @@
|
|||||||
}
|
}
|
||||||
.version-side { width: 100%; }
|
.version-side { width: 100%; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Mobile : les tableaux de release notes défilent localement ── */
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
.versions-panel {
|
||||||
|
padding: 1rem 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* wrapper nécessaire : surcharge la base « overflow: visible » de ce
|
||||||
|
fichier (chargé après styles.css) pour que les tableaux débordent
|
||||||
|
dans leur propre scroll au lieu de casser la page */
|
||||||
|
.latest-note {
|
||||||
|
overflow-x: auto;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
.latest-note table {
|
||||||
|
min-width: 34rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.latest-note pre code {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.latest-actions .button {
|
||||||
|
flex: 1;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggle-note {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
@import "./var.css";
|
||||||
|
|
||||||
|
/* ── Legal pages (mentions légales, conditions, confidentialité) ── */
|
||||||
|
|
||||||
|
.legal-header {
|
||||||
|
max-width: 1120px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: clamp(2.5rem, 6vw, 5rem) 1.25rem 1.25rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-header h1 {
|
||||||
|
margin: 0;
|
||||||
|
font-family: "Georgia", "Times New Roman", serif;
|
||||||
|
font-size: clamp(2rem, 6vw, 3.5rem);
|
||||||
|
line-height: 1.1;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-header p {
|
||||||
|
max-width: 62ch;
|
||||||
|
margin: 1rem auto 0;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 1.05rem;
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main {
|
||||||
|
width: min(1120px, calc(100% - 2.5rem));
|
||||||
|
margin: 1.5rem auto 0;
|
||||||
|
padding: 0 0 3rem;
|
||||||
|
display: grid;
|
||||||
|
gap: 1.5rem;
|
||||||
|
align-content: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main section {
|
||||||
|
padding: clamp(1.4rem, 3vw, 2rem);
|
||||||
|
border-radius: 1rem;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: var(--surface);
|
||||||
|
box-shadow: var(--shadow-sm);
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main h2 {
|
||||||
|
margin: 0 0 0.85rem;
|
||||||
|
color: var(--text);
|
||||||
|
font-family: "Georgia", "Times New Roman", serif;
|
||||||
|
font-size: clamp(1.3rem, 3vw, 1.9rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main p,
|
||||||
|
.legal-main li {
|
||||||
|
margin: 0 0 0.85rem;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main ul {
|
||||||
|
margin: 0 0 1rem;
|
||||||
|
padding-left: 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main li:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main strong {
|
||||||
|
color: var(--text);
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main a:not(.button) {
|
||||||
|
color: var(--accent);
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 0.15em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main a:not(.button):hover,
|
||||||
|
.legal-main a:not(.button):focus-visible {
|
||||||
|
color: var(--accent-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Contact sheet : label/value pairs without bullets. */
|
||||||
|
.legal-sheet {
|
||||||
|
margin: 0 0 0.5rem;
|
||||||
|
padding: 0;
|
||||||
|
list-style: none;
|
||||||
|
display: grid;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-sheet li {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Field to complete by the maintainer (legal identity, IDE, venue). */
|
||||||
|
.legal-updated {
|
||||||
|
margin: 0;
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
|
.legal-header {
|
||||||
|
padding-top: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main {
|
||||||
|
width: min(100% - 1rem, 1120px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.legal-main section {
|
||||||
|
border-radius: 0.8rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -396,3 +396,126 @@ main[data-page-content] {
|
|||||||
.version-item { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0.6rem; border-radius: 0.45rem; }
|
.version-item { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0.6rem; border-radius: 0.45rem; }
|
||||||
.version-meta { color: var(--muted); margin-left: 0.6rem; font-size: 0.92rem; }
|
.version-meta { color: var(--muted); margin-left: 0.6rem; font-size: 0.92rem; }
|
||||||
.version-actions { display: flex; gap: 0.5rem; }
|
.version-actions { display: flex; gap: 0.5rem; }
|
||||||
|
|
||||||
|
/* ── Responsive tablette ── */
|
||||||
|
|
||||||
|
@media (max-width: 900px) {
|
||||||
|
.features {
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.features .card {
|
||||||
|
flex: 1 1 45%;
|
||||||
|
min-height: 9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* La mécanique hover-grow de l'accordéon n'a pas de sens au doigt :
|
||||||
|
chaque carte affiche sa description en permanence. */
|
||||||
|
.features .card p {
|
||||||
|
position: static;
|
||||||
|
margin-top: 0.4rem;
|
||||||
|
padding: 0;
|
||||||
|
background: none;
|
||||||
|
border: 0;
|
||||||
|
opacity: 1;
|
||||||
|
transform: none;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.features .card:hover,
|
||||||
|
.features .card:focus {
|
||||||
|
flex-grow: 0;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.features:not(:hover) .card:first-child,
|
||||||
|
.features:hover .card:first-child:not(:hover):not(:focus) {
|
||||||
|
flex-grow: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.env-row,
|
||||||
|
.env-row.is-reverse {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ordre visuel : l'image au-dessus du texte, même pour les rangées inversées */
|
||||||
|
.env-row.is-reverse .env-text { order: 2; }
|
||||||
|
.env-row.is-reverse .env-media { order: 1; }
|
||||||
|
|
||||||
|
.env-media {
|
||||||
|
min-height: 10rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-media {
|
||||||
|
width: 120px;
|
||||||
|
flex-basis: 120px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Responsive mobile ── */
|
||||||
|
|
||||||
|
@media (max-width: 640px) {
|
||||||
|
main[data-page-content] {
|
||||||
|
padding: 1.25rem 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
min-height: 26rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-controls {
|
||||||
|
position: static;
|
||||||
|
margin-top: 1.25rem;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-inner {
|
||||||
|
max-width: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.features {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.features .card {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 1.15rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.env-choices {
|
||||||
|
padding: 1.1rem 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.env-text {
|
||||||
|
padding: 1rem 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-card {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-media {
|
||||||
|
width: 100%;
|
||||||
|
flex-basis: auto;
|
||||||
|
max-height: 10rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.download-media img {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-item {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 0.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-actions {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.version-actions .button {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
+348
-72
@@ -47,44 +47,92 @@
|
|||||||
|
|
||||||
.nav-dropdown-panel {
|
.nav-dropdown-panel {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc(100% + 0.6rem);
|
top: calc(100% + 0.55rem);
|
||||||
left: 50%;
|
left: 50%;
|
||||||
z-index: 300;
|
z-index: 300;
|
||||||
min-width: 340px;
|
width: min(92vw, 26rem);
|
||||||
max-width: min(92vw, 430px);
|
padding: 0.4rem;
|
||||||
padding: 0.5rem;
|
background: color-mix(in srgb, var(--surface-raised) 88%, transparent);
|
||||||
background: var(--surface-raised);
|
backdrop-filter: blur(14px);
|
||||||
|
-webkit-backdrop-filter: blur(14px);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
border-radius: 0.75rem;
|
border-radius: 1rem;
|
||||||
box-shadow: var(--shadow-lg);
|
box-shadow: 0 18px 50px rgba(2, 6, 23, 0.55), var(--shadow-lg);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
transform: translateX(-50%) translateY(-6px);
|
transform: translateX(-50%) translateY(-6px) scale(0.98);
|
||||||
transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
|
transform-origin: top center;
|
||||||
|
transition: opacity 170ms ease, transform 170ms ease, visibility 170ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown.is-open .nav-dropdown-panel {
|
.nav-dropdown.is-open .nav-dropdown-panel {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
transform: translateX(-50%) translateY(0);
|
transform: translateX(-50%) translateY(0) scale(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* En-tête du panneau : titre + compteur */
|
||||||
|
.nav-dropdown-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 0.75rem;
|
||||||
|
padding: 0.55rem 0.7rem 0.5rem;
|
||||||
|
border-bottom: 1px solid var(--border-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-dropdown-head strong {
|
||||||
|
color: var(--text);
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 700;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.07em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-dropdown-head small {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.72rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown-panel-inner {
|
.nav-dropdown-panel-inner {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.15rem;
|
gap: 0.2rem;
|
||||||
max-height: min(60vh, 26rem);
|
max-height: min(58vh, 24rem);
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
padding: 0.25rem;
|
padding: 0.4rem 0.15rem 0.2rem;
|
||||||
|
scrollbar-width: thin;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown-item {
|
.nav-dropdown-item {
|
||||||
display: grid;
|
display: flex;
|
||||||
gap: 0.15rem;
|
align-items: center;
|
||||||
padding: 0.6rem 0.75rem;
|
gap: 0.65rem;
|
||||||
border-radius: 0.5rem;
|
padding: 0.55rem 0.6rem;
|
||||||
|
border-radius: 0.65rem;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
transition: background 120ms ease, color 120ms ease;
|
transition: background 130ms ease, color 130ms ease, transform 130ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Item avec miniature (première image du paquet) */
|
||||||
|
.nav-dropdown-item.has-thumb {
|
||||||
|
grid-template-columns: auto 1fr;
|
||||||
|
}
|
||||||
|
.nav-dropdown-thumb {
|
||||||
|
width: 2.4rem;
|
||||||
|
height: 2.4rem;
|
||||||
|
border-radius: 0.55rem;
|
||||||
|
object-fit: cover;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
display: block;
|
||||||
|
flex: none;
|
||||||
|
background: var(--surface);
|
||||||
|
}
|
||||||
|
.nav-dropdown-text {
|
||||||
|
display: grid;
|
||||||
|
gap: 0.1rem;
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown-item:hover,
|
.nav-dropdown-item:hover,
|
||||||
@@ -92,6 +140,7 @@
|
|||||||
background: var(--accent-bg);
|
background: var(--accent-bg);
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
outline: none;
|
outline: none;
|
||||||
|
transform: translateX(2px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown-item strong {
|
.nav-dropdown-item strong {
|
||||||
@@ -100,12 +149,12 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
gap: 0.4rem;
|
gap: 0.4rem;
|
||||||
color: var(--text);
|
color: var(--text);
|
||||||
font-size: 0.95rem;
|
font-size: 0.92rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown-version {
|
.nav-dropdown-version {
|
||||||
padding: 0.05rem 0.4rem;
|
padding: 0.05rem 0.45rem;
|
||||||
font-size: 0.65rem;
|
font-size: 0.65rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
@@ -116,22 +165,32 @@
|
|||||||
|
|
||||||
.nav-dropdown-item small {
|
.nav-dropdown-item small {
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
font-size: 0.78rem;
|
font-size: 0.76rem;
|
||||||
line-height: 1.35;
|
line-height: 1.35;
|
||||||
|
overflow: hidden;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown-all {
|
.nav-dropdown-all {
|
||||||
display: block;
|
display: flex;
|
||||||
margin-top: 0.35rem;
|
align-items: center;
|
||||||
padding: 0.6rem 0.75rem 0.3rem;
|
justify-content: center;
|
||||||
border-top: 1px solid var(--border);
|
gap: 0.4rem;
|
||||||
|
margin: 0.3rem 0.15rem 0.1rem;
|
||||||
|
padding: 0.6rem 0.75rem;
|
||||||
|
border-top: 1px solid var(--border-soft);
|
||||||
color: var(--accent);
|
color: var(--accent);
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-size: 0.9rem;
|
font-size: 0.88rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
|
border-radius: 0.65rem;
|
||||||
|
transition: background 130ms ease, color 130ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown-all:hover {
|
.nav-dropdown-all:hover {
|
||||||
|
background: var(--accent-bg);
|
||||||
color: var(--accent-strong);
|
color: var(--accent-strong);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,13 +215,6 @@
|
|||||||
color: var(--text);
|
color: var(--text);
|
||||||
}
|
}
|
||||||
|
|
||||||
.paquets-hero p {
|
|
||||||
margin: 0 auto;
|
|
||||||
max-width: 42rem;
|
|
||||||
color: var(--muted);
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paquets-list {
|
.paquets-list {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
@@ -337,6 +389,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;
|
||||||
@@ -460,45 +679,60 @@
|
|||||||
grid-column: auto;
|
grid-column: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.paquet-detail-nav {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 1rem;
|
|
||||||
padding-top: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paquet-detail-nav a {
|
|
||||||
color: var(--accent);
|
|
||||||
text-decoration: none;
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
padding: 0.5rem 0.75rem;
|
|
||||||
border: 1px solid var(--border);
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
background: var(--surface);
|
|
||||||
transition: color 160ms ease, background 160ms ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paquet-detail-nav a:hover {
|
|
||||||
color: var(--accent-strong);
|
|
||||||
background: var(--accent-bg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.paquet-detail-prev {
|
|
||||||
margin-right: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paquet-detail-next {
|
|
||||||
margin-left: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ── Responsive ── */
|
/* ── Responsive ── */
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
/* Tablette : grilles deux colonnes → une, panels déroulants déjà statiques <900px */
|
||||||
.nav-dropdown {
|
@media (max-width: 900px) {
|
||||||
width: 100%;
|
.paquet-body,
|
||||||
|
.paquet-detail-body {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.paquet-detail-hero {
|
||||||
|
padding: 1.5rem 1.25rem 1.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-detail-hero h1 {
|
||||||
|
font-size: 2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-detail-link {
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* La popup garde la place : flèches en bas, comme le bloc 720px existant */
|
||||||
|
.pkg-lightbox {
|
||||||
|
padding: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-img {
|
||||||
|
max-height: 62vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-nav {
|
||||||
|
top: auto;
|
||||||
|
bottom: 1.2rem;
|
||||||
|
transform: none;
|
||||||
|
width: 2.6rem;
|
||||||
|
height: 2.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-prev { left: auto; right: 4.4rem; }
|
||||||
|
.pkg-lightbox-next { right: 1rem; }
|
||||||
|
|
||||||
|
.pkg-lightbox-close {
|
||||||
|
top: 0.8rem;
|
||||||
|
right: 0.8rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pkg-lightbox-figcap {
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.25rem;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 700px) {
|
||||||
.nav-dropdown-toggle {
|
.nav-dropdown-toggle {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
@@ -511,17 +745,59 @@
|
|||||||
max-width: none;
|
max-width: none;
|
||||||
transform: none;
|
transform: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Le conteneur flex desktop mettrait toggle et panneau côte à côte : en mobile on empile */
|
||||||
|
.nav-dropdown {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-dropdown.is-open .nav-dropdown-panel {
|
.nav-dropdown.is-open .nav-dropdown-panel {
|
||||||
|
display: block;
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.paquet-body {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
.paquet-links {
|
.paquet-links {
|
||||||
grid-column: auto;
|
grid-column: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.paquets-hero h1 {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-card {
|
||||||
|
padding: 1.1rem 1rem 1.3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-title-row h2 {
|
||||||
|
font-size: 1.2rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-timeline {
|
||||||
|
margin-left: 0;
|
||||||
|
padding-left: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-screens-grid {
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-links .button {
|
||||||
|
flex: 1 1 100%;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.paquet-detail-back {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Très petits écrans : captures en une colonne (après le bloc 700px pour gagner) */
|
||||||
|
@media (max-width: 480px) {
|
||||||
|
.paquet-screens-grid {
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+152
-12
@@ -112,6 +112,44 @@ body {
|
|||||||
gap: 0.35rem;
|
gap: 0.35rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Burger mobile : bouton visible <900px, la nav devient un panneau dépliant */
|
||||||
|
|
||||||
|
.nav-burger {
|
||||||
|
display: none;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 5px;
|
||||||
|
width: 2.75rem;
|
||||||
|
height: 2.75rem;
|
||||||
|
padding: 0 0.6rem;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
background: var(--surface-raised);
|
||||||
|
cursor: pointer;
|
||||||
|
flex: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-burger span {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
height: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background: var(--text);
|
||||||
|
transition: transform 180ms ease, opacity 180ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-burger[aria-expanded="true"] span:nth-child(1) {
|
||||||
|
transform: translateY(7px) rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-burger[aria-expanded="true"] span:nth-child(2) {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-burger[aria-expanded="true"] span:nth-child(3) {
|
||||||
|
transform: translateY(-7px) rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
.site-nav a {
|
.site-nav a {
|
||||||
padding: 0.5rem 1rem;
|
padding: 0.5rem 1rem;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
@@ -209,12 +247,13 @@ body {
|
|||||||
|
|
||||||
.footer-links-grid {
|
.footer-links-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
padding: 1.5rem 0;
|
padding: 1.5rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-links-grid section {
|
.footer-links-grid section,
|
||||||
|
.footer-links-grid nav {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
align-content: start;
|
align-content: start;
|
||||||
@@ -251,6 +290,22 @@ body {
|
|||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer-hosting {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-hosting a {
|
||||||
|
color: var(--text-secondary);
|
||||||
|
text-decoration: none;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
transition: color 160ms ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-hosting a:hover,
|
||||||
|
.footer-hosting a:focus-visible {
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
.footer-release,
|
.footer-release,
|
||||||
.footer-commit {
|
.footer-commit {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
@@ -329,25 +384,83 @@ body {
|
|||||||
.footer-links-grid {
|
.footer-links-grid {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Header : burger à droite, nav en panneau dépliant sous la marque */
|
||||||
|
.header-brand-block {
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 0.6rem 1rem;
|
||||||
|
gap: 0.6rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-burger {
|
||||||
|
display: flex;
|
||||||
|
margin-left: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-nav {
|
||||||
|
display: none;
|
||||||
|
flex-basis: 100%;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.3rem;
|
||||||
|
padding: 0.35rem 0 0.5rem;
|
||||||
|
border-top: 1px solid var(--border-soft);
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-nav.is-open {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-nav a,
|
||||||
|
.nav-dropdown-toggle {
|
||||||
|
width: 100%;
|
||||||
|
text-align: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 0.65rem 1rem;
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Le panneau déroulant devient statique : il se déploie dans le flux */
|
||||||
|
.nav-dropdown {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-dropdown-panel {
|
||||||
|
position: static;
|
||||||
|
left: auto;
|
||||||
|
min-width: 0;
|
||||||
|
max-width: none;
|
||||||
|
width: 100%;
|
||||||
|
transform: none;
|
||||||
|
box-shadow: none;
|
||||||
|
background: var(--surface);
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-dropdown.is-open .nav-dropdown-panel {
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-dropdown-panel-inner {
|
||||||
|
max-height: 16rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.site-main {
|
||||||
|
padding: 1.25rem 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
.page-shell {
|
.page-shell {
|
||||||
width: min(100% - 1rem, 1120px);
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header-brand-block {
|
.header-brand-block {
|
||||||
flex-direction: column;
|
padding: 0.55rem 0.85rem;
|
||||||
align-items: stretch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.site-nav {
|
.brand-text {
|
||||||
justify-content: space-between;
|
font-size: 1.25rem;
|
||||||
}
|
|
||||||
|
|
||||||
.site-nav a,
|
|
||||||
.button {
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.footer-brand-row,
|
.footer-brand-row,
|
||||||
@@ -358,4 +471,31 @@ body {
|
|||||||
.footer-brand-block {
|
.footer-brand-block {
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.footer-bottom p {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-actions .button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Très petits écrans (<380px) : marges réduites, tailles resserrées */
|
||||||
|
@media (max-width: 380px) {
|
||||||
|
.site-main {
|
||||||
|
padding: 1rem 0.65rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero {
|
||||||
|
min-height: 24rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-title {
|
||||||
|
font-size: clamp(2rem, 9vw, 2.5rem);
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-links-grid {
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page Conditions d'utilisation (rendu serveur, coquille page.php).
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct (/p/conditions/…) : on délègue au front controller. */
|
||||||
|
require __DIR__ . '/../../page.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = "Conditions d'utilisation | FWS Linux";
|
||||||
|
$description = "Conditions d'utilisation du site et de la distribution FWS Linux : usage, licences libres, téléchargements, responsabilité et droit applicable suisse.";
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/legal.css');
|
||||||
|
?>
|
||||||
|
<header class="legal-header">
|
||||||
|
<h1>Conditions d'utilisation</h1>
|
||||||
|
<p>Les présentes conditions régissent l'accès au site FWS Linux et l'utilisation de la distribution qui y est proposée.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="legal-main">
|
||||||
|
<section>
|
||||||
|
<h2>1. Objet et acceptation</h2>
|
||||||
|
<p>L'accès au site et son utilisation impliquent l'acceptation sans réserve des présentes conditions. Si vous ne les acceptez pas, merci de ne pas utiliser le site. Elles complètent les <a href="<?= e(fws_url('/?p/mentions-legales/')) ?>">mentions légales</a> et la <a href="<?= e(fws_url('/?p/confidentialite/')) ?>">politique de confidentialité</a>.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>2. Description du service</h2>
|
||||||
|
<p>FWS Linux est une distribution open source basée sur Arch Linux. Le site fournit des informations sur le projet et permet de télécharger gratuitement des images disque (ISO) des différentes éditions, ainsi que des paquets développés par l'équipe.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>3. Accès et disponibilité</h2>
|
||||||
|
<p>Le site est en principe accessible en continu, sauf interruption technique, maintenance ou cas de force majeure. L'éditeur ne garantit pas une disponibilité ininterrompue ni l'absence d'erreurs, et peut à tout moment faire évoluer, suspendre ou interrompre le site sans préavis.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>4. Licences et propriété intellectuelle</h2>
|
||||||
|
<p>La distribution FWS Linux et les paquets publiés sont des logiciels libres, distribués sous les licences de leurs dépôts respectifs (notamment des licences de type GPL). Le code source est disponible publiquement sur GitHub et Gitea : vous pouvez l'utiliser, l'étudier, le modifier et le redistribuer selon les termes de ces licences.</p>
|
||||||
|
<p>Les marques citées sur le site (« Linux », « Arch Linux », « Windows », etc.) appartiennent à leurs propriétaires respectifs et sont utilisées à titre descriptif uniquement.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>5. Obligations de l'utilisateur</h2>
|
||||||
|
<p>Vous vous engagez à utiliser le site de manière loyale et licite. Il vous est notamment interdit de :</p>
|
||||||
|
<ul>
|
||||||
|
<li>porter atteinte aux droits de tiers ou à l'ordre public via le site ou ses services ;</li>
|
||||||
|
<li>tenter d'intrure, de surcharger ou de perturber le fonctionnement du site ou de son hébergement ;</li>
|
||||||
|
<li>extraire massivement ou automatiquement les contenus du site ;</li>
|
||||||
|
<li>distribuer des copies altérées de la distribution en se prévalant de l'identité du projet.</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>6. Téléchargements et sécurité</h2>
|
||||||
|
<p>Les images ISO et paquets sont fournis « en l'état », sans garantie d'adéquation à un usage particulier. Avant toute installation, il est recommandé de vérifier l'intégrité du fichier (sommes de contrôle et signatures publiées avec les releases).</p>
|
||||||
|
<p>L'installation d'un système d'exploitation peut entraîner la perte définitive des données présentes sur la machine : pensez à sauvegarder vos fichiers avant toute manipulation. L'exécution d'applications Windows via Wine ou Winboat reste soumise aux licences des éditeurs de ces applications.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>7. Limitation de responsabilité</h2>
|
||||||
|
<p>Dans toute la mesure permise par le droit suisse, l'éditeur ne peut être tenu responsable des dommages directs ou indirects — notamment perte de données, perte d'exploitation ou préjudice matériel — résultant de l'utilisation du site, des téléchargements proposés ou de l'installation de la distribution.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>8. Liens externes</h2>
|
||||||
|
<p>Le site renvoie vers des services tiers (GitHub, Gitea, Discord, Zi-Host…). L'éditeur n'exerce aucun contrôle sur ces sites et décline toute responsabilité quant à leur contenu, leur disponibilité ou leurs pratiques en matière de données.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>9. Modification des conditions</h2>
|
||||||
|
<p>Les présentes conditions peuvent être modifiées à tout moment. La version applicable est celle en ligne au moment de votre consultation ; sa date de mise à jour figure en bas de la présente page.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>10. Droit applicable et juridiction</h2>
|
||||||
|
<p>Les présentes conditions sont soumises au droit suisse. Tout litige relève de la compétence exclusive des tribunaux de Lausanne, sous réserve des fors légaux impératifs.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<p class="legal-updated">Dernière mise à jour : 24 septembre 2026.</p>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page Confidentialité (rendu serveur, coquille page.php).
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct (/p/confidentialite/…) : on délègue au front controller. */
|
||||||
|
require __DIR__ . '/../../page.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = 'Confidentialité | FWS Linux';
|
||||||
|
$description = 'Politique de confidentialité de FWS Linux : aucune collecte de données par le site, journaux techniques de l\'hébergeur Zi-Host, services tiers et vos droits (LPD).';
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/legal.css');
|
||||||
|
?>
|
||||||
|
<header class="legal-header">
|
||||||
|
<h1>Politique de confidentialité</h1>
|
||||||
|
<p>Comment vos données sont — ou ne sont pas — traitées lorsque vous utilisez ce site.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="legal-main">
|
||||||
|
<section>
|
||||||
|
<h2>Responsable du traitement</h2>
|
||||||
|
<p>Le responsable du traitement des données relatives à ce site est le projet FWS Linux. Toute question relative aux données peut nous être adressée via la <a href="<?= e(fws_url('/?p/contact/')) ?>">page de contact</a> ou à <a href="mailto:dami.scoot3@gmail.com">dami.scoot3@gmail.com</a>.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Ce que le site ne fait pas</h2>
|
||||||
|
<p>La navigation et les téléchargements ne nécessitent ni compte, ni inscription, ni communication d'informations personnelles. En particulier, ce site :</p>
|
||||||
|
<ul>
|
||||||
|
<li>n'utilise <strong>aucun cookie</strong> ni traceur de mesure d'audience ;</li>
|
||||||
|
<li>n'affiche <strong>aucune publicité</strong> ;</li>
|
||||||
|
<li>ne crée <strong>aucun profil utilisateur</strong> ;</li>
|
||||||
|
<li>ne demande <strong>aucune donnée personnelle</strong> pour télécharger les ISO ou les paquets.</li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Journaux techniques de l'hébergeur</h2>
|
||||||
|
<p>Comme tout site, les requêtes adressées à FWS Linux transitent par l'infrastructure de notre hébergeur <strong>Zi-Host</strong>, situé en Suisse. Dans le cadre de la sécurité et de la disponibilité du service, l'hébergeur est susceptible de traiter des journaux techniques (adresse IP, date et heure, page demandée, type de navigateur).</p>
|
||||||
|
<p>Ces traitements sont régis par la <a href="https://zi-host.ch/legal/confidentialite" target="_blank" rel="noopener noreferrer">politique de confidentialité de Zi-Host</a>, qui décrit les finalités, les durées de conservation et les modalités d'exercice des droits.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Services tiers</h2>
|
||||||
|
<p>Les informations de releases (ISO et paquets) sont récupérées <strong>côté serveur</strong> auprès des API de Gitea et GitHub : vos données personnelles ne sont pas transmises lors de ces échanges.</p>
|
||||||
|
<p>Lorsque vous cliquez sur un lien externe (GitHub, Gitea, Discord, site de l'hébergeur…), vous quittez ce site. Les services concernés appliquent alors leurs propres conditions et politiques de confidentialité, que nous vous invitons à consulter :</p>
|
||||||
|
<ul>
|
||||||
|
<li>GitHub : <a href="https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement" target="_blank" rel="noopener noreferrer">Déclaration de confidentialité</a></li>
|
||||||
|
<li>Discord : <a href="https://discord.com/privacy" target="_blank" rel="noopener noreferrer">Politique de confidentialité</a></li>
|
||||||
|
<li>Zi-Host : <a href="https://zi-host.ch/legal/confidentialite" target="_blank" rel="noopener noreferrer">Protection des données</a></li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Communications volontaires</h2>
|
||||||
|
<p>Si vous prenez contact avec nous par email, via une issue GitHub ou sur notre serveur Discord, nous utilisons uniquement les informations que vous transmettez volontairement pour traiter votre demande. Nous ne les revendons ni ne les cédons à des tiers.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Cadre légal et vos droits</h2>
|
||||||
|
<p>Le site est conçu pour être conforme à la loi fédérale suisse sur la protection des données (LPD, RS 235.1). Le site ne procédant à aucun traitement automatisé de données personnelles, aucun profilage ni décision automatisée n'a lieu.</p>
|
||||||
|
<p>Conformément à la LPD (et, si vous êtes concerné, au RGPD), vous disposez notamment d'un droit d'accès, de rectification et de suppression des données vous concernant. Pour les exercer, écrivez à <a href="mailto:dami.scoot3@gmail.com">dami.scoot3@gmail.com</a>. Si vous estimez que vos droits ne sont pas respectés, vous pouvez saisir le <a href="https://www.edoeb.admin.ch/" target="_blank" rel="noopener noreferrer">Préposé fédéral à la protection des données</a>.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Modification de la présente politique</h2>
|
||||||
|
<p>La présente politique peut être adaptée à tout moment, notamment si le site venait à intégrer de nouvelles fonctionnalités (formulaires, compte utilisateur, mesure d'audience…). La version applicable est celle en ligne, dont la date de mise à jour figure ci-dessous.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<p class="legal-updated">Dernière mise à jour : 24 septembre 2026.</p>
|
||||||
|
</div>
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="fr">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Contact | FWS Linux</title>
|
|
||||||
<meta name="description" content="Contactez l'équipe de FWS Linux — ouvrez une issue ou une pull request sur GitHub pour signaler un bug ou contribuer au projet." />
|
|
||||||
<link rel="stylesheet" href="../assets/styles/styles.css">
|
|
||||||
<link rel="stylesheet" href="../assets/styles/contact.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<header class="contact-header">
|
|
||||||
<h1>Contactez l'équipe de développement</h1>
|
|
||||||
<p>Une question, un bug à signaler ou envie de contribuer ? Voici comment nous joindre.</p>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<main>
|
|
||||||
<section>
|
|
||||||
<h2>Notre seul canal officiel actuel</h2>
|
|
||||||
<p>Le projet est en plein développement. Pour le moment, nous n'avons pas encore d'adresse email dédiée ni de réseaux sociaux.</p>
|
|
||||||
<p>
|
|
||||||
<strong>Suivez le projet et ouvrez des Issues / PR ici :</strong>
|
|
||||||
</p>
|
|
||||||
<a class="button button-primary" href="https://github.com/You-re-like-Windows-a-bitch/ISO" target="_blank" rel="noopener noreferrer">Notre GitHub</a>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
</main>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page Contact (rendu serveur, contenu inchangé).
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct (/p/contact/…) : on délègue au front controller. */
|
||||||
|
require __DIR__ . '/../../page.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = 'Contact | FWS Linux';
|
||||||
|
$description = 'Contactez l\'équipe de FWS Linux — ouvrez une issue ou une pull request sur GitHub pour signaler un bug ou contribuer au projet.';
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/contact.css');
|
||||||
|
?>
|
||||||
|
<header class="contact-header">
|
||||||
|
<h1>Contactez l'équipe de développement</h1>
|
||||||
|
<p>Une question, un bug à signaler ou envie de contribuer ? Voici comment nous joindre.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<section>
|
||||||
|
<h2>Notre seul canal officiel actuel</h2>
|
||||||
|
<p>Le projet est en plein développement. Pour le moment, nous n'avons pas encore d'adresse email dédiée ni de réseaux sociaux.</p>
|
||||||
|
<p>
|
||||||
|
<strong>Suivez le projet et ouvrez des Issues / PR ici :</strong>
|
||||||
|
</p>
|
||||||
|
<a class="button button-primary" href="https://github.com/You-re-like-Windows-a-bitch/ISO" target="_blank" rel="noopener noreferrer">Notre GitHub</a>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
</main>
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="fr">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<title>Téléchargements | FWS Linux</title>
|
|
||||||
<meta name="description" content="Téléchargez FWS Linux — dernière version stable et archives des versions précédentes. ISO légère basée sur Arch Linux." />
|
|
||||||
<link rel="stylesheet" href="../assets/styles/downloads.css" />
|
|
||||||
<link rel="icon" type="image/png" href="/p/assets/img/logo.png" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main data-page-content>
|
|
||||||
<section class="downloads" aria-labelledby="downloads-title">
|
|
||||||
<header class="downloads-header">
|
|
||||||
<h1 id="downloads-title">Téléchargements</h1>
|
|
||||||
<div class="versions-panel">
|
|
||||||
<div class="latest-version">
|
|
||||||
<h2>Dernière version</h2>
|
|
||||||
<div class="latest-row">
|
|
||||||
<div class="latest-meta">
|
|
||||||
<strong data-current-version>Chargement...</strong>
|
|
||||||
<span data-current-version-date></span>
|
|
||||||
</div>
|
|
||||||
<div class="latest-actions">
|
|
||||||
<a class="button" data-latest-download href="#" target="_blank" rel="noopener noreferrer">Télécharger</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="latest-note" data-current-release-note></div>
|
|
||||||
<button class="toggle-note" data-toggle-release-note style="display:none">Voir plus</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="versions-archive">
|
|
||||||
<h3>Versions précédentes</h3>
|
|
||||||
<ul class="versions-list" data-versions-list role="list"></ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<script src="../assets/js/downloads.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
+112
@@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page Téléchargements (rendu serveur).
|
||||||
|
* Releases ISO : Gitea FWS/ISO s'il existe, sinon GitHub (cache 10 min).
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct (/p/dl/…) : on délègue au front controller. */
|
||||||
|
require __DIR__ . '/../../page.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$releases = fws_site_iso_releases();
|
||||||
|
$items = $releases['items'];
|
||||||
|
$mode = $releases['mode'];
|
||||||
|
|
||||||
|
$title = 'Téléchargements | FWS Linux';
|
||||||
|
$description = 'Téléchargez FWS Linux — dernière version stable et archives des versions précédentes. ISO légère basée sur Arch Linux.';
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/downloads.css');
|
||||||
|
$extraJs[] = fws_url('/p/assets/js/note-toggle.js');
|
||||||
|
|
||||||
|
$latest = $items[0] ?? null;
|
||||||
|
$previous = array_slice($items, 1, 5);
|
||||||
|
|
||||||
|
$latestNote = '';
|
||||||
|
$latestTruncated = false;
|
||||||
|
$latestNoteFull = '';
|
||||||
|
if ($latest !== null && $mode !== 'tags') {
|
||||||
|
$latestNoteFull = fws_markdown((string) ($latest['body'] ?? ''));
|
||||||
|
if ($latestNoteFull === '') {
|
||||||
|
$latestNoteFull = '<p>Release la plus récente.</p>';
|
||||||
|
}
|
||||||
|
$tr = fws_truncate_html($latestNoteFull, 600);
|
||||||
|
$latestNote = $tr['html'];
|
||||||
|
$latestTruncated = $tr['truncated'];
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<section class="downloads" aria-labelledby="downloads-title">
|
||||||
|
<header class="downloads-header">
|
||||||
|
<h1 id="downloads-title">Téléchargements</h1>
|
||||||
|
<div class="versions-panel">
|
||||||
|
<div class="latest-version">
|
||||||
|
<h2>Dernière version</h2>
|
||||||
|
<div class="latest-row">
|
||||||
|
<div class="latest-meta">
|
||||||
|
<strong data-current-version><?php
|
||||||
|
if ($latest === null) {
|
||||||
|
echo 'Aucune release trouvée';
|
||||||
|
} else {
|
||||||
|
echo e(fws_site_release_label($latest));
|
||||||
|
if ($mode === 'tags') {
|
||||||
|
echo ' (tag)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?></strong>
|
||||||
|
<span data-current-version-date><?php
|
||||||
|
if ($latest !== null && $mode !== 'tags') {
|
||||||
|
$d = fws_format_date(fws_site_release_date($latest));
|
||||||
|
echo $d !== '' ? ' · ' . e($d) : '';
|
||||||
|
}
|
||||||
|
?></span>
|
||||||
|
</div>
|
||||||
|
<div class="latest-actions">
|
||||||
|
<a class="button button-primary" data-latest-download href="<?php
|
||||||
|
if ($latest !== null && $mode === 'tags') {
|
||||||
|
echo e('https://github.com/You-re-like-Windows-a-bitch/ISO/releases/tag/' . rawurlencode((string) ($latest['name'] ?? $latest['ref'] ?? '')));
|
||||||
|
} elseif ($latest !== null) {
|
||||||
|
echo e(fws_site_release_download_url($latest));
|
||||||
|
} else {
|
||||||
|
echo e('https://github.com/You-re-like-Windows-a-bitch/ISO');
|
||||||
|
}
|
||||||
|
?>" target="_blank" rel="noopener noreferrer">Télécharger</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="latest-note" data-current-release-note><?php
|
||||||
|
if ($mode === 'tags' && $latest !== null) {
|
||||||
|
echo '<p>Aucune release publiée pour le moment, affichage des tags du dépôt.</p>';
|
||||||
|
} elseif ($latest === null) {
|
||||||
|
echo '<p>Le dépôt ne renvoie ni release ni tag public.</p>';
|
||||||
|
} else {
|
||||||
|
echo $latestNote;
|
||||||
|
}
|
||||||
|
?><?php if ($latestTruncated): ?><template data-note-full><?= $latestNoteFull ?></template><?php endif; ?></div>
|
||||||
|
<button class="toggle-note" data-toggle-release-note style="<?= $latestTruncated ? 'display:inline-block' : 'display:none' ?>">Voir plus</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="versions-archive">
|
||||||
|
<h3>Versions précédentes</h3>
|
||||||
|
<ul class="versions-list" data-versions-list role="list"><?php
|
||||||
|
if ($items === []) {
|
||||||
|
echo '<li class="version-item version-item-empty"><div class="version-main"><strong>Aucune release trouvée</strong><span>Le dépôt n\'expose pas encore de release ou les releases ne sont pas accessibles.</span></div>'
|
||||||
|
. '<div class="version-side"><a class="button button-secondary" href="https://github.com/You-re-like-Windows-a-bitch/ISO" target="_blank" rel="noreferrer">Voir le repo</a></div></li>';
|
||||||
|
} elseif ($previous === []) {
|
||||||
|
echo '<li class="version-item version-item-empty"><div class="version-main"><strong>Aucune release précédente</strong><span>Il n\'y a qu\'une seule release publiée pour le moment.</span></div></li>';
|
||||||
|
} else {
|
||||||
|
foreach ($previous as $rel) {
|
||||||
|
$d = fws_format_date(fws_site_release_date($rel));
|
||||||
|
$url = $mode === 'tags'
|
||||||
|
? 'https://github.com/You-re-like-Windows-a-bitch/ISO/releases/tag/' . rawurlencode((string) ($rel['name'] ?? $rel['ref'] ?? ''))
|
||||||
|
: fws_site_release_download_url($rel);
|
||||||
|
echo '<li class="version-item"><div class="version-main"><strong>' . e(fws_site_release_label($rel)) . '</strong>'
|
||||||
|
. '<span>' . ($d !== '' ? 'Publié le ' . e($d) : ($mode === 'tags' ? 'Tag GitHub' : 'Date inconnue')) . '</span></div>'
|
||||||
|
. '<div class="version-side"><a class="button button-secondary" href="' . e($url) . '" target="_blank" rel="noreferrer">Télécharger</a></div></li>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?></ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
</section>
|
||||||
+13
-2
@@ -1,12 +1,13 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "BlackAngelTVdev",
|
"name": "BlackAngelTV",
|
||||||
"role": "Owner",
|
"role": "Owner",
|
||||||
"avatar": "/p/assets/img/logo.png",
|
"avatar": "/p/assets/img/logo.png",
|
||||||
"joined": "2026-03-17",
|
"joined": "2026-03-17",
|
||||||
"email": "dami.scoot3@gmail.com",
|
"email": "dami.scoot3@gmail.com",
|
||||||
"links": [
|
"links": [
|
||||||
{ "label": "GitHub", "url": "https://github.com/BlackAngelTVdev" }
|
{ "label": "GitHub", "url": "https://github.com/BlackAngelTVdev" },
|
||||||
|
{"label": "Gitea", "url": "https://gitea.nocode-var.tech/BlackAngelTV"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -28,5 +29,15 @@
|
|||||||
"links": [
|
"links": [
|
||||||
{ "label": "Portfolio (coming soon)", "url": "https://dev-sol.laxacube.ch" }
|
{ "label": "Portfolio (coming soon)", "url": "https://dev-sol.laxacube.ch" }
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Angi",
|
||||||
|
"role": "Devlopper",
|
||||||
|
"avatar": "/p/assets/img/logo.png",
|
||||||
|
"joined": "2026-09-14",
|
||||||
|
"email": "gianmarco.ruberti@gmail.com",
|
||||||
|
"links": [
|
||||||
|
{ "label": "GitHub", "url": "https://github.com/Gianmarco-Ruberti" }
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="fr">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>L'équipe | FWS Linux</title>
|
|
||||||
<meta name="description" content="Découvrez les contributeurs de FWS Linux — l'équipe qui développe et maintient cette distribution open-source." />
|
|
||||||
<link rel="stylesheet" href="../assets/styles/styles.css">
|
|
||||||
<link rel="stylesheet" href="../assets/styles/equipe.css">
|
|
||||||
<link rel="stylesheet" href="../assets/styles/creators.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<main data-page-content>
|
|
||||||
<section class="equipe-hero">
|
|
||||||
<h1>L'équipe</h1>
|
|
||||||
<p>Les personnes qui contribuent au projet FWS Linux.</p>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="equipe-grid-section" aria-label="Liste des contributeurs">
|
|
||||||
<div data-creators-src="/p/equipe/creators.json"></div>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<script src="../assets/js/creators-loader.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page Équipe (rendu serveur depuis p/equipe/creators.json).
|
||||||
|
* Remplace creators-loader.js.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct (/p/equipe/…) : on délègue au front controller. */
|
||||||
|
require __DIR__ . '/../../page.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = "L'équipe | FWS Linux";
|
||||||
|
$description = 'Découvrez les contributeurs de FWS Linux — l\'équipe qui développe et maintient cette distribution open-source.';
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/equipe.css');
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/creators.css');
|
||||||
|
|
||||||
|
$creators = [];
|
||||||
|
$file = dirname(__DIR__) . '/equipe/creators.json';
|
||||||
|
if (is_file($file)) {
|
||||||
|
$data = json_decode((string) file_get_contents($file), true);
|
||||||
|
if (is_array($data)) {
|
||||||
|
$creators = fws_utf8_arr($data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<section class="equipe-hero">
|
||||||
|
<h1>L'équipe</h1>
|
||||||
|
<p>Les personnes qui contribuent au projet FWS Linux.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="equipe-grid-section" aria-label="Liste des contributeurs">
|
||||||
|
<?php if ($creators === []): ?>
|
||||||
|
<p class="creators-error">Impossible de charger les données des créateurs.</p>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="creators-grid">
|
||||||
|
<?php foreach ($creators as $creator): ?>
|
||||||
|
<article class="creator-card">
|
||||||
|
<?php if (!empty($creator['avatar'])): ?>
|
||||||
|
<img class="creator-avatar" src="<?= e(fws_url((string) $creator['avatar'])) ?>" alt="<?= e((string) ($creator['name'] ?? $creator['role'] ?? '')) ?>" loading="lazy">
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="creator-info">
|
||||||
|
<?php if (!empty($creator['name'])): ?>
|
||||||
|
<h3 class="creator-name"><?= e((string) $creator['name']) ?></h3>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($creator['role'])): ?>
|
||||||
|
<span class="creator-role"><?= e((string) $creator['role']) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($creator['joined'])): ?>
|
||||||
|
<span class="creator-joined">A rejoint le <?= e(fws_format_date((string) $creator['joined'])) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($creator['email'])): ?>
|
||||||
|
<a class="creator-email" href="mailto:<?= e((string) $creator['email']) ?>"><?= e((string) $creator['email']) ?></a>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!empty($creator['links'])): ?>
|
||||||
|
<div class="creator-links">
|
||||||
|
<?php foreach ($creator['links'] as $link): ?>
|
||||||
|
<a class="creator-link" href="<?= e((string) ($link['url'] ?? '')) ?>" target="_blank" rel="noopener noreferrer"><?= e((string) ($link['label'] ?? '') !== '' ? (string) $link['label'] : (string) ($link['url'] ?? '')) ?></a>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="fr">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<title>Accueil | FWS Linux</title>
|
|
||||||
<meta name="description" content="Découvrez FWS Linux — distribution open-source légère et rapide basée sur Arch Linux. Choisissez parmi KDE Plasma, Gnome, XFCE, Hyprland ou CLI." />
|
|
||||||
<link rel="stylesheet" href="../assets/styles/main.css" />
|
|
||||||
<link rel="icon" type="image/png" href="/p/assets/img/logo.png" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<main data-page-content>
|
|
||||||
<section class="hero hero-carousel" aria-label="Présentation de FWS Linux">
|
|
||||||
<div class="hero-carousel-track" data-hero-track>
|
|
||||||
<article class="hero-slide is-active" data-hero-slide style="background-image: url('/p/assets/img/hero/xfce.webp');" aria-hidden="false"></article>
|
|
||||||
<article class="hero-slide" data-hero-slide style="background-image: url('/p/assets/img/hero/install.webp');" aria-hidden="true"></article>
|
|
||||||
<article class="hero-slide" data-hero-slide style="background-image: url('/p/assets/img/hero/gnome.webp');" aria-hidden="true"></article>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="hero-inner">
|
|
||||||
<h1 class="hero-title">FWS Linux</h1>
|
|
||||||
<p class="hero-subtitle">Un système léger, libre et compatible</p>
|
|
||||||
<p class="lead">Open-source basé sur Arch Linux, FWS facilite la transition depuis Windows sans vous déposséder de vos données. Installation simplifiée, interface épurée, et compatibilité avec vos applications Windows grâce à Wine et Winboat.</p>
|
|
||||||
<div class="hero-actions">
|
|
||||||
<a class="button button-primary" href="/?p/dl/" data-route="dl">Télécharger</a>
|
|
||||||
<a class="button button-secondary" href="/?p/contact/" data-route="contact">En savoir plus</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="hero-controls" aria-label="Contrôles du carrousel">
|
|
||||||
<button class="hero-control" type="button" data-hero-prev aria-label="Image précédente">‹</button>
|
|
||||||
<div class="hero-dots" data-hero-dots role="tablist" aria-label="Sélectionner une image"></div>
|
|
||||||
<button class="hero-control" type="button" data-hero-next aria-label="Image suivante">›</button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="features" aria-label="Fonctionnalités">
|
|
||||||
<article class="card" tabindex="0">
|
|
||||||
<h2>Installation simplifiée</h2>
|
|
||||||
<p>Installateur graphique pour une configuration facile et rapide.</p>
|
|
||||||
</article>
|
|
||||||
<article class="card" tabindex="0">
|
|
||||||
<h2>Léger et rapide</h2>
|
|
||||||
<p>Conçu pour être peu gourmand en ressources : idéal pour redonner vie à d'anciens PC.</p>
|
|
||||||
</article>
|
|
||||||
<article class="card" tabindex="0">
|
|
||||||
<h2>Respect de la vie privée</h2>
|
|
||||||
<p>Pas de télémétrie intrusive ni de collecte de données : vous gardez le contrôle.</p>
|
|
||||||
</article>
|
|
||||||
<article class="card" tabindex="0">
|
|
||||||
<h2>Compatibilité Windows</h2>
|
|
||||||
<p>Exécutez vos logiciels Windows avec Wine et Winboat sans devoir rester sous Windows.</p>
|
|
||||||
</article>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="env-choices" aria-labelledby="env-choices-title">
|
|
||||||
<header class="env-choices-header">
|
|
||||||
<h2 id="env-choices-title">Choisissez votre environnement à l'installation</h2>
|
|
||||||
<p>FWS Linux vous laisse choisir l'interface qui correspond à votre usage. Vous pouvez démarrer en CLI minimale ou installer un bureau complet dès le début.</p>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<article class="env-row is-reverse">
|
|
||||||
<div class="env-text">
|
|
||||||
<h3>KDE Plasma</h3>
|
|
||||||
<p>Interface moderne, complète et hautement personnalisable. Un excellent choix si vous voulez un bureau riche avec de nombreux outils intégrés.</p>
|
|
||||||
</div>
|
|
||||||
<figure class="env-media">
|
|
||||||
<img src="/p/assets/img/hero/KDE.webp" alt="Capture d'écran de l'environnement KDE Plasma sur FWS Linux" loading="lazy" width="600" height="340" />
|
|
||||||
</figure>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="env-row">
|
|
||||||
<figure class="env-media">
|
|
||||||
<img src="/p/assets/img/hero/gnome.webp" alt="Capture d'écran de l'environnement GNOME sur FWS Linux" loading="lazy" width="600" height="340" />
|
|
||||||
</figure>
|
|
||||||
<div class="env-text">
|
|
||||||
<h3>GNOME</h3>
|
|
||||||
<p>Expérience épurée et orientée productivité. GNOME met l'accent sur la simplicité d'utilisation et un flux de travail propre sans surcharge visuelle.</p>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="env-row is-reverse">
|
|
||||||
<div class="env-text">
|
|
||||||
<h3>XFCE</h3>
|
|
||||||
<p>Environnement léger et très stable, idéal pour les machines modestes ou pour privilégier les performances au quotidien.</p>
|
|
||||||
</div>
|
|
||||||
<figure class="env-media">
|
|
||||||
<img src="/p/assets/img/hero/xfce.webp" alt="Capture d'écran de l'environnement XFCE sur FWS Linux" loading="lazy" width="600" height="340" />
|
|
||||||
</figure>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="env-row">
|
|
||||||
<figure class="env-media">
|
|
||||||
<img src="/p/assets/img/hero/hyprland.webp" alt="Capture d'écran de l'environnement Hyprland sur FWS Linux" loading="lazy" width="600" height="340" />
|
|
||||||
</figure>
|
|
||||||
<div class="env-text">
|
|
||||||
<h3>Hyprland</h3>
|
|
||||||
<p>Tiling Wayland rapide et moderne, pensé pour un workflow clavier et une grande efficacité. Parfait pour les utilisateurs techniques qui aiment optimiser leur espace de travail.</p>
|
|
||||||
</div>
|
|
||||||
</article>
|
|
||||||
|
|
||||||
<article class="env-row is-reverse">
|
|
||||||
<div class="env-text">
|
|
||||||
<h3>CLI (sans environnement)</h3>
|
|
||||||
<p>Version minimale pour les utilisateurs avancés, les serveurs ou ceux qui veulent construire leur système à la carte. Aucun bureau graphique n'est préinstallé.</p>
|
|
||||||
</div>
|
|
||||||
<figure class="env-media">
|
|
||||||
<img src="/p/assets/img/hero/install.webp" alt="Capture d'écran de l'interface CLI de FWS Linux" loading="lazy" width="600" height="340" />
|
|
||||||
</figure>
|
|
||||||
</article>
|
|
||||||
</section>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<script src="../assets/js/hero-carousel.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page d'accueil (rendu serveur, markup identique à l'ancien).
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct (/p/index/…) : on délègue au front controller. */
|
||||||
|
require __DIR__ . '/../../page.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = 'Accueil | FWS Linux';
|
||||||
|
$description = 'Découvrez FWS Linux — distribution open-source légère et rapide basée sur Arch Linux. Choisissez parmi KDE Plasma, Gnome, XFCE, Hyprland ou CLI.';
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/main.css');
|
||||||
|
$extraJs[] = fws_url('/p/assets/js/hero-carousel.js');
|
||||||
|
?>
|
||||||
|
<section class="hero hero-carousel" aria-label="Présentation de FWS Linux">
|
||||||
|
<div class="hero-carousel-track" data-hero-track>
|
||||||
|
<article class="hero-slide is-active" data-hero-slide style="background-image: url('<?= e(fws_url('/p/assets/img/hero/xfce.webp')) ?>');" aria-hidden="false"></article>
|
||||||
|
<article class="hero-slide" data-hero-slide style="background-image: url('<?= e(fws_url('/p/assets/img/hero/install.webp')) ?>');" aria-hidden="true"></article>
|
||||||
|
<article class="hero-slide" data-hero-slide style="background-image: url('<?= e(fws_url('/p/assets/img/hero/gnome.webp')) ?>');" aria-hidden="true"></article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hero-inner">
|
||||||
|
<h1 class="hero-title">FWS Linux</h1>
|
||||||
|
<p class="hero-subtitle">Un système léger, libre et compatible</p>
|
||||||
|
<p class="lead">Open-source basé sur Arch Linux, FWS facilite la transition depuis Windows sans vous déposséder de vos données. Installation simplifiée, interface épurée, et compatibilité avec vos applications Windows grâce à Wine et Winboat.</p>
|
||||||
|
<div class="hero-actions">
|
||||||
|
<a class="button button-primary" href="<?= e(fws_url('/?p/dl/')) ?>">Télécharger</a>
|
||||||
|
<a class="button button-secondary" href="<?= e(fws_url('/?p/contact/')) ?>">En savoir plus</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hero-controls" aria-label="Contrôles du carrousel">
|
||||||
|
<button class="hero-control" type="button" data-hero-prev aria-label="Image précédente">‹</button>
|
||||||
|
<div class="hero-dots" data-hero-dots role="tablist" aria-label="Sélectionner une image"></div>
|
||||||
|
<button class="hero-control" type="button" data-hero-next aria-label="Image suivante">›</button>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="features" aria-label="Fonctionnalités">
|
||||||
|
<article class="card" tabindex="0">
|
||||||
|
<h2>Installation simplifiée</h2>
|
||||||
|
<p>Installateur graphique pour une configuration facile et rapide.</p>
|
||||||
|
</article>
|
||||||
|
<article class="card" tabindex="0">
|
||||||
|
<h2>Léger et rapide</h2>
|
||||||
|
<p>Conçu pour être peu gourmand en ressources : idéal pour redonner vie à d'anciens PC.</p>
|
||||||
|
</article>
|
||||||
|
<article class="card" tabindex="0">
|
||||||
|
<h2>Respect de la vie privée</h2>
|
||||||
|
<p>Pas de télémétrie intrusive ni de collecte de données : vous gardez le contrôle.</p>
|
||||||
|
</article>
|
||||||
|
<article class="card" tabindex="0">
|
||||||
|
<h2>Compatibilité Windows</h2>
|
||||||
|
<p>Exécutez vos logiciels Windows avec Wine et Winboat sans devoir rester sous Windows.</p>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="env-choices" aria-labelledby="env-choices-title">
|
||||||
|
<header class="env-choices-header">
|
||||||
|
<h2 id="env-choices-title">Choisissez votre environnement à l'installation</h2>
|
||||||
|
<p>FWS Linux vous laisse choisir l'interface qui correspond à votre usage. Vous pouvez démarrer en CLI minimale ou installer un bureau complet dès le début.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<article class="env-row is-reverse">
|
||||||
|
<div class="env-text">
|
||||||
|
<h3>KDE Plasma</h3>
|
||||||
|
<p>Interface moderne, complète et hautement personnalisable. Un excellent choix si vous voulez un bureau riche avec de nombreux outils intégrés.</p>
|
||||||
|
</div>
|
||||||
|
<figure class="env-media">
|
||||||
|
<img src="<?= e(fws_url('/p/assets/img/hero/KDE.webp')) ?>" alt="Capture d'écran de l'environnement KDE Plasma sur FWS Linux" loading="lazy" width="600" height="340" />
|
||||||
|
</figure>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="env-row">
|
||||||
|
<figure class="env-media">
|
||||||
|
<img src="<?= e(fws_url('/p/assets/img/hero/gnome.webp')) ?>" alt="Capture d'écran de l'environnement GNOME sur FWS Linux" loading="lazy" width="600" height="340" />
|
||||||
|
</figure>
|
||||||
|
<div class="env-text">
|
||||||
|
<h3>GNOME</h3>
|
||||||
|
<p>Expérience épurée et orientée productivité. GNOME met l'accent sur la simplicité d'utilisation et un flux de travail propre sans surcharge visuelle.</p>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="env-row is-reverse">
|
||||||
|
<div class="env-text">
|
||||||
|
<h3>XFCE</h3>
|
||||||
|
<p>Environnement léger et très stable, idéal pour les machines modestes ou pour privilégier les performances au quotidien.</p>
|
||||||
|
</div>
|
||||||
|
<figure class="env-media">
|
||||||
|
<img src="<?= e(fws_url('/p/assets/img/hero/xfce.webp')) ?>" alt="Capture d'écran de l'environnement XFCE sur FWS Linux" loading="lazy" width="600" height="340" />
|
||||||
|
</figure>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="env-row">
|
||||||
|
<figure class="env-media">
|
||||||
|
<img src="<?= e(fws_url('/p/assets/img/hero/hyprland.webp')) ?>" alt="Capture d'écran de l'environnement Hyprland sur FWS Linux" loading="lazy" width="600" height="340" />
|
||||||
|
</figure>
|
||||||
|
<div class="env-text">
|
||||||
|
<h3>Hyprland</h3>
|
||||||
|
<p>Tiling Wayland rapide et moderne, pensé pour un workflow clavier et une grande efficacité. Parfait pour les utilisateurs techniques qui aiment optimiser leur espace de travail.</p>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="env-row is-reverse">
|
||||||
|
<div class="env-text">
|
||||||
|
<h3>CLI (sans environnement)</h3>
|
||||||
|
<p>Version minimale pour les utilisateurs avancés, les serveurs ou ceux qui veulent construire leur système à la carte. Aucun bureau graphique n'est préinstallé.</p>
|
||||||
|
</div>
|
||||||
|
<figure class="env-media">
|
||||||
|
<img src="<?= e(fws_url('/p/assets/img/hero/install.webp')) ?>" alt="Capture d'écran de l'interface CLI de FWS Linux" loading="lazy" width="600" height="340" />
|
||||||
|
</figure>
|
||||||
|
</article>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page Mentions légales (rendu serveur, coquille page.php).
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct (/p/mentions-legales/…) : on délègue au front controller. */
|
||||||
|
require __DIR__ . '/../../page.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = 'Mentions légales | FWS Linux';
|
||||||
|
$description = 'Mentions légales du site FWS Linux : éditeur, hébergement en Suisse par Zi-Host, propriété intellectuelle et signalement de contenu.';
|
||||||
|
$extraCss[] = fws_url('/p/assets/styles/legal.css');
|
||||||
|
?>
|
||||||
|
<header class="legal-header">
|
||||||
|
<h1>Mentions légales</h1>
|
||||||
|
<p>Informations légales relatives à l'éditeur du site, à son hébergement et à la propriété intellectuelle.</p>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="legal-main">
|
||||||
|
<section>
|
||||||
|
<h2>Éditeur du site</h2>
|
||||||
|
<ul class="legal-sheet">
|
||||||
|
<li><strong>Site :</strong> FWS Linux — site officiel de la distribution FWS Linux</li>
|
||||||
|
<li><strong>Éditeur :</strong> FWS Linux, projet open source communautaire à but non lucratif</li>
|
||||||
|
<li><strong>Responsable de la publication :</strong> BlackAngelTV</li>
|
||||||
|
<li><strong>Contact :</strong> <a href="mailto:dami.scoot3@gmail.com">dami.scoot3@gmail.com</a> ou via la <a href="<?= e(fws_url('/?p/contact/')) ?>">page de contact</a></li>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Hébergement du site</h2>
|
||||||
|
<p>Le présent site est hébergé sur l'infrastructure de notre partenaire :</p>
|
||||||
|
<ul class="legal-sheet">
|
||||||
|
<li><strong>Hébergeur :</strong> Zi-Host — <a href="https://zi-host.ch" target="_blank" rel="noopener noreferrer">zi-host.ch</a></li>
|
||||||
|
<li><strong>Localisation :</strong> Suisse (nodes « Ziost » et « Tython »)</li>
|
||||||
|
<li><strong>Signalement à l'hébergeur :</strong> <a href="mailto:abuse@zi-host.ch">abuse@zi-host.ch</a></li>
|
||||||
|
</ul>
|
||||||
|
<p>Tout signalement d'un contenu illicite doit indiquer l'URL concernée, la nature du contenu en cause ainsi que vos coordonnées.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Propriété intellectuelle</h2>
|
||||||
|
<p>L'ensemble des éléments du site (textes, visuels, code) est la propriété du projet FWS Linux ou de ses contributeurs. Les sources du site et de la distribution sont publiées librement sur GitHub ; toute réutilisation est soumise aux licences des dépôts respectifs (licences libres).</p>
|
||||||
|
<p>« Linux » est une marque déposée de Linus Torvalds. « Arch Linux » est une marque de ses détenteurs respectifs. « Windows » est une marque déposée de Microsoft Corporation. Ces marques sont mentionnées uniquement pour décrire la compatibilité technique du projet ; FWS Linux n'est ni affilié à, ni approuvé par ces sociétés.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Signalement de contenu</h2>
|
||||||
|
<p>Pour signaler un contenu illicite ou inapproprié publié sur ce site, écrivez à <a href="mailto:dami.scoot3@gmail.com">dami.scoot3@gmail.com</a> ou ouvrez une issue sur <a href="https://github.com/You-re-like-Windows-a-bitch/ISO" target="_blank" rel="noopener noreferrer">notre dépôt GitHub</a>. Les signalements sont traités dans les meilleurs délais.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<p class="legal-updated">Dernière mise à jour : 24 septembre 2026.</p>
|
||||||
|
</div>
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="fr">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Paquet | FWS Linux</title>
|
|
||||||
<link rel="stylesheet" href="../../assets/styles/styles.css">
|
|
||||||
<link rel="stylesheet" href="../../assets/styles/paquets.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<main data-page-content>
|
|
||||||
<section class="paquet-detail-page" data-package-detail></section>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<script src="../../assets/js/packages.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1,111 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page détail « /?p/paquets/N/ » (rendu serveur).
|
||||||
|
* Le paquet N en grand : badge, tagline, description, dernière release,
|
||||||
|
* historique, captures, liens. Pas de navigation précédent/suivant.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct : /p/paquets/detail.php n'est pas une URL publique. */
|
||||||
|
http_response_code(404);
|
||||||
|
exit('Page introuvable.');
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Le paquet N est identifié par son id en base ; repli sur la position. */
|
||||||
|
$pkg = null;
|
||||||
|
foreach ($packages as $i => $p) {
|
||||||
|
if ((int) ($p['dbId'] ?? 0) === $detailId || ($p['dbId'] ?? 0) === 0 && ($i + 1) === $detailId) {
|
||||||
|
$pkg = $p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pkg === null) {
|
||||||
|
http_response_code(404);
|
||||||
|
$title = 'Paquet introuvable | FWS Linux';
|
||||||
|
echo '<section class="paquet-detail-page">'
|
||||||
|
. '<p class="paquet-empty">Ce paquet n\'existe pas (il y en a ' . count($packages) . ').</p>'
|
||||||
|
. '<a class="paquet-detail-back" href="' . e(fws_url('/?p/paquets/')) . '">← Tous les paquets</a>'
|
||||||
|
. '</section>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = $pkg['name'] . ' | FWS Linux';
|
||||||
|
$description = (string) ($pkg['tagline'] ?? '') !== '' ? (string) $pkg['tagline'] : (string) ($pkg['description'] ?? '');
|
||||||
|
$extraJs[] = fws_url('/p/assets/js/packages-ui.js');
|
||||||
|
|
||||||
|
$latest = $pkg['latest'] ?? null;
|
||||||
|
?>
|
||||||
|
<section class="paquet-detail-page">
|
||||||
|
<a class="paquet-detail-back" href="<?= e(fws_url('/?p/paquets/')) ?>">← Tous les paquets</a>
|
||||||
|
|
||||||
|
<div class="paquet-detail-hero">
|
||||||
|
<span class="paquet-since" title="<?= !empty($pkg['since']) ? e('Depuis le ' . fws_format_date((string) $pkg['since'])) : '' ?>"><?= e($pkg['sinceLabel'] !== '' ? $pkg['sinceLabel'] : 'FWS') ?></span>
|
||||||
|
<h1><?= e($pkg['name']) ?></h1>
|
||||||
|
<?php if (!empty($pkg['tagline'])): ?><p class="paquet-tagline"><?= e($pkg['tagline']) ?></p><?php endif; ?>
|
||||||
|
<?php if (!empty($pkg['description'])): ?><p class="paquet-description"><?= e($pkg['description']) ?></p><?php endif; ?>
|
||||||
|
<div class="paquet-detail-latest<?php if ($latest === null || ($latest['name'] ?? '') === ''): ?> paquet-detail-latest-empty<?php endif; ?>">
|
||||||
|
<?php if ($latest !== null && ($latest['name'] ?? '') !== ''): ?>
|
||||||
|
<span class="paquet-detail-version"><?= e((string) $latest['name']) ?></span>
|
||||||
|
<?php if (!empty($latest['date'])): ?>
|
||||||
|
<span class="paquet-detail-date">Publiée le <?= e(fws_format_date((string) $latest['date'])) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php else: ?>
|
||||||
|
Aucune release publiée pour le moment.
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="paquet-detail-body">
|
||||||
|
<?php if (empty($pkg['changelog'])): ?>
|
||||||
|
<div class="paquet-changelog"><h3>Historique</h3><p class="paquet-empty">Historique en cours de rédaction.</p></div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="paquet-changelog"><h3>Historique</h3>
|
||||||
|
<ol class="paquet-timeline">
|
||||||
|
<?php foreach ($pkg['changelog'] as $entry): ?>
|
||||||
|
<li class="paquet-timeline-item">
|
||||||
|
<strong class="paquet-timeline-version"><?= e((string) ($entry['version'] ?? '—')) ?></strong>
|
||||||
|
<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>
|
||||||
|
<?php if (!empty($entry['notes'])): ?>
|
||||||
|
<span class="paquet-timeline-notes"><?= e((string) $entry['notes']) ?></span>
|
||||||
|
<?php endif; ?>
|
||||||
|
</li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if (empty($pkg['screens'])): ?>
|
||||||
|
<div class="paquet-screens"><h3>Captures d'écran</h3><p class="paquet-empty">Captures d'écran à venir.</p></div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="paquet-screens"><h3>Captures d'écran</h3>
|
||||||
|
<div class="paquet-screens-grid">
|
||||||
|
<?php foreach ($pkg['screens'] as $screen): ?>
|
||||||
|
<figure>
|
||||||
|
<img src="<?= e(fws_url((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'])): ?>
|
||||||
|
<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; ?>
|
||||||
|
</figure>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="paquet-links">
|
||||||
|
<h3>Liens utiles</h3>
|
||||||
|
<?php if (empty($pkg['links'])): ?>
|
||||||
|
<p class="paquet-empty">Aucun lien pour le moment.</p>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($pkg['links'] as $link): ?>
|
||||||
|
<?php $url = (string) ($link['url'] ?? ''); $external = (bool) preg_match('/^https?:\/\//i', $url); ?>
|
||||||
|
<a class="button button-secondary" href="<?= e($url) ?>"<?= $external ? ' target="_blank" rel="noopener noreferrer"' : '' ?>><?= e((string) ($link['label'] ?? '') !== '' ? (string) $link['label'] : $url) ?></a>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="fr">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Paquets | FWS Linux</title>
|
|
||||||
<meta name="description" content="Les outils développés pour FWS Linux — historique de chaque paquet, captures d'écran et liens utiles." />
|
|
||||||
<link rel="stylesheet" href="../assets/styles/styles.css">
|
|
||||||
<link rel="stylesheet" href="../assets/styles/paquets.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<main data-page-content>
|
|
||||||
<section class="paquets-hero">
|
|
||||||
<h1>Paquets</h1>
|
|
||||||
<p>Tous les outils développés pour FWS Linux, leur historique, leurs captures d'écran et les liens utiles.</p>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="paquets-list" data-packages-page aria-label="Liste des paquets FWS"></section>
|
|
||||||
</main>
|
|
||||||
|
|
||||||
<script src="../assets/js/packages.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — page Paquets (liste) : rendu serveur depuis la base SQLite
|
||||||
|
* (avec releases Gitea fusionnées). Remplace packages.js.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
if (!defined('FWS_PAGE_SHELL')) {
|
||||||
|
/* Accès direct (/p/paquets/…) : on délègue au front controller. */
|
||||||
|
require __DIR__ . '/../../page.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = 'Paquets | FWS Linux';
|
||||||
|
$description = 'Les outils développés pour FWS Linux — historique de chaque paquet, captures d\'écran et liens utiles.';
|
||||||
|
$extraJs[] = fws_url('/p/assets/js/packages-ui.js');
|
||||||
|
|
||||||
|
function fws_packages_empty(string $message): string
|
||||||
|
{
|
||||||
|
return '<p class="paquet-empty">' . e($message) . '</p>';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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>';
|
||||||
|
if (empty($pkg['changelog'])) {
|
||||||
|
$html .= fws_packages_empty('Historique en cours de rédaction.') . '</div>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
$entries = array_values($pkg['changelog']);
|
||||||
|
$total = count($entries);
|
||||||
|
$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>'
|
||||||
|
. '<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>'
|
||||||
|
. (!empty($entry['notes']) ? '<span class="paquet-timeline-notes">' . e((string) $entry['notes']) . '</span>' : '')
|
||||||
|
. '</li>';
|
||||||
|
}
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Les captures d'écran ne s'affichent que sur la page détail
|
||||||
|
(« Voir en grand ») : la liste reste compacte. */
|
||||||
|
|
||||||
|
function fws_packages_links(array $pkg): string
|
||||||
|
{
|
||||||
|
$html = '<div class="paquet-links"><h3>Liens utiles</h3>';
|
||||||
|
if (empty($pkg['links'])) {
|
||||||
|
$html .= fws_packages_empty('Aucun lien pour le moment.') . '</div>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
foreach ($pkg['links'] as $link) {
|
||||||
|
$url = (string) ($link['url'] ?? '');
|
||||||
|
$external = (bool) preg_match('/^https?:\/\//i', $url);
|
||||||
|
$html .= '<a class="button button-secondary" href="' . e($url) . '"'
|
||||||
|
. ($external ? ' target="_blank" rel="noopener noreferrer"' : '') . '>'
|
||||||
|
. e((string) ($link['label'] ?? '') !== '' ? (string) $link['label'] : $url) . '</a>';
|
||||||
|
}
|
||||||
|
$html .= '</div>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fws_packages_card(array $pkg, int $position): string
|
||||||
|
{
|
||||||
|
$latest = $pkg['latest'] ?? null;
|
||||||
|
$latestText = ($latest !== null && ($latest['name'] ?? '') !== '')
|
||||||
|
? 'Dernière release : ' . $latest['name'] . (!empty($latest['date']) ? ' — ' . fws_format_date((string) $latest['date']) : '')
|
||||||
|
: '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']) . '">'
|
||||||
|
. '<header class="paquet-head"><div class="paquet-title-row">'
|
||||||
|
. '<h2>' . e($pkg['name']) . '</h2>'
|
||||||
|
. '<span class="paquet-since" title="' . (!empty($pkg['since']) ? e('Depuis le ' . fws_format_date((string) $pkg['since'])) : '') . '">'
|
||||||
|
. e($pkg['sinceLabel'] !== '' ? $pkg['sinceLabel'] : 'FWS') . '</span>'
|
||||||
|
. '<a class="paquet-detail-link" href="' . e(fws_url('/?p/paquets/' . $position . '/')) . '">Voir en grand</a>'
|
||||||
|
. '</div>'
|
||||||
|
. (!empty($pkg['tagline']) ? '<p class="paquet-tagline">' . e($pkg['tagline']) . '</p>' : '')
|
||||||
|
. '<p class="paquet-latest">' . e($latestText) . '</p>'
|
||||||
|
. (!empty($pkg['description']) ? '<p class="paquet-description">' . e($pkg['description']) . '</p>' : '')
|
||||||
|
. '</header>'
|
||||||
|
. '<div class="paquet-body">' . fws_packages_changelog($pkg, true) . fws_packages_links($pkg) . '</div>'
|
||||||
|
. '</article>';
|
||||||
|
return $html;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<section class="paquets-hero">
|
||||||
|
<h1>Paquets</h1>
|
||||||
|
<p>Tous les outils développés pour FWS Linux, leur historique, leurs captures d'écran et les liens utiles.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="paquets-list" aria-label="Liste des paquets FWS">
|
||||||
|
<?php if ($packages === []): ?>
|
||||||
|
<?= fws_packages_empty('Aucun paquet pour le moment. Revenez bientôt !') ?>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($packages as $i => $pkg): ?>
|
||||||
|
<?= fws_packages_card($pkg, max($i + 1, (int) ($pkg['dbId'] ?? 0))) . "\n" ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</section>
|
||||||
@@ -0,0 +1,303 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* FWS Linux — point d'entrée unique du site (rendu 100 % serveur).
|
||||||
|
*
|
||||||
|
* Les URLs restent identiques : /?p/index/, /?p/dl/, /?p/paquets/,
|
||||||
|
* /?p/paquets/1/… (les deux formes « ?p=route » et « ?p/route » marchent).
|
||||||
|
* Chaque page inclut son corps depuis p/<route>/index.php et la coquille
|
||||||
|
* (header/nav/footer) est écrite une seule fois ici.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
require __DIR__ . '/inc/site.php';
|
||||||
|
|
||||||
|
/* ───────────────────────── route ───────────────────────── */
|
||||||
|
|
||||||
|
function fws_site_current_route(): string
|
||||||
|
{
|
||||||
|
$raw = '';
|
||||||
|
$qs = (string) ($_SERVER['QUERY_STRING'] ?? '');
|
||||||
|
if ($qs !== '') {
|
||||||
|
if (str_starts_with($qs, 'p=')) {
|
||||||
|
$raw = substr($qs, 2);
|
||||||
|
} elseif (str_starts_with($qs, 'p/')) {
|
||||||
|
$raw = substr($qs, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($raw === '' && isset($_GET['p'])) {
|
||||||
|
$raw = (string) $_GET['p'];
|
||||||
|
}
|
||||||
|
if ($raw === '') {
|
||||||
|
/* Forme chemin : /p/dl/ (directement sous la base URL). En
|
||||||
|
sous-dossier (WAMP), REQUEST_URI commence par /FWS-Website/ : on
|
||||||
|
retire la base pour retrouver le début de la route. */
|
||||||
|
$path = trim((string) (parse_url((string) ($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH) ?: '/'), '/');
|
||||||
|
if ($path !== '') {
|
||||||
|
$base = ltrim(fws_base_url() . '/', '/');
|
||||||
|
if ($base !== '' && str_starts_with($path, $base)) {
|
||||||
|
$path = substr($path, strlen($base));
|
||||||
|
$path = trim(preg_replace('/^\\/+|\\/+$/', '', $path) ?? '');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($path !== '' && !str_contains($path, '.') && str_starts_with($path, 'p/')) {
|
||||||
|
$raw = substr($path, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$raw = strtolower(trim($raw));
|
||||||
|
$raw = trim(preg_replace('/^\/+|\/+$/', '', $raw) ?? '');
|
||||||
|
if ($raw === '' || $raw === 'home' || $raw === 'accueil' || $raw === 'index') {
|
||||||
|
return 'index';
|
||||||
|
}
|
||||||
|
return $raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
$route = fws_site_current_route();
|
||||||
|
|
||||||
|
/* Résolution du corps de page : index, dl, paquets, paquets/N, equipe, contact. */
|
||||||
|
$pageFile = null;
|
||||||
|
$detailId = 0;
|
||||||
|
if (preg_match('/^paquets\/(\d+)$/', $route, $m)) {
|
||||||
|
$detailId = max(1, (int) $m[1]);
|
||||||
|
$route = 'paquets/_detail';
|
||||||
|
$pageFile = __DIR__ . '/p/paquets/detail.php';
|
||||||
|
} else {
|
||||||
|
$known = ['index', 'dl', 'paquets', 'equipe', 'contact', 'mentions-legales', 'conditions', 'confidentialite'];
|
||||||
|
if (in_array($route, $known, true)) {
|
||||||
|
$pageFile = __DIR__ . '/p/' . $route . '/index.php';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$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
|
||||||
|
(le corps ET la nav déroulante les consomment). */
|
||||||
|
$packages = fws_site_packages();
|
||||||
|
|
||||||
|
/* ───────────────────────── corps de page ───────────────────────── */
|
||||||
|
/* Le corps est rendu d'abord : il peut définir $title, $description,
|
||||||
|
$canonical, $extraCss[] et $extraJs[] (données issues de la DB / API). */
|
||||||
|
|
||||||
|
/* NB : pas de null pour title/description — isset(null) est false et les
|
||||||
|
gardes des pages incluses (« isset($title, …) ») échoueraient. */
|
||||||
|
$title = '';
|
||||||
|
$description = '';
|
||||||
|
$canonical = null;
|
||||||
|
$extraCss = [];
|
||||||
|
$extraJs = [];
|
||||||
|
|
||||||
|
define('FWS_PAGE_SHELL', 1); /* les corps inclus peuvent vérifier qu'ils
|
||||||
|
ne sont pas exécutés en accès direct */
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
if ($is404) {
|
||||||
|
http_response_code(404);
|
||||||
|
include __DIR__ . '/p/404.php';
|
||||||
|
} else {
|
||||||
|
include $pageFile;
|
||||||
|
}
|
||||||
|
$body = ob_get_clean();
|
||||||
|
|
||||||
|
if ($title === null) {
|
||||||
|
$labels = [
|
||||||
|
'index' => 'Accueil', 'dl' => 'Téléchargements', 'paquets' => 'Paquets',
|
||||||
|
'paquets/_detail' => 'Paquet', 'equipe' => "L'équipe", 'contact' => 'Contact',
|
||||||
|
'mentions-legales' => 'Mentions légales', 'conditions' => "Conditions d'utilisation",
|
||||||
|
'confidentialite' => 'Confidentialité',
|
||||||
|
];
|
||||||
|
$label = $labels[$route] ?? 'FWS Linux';
|
||||||
|
$title = $label . ' | FWS Linux';
|
||||||
|
}
|
||||||
|
if ($description === null) {
|
||||||
|
$description = 'FWS Linux — distribution open-source basée sur Arch Linux. Installation simplifiée, léger, respectueux de la vie privée, compatible Windows grâce à Wine et Winboat.';
|
||||||
|
}
|
||||||
|
if ($canonical === null) {
|
||||||
|
$canonRoute = $route === 'paquets/_detail' ? 'paquets/' . $detailId : $route;
|
||||||
|
/* Portabilité : hôte courant + base URL (sous-dossier WAMP inclus),
|
||||||
|
au lieu du domaine de production codé en dur. */
|
||||||
|
$fwsScheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
|
||||||
|
|| (($_SERVER['HTTP_X_FORWARDED_PROTO'] ?? '') === 'https') ? 'https' : 'http';
|
||||||
|
$fwsHost = trim((string) ($_SERVER['HTTP_HOST'] ?? '')) !== ''
|
||||||
|
? (string) $_SERVER['HTTP_HOST'] : 'fwslinux.fr';
|
||||||
|
$canonical = $fwsScheme . '://' . $fwsHost . fws_url('/?p/' . ($canonRoute === 'index' ? 'index' : $canonRoute) . '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
function fws_site_active(string $route, string $prefix): string
|
||||||
|
{
|
||||||
|
return $route === $prefix || str_starts_with($route, $prefix . '/')
|
||||||
|
? ' aria-current="page"' : '';
|
||||||
|
}
|
||||||
|
?><!doctype html>
|
||||||
|
<html lang="fr">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title><?= e($title) ?></title>
|
||||||
|
<meta name="description" content="<?= e($description) ?>" />
|
||||||
|
<meta name="robots" content="index, follow" />
|
||||||
|
<link rel="canonical" href="<?= e($canonical) ?>" />
|
||||||
|
|
||||||
|
<!-- Open Graph -->
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta property="og:title" content="<?= e($title) ?>" />
|
||||||
|
<meta property="og:description" content="<?= e($description) ?>" />
|
||||||
|
<meta property="og:image" content="<?= e(fws_url('/p/assets/img/logo.png')) ?>" />
|
||||||
|
<meta property="og:locale" content="fr_FR" />
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="<?= e(fws_asset('/p/assets/styles/styles.css')) ?>" />
|
||||||
|
<link rel="stylesheet" href="<?= e(fws_asset('/p/assets/styles/paquets.css')) ?>" />
|
||||||
|
<?php foreach ($extraCss as $css): ?>
|
||||||
|
<link rel="stylesheet" href="<?= e(fws_asset($css)) ?>" />
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<link rel="icon" type="image/png" href="<?= e(fws_url('/p/assets/img/logo.png')) ?>" />
|
||||||
|
|
||||||
|
<!-- Réseau : releases des paquets (Gitea) et de l'ISO (GitHub) -->
|
||||||
|
<link rel="preconnect" href="https://gitea.nocode-var.tech" crossorigin />
|
||||||
|
<link rel="dns-prefetch" href="https://gitea.nocode-var.tech" />
|
||||||
|
<link rel="preconnect" href="https://api.github.com" crossorigin />
|
||||||
|
<link rel="dns-prefetch" href="https://api.github.com" />
|
||||||
|
<link rel="dns-prefetch" href="https://github.com" />
|
||||||
|
<link rel="dns-prefetch" href="https://objects.githubusercontent.com" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<a class="skip-link" href="#app-main">Aller au contenu principal</a>
|
||||||
|
|
||||||
|
<div class="page-shell">
|
||||||
|
<header class="site-header" role="banner">
|
||||||
|
<div class="header-brand-block">
|
||||||
|
<a class="brand" href="<?= e(fws_url('/?p/index/')) ?>" aria-label="FWS Linux — Retour à l'accueil">
|
||||||
|
<img class="brand-mark" src="<?= e(fws_url('/p/assets/img/logo.png')) ?>" alt="" width="44" height="44" />
|
||||||
|
<span class="brand-text">
|
||||||
|
<strong>FWS Linux</strong>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<button type="button" class="nav-burger" aria-expanded="false" aria-controls="app-nav" aria-label="Ouvrir le menu de navigation">
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
<span></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<nav class="site-nav" id="app-nav" aria-label="Navigation principale">
|
||||||
|
<a href="<?= e(fws_url('/?p/index/')) ?>"<?= fws_site_active($route, 'index') ?>>Accueil</a>
|
||||||
|
<a href="<?= e(fws_url('/?p/dl/')) ?>"<?= fws_site_active($route, 'dl') ?>>Téléchargements</a>
|
||||||
|
|
||||||
|
<div class="nav-dropdown" data-nav-dropdown>
|
||||||
|
<button type="button" class="nav-dropdown-toggle" aria-expanded="false" aria-haspopup="true" aria-controls="nav-paquets-panel"<?= fws_site_active($route, 'paquets') ?>>
|
||||||
|
Paquets
|
||||||
|
<span class="nav-dropdown-caret" aria-hidden="true"></span>
|
||||||
|
</button>
|
||||||
|
<div class="nav-dropdown-panel" id="nav-paquets-panel" role="group" aria-label="Liste des paquets">
|
||||||
|
<div class="nav-dropdown-head">
|
||||||
|
<strong>Paquets FWS</strong>
|
||||||
|
<small><?= count($packages) ?> disponible<?= count($packages) > 1 ? 's' : '' ?></small>
|
||||||
|
</div>
|
||||||
|
<div class="nav-dropdown-panel-inner">
|
||||||
|
<?php if ($packages === []): ?>
|
||||||
|
<p class="nav-dropdown-error">Aucun paquet pour le moment.</p>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php foreach ($packages as $i => $pkg): ?>
|
||||||
|
<?php $navThumb = (string) ($pkg['screens'][0]['src'] ?? ''); ?>
|
||||||
|
<a class="nav-dropdown-item<?= $navThumb !== '' ? ' has-thumb' : '' ?>" href="<?= e(fws_url('/?p/paquets/' . max($i + 1, (int) $pkg['dbId']) . '/')) ?>">
|
||||||
|
<?php if ($navThumb !== ''): ?>
|
||||||
|
<img class="nav-dropdown-thumb" src="<?= e(fws_url($navThumb)) ?>" alt="" loading="lazy" width="30" height="30">
|
||||||
|
<?php endif; ?>
|
||||||
|
<span class="nav-dropdown-text">
|
||||||
|
<strong><?= e($pkg['name']) ?><?php if (!empty($pkg['latest']['name'])): ?><span class="nav-dropdown-version"><?= e($pkg['latest']['name']) ?></span><?php endif; ?></strong>
|
||||||
|
<small><?= e($pkg['tagline'] ?? '') ?></small>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<a class="nav-dropdown-all" href="<?= e(fws_url('/?p/paquets/')) ?>">Voir tous les paquets →</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main id="app-main" class="site-main">
|
||||||
|
<?= $body ?>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="site-footer" role="contentinfo">
|
||||||
|
<div class="footer-content">
|
||||||
|
<div class="footer-brand-row">
|
||||||
|
<div class="footer-brand-block">
|
||||||
|
<img class="footer-brand-mark" src="<?= e(fws_url('/p/assets/img/logo.png')) ?>" alt="" width="40" height="40" />
|
||||||
|
<div>
|
||||||
|
<strong>FWS Linux</strong>
|
||||||
|
<p>Un système léger, libre et compatible</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer-links-grid">
|
||||||
|
<nav aria-label="Navigation secondaire">
|
||||||
|
<h2>Navigation</h2>
|
||||||
|
<a href="<?= e(fws_url('/?p/index/')) ?>">Accueil</a>
|
||||||
|
<a href="<?= e(fws_url('/?p/dl/')) ?>">Téléchargements</a>
|
||||||
|
<a href="<?= e(fws_url('/?p/paquets/')) ?>">Paquets</a>
|
||||||
|
<a href="<?= e(fws_url('/?p/equipe/')) ?>">Équipe</a>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Contact</h2>
|
||||||
|
<a href="<?= e(fws_url('/?p/contact/')) ?>">Page de contact</a>
|
||||||
|
<a href="<?= e(fws_url('/?p/equipe/')) ?>">Équipe</a>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<h2>Réseaux</h2>
|
||||||
|
<a href="https://gitea.nocode-var.tech/FWS" target="_blank" rel="noopener noreferrer">Gitea</a>
|
||||||
|
<a href="https://github.com/You-re-like-Windows-a-bitch/ISO" target="_blank" rel="noopener noreferrer">GitHub</a>
|
||||||
|
<a href="https://discord.gg/6mnpPr2jq4" target="_blank" rel="noopener noreferrer">Discord</a>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section aria-label="Informations légales">
|
||||||
|
<h2>Légal</h2>
|
||||||
|
<a href="<?= e(fws_url('/?p/mentions-legales/')) ?>">Mentions légales</a>
|
||||||
|
<a href="<?= e(fws_url('/?p/conditions/')) ?>">Conditions d'utilisation</a>
|
||||||
|
<a href="<?= e(fws_url('/?p/confidentialite/')) ?>">Confidentialité</a>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer-bottom">
|
||||||
|
<p>© <?= date('Y') ?> FWS Linux</p>
|
||||||
|
<p class="footer-hosting">Powered by <a href="https://zi-host.ch" target="_blank" rel="noopener noreferrer">ZI-HOST.ch</a></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="<?= e(fws_asset('/p/assets/main-nav/nav.js')) ?>"></script>
|
||||||
|
<?php foreach ($extraJs as $js): ?>
|
||||||
|
<script src="<?= e(fws_asset($js)) ?>"></script>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Routeur du serveur de développement `php -S` (voir tools/serve.sh).
|
||||||
|
*
|
||||||
|
* En production, Apache s'appuie sur .htaccess : page.php est le point
|
||||||
|
* d'entrée unique et ErrorDocument renvoie les 404 vers la page du site.
|
||||||
|
* Le serveur intégré de PHP ignore ces fichiers : ce routeur reproduit le
|
||||||
|
* même comportement pour que les URLs propres, les assets, l'API, l'admin
|
||||||
|
* et la page 404 soient identiques en local et sur le serveur.
|
||||||
|
*
|
||||||
|
* Usage : php -S 127.0.0.1:8080 tools/router.php
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
$root = dirname(__DIR__);
|
||||||
|
$uri = (string) (parse_url((string) ($_SERVER['REQUEST_URI'] ?? '/'), PHP_URL_PATH) ?: '/');
|
||||||
|
$path = $root . str_replace('/', DIRECTORY_SEPARATOR, rawurldecode($uri));
|
||||||
|
|
||||||
|
/* Fichier réel (asset statique, point d'entrée API/admin…) : on laisse le
|
||||||
|
* serveur intégré le traiter normalement. */
|
||||||
|
if ($uri !== '/' && is_file($path)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Répertoire réel avec un index.php. Les routes du site (/p/…) passent par le
|
||||||
|
* front controller — plus fiable que leurs shims en accès direct. Les autres
|
||||||
|
* (ex. /admin/bugs/) sont servis normalement, comme le ferait Apache. */
|
||||||
|
if (is_dir($path) && is_file(rtrim($path, '/\\') . '/index.php')) {
|
||||||
|
if (preg_match('~^/p/~', rawurldecode($uri))) {
|
||||||
|
$_SERVER['SCRIPT_NAME'] = rtrim(rawurldecode($uri), '/') . '/index.php';
|
||||||
|
$_SERVER['SCRIPT_FILENAME'] = $root . '/index.php';
|
||||||
|
require $root . '/index.php';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tout le reste : front controller, avec __e=404 pour imiter l'ErrorDocument
|
||||||
|
* d'Apache — le site affiche alors sa propre page 404. SCRIPT_NAME est fixé
|
||||||
|
* au point d'entrée pour que fws_base_url() résolve les assets depuis la
|
||||||
|
* racine (le serveur intégré y mettrait sinon le chemin du routeur). */
|
||||||
|
$_GET['__e'] = 404;
|
||||||
|
$_SERVER['SCRIPT_NAME'] = '/index.php';
|
||||||
|
$_SERVER['SCRIPT_FILENAME'] = $root . '/index.php';
|
||||||
|
require $root . '/index.php';
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@echo off
|
||||||
|
rem Serveur de développement local sous Windows (aucun Apache/WAMP requis).
|
||||||
|
rem Usage : tools\serve.cmd (ou set PORT=8080 && tools\serve.cmd)
|
||||||
|
cd /d "%~dp0.."
|
||||||
|
if "%HOST%"=="" set HOST=127.0.0.1
|
||||||
|
if "%PORT%"=="" set PORT=8080
|
||||||
|
echo FWS Linux - serveur local : http://%HOST%:%PORT%
|
||||||
|
php -S %HOST%:%PORT% tools\router.php
|
||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Serveur de développement local (aucun Apache/WAMP requis).
|
||||||
|
# Usage : bash tools/serve.sh (ou HOST=0.0.0.0 PORT=8080 bash tools/serve.sh)
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
|
||||||
|
HOST="${HOST:-127.0.0.1}"
|
||||||
|
PORT="${PORT:-8080}"
|
||||||
|
|
||||||
|
echo "FWS Linux — serveur local : http://${HOST}:${PORT}"
|
||||||
|
exec php -S "${HOST}:${PORT}" tools/router.php
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
/* Tiny TCP forwarder: listens on 127.0.0.1:8765 and pipes to 127.0.0.1:8555.
|
||||||
|
Exists only because the preview browser cannot attach to Docker's
|
||||||
|
published port process. Ctrl+C to stop. */
|
||||||
|
const net = require("net");
|
||||||
|
|
||||||
|
const LISTEN = 8765;
|
||||||
|
const TARGET_PORT = 8555;
|
||||||
|
const TARGET_HOST = "127.0.0.1";
|
||||||
|
|
||||||
|
const server = net.createServer((client) => {
|
||||||
|
const upstream = net.connect(TARGET_PORT, TARGET_HOST);
|
||||||
|
client.pipe(upstream);
|
||||||
|
upstream.pipe(client);
|
||||||
|
const cleanup = () => {
|
||||||
|
client.destroy();
|
||||||
|
upstream.destroy();
|
||||||
|
};
|
||||||
|
client.on("error", cleanup);
|
||||||
|
upstream.on("error", cleanup);
|
||||||
|
});
|
||||||
|
|
||||||
|
server.listen(LISTEN, "127.0.0.1", () => {
|
||||||
|
console.log(`forwarding 127.0.0.1:${LISTEN} -> ${TARGET_HOST}:${TARGET_PORT}`);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user