|
|
|
@ -3,12 +3,8 @@
|
|
|
|
|
|
|
|
|
|
$instance = resolve_instance($_GET['instance'] ?? '');
|
|
|
|
|
if ($instance === false) {
|
|
|
|
|
http_response_code(400);
|
|
|
|
|
die(json_encode([
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'message' => lr('error.instance_not_exists',
|
|
|
|
|
'Instance does not exist or is incorrect.')
|
|
|
|
|
]));
|
|
|
|
|
hres_json(400, ERR, lr('error.instance_not_exists',
|
|
|
|
|
'Instance does not exist or is incorrect.'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$app_name = conf('app_name', 'RealFan');
|
|
|
|
@ -33,12 +29,8 @@ curl_close($ch);
|
|
|
|
|
# result must be JSON
|
|
|
|
|
$result = @json_decode($result);
|
|
|
|
|
if ($result === null) {
|
|
|
|
|
http_response_code(500);
|
|
|
|
|
die(json_encode([
|
|
|
|
|
'status' => 'error',
|
|
|
|
|
'message' => lr('error.instance_failed_or_not_mastodon',
|
|
|
|
|
'Instance failed to create an authorization App. Is it an instance?')
|
|
|
|
|
]));
|
|
|
|
|
hres_json(500, ERR, lr('error.instance_failed_or_not_mastodon',
|
|
|
|
|
'Instance failed to create an authorization App. Is it an instance?'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# create the URL for OAUTH
|
|
|
|
@ -48,7 +40,4 @@ $query_string = http_build_query([
|
|
|
|
|
'response_type' => 'code',
|
|
|
|
|
'scope' => $scopes
|
|
|
|
|
]);
|
|
|
|
|
echo json_encode([
|
|
|
|
|
'status' => 'ok',
|
|
|
|
|
'message' => $instance.'/oauth/autorize?'.$query_string
|
|
|
|
|
]);
|
|
|
|
|
hres_json(200, OK, $instance.'/oauth/authorize?'.$query_string);
|
|
|
|
|