fix link multipli

This commit is contained in:
2025-03-09 19:28:29 +01:00
parent b911d0fcab
commit 7f1f4fd518
7 changed files with 3 additions and 293 deletions

View File

@@ -1 +1 @@
streamingcommunity.paris
streamingcommunity.hiphop

View File

@@ -1,44 +0,0 @@
#### 1. Genera una pagina html con il link aggiornato di streamingcommunity
Le istruzioni di installazione/settaggio sono uguali sia per [make_index.sh](./make_index.sh) che per [make_index_without_stats.sh](./make_index_without_stats.sh), entrambi richiedono [attuale.txt](attuale.txt): <br>
- [make_index.sh](./make_index.sh): Genera la index scaricando le stats ([make_stats.sh](make_stats.sh)), quindi ne mostra i link sulla index come in [questo link](http://streamingcommunity.accol.li)<br>
- [make_index_without_stats.sh](./make_index_without_stats.sh): Genera la index senza scaricare e mostrare le stats
```bash
# (richiede "attuale.txt")
# Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provare in locale
nano make_index.sh
# Avvia lo script manualmente
./make_index.sh
# oppure mettilo in cron
0 0 * * * /path/to/make_index.sh
```
Se vuoi pubblicarla sul web: aggiusta la variabile <code>PWD_SC</code> in testa allo script [make_index.sh](./make_index.sh), decommenta i comandi in fondo allo stesso script e metti la tua cartella (quella che hai messo in <code>PWD_SC</code>) dietro a un reverse proxy
<br>
#### 2. Crea un feed rss con il link:
```bash
# (richiede "attuale.txt")
# Setta la variabile "PWD_SC" in testa allo script o lasciala con "PWD" per provare in locale
nano rss_generator.sh
# Avvia lo manualmente
./rss_generator.sh
# oppure mettilo in cron
0 0 * * * /path/to/rss_generator.sh
```
<br>
#### 3. Se vuoi semplicemente sapere qual'è il link giusto aggiornato:
```bash
# (richiede "attuale.txt")
# esgui lo script:
./show_link.sh
```

View File

@@ -1,129 +0,0 @@
#!/bin/bash
# SETTARE QUESTA VARIABILE CON IL PERCORSO GIUSTO:
# Es: PWD_SC="/var/www/html/streamingcommunity"
PWD_SC="$PWD"
# Segue link per vedere se è stato aggiornato...
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+)?')
# Se il nuovo link è diverso dal nuovo, allora...
if [ "$attuale" != "$nuovo" ]; then
# se è vuoto lascia il vecchio
if [ -z "$nuovo" ]; then
echo "STANNO FACENDO CASINI O LINK CORROTTO. LASCIATO IL VECCHIO LINK"
else
# Se non è vuoto lo aggiorna con il nuovo link il file attuale.txt
attuale="$nuovo"
echo "$attuale" > $PWD_SC/attuale.txt
fi
else
# se il link giusto è ancora il vecchio lascia il vecchio
echo "Il link giusto è ancora il vecchio"
fi
# Formatta il link e lo stampa
formatted="https://$(cat "$PWD_SC/attuale.txt")"
echo "$formatted"
# 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: #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 {
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><br>
<h5> stats di $attuale (non di mywebsite.com): <a href=./stats1.html>stats1</a> e <a href=./stats2.html>stats2 </a> </h5>
</div>
<br><br>
</center>
</body>
</html>
_EOF
# Genera le stats scrapate da streaming community sui client più altre cose da capire
./make_stats.sh
# Da i permessi alla cartella (decommentare se hostato)
#chown -R root:root $PWD_SC; echo "la cartella $PWD_SC è di root"
#chmod +x $PWD_SC ; echo "permetto di leggere dentro a $PWD_SC"
#chmod 740 $PWD_SC/*; echo "reset permessi per tutti i file dentro a $PWD_SC"
#chown -R www-data:www-data $PWD_SC/*.html; chmod -R 744 $PWD_SC/*.html; echo "do i permessi agli html dentro a $PWD_SC"
#chown -R www-data:www-data $PWD_SC/*.json; chmod -R 744 $PWD_SC/*.json; echo "do i permessi ai json dentro a $PWD_SC"
#chown -R www-data:www-data $PWD_SC/*.xml; chmod -R 744 $PWD_SC/*.xml; echo "do i permessi agli xml dentro a $PWD_SC"
#chown root:root ./*.sh; chmod 740 ./*.sh; echo "do i permesi agli sh dentro $PWD_SC"
#chown www-data:www-data ./splash.gif; chmod 744 ./splash.gif; echo "do i permesi alla gif splash"

