Commit 79f136e8 authored by Thomas's avatar Thomas
Browse files

Some fixes

parent f7bb4002
......@@ -84,13 +84,37 @@ class FediPlanController extends AbstractController
$mastodon_api->set_client($client->getClientId(), $client->getClientSecret());
$reply = $mastodon_api->loginAuthorization($code);
if( isset($reply['error']) ){
/* $access_token = $code;
$token_type = "Bearer";
$mastodon_api->set_url("https://" . $client->getHost());
$mastodon_api->set_token($access_token, $token_type);
try {
$accountReply = $mastodon_api->accounts_verify_credentials();
} catch (\ErrorException $e) {
}
if( isset($accountReply['error']) ){
$form->get('code')->addError(new FormError($translator->trans('error.instance.mastodon_account',[],'fediplan','en')));
}else{
$Account = $mastodon_api->getSingleAccount($accountReply['response']);
$Account->setInstance($host);
$Account->setToken($token_type ." ".$access_token);
$token = new UsernamePasswordToken($Account, null, 'main', array('ROLE_USER'));
$this->get('security.token_storage')->setToken($token);
$event = new InteractiveLoginEvent($request, $token);
$eventDispatcher->dispatch("security.interactive_login", $event);
return $this->redirectToRoute('schedule');
}*/
$form->get('code')->addError(new FormError($translator->trans('error.instance.mastodon_token',[],'fediplan','en')));
}else{
$access_token = $reply['response']['access_token'];
$token_type = $reply['response']['token_type'];
$mastodon_api->set_url("https://" . $client->getHost());
$mastodon_api->set_token($access_token, $token_type);
$accountReply = $mastodon_api->accounts_verify_credentials();
try {
$accountReply = $mastodon_api->accounts_verify_credentials();
} catch (\ErrorException $e) {
}
if( isset($accountReply['error']) ){
$form->get('code')->addError(new FormError($translator->trans('error.instance.mastodon_account',[],'fediplan','en')));
}else{
......
......@@ -1523,7 +1523,7 @@ class Mastodon_api {
}
$status->setEmojis($emojis);
}
$status->setSensitive($statusParams['params']['sensitive']);
$status->setSensitive($statusParams['params']['sensitive']?1:0);
$status->setSpoilerText($statusParams['params']['spoiler_text']);;
$status->setVisibility($statusParams['params']['visibility']);
if( isset($statusParams['media_attachments']) && count($statusParams['media_attachments']) > 0){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment