From 4ff784d4b4f3ac0fe04f051df6f43448542bafa4 Mon Sep 17 00:00:00 2001 From: Adriel Sand Date: Sun, 26 Sep 2021 18:23:53 +0300 Subject: [PATCH] added showing date and time; added conveniences --- make-new-file.cgi | 6 ++++-- off.html | 34 +++++++++++++++++++++++++++++----- on.html | 34 +++++++++++++++++++++++++++++----- telegram | 2 +- 4 files changed, 63 insertions(+), 13 deletions(-) diff --git a/make-new-file.cgi b/make-new-file.cgi index 75c4cf0..c7f358f 100755 --- a/make-new-file.cgi +++ b/make-new-file.cgi @@ -3,14 +3,16 @@ echo "Content-type: text/html" echo "" +date_now=$(date +'%b %d, %Y at %H:%M') + if [[ $(cat state.txt) = "ON" ]] then echo "OFF" > state.txt - echo $(cat off.html) > /usr/local/apache2/htdocs/index.html + cat off.html | sed "s/date-n-time-placeholder/$date_now" > /usr/local/apache2/htdocs/index.html ./telegram "✅ The generator is OFF!" else echo "ON" > state.txt - echo $(cat on.html) > /usr/local/apache2/htdocs/index.html + cat on.html | sed "s/date-n-time-placeholder/$date_now" > /usr/local/apache2/htdocs/index.html ./telegram "❌ The generator is on. :(" fi diff --git a/off.html b/off.html index 2b8956b..6780758 100644 --- a/off.html +++ b/off.html @@ -20,7 +20,7 @@ display: block; text-align: center; align-content: center; - padding: 50px; + padding: 50px 50px 10px 50px; } .status-bg-on { background-color: dimgray; @@ -28,10 +28,11 @@ display: block; text-align: center; align-content: center; - padding: 50px; + padding: 50px 50px 10px 50px; } .status-text { color: white; + padding: 10px 5px; font-size: 40px; } .credits { @@ -51,17 +52,40 @@ text-decoration: none; color: inherit; } - - + .date-time-updated { + padding: 5px 5px; + color: #dddddd; + text-align: center; + } + .date-time-updated b { + color: #ffffff; + } + .hidden { + display: none; + } + .nothidden { + display: block + } -
+ +

The generator is OFF! :)

+
+

last updated at: date-n-time-placeholder

+

Made with ❤️ | Source Code: Gitea diff --git a/on.html b/on.html index 6ec7c5f..b654607 100644 --- a/on.html +++ b/on.html @@ -20,7 +20,7 @@ display: block; text-align: center; align-content: center; - padding: 50px; + padding: 50px 50px 10px 50px; } .status-bg-on { background-color: dimgray; @@ -28,10 +28,11 @@ display: block; text-align: center; align-content: center; - padding: 50px; + padding: 50px 50px 10px 50px; } .status-text { color: white; + padding: 10px 5px; font-size: 40px; } .credits { @@ -51,17 +52,40 @@ text-decoration: none; color: inherit; } - - + .date-time-updated { + padding: 5px 5px; + color: #dddddd; + text-align: center; + } + .date-time-updated b { + color: #ffffff; + } + .hidden { + display: none; + } + .nothidden { + display: block + } -

+

The generator is ON :(

+
+

last updated at: date-n-time-placeholder

+
+
+

Made with ❤️ | Source Code: Gitea diff --git a/telegram b/telegram index a562460..0c8d199 100755 --- a/telegram +++ b/telegram @@ -14,7 +14,7 @@ # along with this program. If not, see . VERSION="0.4" -TOKEN="2021660264:AAHAMctZcI0vP7vB_uto-vfUkiUDNABbQVo" +TOKEN="$(cat token)" CHATS=(-1001541565264) DEBUG=false DRY_RUN=false