Missing $ on auth vars

This commit is contained in:
shockrah 2021-02-10 23:40:39 -08:00
parent 53653387ed
commit 6fcc5216a6

View File

@ -1,12 +1,12 @@
#!/bin/bash
if [ ! -z $CI_COMMIT_BRANCH ];then
echo Gitlab CI Detected!
echo export KEY=$NEOCITIES_KEY >> .env
if [ ! -z .env ];then
# no env means we have to use the neocities var
export KEY=$NEOCITIES_KEY
else
source .env
fi
source .env
url="https://neocities.org"
site=.mirror
auth="Authorization: Bearer $KEY"
@ -21,7 +21,7 @@ _upload_html() {
for f in $@;do
remote_path=${f:1}
echo curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload
curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload
curl -s -o /dev/null -w '%{http_code}' -H "$auth" -F "$remote_path=@$f" $url/api/upload
done
}
@ -33,7 +33,7 @@ _upload_media() {
for f in $@;do
remote_path=${f:1}
echo curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload
curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload
curl -s -o /dev/null -w '%{http_code}' -H "$auth" -F "$remote_path=@$f" $url/api/upload
done
}
@ -82,7 +82,7 @@ if [ -z $1 ];then
_help
else
pushd $site > /dev/null
while getopts ':Hhrf:s:m:M' opt;do
while getopts 'a::Hhrf:s:m:M' opt;do
case $opt in
H) _help;;
h) _upload_html $(find -name '*.html');; # Upload all html content