basic upload script which can now rebuild all html

This commit is contained in:
shockrah 2020-07-14 12:29:13 -07:00
parent 964fdc26bf
commit 77b3c895b8

31
upload.sh Normal file
View File

@ -0,0 +1,31 @@
#!/bin/bash
source ./.env
url="https://neocities.org"
auth="Authorization: Bearer $KEY"
site=.mirror
html() {
# Total reupload of the site's html
pushd $site > /dev/null
echo `pwd`
for f in $(find -name '*.html');do
remote_path=${f:1}
curl -H "$auth" -F "$remote_path=@$f" $url/api/upload
done
popd > /dev/null
}
if [ -z $1 ];then
cat <<EOF
Options:
folder [name] - rebuilds html of that folder
page [remote path] - single page is rebuilt
html - rebuilds the html of the site
media - recopies the media desired
EOF
else
for cmd in $@;do $cmd;done
fi