added showing date and time; added conveniences

master
Adriel Sand 2021-09-26 18:23:53 +03:00
parent ebe99294fb
commit 4ff784d4b4
4 changed files with 63 additions and 13 deletions

View File

@ -3,14 +3,16 @@
echo "Content-type: text/html" echo "Content-type: text/html"
echo "" echo ""
date_now=$(date +'%b %d, %Y at %H:%M')
if [[ $(cat state.txt) = "ON" ]] if [[ $(cat state.txt) = "ON" ]]
then then
echo "OFF" > state.txt 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!" ./telegram "✅ The generator is OFF!"
else else
echo "ON" > state.txt 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. :(" ./telegram "❌ The generator is on. :("
fi fi

View File

@ -20,7 +20,7 @@
display: block; display: block;
text-align: center; text-align: center;
align-content: center; align-content: center;
padding: 50px; padding: 50px 50px 10px 50px;
} }
.status-bg-on { .status-bg-on {
background-color: dimgray; background-color: dimgray;
@ -28,10 +28,11 @@
display: block; display: block;
text-align: center; text-align: center;
align-content: center; align-content: center;
padding: 50px; padding: 50px 50px 10px 50px;
} }
.status-text { .status-text {
color: white; color: white;
padding: 10px 5px;
font-size: 40px; font-size: 40px;
} }
.credits { .credits {
@ -51,17 +52,40 @@
text-decoration: none; text-decoration: none;
color: inherit; 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
}
</style> </style>
</head> </head>
<body> <body>
<div class="status-bg-off"> <div class="status-bg-on hidden">
<div class="status-text">
<p>The generator is <b>ON</b> :(</p>
</div>
<div class="date-time-updated">
<p>last updated at: <b>date-n-time-placeholder</b></p>
</div>
</div>
<div class="status-bg-off nothidden">
<div class="status-text"> <div class="status-text">
<p>The generator is <b>OFF!</b> :)</p> <p>The generator is <b>OFF!</b> :)</p>
</div> </div>
<div class="date-time-updated">
<p>last updated at: <b>date-n-time-placeholder</b></p>
</div>
</div> </div>
<div class="credits"> <div class="credits">
<p>Made with ❤️ | Source Code: <a href="https://git.sandcastle.eu.org/thebiblelover7/generator-status">Gitea</a> <p>Made with ❤️ | Source Code: <a href="https://git.sandcastle.eu.org/thebiblelover7/generator-status">Gitea</a>

34
on.html
View File

@ -20,7 +20,7 @@
display: block; display: block;
text-align: center; text-align: center;
align-content: center; align-content: center;
padding: 50px; padding: 50px 50px 10px 50px;
} }
.status-bg-on { .status-bg-on {
background-color: dimgray; background-color: dimgray;
@ -28,10 +28,11 @@
display: block; display: block;
text-align: center; text-align: center;
align-content: center; align-content: center;
padding: 50px; padding: 50px 50px 10px 50px;
} }
.status-text { .status-text {
color: white; color: white;
padding: 10px 5px;
font-size: 40px; font-size: 40px;
} }
.credits { .credits {
@ -51,17 +52,40 @@
text-decoration: none; text-decoration: none;
color: inherit; 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
}
</style> </style>
</head> </head>
<body> <body>
<div class="status-bg-on"> <div class="status-bg-on nothidden">
<div class="status-text"> <div class="status-text">
<p>The generator is <b>ON</b> :(</p> <p>The generator is <b>ON</b> :(</p>
</div> </div>
<div class="date-time-updated">
<p>last updated at: <b>date-n-time-placeholder</b></p>
</div>
</div>
<div class="status-bg-off hidden">
<div class="status-text">
<p>The generator is <b>OFF!</b> :)</p>
</div>
<div class="date-time-updated">
<p>last updated at: <b>date-n-time-placeholder</b></p>
</div>
</div> </div>
<div class="credits"> <div class="credits">
<p>Made with ❤️ | Source Code: <a href="https://git.sandcastle.eu.org/thebiblelover7/generator-status">Gitea</a> <p>Made with ❤️ | Source Code: <a href="https://git.sandcastle.eu.org/thebiblelover7/generator-status">Gitea</a>

View File

@ -14,7 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
VERSION="0.4" VERSION="0.4"
TOKEN="2021660264:AAHAMctZcI0vP7vB_uto-vfUkiUDNABbQVo" TOKEN="$(cat token)"
CHATS=(-1001541565264) CHATS=(-1001541565264)
DEBUG=false DEBUG=false
DRY_RUN=false DRY_RUN=false