Missing $ on auth vars
This commit is contained in:
parent
53653387ed
commit
6fcc5216a6
16
upload.sh
16
upload.sh
@ -1,12 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [ ! -z $CI_COMMIT_BRANCH ];then
|
if [ ! -z .env ];then
|
||||||
echo Gitlab CI Detected!
|
# no env means we have to use the neocities var
|
||||||
echo export KEY=$NEOCITIES_KEY >> .env
|
export KEY=$NEOCITIES_KEY
|
||||||
|
else
|
||||||
|
source .env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source .env
|
|
||||||
|
|
||||||
url="https://neocities.org"
|
url="https://neocities.org"
|
||||||
site=.mirror
|
site=.mirror
|
||||||
auth="Authorization: Bearer $KEY"
|
auth="Authorization: Bearer $KEY"
|
||||||
@ -21,7 +21,7 @@ _upload_html() {
|
|||||||
for f in $@;do
|
for f in $@;do
|
||||||
remote_path=${f:1}
|
remote_path=${f:1}
|
||||||
echo curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload
|
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
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ _upload_media() {
|
|||||||
for f in $@;do
|
for f in $@;do
|
||||||
remote_path=${f:1}
|
remote_path=${f:1}
|
||||||
echo curl -s -o /dev/null -w '%{http_code}' -H "auth" -F "$remote_path=@$f" $url/api/upload
|
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
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ if [ -z $1 ];then
|
|||||||
_help
|
_help
|
||||||
else
|
else
|
||||||
pushd $site > /dev/null
|
pushd $site > /dev/null
|
||||||
while getopts ':Hhrf:s:m:M' opt;do
|
while getopts 'a::Hhrf:s:m:M' opt;do
|
||||||
case $opt in
|
case $opt in
|
||||||
H) _help;;
|
H) _help;;
|
||||||
h) _upload_html $(find -name '*.html');; # Upload all html content
|
h) _upload_html $(find -name '*.html');; # Upload all html content
|
||||||
|
Loading…
Reference in New Issue
Block a user