From e7841d40dea89b4ec0699dbbc9bd2dc255a837fd Mon Sep 17 00:00:00 2001 From: Boris Date: Mon, 31 Oct 2022 21:40:42 +0100 Subject: [PATCH] La Bureautique se meurt --- config.php | 2 +- lib/js/farfetched.js | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config.php b/config.php index 7d42aed..8c4214f 100644 --- a/config.php +++ b/config.php @@ -88,12 +88,12 @@ $games = [ $radiuses = [5, 10, 20, 50, 100]; define('DEFAULT_GAME', 'spationaute'); -define('GAME_JS_DIR', 'themes/'. $_SESSION['gameId'] . '/js/map'); if (!isset($_SESSION['gameId'])) { $_SESSION['gameId'] = DEFAULT_GAME; } +define('GAME_JS_DIR', 'themes/'. $_SESSION['gameId'] . '/js/map'); define('DEFAULT_WEBPAGE_TITLE', 'La bureautique'); diff --git a/lib/js/farfetched.js b/lib/js/farfetched.js index 6a921ca..68447c7 100644 --- a/lib/js/farfetched.js +++ b/lib/js/farfetched.js @@ -162,7 +162,7 @@ function storeAtFreds (json) { const controller = new AbortController() const timeoutId = setTimeout( () => { controller.abort() - }, 2000) + }, 15000) var fetchOpts = { method: 'GET', headers: { @@ -189,14 +189,19 @@ function storeAtFreds (json) { const controller2 = new AbortController() const timeoutId2 = setTimeout( () => { controller.abort() - }, 2000) + }, 15000) var fetchOpts2 = { method: 'GET', headers: { - // 'Accept': 'txt/html' + 'Accept': 'text/html', + 'Content-Type': 'text/html', + // 'Access-Control-Allow-Origin': '*', + 'Origin': 'la-bureautique', + 'Referrer-Policy': 'unsafe-url' }, - signal: controller2.signal, - redirect: 'follow' + mode: 'cors', + redirect: 'follow', + signal: controller2.signal } fetch(url, fetchOpts2) .then(html => { @@ -246,7 +251,7 @@ fetchImmaterial(5) console.error(error) }) -fetchShippable(25) +fetchShippable(5) .then(records => { displayShippable(records.hits.hits)