Files
StreamingCommunity/update_link.sh

105 lines
2.2 KiB
Bash
Raw Normal View History

2024-08-30 10:36:22 +02:00
#!/bin/bash
2025-01-11 16:01:17 +01:00
attuale=$(<attuale.txt)
2024-08-30 10:36:22 +02:00
2025-01-11 16:01:17 +01:00
nuovo=$(curl -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?')
if [ "$attuale" != "$nuovo" ]; then
attuale="$nuovo"
echo "$attuale" > attuale.txt
fi
formatted="https.//$(<attuale.txt)"
2024-08-30 10:36:22 +02:00
2024-11-03 00:02:09 +01:00
cat <<- _EOF > /var/www/html/scommunity/index.html
2024-08-30 10:36:22 +02:00
<!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: #f4f4f4;
}
div {
width: 200wj;
height: 200wj;
background-color: #fbfbfb;
padding: 20px;
}
img {
max-width: 90%;
padding: 20px;
}
a {
width: 300wj;
height: 200wj;
}
h1 {
font-size: 36px;
/* Default size */
}
@media (max-width: 480px) {
h1 {
2024-08-30 14:19:39 +02:00
font-size: 17px;
2024-08-30 10:36:22 +02:00
/* 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>
2024-11-03 00:08:20 +01:00
<h1><a href=$formatted>$formatted</a></h1>
2024-08-30 10:36:22 +02:00
<h3>(cambia circa una volta al mese)</h3>
</div>
<br><br>
2024-11-03 00:08:20 +01:00
<a href=$formatted target="_blank">
2024-08-30 10:36:22 +02:00
<img style="display:block; margin-left: auto; margin-right: auto" src="./splash.gif">
2024-11-03 00:02:09 +01:00
</a>
2024-08-30 10:36:22 +02:00
<br><br>
<div class="link">
<h3>Link aggiornato per Streaming Community:</h3>
2024-11-03 00:08:20 +01:00
<h1><a href=$formatted>$formatted</a></h1>
2024-08-30 10:36:22 +02:00
<h3>(cambia circa una volta al mese)</h3>
</div>
2024-11-03 00:02:09 +01:00
<br><br>
2024-08-30 10:36:22 +02:00
</center>
</body>
</html>
_EOF
2024-11-03 00:02:09 +01:00
sudo chown -R www-data:www-data /var/www/html/scommunity ; sudo chmod -R 755 /var/www/html/scommunity
2024-11-03 00:08:20 +01:00