First commit

This commit is contained in:
Daniil Gentili 2019-04-21 22:26:11 +00:00
commit 210dad5c10
4 changed files with 55 additions and 0 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "ypmirror"]
path = ypmirror
url = https://git.yayponies.pw/ypmirror.git

33
install.sh Normal file
View File

@ -0,0 +1,33 @@
#!/bin/bash
[ $(id -u) -ne 0 ] { echo "This script has to be run as root"; exit 1; }
service nginx stop
rm /etc/nginx/sites-enabled/default
rm /etc/nginx/conf.d/default
HTTP=" server {\n
listen 80 default_server;\n
listen [::]:80 default_server;\n
server_name $DOMAIN;\n
ssi on;\n
root $PWD/yay;\n
error_page 404 /sorry/404.php;\n
error_page 403 /sorry/403.php;\n
autoindex off;\n
location / {\n
index index.php index.html index.htm;\n
error_page 404 /sorry/404.php;\n
error_page 403 /sorry/403.php;\n
}\n
location ~ \.php$ {\n
types { text/html php; }\n
} \n
}"
echo -e $HTTP > /etc/nginx/conf.d/yp.conf
service nginx start
co script.sh /usr/bin/yayponies-update.sh
crontab -l > /tmp/yayponies-cron
echo "*/10 * * * * /usr/bin/yayponies-update.sh $PWD localhost:8808" >> /tmp/yayponies-cron
crontab /tmp/yayponies-cron
rm /tmp/yayponies-cron

18
script.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
cd $1/ypmirror
git reset --hard
git pull origin master
for f in $(find . -type f -name '*.php'); do
curl "$2/$f" -so $f
done
cd ..
hash=$(ipfs name publish /ipfs/$(ipfs add -r ypmirror/ | sed '/ ypmirror$/!d;s/added //;s/ .*//g') | sed 's/:.*//g;s/Published to //g')
echo "Create a DNS TXT record with value dnslink=/ipfs/$hash and name _dnslink.domain.name.
Then configure it using https://www.cloudflare.com/distributed-web-gateway
Enjoy!
~Daniil Gentili"

1
ypmirror Submodule

@ -0,0 +1 @@
Subproject commit 5e5e9268aeccb78673a7f7b78a584394853d32df