diff --git a/auth_helper.sh b/auth_helper.sh index e8e0afd..c805a09 100755 --- a/auth_helper.sh +++ b/auth_helper.sh @@ -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 diff --git a/dybr2fedi.sh b/dybr2fedi.sh index 833e835..96fceba 100755 --- a/dybr2fedi.sh +++ b/dybr2fedi.sh @@ -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() {