blog/upload.sh

32 lines
572 B
Bash
Raw Normal View History

#!/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