Change hardcoded DEV HOST

This commit is contained in:
Bofh 2021-11-25 19:18:00 +01:00
parent a549dff9d6
commit b889e008a4
2 changed files with 9 additions and 9 deletions

View File

@ -8,8 +8,8 @@ if ($instance === false) {
} }
$app_name = conf('app_name', 'RealFan'); $app_name = conf('app_name', 'RealFan');
$site_name = conf('site_name', 'http://127.0.0.1:8080'); $site_name = conf('site_name', HOST_DEV);
$redirect_uris = conf('site_name', 'http://127.0.0.1:8080'); $redirect_uris = conf('site_name', HOST_DEV).'/signup/mastodon:oauth';
$scopes = 'read write'; $scopes = 'read write';
# create the Authorization App # create the Authorization App
@ -33,11 +33,10 @@ if ($result === null) {
'Instance failed to create an authorization App. Is it an instance?')); 'Instance failed to create an authorization App. Is it an instance?'));
} }
# create the URL for OAUTH # return authentication data
$query_string = http_build_query([ hres_json(200, OK, [
'client_id' => $result->client_id ?? null, 'instance' => $instance,
'redirect_uris' => $redirect_uris, 'result' => $result,
'response_type' => 'code', 'response_type' => 'code',
'scope' => $scopes 'scope' => $scopes
]); ]);
hres_json(200, OK, $instance.'/oauth/authorize?'.$query_string);

View File

@ -2,6 +2,7 @@
define('OK', 'ok'); define('OK', 'ok');
define('ERR', 'err'); define('ERR', 'err');
define('HOST_DEV', 'http://127.0.0.1:8080');
$env = 'prod'; $env = 'prod';
if (getenv('ENV') !== false && in_array(getenv('ENV'), ['prod', 'dev'])) if (getenv('ENV') !== false && in_array(getenv('ENV'), ['prod', 'dev']))