diff --git a/README.md b/README.md index 5026410..4e2d655 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,8 @@ -### Genera una pagina html con il link aggiornato di streamingcommunity +# Streaming Community Redirector -Avvia lo script manualmente
-./update_link.sh
+Un plugin per nginx scritto in njs per dare un HTTP 301 a un dominio X. -o mettilo in cron
-0 0 * * * /path/to/update_link.sh
- -per generare la pagina index.html contente il link giusto
- -Se vuoi pubblicarla sul web, dai i permessi alla cartella contenente lo script
-sudo chown -R www-data:www-data /path/to/streamingcommunity_directory ; sudo chmod -R 755 /path/to/streamingcommunity_directory
\ No newline at end of file +1. Install njs +2. Copia main.js dove vuoi +3. Aggiungi main.js dentro il tuo nginx +4. Metti crontab per generare automaticamente il file con l'ultimo indirizzo di steraming community diff --git a/main.js b/main.js new file mode 100644 index 0000000..bf9e531 --- /dev/null +++ b/main.js @@ -0,0 +1,8 @@ +var fs = require('fs'); + +function redirect(r) { + + r.return(301, fs.readFileSync('/etc/nginx/streaming_community_last_url.txt', {string: 'utf-8'}).toString().trim() ); +} + +export default {redirect}; diff --git a/script_link.sh b/script_link.sh deleted file mode 100755 index bf6795b..0000000 --- a/script_link.sh +++ /dev/null @@ -1 +0,0 @@ -giusto=$(curl -L https://www.giardiniblog.it/streamingcommunity-nuovo-link/ | grep -oP '(?<=).*?(?=

)' | grep -oP 'https://streamingcommunity.*') ; echo -e "\n$giusto\n" diff --git a/splash.gif b/splash.gif deleted file mode 100644 index 2575b97..0000000 Binary files a/splash.gif and /dev/null differ diff --git a/update_link.sh b/update_link.sh index 15dfd0b..145981e 100755 --- a/update_link.sh +++ b/update_link.sh @@ -1,96 +1,5 @@ #!/bin/bash -giusto=$(curl -L https://www.giardiniblog.it/streamingcommunity-nuovo-link/ | grep -oP '(?<=).*?(?=

)' | grep -oP 'https://streamingcommunity.*') +giusto=$(curl -L https://www.giardiniblog.it/streamingcommunity-nuovo-link/ | grep -oP '(?<=).*?(?=

)' | grep -oP 'https://streamingcommunity.*') -formatted="${giusto#*://}" -formatted="${formatted%/}" - -cat <<- _EOF > index.html - - - - - - - StreamingCommunity Link Giusto - - - - -
- -

- - - -

- - - - - -

- - - -

- -
- - - -_EOF - -#setta e decommenta per dare i permessi in automatico -#sudo chown -R www-data:www-data /path/to/streamingcommunity_directory ; sudo chmod -R 755 /path/to/streamingcommunity_directory \ No newline at end of file +echo -n "${giusto}" > /etc/nginx/streaming_community_last_url.txt