From df930ba91d663422599f4b19815e54b75c35d3b6 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Wed, 17 Aug 2022 08:25:17 +0300 Subject: [PATCH] Fix check auth --- auth_helper.sh | 6 +++--- dybr2fedi.sh | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/auth_helper.sh b/auth_helper.sh index c805a09..708b612 100755 --- a/auth_helper.sh +++ b/auth_helper.sh @@ -47,9 +47,9 @@ auth_api_get_token() --data-urlencode "redirect_uri=urn:ietf:wg:oauth:2.0:oob" \ --data-urlencode 'scope=read write follow' \ --data-urlencode "code=$pass" | jj access_token) - echo > .auth - chmod 600 .auth - echo "$token" > .auth + echo > "$basedir"/.auth + chmod 600 "$basedir"/.auth + echo "$token" > "$basedir"/.auth } auth_api_get_token diff --git a/dybr2fedi.sh b/dybr2fedi.sh index 96fceba..2eb903b 100755 --- a/dybr2fedi.sh +++ b/dybr2fedi.sh @@ -14,9 +14,10 @@ touch $log_sended_articles #[Fedi section] instance_point='https://expired.mentality.rip/api/v1' -if [ ! -f .auth ]; then +if [ ! -f "$basedir"/.auth ]; then + export basedir "$basedir"/auth_helper.sh - if [ ! -f .auth ]; then + if [ ! -f "$basedir"/.auth ]; then echo 'Failed, access denied' else echo 'OK! Success'