Compare commits
7 Commits
v2026.5.33
...
v2026.5.38
| Author | SHA1 | Date | |
|---|---|---|---|
| c9363c64b6 | |||
| 08bf8cb5f5 | |||
| dd0b5e1a36 | |||
| 0fbc1997bb | |||
| cd54764dd5 | |||
| a92e3429b2 | |||
| 1ecc60e160 |
@@ -17,6 +17,7 @@ desktop.ini
|
||||
*.old
|
||||
|
||||
# Build artifacts (les ZIP/XPI livrés ne sont pas dans le repo, ils sont buildés à la demande)
|
||||
dist/
|
||||
*.zip
|
||||
*.xpi
|
||||
*.crx
|
||||
|
||||
+43
-3
@@ -1,7 +1,7 @@
|
||||
# CHANGELOG — Extension Planification EasyVista Canton de Vaud
|
||||
|
||||
> Ce changelog documente l'évolution de l'extension Chrome/Firefox "Planification"
|
||||
> développée par Quentin Rouiller pour les techniciens IT du Canton de Vaud.
|
||||
> développée par Quentin Rouiller pour les techniciens DGNSI (Canton de Vaud).
|
||||
>
|
||||
> Les versions documentées ci-dessous sont celles dont les détails sont connus.
|
||||
> Pour les versions plus anciennes, Claude Code se basera sur l'analyse du code
|
||||
@@ -9,9 +9,49 @@
|
||||
|
||||
---
|
||||
|
||||
## v2026.5.37 — Refonte vue horizontale (sidebar complète)
|
||||
## v2026.5.38 — Attribution auteur + nettoyage code
|
||||
**Branche** : current
|
||||
|
||||
### Attribution auteur
|
||||
- Ajout en-têtes copyright dans tous les fichiers source
|
||||
(viewer.js, viewer.html, viewer.css, background.js)
|
||||
- Ajout `@author Quentin Rouiller` sur les fonctions principales
|
||||
(loadForDate, buildCard, buildTooltipHTML, pinTooltip, _softUnpinPopup,
|
||||
positionTooltipAnchored, _applyViewMode, _moveElementsToSidebar,
|
||||
_restoreElementsToTopbar, fetchAndShowCurrentUser, _maybeRetryFetchUser,
|
||||
initAppClock, initAppFooter, bindTimelinePopover,
|
||||
openPersistentTimelinePopup, showTooltip, _findFreePopupPosition,
|
||||
_clampPopupInSafeArea, findEasyVistaSession, fetchPlanningXml,
|
||||
fetchCurrentUser, detectNetworkContext)
|
||||
- Ajout signature "Développé par Quentin Rouiller" en bas du popup
|
||||
user-badge (style cohérent avec footer version : 11px, italique,
|
||||
gris atténué, séparateur fin)
|
||||
- Mise à jour `description` du manifest pour mentionner DGNSI
|
||||
|
||||
### Nettoyage et optimisation
|
||||
- Retrait fonction vide `initAdminMenu()` (inutile depuis v2026.5.25,
|
||||
l'admin passe par le bouton ⚙ Paramètres du popup user-badge)
|
||||
- Retrait classe CSS orpheline `.date-picker-day` (déjà remplacée par
|
||||
`.date-custom` en v2026.5.17)
|
||||
- Retrait anciens styles CSS `.intervention` (layout v1, jamais générés
|
||||
depuis le passage à `.intervention-v2`)
|
||||
- Retrait commentaire orphelin `.intervention-v2.is-ghost` (classe
|
||||
retirée en v4.3.3)
|
||||
- Retrait 14× `console.log("[viewMode]")` debug verbose (gardé
|
||||
uniquement les `console.warn` utiles pour erreurs)
|
||||
- Retrait 5× `console.log("[bg]")` debug verbose dans
|
||||
fetchPlanningXml / fetchFicheHtml / fetchSessionTimeRemaining /
|
||||
extendSessionKeepAlive (gardé warnings + logs critiques)
|
||||
- Remplacement `extendBtn.onclick` par `addEventListener("click", ...)`
|
||||
pour plus de cohérence
|
||||
|
||||
### Builds
|
||||
- `dist/chromium/` et `dist/firefox/` prêts à charger en mode dev
|
||||
- `planification-v2026.5.38-chromium.zip` (~144 Ko)
|
||||
- `planification-v2026.5.38-firefox.xpi` (~144 Ko, à signer sur AMO)
|
||||
|
||||
## v2026.5.37 — Refonte vue horizontale (sidebar complète)
|
||||
|
||||
- Topbar en haut supprimée en vue horizontale
|
||||
- User-badge + titre déplacés tout en haut de la sidebar
|
||||
- Bouton "Aujourd'hui" pleine largeur avec icône ↺
|
||||
@@ -175,5 +215,5 @@
|
||||
## Auteur
|
||||
|
||||
**Quentin Rouiller** (QRO)
|
||||
Canton de Vaud — Service IT
|
||||
Technicien DGNSI — Canton de Vaud
|
||||
Email pour commits Git : `quentin.rouiller@ikmail.com`
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# Planification — Extension EasyVista Canton de Vaud
|
||||
|
||||
Extension Chrome / Firefox pour visualiser de manière claire et rapide le planning des techniciens IT du Canton de Vaud dans EasyVista.
|
||||
Extension Chrome / Firefox pour visualiser de manière claire et rapide le planning des techniciens DGNSI (Canton de Vaud) dans EasyVista.
|
||||
|
||||
## Aperçu rapide
|
||||
|
||||
- **Auteur** : Quentin Rouiller (QRO)
|
||||
- **Cible** : techniciens IT Canton de Vaud, EasyVista (`itsma.etat-de-vaud.ch` / `itsma.vd.ch`)
|
||||
- **Cible** : techniciens DGNSI (Canton de Vaud), EasyVista (`itsma.etat-de-vaud.ch` / `itsma.vd.ch`)
|
||||
- **Démarrage projet** : jeudi 16 avril 2026
|
||||
- **Version actuelle** : `v2026.5.37`
|
||||
- **Manifest** : V3 (Chrome/Edge/Firefox)
|
||||
@@ -60,14 +60,24 @@ L'extension a connu **3 systèmes de versionning successifs** :
|
||||
|---|---|---|
|
||||
| 16-17 avril 2026 | Versions de base | `1.0.0`, `2.0.0`, `3.0.0` |
|
||||
| 18-20 avril 2026 | SemVer classique | `4.1.3`, `4.2.8`, `5.0.12` |
|
||||
| 21 avril 2026 → maintenant | **Année + mois + patch** | `2026.5.16` → `2026.5.37` |
|
||||
| 21 avril 2026 → maintenant | **`ANNÉE.MAJEURE.PATCH`** | `2026.5.16` → `2026.5.37` |
|
||||
|
||||
### Pourquoi le passage à `YYYY.M.PATCH` ?
|
||||
### Format actuel : `ANNÉE.MAJEURE.PATCH`
|
||||
|
||||
À partir de la **v2026.5.16** (21 avril 2026), l'extension est passée au versionning par année :
|
||||
- Plus lisible pour les utilisateurs (l'année indique immédiatement la fraîcheur)
|
||||
- Plus de débat sur ce qui constitue un "majeur" vs "mineur"
|
||||
- Bump du `PATCH` à chaque livraison
|
||||
À partir de la **v2026.5.16** (21 avril 2026), l'extension utilise le schéma suivant :
|
||||
|
||||
| Position | Sens | Quand ça change |
|
||||
|---|---|---|
|
||||
| `2026` | **Année** | À chaque nouvelle année calendaire |
|
||||
| `5` | **Majeure** | À chaque **gros changement / ajout important** (refonte, nouvelle feature majeure, bump volontaire) |
|
||||
| `37` | **Patch** | À **chaque livraison** dans la majeure courante (corrections, ajustements, petites features) |
|
||||
|
||||
Exemples :
|
||||
- `2026.5.16` → `2026.5.17` : petite correction ou ajustement (patch)
|
||||
- `2026.5.37` → `2026.6.0` : refonte majeure (par exemple nouvelle vue, nouvelle architecture)
|
||||
- `2026.x.y` → `2027.0.0` : passage à la nouvelle année
|
||||
|
||||
Le numéro de **majeure** n'est **pas** un mois et **pas** un chiffre lié au calendrier — c'est un compteur de versions importantes propre au projet (la `5` actuelle continue le `5.x` qui précédait, repris tel quel lors du passage au format annuel).
|
||||
|
||||
⚠️ **Important** : `v2026.5.16` succède chronologiquement à `v5.0.12`, malgré le numéro qui semble plus petit. Le préfixe `2026` indique l'année.
|
||||
|
||||
@@ -179,4 +189,4 @@ git push --tags
|
||||
## Auteur
|
||||
|
||||
**Quentin Rouiller** (QRO)
|
||||
Canton de Vaud — Service IT
|
||||
Technicien DGNSI — Canton de Vaud
|
||||
|
||||
+131
-15
@@ -1,3 +1,16 @@
|
||||
/**
|
||||
* Planification — Extension navigateur EasyVista (Canton de Vaud / DGNSI)
|
||||
*
|
||||
* Service worker (Manifest V3) : récupération session EV, fetch planning XML,
|
||||
* fetch fiches détaillées, gestion cache.
|
||||
*
|
||||
* Copyright (c) 2026 Quentin Rouiller
|
||||
* Licensed under the MIT License — see LICENSE file in the project root.
|
||||
*
|
||||
* @author Quentin Rouiller
|
||||
* @repository https://gitea.netaplaid.ch/FroSteel/Planification
|
||||
*/
|
||||
|
||||
// background.js — Service worker (Manifest V3) — v4
|
||||
//
|
||||
// Rôles :
|
||||
@@ -14,6 +27,94 @@
|
||||
// directement ref/contact/lieu/catégorie dans ses attributs attr1/attr2/attr3,
|
||||
// donc on n'a plus besoin ni de xhr2 en masse, ni de l'API timeline.
|
||||
|
||||
// ============================================================================
|
||||
// v2026.5.38 : Observabilité — logger unifié + handlers globaux SW
|
||||
// ============================================================================
|
||||
// Le service worker MV3 est endormi/relancé fréquemment, donc important d'avoir
|
||||
// un format de log compact et reproductible. Les handlers `error` et
|
||||
// `unhandledrejection` sur `self` capturent ce qui passe à travers les
|
||||
// try/catch (ex: une promise oubliée dans un setTimeout).
|
||||
// ============================================================================
|
||||
|
||||
// Clef chrome.storage.local pour le mode debug — toggle depuis le panel admin
|
||||
// du viewer. Le viewer envoie un message {type:"setDebugLogs"} qu'on traite
|
||||
// plus bas pour sync, et on lit aussi au boot.
|
||||
const DEBUG_LOGS_KEY = "debug_logs";
|
||||
|
||||
const LOG = (() => {
|
||||
let _version = "?";
|
||||
try {
|
||||
if (chrome && chrome.runtime && chrome.runtime.getManifest) {
|
||||
_version = chrome.runtime.getManifest().version || "?";
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
let _debug = false;
|
||||
// Lecture initiale (asynchrone, mais on s'en fout : on commence muet
|
||||
// et qd la valeur arrive on update). Le SW peut être tué/relancé donc
|
||||
// on relit à chaque démarrage.
|
||||
try {
|
||||
chrome.storage.local.get([DEBUG_LOGS_KEY]).then(obj => {
|
||||
_debug = !!obj[DEBUG_LOGS_KEY];
|
||||
}).catch(() => {});
|
||||
} catch (e) {}
|
||||
|
||||
const _stamp = () => new Date().toISOString().substring(11, 23);
|
||||
const _format = (level, prefix, msg, ctx) => {
|
||||
const head = `[${_stamp()}][v${_version}][bg/${prefix}][${level}]`;
|
||||
if (ctx !== undefined) return [head, msg, ctx];
|
||||
return [head, msg];
|
||||
};
|
||||
|
||||
return {
|
||||
info: (prefix, msg, ctx) => {
|
||||
if (!_debug) return;
|
||||
console.log(..._format("INFO", prefix, msg, ctx));
|
||||
},
|
||||
warn: (prefix, msg, ctx) => console.warn (..._format("WARN", prefix, msg, ctx)),
|
||||
error:(prefix, msg, ctx) => console.error(..._format("ERROR", prefix, msg, ctx)),
|
||||
exception: (prefix, msg, err, extra) => {
|
||||
const ctx = {
|
||||
name: err && err.name,
|
||||
message: err && err.message,
|
||||
stack: err && err.stack,
|
||||
extra: extra
|
||||
};
|
||||
console.error(..._format("ERROR", prefix, msg, ctx));
|
||||
},
|
||||
setDebug: (on) => {
|
||||
_debug = !!on;
|
||||
try { chrome.storage.local.set({ [DEBUG_LOGS_KEY]: _debug }); } catch (e) {}
|
||||
console.log(..._format("INFO", "logger", `mode debug = ${_debug ? "ON" : "OFF"}`));
|
||||
},
|
||||
isDebug: () => _debug,
|
||||
version: () => _version
|
||||
};
|
||||
})();
|
||||
|
||||
// Si le viewer toggle pendant qu'on est endormi/relancé, on capte le
|
||||
// changement chrome.storage et on update le flag local.
|
||||
chrome.storage.onChanged.addListener((changes, area) => {
|
||||
if (area === "local" && changes[DEBUG_LOGS_KEY]) {
|
||||
const newVal = !!changes[DEBUG_LOGS_KEY].newValue;
|
||||
LOG.setDebug(newVal);
|
||||
}
|
||||
});
|
||||
|
||||
self.addEventListener("error", (event) => {
|
||||
LOG.exception("global", "uncaught error in service worker",
|
||||
event.error || new Error(event.message || "unknown"),
|
||||
{ filename: event.filename, lineno: event.lineno, colno: event.colno });
|
||||
});
|
||||
|
||||
self.addEventListener("unhandledrejection", (event) => {
|
||||
const reason = event.reason;
|
||||
LOG.exception("global", "unhandled promise rejection in service worker",
|
||||
reason instanceof Error ? reason : new Error(String(reason)));
|
||||
});
|
||||
|
||||
LOG.info("boot", "service worker démarré", { version: LOG.version() });
|
||||
|
||||
// Domaines EasyVista reconnus (interne d'abord, externe en fallback)
|
||||
const EV_ORIGINS = [
|
||||
"https://itsma.etat-de-vaud.ch",
|
||||
@@ -40,6 +141,11 @@ chrome.action.onClicked.addListener(async () => {
|
||||
// Trouver l'onglet EasyVista actif et en extraire le PHPSESSID
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Trouve l'onglet EasyVista ouvert et récupère phpsessid + origin.
|
||||
*
|
||||
* @author Quentin Rouiller
|
||||
*/
|
||||
async function findEasyVistaSession() {
|
||||
// Chercher tous les onglets sur un domaine EasyVista
|
||||
for (const origin of EV_ORIGINS) {
|
||||
@@ -65,6 +171,8 @@ async function findEasyVistaSession() {
|
||||
*
|
||||
* Ce n'est PAS le HTML de la page Planning — le serveur ne rend pas les données
|
||||
* dans le HTML, elles arrivent via cet endpoint AJAX.
|
||||
*
|
||||
* @author Quentin Rouiller
|
||||
*/
|
||||
async function fetchPlanningXml(origin, phpsessid, unixDate) {
|
||||
const techIds = "76272,83725,66635,92235,90070,40944,72485,86874";
|
||||
@@ -84,9 +192,9 @@ async function fetchPlanningXml(origin, phpsessid, unixDate) {
|
||||
`&mail_title=mail` +
|
||||
`&day_start_hour=8` +
|
||||
`&day_end_hour=19`;
|
||||
console.log("[bg] fetchPlanningXml →", url.substring(0, 140));
|
||||
// v2026.5.38 : on retire les logs verbose à chaque fetch (URL/status/taille).
|
||||
// En cas de souci, le throw plus bas porte assez d'info pour debug.
|
||||
const r = await evFetch(url, origin);
|
||||
console.log("[bg] status =", r.status);
|
||||
if (!r.ok) {
|
||||
// v4.2 : classifier l'erreur HTTP pour que le viewer affiche le bon
|
||||
// écran (session expirée vs EV inaccessible).
|
||||
@@ -95,9 +203,7 @@ async function fetchPlanningXml(origin, phpsessid, unixDate) {
|
||||
err.status = r.status;
|
||||
throw err;
|
||||
}
|
||||
const xml = await r.text();
|
||||
console.log("[bg] taille XML =", xml.length);
|
||||
return xml;
|
||||
return await r.text();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +262,6 @@ async function fetchXhr2(origin, phpsessid, actionId) {
|
||||
|
||||
async function fetchFicheHtml(origin, phpsessid, formLink) {
|
||||
const url = `${origin}/index.php?${formLink}&PHPSESSID=${encodeURIComponent(phpsessid)}`;
|
||||
console.log("[bg] fetchFicheHtml →", url.substring(0, 120));
|
||||
|
||||
// v2026.5.16 : juste après une reconnexion SSO, EasyVista retourne parfois
|
||||
// une page intermédiaire tronquée (~8 Ko au lieu de ~250 Ko), le temps que
|
||||
@@ -175,7 +280,11 @@ async function fetchFicheHtml(origin, phpsessid, formLink) {
|
||||
throw err;
|
||||
}
|
||||
const html = await r.text();
|
||||
console.log(`[bg] fiche status = ${r.status} | taille = ${html.length}${attempt > 1 ? ` (tentative ${attempt}/${MAX_RETRIES})` : ""}`);
|
||||
// v2026.5.38 : on log seulement les retries (utile en cas de pb SSO),
|
||||
// pas chaque tentative normale qui réussit du premier coup.
|
||||
if (attempt > 1) {
|
||||
console.log(`[bg] fiche tentative ${attempt}/${MAX_RETRIES} (taille = ${html.length})`);
|
||||
}
|
||||
|
||||
// Si réponse clairement une redirection courte → login expiré, inutile de retry
|
||||
if (html.length < 500) {
|
||||
@@ -273,7 +382,7 @@ async function fetchSessionTimeRemaining(origin, phpsessid) {
|
||||
const url = `${origin}/timeout_ajax.php`
|
||||
+ `?PHPSESSID=${encodeURIComponent(phpsessid)}`
|
||||
+ `&__AJAX_TIMEOUT_FCT__=session_time`;
|
||||
console.log("[bg] fetchSessionTimeRemaining →", url.substring(0, 120));
|
||||
// v2026.5.38 : log retiré (appelé toutes les minutes, polluait la console).
|
||||
const r = await evFetch(url, origin);
|
||||
if (!r.ok) {
|
||||
throw new Error("HTTP " + r.status);
|
||||
@@ -288,9 +397,7 @@ async function fetchSessionTimeRemaining(origin, phpsessid) {
|
||||
}
|
||||
throw new Error("invalid_response");
|
||||
}
|
||||
const ms = parseInt(body, 10);
|
||||
console.log(`[bg] session_time = ${ms} ms = ${Math.round(ms/60000)} min`);
|
||||
return ms;
|
||||
return parseInt(body, 10);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -302,7 +409,7 @@ async function extendSessionKeepAlive(origin, phpsessid) {
|
||||
const url = `${origin}/timeout_ajax.php`
|
||||
+ `?PHPSESSID=${encodeURIComponent(phpsessid)}`
|
||||
+ `&__AJAX_TIMEOUT_FCT__=keep_connection`;
|
||||
console.log("[bg] extendSessionKeepAlive →", url.substring(0, 120));
|
||||
// v2026.5.38 : log retiré (déclenché par bouton "prolonger", l'UI affiche déjà un toast).
|
||||
const r = await evFetch(url, origin);
|
||||
if (!r.ok) {
|
||||
throw new Error("HTTP " + r.status);
|
||||
@@ -312,9 +419,7 @@ async function extendSessionKeepAlive(origin, phpsessid) {
|
||||
if (looksLikeLoginPage(body)) throw new Error("session_expired");
|
||||
throw new Error("invalid_response");
|
||||
}
|
||||
const ms = parseInt(body, 10);
|
||||
console.log(`[bg] keep_connection → session prolongée à ${ms} ms`);
|
||||
return ms;
|
||||
return parseInt(body, 10);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
@@ -337,6 +442,8 @@ async function extendSessionKeepAlive(origin, phpsessid) {
|
||||
*
|
||||
* @param {boolean} force - si true, ignore le cache et refait le test
|
||||
* @returns {Promise<"internal"|"external">}
|
||||
*
|
||||
* @author Quentin Rouiller
|
||||
*/
|
||||
async function detectNetworkContext(force = false) {
|
||||
const CACHE_KEY = "network_context_v2"; // v5.0.12 : nouvelle clé pour invalider le cache fautif v5.0.11
|
||||
@@ -475,6 +582,8 @@ function watchReconnectTabForIamLogin(tabId) {
|
||||
* - champ "Bienvenue Nom Prénom"
|
||||
* Retourne { name: "Nom Prénom" | null, login: "..." | null } ou null si
|
||||
* tout a échoué.
|
||||
*
|
||||
* @author Quentin Rouiller
|
||||
*/
|
||||
async function fetchCurrentUser(origin, phpsessid) {
|
||||
const url = `${origin}/index.php?PHPSESSID=${encodeURIComponent(phpsessid)}`;
|
||||
@@ -1213,6 +1322,13 @@ chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// v2026.5.38 : toggle debug logs (depuis le panel admin du viewer)
|
||||
if (msg.type === "setDebugLogs") {
|
||||
LOG.setDebug(!!msg.on);
|
||||
sendResponse({ ok: true, debug: LOG.isDebug() });
|
||||
return;
|
||||
}
|
||||
|
||||
sendResponse({ ok: false, error: "unknown_message" });
|
||||
} catch (err) {
|
||||
console.error("background error:", err);
|
||||
|
||||
+3
-16
@@ -1,19 +1,8 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Planification",
|
||||
"version": "2026.5.33",
|
||||
"description": "Vue claire et rapide du planning des techniciens EasyVista. Regroupe interventions et réservations par tech, affiche horaires, contact, lieu, catégorie et statut en un coup d'œil.",
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "planification@vd.ch",
|
||||
"strict_min_version": "140.0",
|
||||
"data_collection_permissions": {
|
||||
"required": [
|
||||
"none"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"version": "2026.5.38",
|
||||
"description": "Vue claire et rapide du planning des techniciens EasyVista. Développé par Quentin Rouiller — DGNSI, Canton de Vaud.",
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
"scripting",
|
||||
@@ -29,9 +18,7 @@
|
||||
"default_title": "Ouvrir la Planification"
|
||||
},
|
||||
"background": {
|
||||
"scripts": [
|
||||
"background.js"
|
||||
]
|
||||
"service_worker": "background.js"
|
||||
},
|
||||
"icons": {
|
||||
"16": "icons/icon16.png",
|
||||
|
||||
+1083
-45
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,13 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
Planification — Extension navigateur EasyVista (Canton de Vaud / DGNSI)
|
||||
|
||||
Copyright (c) 2026 Quentin Rouiller
|
||||
Licensed under the MIT License — see LICENSE file in the project root.
|
||||
|
||||
@author Quentin Rouiller
|
||||
@repository https://gitea.netaplaid.ch/FroSteel/Planification
|
||||
-->
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
Reference in New Issue
Block a user