110 lines
2.5 KiB
Bash
Executable File
110 lines
2.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO:
|
|
PWD_SC="$PWD"
|
|
|
|
# Se il link รจ stato aggiornato, aggiorna il file "attuale.txt"
|
|
attuale="$(cat "$PWD_SC/attuale.txt")"
|
|
nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?')
|
|
if [ "$attuale" != "$nuovo" ]; then
|
|
attuale="$nuovo"
|
|
echo "$attuale" > $PWD_SC/attuale.txt
|
|
fi
|
|
|
|
# Formatta il link e lo stampa
|
|
formatted="https://$(cat "$PWD_SC/attuale.txt")"
|
|
echo "$formatted" #per debug
|
|
|
|
# Crea pagina "index.html"
|
|
cat <<- _EOF > $PWD_SC/index.html
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>StreamingCommunity Link Giusto</title>
|
|
<style>
|
|
body {
|
|
box-sizing: border-box;
|
|
margin: 0;
|
|
padding: 4wh;
|
|
border: 10px solid #ccc;
|
|
background-color: #121212;
|
|
color: #e4d183;
|
|
}
|
|
|
|
div {
|
|
width: 200wj;
|
|
height: 200wj;
|
|
background-color: #1e1e1e;
|
|
padding: 20px;
|
|
}
|
|
|
|
img {
|
|
max-width: 90%;
|
|
padding: 20px;
|
|
}
|
|
|
|
a {
|
|
width: 300wj;
|
|
height: 200wj;
|
|
color: #bb86fc;
|
|
}
|
|
|
|
|
|
h1 {
|
|
font-size: 36px;
|
|
/* Default size */
|
|
}
|
|
@media (max-width: 480px) {
|
|
h1 {
|
|
font-size: 17px;
|
|
/* Size mobile phones */
|
|
}
|
|
}
|
|
@media (max-width: 480px) {
|
|
h3 {
|
|
font-size: 15px;
|
|
/* Size mobile phones */
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<center>
|
|
|
|
<br><br>
|
|
|
|
<div class="link">
|
|
<h3> Link aggiornato per Streaming Community: </h3>
|
|
<h1> <a href=$formatted>$formatted </a> </h1>
|
|
<h3> (cambia circa una volta al mese) </h3>
|
|
</div>
|
|
|
|
<br><br>
|
|
|
|
<a href=$formatted target="_blank">
|
|
<img style="display:block; margin-left: auto; margin-right: auto" src="./splash.gif">
|
|
</a>
|
|
|
|
<br><br>
|
|
|
|
<div class="link">
|
|
<h3> Link aggiornato per Streaming Community: </h3>
|
|
<h1> <a href=$formatted> $formatted </a> </h1>
|
|
<h3> (cambia circa una volta al mese) </h3>
|
|
</div>
|
|
|
|
<br><br>
|
|
|
|
</center>
|
|
</body>
|
|
|
|
</html>
|
|
_EOF
|
|
|
|
# Da i permessi alla cartella
|
|
sudo chown -R www-data:www-data $PWD_SC ; sudo chmod -R 755 $PWD_SC |