From 9f67c28bc07d5fda21782ce00c8238991671244d Mon Sep 17 00:00:00 2001 From: EpicKiwi Date: Sat, 1 Aug 2026 21:00:28 +0200 Subject: [PATCH] Ajout du script du lien symbolique --- .gitignore | 1 + js/status.js | 2 +- status/index.html | 20 -------------------- status/set-status.sh | 23 +++++++++++++++++++++++ 4 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 .gitignore delete mode 100644 status/index.html create mode 100755 status/set-status.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32ff6e5 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +status/index.html \ No newline at end of file diff --git a/js/status.js b/js/status.js index 0855a37..908f38f 100644 --- a/js/status.js +++ b/js/status.js @@ -1,7 +1,7 @@ import { statusProxy } from './main.js' export async function loadStatus(){ - let res = await fetch('/status/index.ouvert.html'); + let res = await fetch('/status/index.html'); let html_text = await res.text() let html = new DOMParser().parseFromString(html_text, "text/html"); diff --git a/status/index.html b/status/index.html deleted file mode 100644 index 7547440..0000000 --- a/status/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - Le LOL est Ouvert - - -
-

Ouvert !

-
- - diff --git a/status/set-status.sh b/status/set-status.sh new file mode 100755 index 0000000..33c69f2 --- /dev/null +++ b/status/set-status.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +if [ "$#" = "0" ]; then + echo "Usage set-status.sh [new-status]" + echo "" + echo "[new-status] can be \"opened\" or \"closed\"" + echo "" + exit 1 +fi + +#SPACE_JSON=/var/www/html/spaceapi/space.json + +if [ "$1" = "opened" ]; then + ln -sf "index.ouvert.html" "$(dirname $0)/index.html" + #jq "setpath([\"state\", \"open\"]; true) | setpath([\"state\", \"lastchange\"]; $(date +%s))" < $SPACE_JSON > $SPACE_JSON.new && + #mv -f $SPACE_JSON.new $SPACE_JSON +fi + +if [ "$1" = "closed" ]; then + ln -sf "index.fermé.html" "$(dirname $0)/index.html" + #jq "setpath([\"state\", \"open\"]; false) | setpath([\"state\", \"lastchange\"]; $(date +%s))" < $SPACE_JSON > $SPACE_JSON.new && + #mv -f $SPACE_JSON.new $SPACE_JSON +fi