forked from FroSteel/Planification
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ae440cbf1 |
+32
-3
@@ -85,7 +85,7 @@ async function fetchPlanningXml(origin, phpsessid, unixDate) {
|
||||
`&day_start_hour=8` +
|
||||
`&day_end_hour=19`;
|
||||
console.log("[bg] fetchPlanningXml →", url.substring(0, 140));
|
||||
const r = await fetch(url, { credentials: "include" });
|
||||
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
|
||||
@@ -100,6 +100,32 @@ async function fetchPlanningXml(origin, phpsessid, unixDate) {
|
||||
return xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* v5.0.9 : wrapper autour de fetch() qui ajoute systématiquement les
|
||||
* headers de sécurité attendus par EasyVista (Referer, Sec-Fetch-Site,
|
||||
* X-Requested-With). Sans ces headers, EV renvoie soit un <script> de
|
||||
* redirection (CSRF check), soit une page de login, même avec une session
|
||||
* valide.
|
||||
*
|
||||
* Observé dans les captures réseau du navigateur :
|
||||
* Referer: https://itsma.etat-de-vaud.ch/index.php?eventName=HelpDesk_PlanningItem
|
||||
* Sec-Fetch-Site: same-origin
|
||||
* X-Requested-With: XMLHttpRequest (parfois)
|
||||
*
|
||||
* @param {string} url - URL complète à fetcher
|
||||
* @param {string} origin - origine EasyVista (pour construire le Referer)
|
||||
* @param {object} [opts] - options fetch (method, body, headers supplémentaires)
|
||||
*/
|
||||
async function evFetch(url, origin, opts = {}) {
|
||||
const defaultHeaders = {
|
||||
"Referer": `${origin}/index.php?eventName=HelpDesk_PlanningItem`,
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
};
|
||||
const headers = Object.assign({}, defaultHeaders, opts.headers || {});
|
||||
const fetchOpts = Object.assign({ credentials: "include" }, opts, { headers });
|
||||
return await fetch(url, fetchOpts);
|
||||
}
|
||||
|
||||
/**
|
||||
* v4.2 : classifie un statut HTTP comme "session_expired" ou "ev_unreachable".
|
||||
* - 401, 403, 404 → session_expired (EV renvoie souvent 404 au lieu de rediriger
|
||||
@@ -118,7 +144,7 @@ function classifyHttpStatus(status) {
|
||||
*/
|
||||
async function fetchXhr2(origin, phpsessid, actionId) {
|
||||
const url = `${origin}/planning_xhr_2.php?PHPSESSID=${encodeURIComponent(phpsessid)}&id=${encodeURIComponent(actionId)}`;
|
||||
const r = await fetch(url, { credentials: "include" });
|
||||
const r = await evFetch(url, origin);
|
||||
if (!r.ok) {
|
||||
const err = new Error("HTTP " + r.status);
|
||||
err.kind = classifyHttpStatus(r.status);
|
||||
@@ -131,7 +157,7 @@ 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));
|
||||
const r = await fetch(url, { credentials: "include" });
|
||||
const r = await evFetch(url, origin);
|
||||
if (!r.ok) {
|
||||
const err = new Error("HTTP " + r.status);
|
||||
err.kind = classifyHttpStatus(r.status);
|
||||
@@ -140,6 +166,9 @@ async function fetchFicheHtml(origin, phpsessid, formLink) {
|
||||
}
|
||||
const html = await r.text();
|
||||
console.log("[bg] fiche status =", r.status, "| taille =", html.length);
|
||||
if (html.length < 500) {
|
||||
console.warn("[bg] ⚠ fiche très courte, contenu =", JSON.stringify(html));
|
||||
}
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Planification",
|
||||
"version": "4.3.0",
|
||||
"version": "5.0.0",
|
||||
"description": "Vue claire du planning EasyVista (itsma.etat-de-vaud.ch et itsma.vd.ch). v4.3.0 : (1) conflits horaires entre interventions d'un même tech affichés en rouge + ⚠. (2) Réservations disparues retirées directement (pas de re-fetch inutile). (3) Popups épinglés détachés : plusieurs peuvent coexister, ancrés au contenu (scrollent avec la page), auto-positionnés sans se marcher dessus (toast si pas de place), Échap pour tout fermer, Ctrl×2 pour fermer si un seul épinglé. Inclut v4.2.9.",
|
||||
"permissions": [
|
||||
"activeTab",
|
||||
|
||||
+9
-7
@@ -262,7 +262,7 @@ html, body {
|
||||
background: rgba(255,255,255,0.15);
|
||||
}
|
||||
|
||||
/* Barre de progression pendant le rafraîchissement — v4.1.12 : texte
|
||||
/* Barre de progression pendant le rafraichissement — v4.1.12 : texte
|
||||
toujours lisible, que la zone verte l'ait atteint ou non (utilise
|
||||
mix-blend-mode:difference pour inverser la couleur du texte là où la
|
||||
barre verte est dessous). */
|
||||
@@ -438,7 +438,7 @@ html, body {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* Bouton "Arrêter" (apparaît pendant un refresh manuel) */
|
||||
/* Bouton "Arrêter" (apparaît pdt un refresh manuel) */
|
||||
.btn-abort {
|
||||
background: var(--danger-soft);
|
||||
color: var(--danger);
|
||||
@@ -909,10 +909,9 @@ html, body {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.intervention-v2.is-ghost {
|
||||
opacity: 0.5;
|
||||
text-decoration: line-through;
|
||||
}
|
||||
/* .intervention-v2.is-ghost : retirée en v4.3.3 — on ne barre plus les
|
||||
cartes. La gestion des tickets disparus se fait via _disappearStatus
|
||||
(vert ✓/✓✓) ou _disappearRemove (retrait total). */
|
||||
|
||||
/* Ligne 1 : REF en titre centré gros gras */
|
||||
.iv-ref-header {
|
||||
@@ -1806,7 +1805,10 @@ body.modal-open {
|
||||
───────────────────────────────────────────────────────────────────────── */
|
||||
.tooltip.pinned-popup {
|
||||
position: absolute !important; /* override le fixed du .tooltip */
|
||||
z-index: 500; /* au-dessus du contenu, sous les modals (10000) */
|
||||
/* v4.3.3 corr : les popups épinglées doivent passer DERRIÈRE la topbar
|
||||
quand on scrolle (topbar sticky z-index 10). Donc on met 5 : au-dessus
|
||||
du contenu normal, mais sous la topbar / bannières / modals. */
|
||||
z-index: 5 !important;
|
||||
opacity: 1 !important;
|
||||
pointer-events: auto !important;
|
||||
/* Bordure plus visible pour distinguer du tooltip live */
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
<button id="user-badge" class="user-badge hidden"
|
||||
type="button" aria-label="Utilisateur connecté"
|
||||
title="Utilisateur connecté"></button>
|
||||
<h1>Planification</h1>
|
||||
<h1 id="app-title">Planification</h1>
|
||||
<div class="date-nav">
|
||||
<button id="nav-prev" class="btn btn-nav" title="Jour précédent" aria-label="Jour précédent">◀</button>
|
||||
<input type="date" id="date-picker" class="date-input">
|
||||
|
||||
Reference in New Issue
Block a user