View File

@@ -1,30 +0,0 @@
#!/bin/bash
# Scarica pagine "test" da ip pre CF
curl --no-progress-meter -L http://52.203.236.205:8080/ -o stats1.html
curl --no-progress-meter -L http://52.203.236.205:8081/ -o stats2.html
curl --no-progress-meter -L http://52.203.236.205:8080/download/userViewer.json -o userViewer.json
curl --no-progress-meter -L http://52.203.236.205:8080/download/userVieweOperation.json -o userVieweOperation.json
# Aggiusta link
sed -i 's|/download/userViewer.json|./userViewer.json|g' stats1.html
sed -i 's|/download/userViewer.json|./userViewer.json|g' stats2.html
sed -i 's|/download/userVieweOperation.json|./userVieweOperation.json|g' stats1.html
sed -i 's|/download/userVieweOperation.json|./userVieweOperation.json|g' stats2.html
# Paranoid Hardenoid
sed -i 's/\.js/[.]js/g' stats1.html
sed -i 's/\.js/[.]js/g' stats2.html
sed -i 's/\.php/[.]php/g' stats1.html
sed -i 's/\.php/[.]php/g' stats2.html
sed -i 's/\.py/[.]py/g' stats1.html
sed -i 's/\.py/[.]py/g' stats2.html
sed -i 's/\.js/[.]js/g' userVieweOperation.json
sed -i 's/\.js/[.]js/g' userViewer.json
sed -i 's/\.php/[.]php/g' userVieweOperation.json
sed -i 's/\.php/[.]php/g' userViewer.json
sed -i 's/\.py/[.]py/g' userVieweOperation.json
sed -i 's/\.py/[.]py/g' userViewer.json
sed -i 's/\[\.]json/.json/g' stats1.html
sed -i 's/\[\.]json/.json/g' stats2.html

View File

@@ -1,87 +0,0 @@
<!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=https://streamingcommunity.paris>https://streamingcommunity.paris </a> </h1>
<h3> (cambia circa una volta al mese) </h3>
</div>
<br><br>
<a href=https://streamingcommunity.paris 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=https://streamingcommunity.paris> https://streamingcommunity.paris </a> </h1>
<h3> (cambia circa una volta al mese) </h3>
</div>
<br><br>
</center>
</body>
</html>

View File

@@ -7,7 +7,7 @@ PWD_SC="$PWD"
# Segue link per vedere se è stato aggiornato...
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+)?')
nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?' | head -n1)
# Se il nuovo link è diverso dal nuovo, allora...
if [ "$attuale" != "$nuovo" ]; then

View File

@@ -5,7 +5,7 @@ PWD_SC="$PWD"
# Segue link per vedere se è stato aggiornato...
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+)?')
nuovo=$(curl --no-progress-meter -L $attuale | sed -n 's/.*\(https:\/\/cdn\.streamingcommunity\.[^ ]*images[^ ]*\).*/\1/p' | grep -oP 'streamingcommunity\.\w+(\.\w+)?' | head -n1)
# Se il nuovo link è diverso dal nuovo, allora...
if [ "$attuale" != "$nuovo" ]; then