Auth check

This commit is contained in:
localhost_frssoft 2022-08-14 15:52:01 +03:00
parent 300db5a278
commit 008c9d2230
2 changed files with 15 additions and 1 deletions

View file

@ -1,5 +1,8 @@
#!/bin/sh
default_auth_browser=links
default_auth_browser()
{
links $@
}
mkdir -m 711 -p .app_sessions
@ -16,6 +19,7 @@ auth_api_create_client()
--data-urlencode 'client_name=dybr2fedi bridge' \
--data-urlencode 'redirect_uris=urn:ietf:wg:oauth:2.0:oob' \
--data-urlencode 'scopes=read write follow' \
--data-urlencode 'website=https://gitea.phreedom.club/localhost_frssoft/dybr2fedi' \
--output ".app_sessions/$instance" \
--create-file-mode 0600
fi
@ -47,3 +51,5 @@ auth_api_get_token()
chmod 600 .auth
echo "$token" > .auth
}
auth_api_get_token

View file

@ -14,6 +14,14 @@ touch $log_sended_articles
#[Fedi section]
instance_point='https://expired.mentality.rip/api/v1'
if [ ! -f .auth ]; then
"$basedir"/auth_helper.sh
if [ ! -f .auth ]; then
echo 'Failed, access denied'
else
echo 'OK! Success'
fi
fi
auth=$(cat "$basedir"/.auth | tr -d '\n')
post_request()
{