2018-03-11 12:07:57 +01:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html lang='en'>
|
|
|
|
<head>
|
|
|
|
<script>
|
|
|
|
if(
|
|
|
|
localStorage.getItem('current_id') |
|
|
|
|
localStorage.getItem('current_instance') |
|
|
|
|
localStorage.getItem('current_authtoken')
|
|
|
|
){
|
|
|
|
location.href = '/logout';
|
|
|
|
};
|
|
|
|
</script>
|
2018-09-03 17:04:14 +02:00
|
|
|
<script src="/assets/js/jquery/jquery.min.js"></script>
|
|
|
|
<script src="/assets/js/mastodon.js/mastodon.js"></script>
|
|
|
|
<script src="/assets/js/jquery-cookie/src/jquery.cookie.js"></script>
|
2018-03-11 12:07:57 +01:00
|
|
|
<?php
|
|
|
|
require_once('../authorize/mastodon.php');
|
|
|
|
use HalcyonSuite\HalcyonForMastodon\Mastodon;
|
|
|
|
$api = new Mastodon();
|
|
|
|
if ($_GET['code']) {
|
|
|
|
$domain = htmlspecialchars((string)filter_input(INPUT_GET, 'host'), ENT_QUOTES);
|
2019-06-20 16:50:42 +02:00
|
|
|
if(in_array($domain,json_decode(base64_decode("WyJnYWIuY29tIiwiZ2FiLmFpIl0=")))) die();
|
2018-03-11 12:07:57 +01:00
|
|
|
$URL= 'https://'.$domain;
|
|
|
|
$api->selectInstance($URL);
|
|
|
|
$response = $api->get_access_token($api->clientWebsite.'/auth?&host='.$domain, htmlspecialchars((string)filter_input(INPUT_GET, 'code'), ENT_QUOTES));
|
|
|
|
if ($response['html']["access_token"]) {
|
|
|
|
$access_token = $response['html']["access_token"];
|
2018-06-09 17:29:25 +02:00
|
|
|
$profile = $api->accounts_verify_credentials()['html'];
|
|
|
|
$account_id = $profile['id'];
|
2018-03-11 12:07:57 +01:00
|
|
|
echo "
|
|
|
|
<script>
|
|
|
|
localStorage.setItem('current_id','$account_id');
|
|
|
|
localStorage.setItem('current_instance','$domain');
|
|
|
|
localStorage.setItem('current_authtoken', '$access_token');
|
2018-12-02 15:01:21 +01:00
|
|
|
localStorage.setItem('current_search_history', '[]');
|
2018-03-19 19:42:49 +01:00
|
|
|
localStorage.setItem('setting_post_stream', 'auto');
|
2018-03-11 12:07:57 +01:00
|
|
|
localStorage.setItem('setting_post_privacy', 'public');
|
|
|
|
localStorage.setItem('setting_local_instance', 'default');
|
|
|
|
localStorage.setItem('setting_search_filter', 'all');
|
2018-04-27 15:32:45 +02:00
|
|
|
localStorage.setItem('setting_link_previews', 'true');
|
2018-05-01 18:51:00 +02:00
|
|
|
localStorage.setItem('setting_desktop_notifications', 'true');
|
2018-10-14 15:37:55 +02:00
|
|
|
localStorage.setItem('setting_service_worker', 'false');
|
2018-05-19 19:52:19 +02:00
|
|
|
localStorage.setItem('setting_who_to_follow', 'false');
|
2018-06-09 17:29:25 +02:00
|
|
|
localStorage.setItem('setting_show_replies', 'true');
|
2018-11-25 19:14:16 +01:00
|
|
|
localStorage.setItem('setting_show_bots', 'true');
|
2018-07-25 17:31:54 +02:00
|
|
|
localStorage.setItem('setting_show_content_warning', 'false');
|
|
|
|
localStorage.setItem('setting_show_nsfw', 'false');
|
2019-03-01 16:17:03 +01:00
|
|
|
localStorage.setItem('setting_full_height', 'false');
|
|
|
|
localStorage.setItem('setting_thread_view', 'true');
|
2018-11-01 18:45:46 +01:00
|
|
|
localStorage.setItem('setting_compose_autocomplete', 'true');
|
2019-01-13 19:02:16 +01:00
|
|
|
localStorage.setItem('setting_play_gif','true');
|
|
|
|
localStorage.setItem('setting_play_video','true');
|
|
|
|
localStorage.setItem('setting_play_audio','true');
|
|
|
|
localStorage.setItem('setting_play_peertube','true');
|
|
|
|
localStorage.setItem('setting_play_youplay','false');
|
|
|
|
localStorage.setItem('setting_play_invidious','false');
|
|
|
|
localStorage.setItem('setting_play_vimeo','false');
|
2018-06-09 17:29:25 +02:00
|
|
|
localStorage.setItem('setting_post_privacy','".$profile["source"]["privacy"]."');
|
|
|
|
localStorage.setItem('setting_post_sensitive','".$profile["source"]["sensitive"]."');
|
2019-02-25 18:18:21 +01:00
|
|
|
$.cookie('darktheme','unset',{path:'/',expires:3650});
|
2019-06-20 16:50:42 +02:00
|
|
|
if(sessionStorage.return && sessionStorage.return == 'share') location.href = '/intent/toot?action=send';
|
|
|
|
else location.href = '/';
|
2018-03-11 12:07:57 +01:00
|
|
|
</script>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
</body>
|
|
|
|
</html>
|