From d05046ff1f711cfd911b044238aa2e383dffa222 Mon Sep 17 00:00:00 2001 From: flashwave Date: Thu, 9 Mar 2023 21:38:03 +0000 Subject: [PATCH] Removed Twitter integrations. --- docs/contact.md | 2 - misuzu.php | 1 - public/manage/general/twitter.php | 60 -------- public/manage/news/post.php | 7 +- src/Console/Commands/CronCommand.php | 15 -- src/MisuzuContext.php | 7 - src/Twitter/TwitterAccessToken.php | 91 ------------- src/Twitter/TwitterAuthorisation.php | 115 ---------------- src/Twitter/TwitterClient.php | 188 -------------------------- src/Twitter/TwitterClientId.php | 35 ----- src/Twitter/TwitterRoutes.php | 53 -------- src/manage.php | 7 - src/perms.php | 2 +- src/url.php | 3 - templates/_layout/meta.twig | 9 -- templates/manage/general/twitter.twig | 40 ------ templates/master.twig | 5 - 17 files changed, 2 insertions(+), 638 deletions(-) delete mode 100644 public/manage/general/twitter.php delete mode 100644 src/Twitter/TwitterAccessToken.php delete mode 100644 src/Twitter/TwitterAuthorisation.php delete mode 100644 src/Twitter/TwitterClient.php delete mode 100644 src/Twitter/TwitterClientId.php delete mode 100644 src/Twitter/TwitterRoutes.php delete mode 100644 templates/manage/general/twitter.twig diff --git a/docs/contact.md b/docs/contact.md index 41dbc42..e1f41e7 100644 --- a/docs/contact.md +++ b/docs/contact.md @@ -6,9 +6,7 @@ If you need to reach us outside of this website, this is the page for you. Below - [flash](mailto:flashii@flash.moe): Site Administrator ## Twitter - - [@flashiinet](https://twitter.com/flashiinet): General updates and conversation. - [@flashiistatus](https://twitter.com/flashiistatus): Exclusively system status updates, posts by this accounts are generally retweeted by @flashiinet. - - [@flashwahaha](https://twitter.com/flashwahaha): Twitter of the owner. This is a personal space, proceed with caution! ## Source Code - [Misuzu](https://git.flash.moe/flashii/misuzu): Backend of the main website. diff --git a/misuzu.php b/misuzu.php index 54f240e..3d53979 100644 --- a/misuzu.php +++ b/misuzu.php @@ -152,7 +152,6 @@ Template::set('globals', [ 'site_name' => $cfg->getValue('site.name', IConfig::T_STR, 'Misuzu'), 'site_description' => $cfg->getValue('site.desc', IConfig::T_STR), 'site_url' => $cfg->getValue('site.url', IConfig::T_STR), - 'site_twitter' => $cfg->getValue('social.twitter', IConfig::T_STR), 'site_chat' => $cfg->getValue('sockChat.chatPath.normal', IConfig::T_STR), 'eeprom' => [ 'path' => $cfg->getValue('eeprom.path', IConfig::T_STR), diff --git a/public/manage/general/twitter.php b/public/manage/general/twitter.php deleted file mode 100644 index 2637af5..0000000 --- a/public/manage/general/twitter.php +++ /dev/null @@ -1,60 +0,0 @@ -getId(), MSZ_PERM_GENERAL_MANAGE_TWITTER)) { - echo render_error(403); - return; -} - -$tCfg = $cfg->scopeTo('twitter'); - -$tClient = $msz->createTwitterClient(); -$tHasClientId = $tClient->hasClientId(); -$tHasAccessToken = $tClient->hasAccessToken(); -$tHasRefreshToken = $tClient->hasRefreshToken(); -$tExpires = $tClient->getAccessToken()->getExpiresTime(); - -if(isset($_GET['m'])) { - if(CSRF::validateRequest()) { - $mode = (string)filter_input(INPUT_GET, 'm'); - - if($mode === 'authorise' && $tHasClientId && !$tHasAccessToken) { - $tAuthorise = $tClient->authorise(TwitterClient::SYSTEM_SCOPES, url_prefix(false) . url('twitter-callback')); - setcookie('msz_twitter', $tAuthorise->getVerifier(), strtotime('+5 minutes'), '/', msz_cookie_domain(), !empty($_SERVER['HTTPS']), true); - header('Location: ' . $tAuthorise->getUri()); - return; - } - - if($mode === 'refresh' && $tHasClientId && $tHasAccessToken && $tHasRefreshToken) { - $tRefresh = TwitterAccessToken::fromTwitterResponse($tClient->authRefresh()); - TwitterAccessToken::save($tCfg->scopeTo('access'), $tRefresh); - header('Location: ' . url('manage-general-twitter')); - return; - } - - if($mode === 'revoke' && $tHasClientId && $tHasAccessToken) { - $tRevoke = $tClient->authRevoke(); - if(!empty($tRevoke->revoked)) - TwitterAccessToken::nuke($tCfg->scopeTo('access')); - - header('Location: ' . url('manage-general-twitter')); - return; - } - } - - header('Location: ' . url('manage-general-twitter')); - return; -} - -Template::render('manage.general.twitter', [ - 'twitter_has_oauth2' => $tHasClientId, - 'twitter_has_access' => $tHasAccessToken, - 'twitter_has_refresh' => $tHasRefreshToken, - 'twitter_expires' => $tExpires, -]); diff --git a/public/manage/news/post.php b/public/manage/news/post.php index 106ff03..0d6efad 100644 --- a/public/manage/news/post.php +++ b/public/manage/news/post.php @@ -53,12 +53,7 @@ if(!empty($_POST['post']) && CSRF::validateRequest()) { if(!empty($isNew)) { if($postInfo->isFeatured()) { - $twitter = $msz->createTwitterClient(); - - if($twitter->hasAccessToken()) { - $url = url('news-post', ['post' => $postInfo->getId()]); - $twitter->sendTweet("News :: {$postInfo->getTitle()}\nhttps://{$_SERVER['HTTP_HOST']}{$url}"); - } + // Twitter integration used to be here, replace with Railgun Pulse integration } header('Location: ' . url('manage-news-post', ['post' => $postInfo->getId()])); diff --git a/src/Console/Commands/CronCommand.php b/src/Console/Commands/CronCommand.php index 83aff6d..bfff4f2 100644 --- a/src/Console/Commands/CronCommand.php +++ b/src/Console/Commands/CronCommand.php @@ -5,7 +5,6 @@ use Misuzu\DB; use Misuzu\MisuzuContext; use Misuzu\Console\CommandArgs; use Misuzu\Console\CommandInterface; -use Misuzu\Twitter\TwitterAccessToken; class CronCommand implements CommandInterface { private MisuzuContext $context; @@ -45,14 +44,6 @@ class CronCommand implements CommandInterface { forum_count_synchronise(); } - private function refreshTwitterToken(): void { - $tClient = $this->context->createTwitterClient(); - if($tClient->hasAccessToken() && $tClient->hasRefreshToken()) { - $tRefresh = TwitterAccessToken::fromTwitterResponse($tClient->authRefresh()); - TwitterAccessToken::save($this->context->getConfig()->scopeTo('twitter.access'), $tRefresh); - } - } - private const TASKS = [ [ 'name' => 'Ensures main role exists.', @@ -171,11 +162,5 @@ class CronCommand implements CommandInterface { WHERE `tfa_created` < NOW() - INTERVAL 15 MINUTE ", ], - [ - 'name' => 'Refresh Twitter authentication token.', - 'type' => 'func', - 'slow' => true, - 'command' => 'refreshTwitterToken', - ], ]; } diff --git a/src/MisuzuContext.php b/src/MisuzuContext.php index 4441e3e..42a25a4 100644 --- a/src/MisuzuContext.php +++ b/src/MisuzuContext.php @@ -6,8 +6,6 @@ use Misuzu\Config\IConfig; use Misuzu\GeoIP\GeoIPHelper; use Misuzu\SharpChat\SharpChatRoutes; use Misuzu\Users\Users; -use Misuzu\Twitter\TwitterClient; -use Misuzu\Twitter\TwitterRoutes; use Index\Data\IDbConnection; use Index\Data\Migration\IDbMigrationRepo; use Index\Data\Migration\DbMigrationManager; @@ -63,10 +61,6 @@ class MisuzuContext { return $this->geoIP; } - public function createTwitterClient(): TwitterClient { - return TwitterClient::create($this->config->scopeTo('twitter')); - } - public function setUpHttp(bool $legacy = false): void { $this->router = new HttpFx; $this->router->use('/', function($response) { @@ -136,7 +130,6 @@ class MisuzuContext { $this->router->post('/forum/mark-as-read', msz_compat_handler('Forum', 'markAsReadPOST')); new SharpChatRoutes($this->router, $this->config->scopeTo('sockChat')); - new TwitterRoutes($this, $this->router, $this->config->scopeTo('twitter')); } private function registerLegacyRedirects(): void { diff --git a/src/Twitter/TwitterAccessToken.php b/src/Twitter/TwitterAccessToken.php deleted file mode 100644 index 919c159..0000000 --- a/src/Twitter/TwitterAccessToken.php +++ /dev/null @@ -1,91 +0,0 @@ -type; - } - - public function getAccessToken(): string { - return $this->accessToken; - } - - public function hasAccessToken(): bool { - return $this->type !== '' && $this->accessToken !== ''; - } - - public function getExpiresTime(): int { - return $this->expires; - } - - public function hasExpires(): bool { - return time() > $this->expires; - } - - public function getScope(): array { - return $this->scope; - } - - public function getRefreshToken(): string { - return $this->refreshToken; - } - - public function hasRefreshToken(): bool { - return $this->refreshToken !== ''; - } - - public function __toString(): string { - return 'Bearer ' . $this->accessToken; - } - - public static function empty(): self { - return new static('', '', 0, [], ''); - } - - public static function fromTwitterResponse(object $obj): self { - return new static( - $obj->token_type ?? '', - $obj->access_token ?? '', - time() + ($obj->expires_in ?? 0), - explode(' ', ($obj->scope ?? '')), - $obj->refresh_token ?? '' - ); - } - - public static function load(IConfig $config): self { - return new static( - $config->getValue('type', IConfig::T_STR), - $config->getValue('token', IConfig::T_STR), - $config->getValue('expires', IConfig::T_INT), - $config->getValue('token', IConfig::T_ARR), - $config->getValue('refresh', IConfig::T_STR) - ); - } - - public static function save(IConfig $config, self $tokenInfo): void { - $config->setValue('type', $tokenInfo->getType()); - $config->setValue('token', $tokenInfo->getAccessToken()); - $config->setValue('expires', $tokenInfo->getExpiresTime()); - $config->setValue('scope', $tokenInfo->getScope()); - $config->setValue('refresh', $tokenInfo->getRefreshToken()); - } - - public static function nuke(IConfig $config): void { - $config->removeValue('type'); - $config->removeValue('token'); - $config->removeValue('expires'); - $config->removeValue('scope'); - $config->removeValue('refresh'); - } -} diff --git a/src/Twitter/TwitterAuthorisation.php b/src/Twitter/TwitterAuthorisation.php deleted file mode 100644 index 4c1487f..0000000 --- a/src/Twitter/TwitterAuthorisation.php +++ /dev/null @@ -1,115 +0,0 @@ -clientId = $clientId; - $this->scope = $scope; - $this->redirect = $redirect; - - $this->state = self::generateState($clientId); - [$this->verifier, $this->verifierHash] = self::generateVerifier(); - } - - public function getClientId(): TwitterClientId { - return $this->clientId; - } - - public function getScope(): array { - return $this->scope; - } - - public function getRedirectUri(): string { - return $this->redirect; - } - - public function getState(): string { - return $this->state; - } - - public function getVerifier(): string { - return $this->verifier; - } - - public function getVerifierHash(): string { - return $this->verifierHash; - } - - public function getUri(): string { - return self::AUTHORIZE . '?' . http_build_query([ - 'response_type' => 'code', - 'client_id' => $this->clientId->getClientId(), - 'redirect_uri' => $this->redirect, - 'scope' => implode(' ', $this->scope), - 'state' => $this->state, - 'code_challenge' => $this->verifierHash, - 'code_challenge_method' => 'S256', - ], '', null, PHP_QUERY_RFC3986); - } - - public static function generateVerifier(): array { - $verifier = XString::random(self::VERIFIER_LENGTH); - return [ - $verifier, - Serialiser::uriBase64()->serialise(hash('sha256', $verifier, true)), - ]; - } - - private static function currentStateTime(): int { - return time() - self::STATE_EPOCH; - } - - public static function generateState(TwitterClientId $clientId): string { - $rng = XString::random(self::STATE_RNG_LENGTH); - $time = self::currentStateTime(); - - $string = $rng . ':' . (string)$time; - $hash = hash_hmac('sha256', $string, $clientId->getClientSecret(), true); - - $time = Serialiser::base62()->serialise($time); - $hash = Serialiser::uriBase64()->serialise($hash); - - return $rng . '.' . $time . '.' . $hash; - } - - public static function verifyState(TwitterClientId $clientId, string $state): bool { - $parts = explode('.', $state, 4); - if(count($parts) !== 3) - return false; - - $rng = $parts[0]; - if(strlen($rng) !== self::STATE_RNG_LENGTH) - return false; - - $currentTime = self::currentStateTime(); - $time = Serialiser::base62()->deserialise($parts[1]); - if($currentTime < $time || $currentTime >= ($time + self::STATE_TOLERANCE)) - return false; - - $hash = Serialiser::uriBase64()->deserialise($parts[2]); - if(strlen($hash) !== 32) - return false; - - $string = $rng . ':' . (string)$time; - $realHash = hash_hmac('sha256', $string, $clientId->getClientSecret(), true); - - return hash_equals($realHash, $hash); - } -} diff --git a/src/Twitter/TwitterClient.php b/src/Twitter/TwitterClient.php deleted file mode 100644 index 7a3d9ca..0000000 --- a/src/Twitter/TwitterClient.php +++ /dev/null @@ -1,188 +0,0 @@ -clientId; - } - public function hasClientId(): bool { - return $this->clientId->hasClientId(); - } - - public function getAccessToken(): TwitterAccessToken { - return $this->accessToken; - } - public function hasAccessToken(): bool { - return $this->accessToken->hasAccessToken(); - } - public function hasRefreshToken(): bool { - return $this->accessToken->hasRefreshToken(); - } - - public function authorise(array $scope, string $redirect): TwitterAuthorisation { - return new TwitterAuthorisation($this->clientId, $scope, $redirect); - } - - public function token(string $code, string $verifier, string $redirect): object { - if(!$this->clientId->hasClientId()) - throw new RuntimeException('Need OAuth2 info in order to manage tokens.'); - - $req = json_decode(self::request('POST', self::API_OAUTH2_TOKEN, [ - 'Authorization: ' . (string)$this->clientId, - ], [], [ - 'code' => $code, - 'grant_type' => 'authorization_code', - 'code_verifier' => $verifier, - 'redirect_uri' => $redirect, // needed because???????? - ], false)); - - if($req === false) - return new RuntimeException('Unable to parse token response.'); - - return $req; - } - - public function authRefresh(): object { - if(!$this->clientId->hasClientId()) - throw new RuntimeException('Need OAuth2 info in order to manage tokens.'); - if(!$this->accessToken->hasRefreshToken()) - throw new RuntimeException('There is no refresh token.'); - - $req = json_decode(self::request('POST', self::API_OAUTH2_TOKEN, [ - 'Authorization: ' . (string)$this->clientId, - ], [], [ - 'refresh_token' => $this->accessToken->getRefreshToken(), - 'grant_type' => 'refresh_token', - ], false)); - - if($req === false) - return new RuntimeException('Unable to parse token response.'); - - return $req; - } - - public function authRevoke(): object { - if(!$this->clientId->hasClientId()) - throw new RuntimeException('Need OAuth2 info in order to manage tokens.'); - if(!$this->accessToken->hasAccessToken()) - throw new RuntimeException('Cannot revoke an access token we do not have.'); - - $req = json_decode(self::request('POST', self::API_OAUTH2_REVOKE, [ - 'Authorization: ' . (string)$this->clientId, - ], [], [ - 'token' => $this->accessToken->getAccessToken(), - 'token_type_hint' => 'access_token', - ], false)); - - if($req === false) - return new RuntimeException('Unable to parse token response.'); - - return $req; - } - - public function sendTweet(string $text): object { - if(!$this->accessToken->hasAccessToken()) - throw new RuntimeException('Need access token in order to post Tweets.'); - - $req = json_decode(self::request('POST', self::API_TWEETS, [ - 'Authorization: ' . (string)$this->accessToken, - ], [], [ - 'text' => $text, - ])); - - if($req === false) - return new RuntimeException('Unable to parse Tweet response.'); - - return $req; - } - - public function request( - string $method, - string $uri, - array $headers = [], - array $queryFields = [], - mixed $bodyFields = [], - bool $bodyAsJson = true, - ): string|bool { - if(!empty($queryFields)) - $uri .= '?' . http_build_query($queryFields, '', null, PHP_QUERY_RFC3986); - - $curl = curl_init($uri); - curl_setopt_array($curl, [ - CURLOPT_AUTOREFERER => true, - CURLOPT_FAILONERROR => false, - CURLOPT_FOLLOWLOCATION => true, - CURLOPT_TCP_NODELAY => true, - CURLOPT_HEADER => false, - CURLOPT_NOBODY => false, - CURLOPT_RETURNTRANSFER => true, - CURLOPT_TCP_FASTOPEN => true, - CURLOPT_MAXREDIRS => 3, - CURLOPT_PROTOCOLS => CURLPROTO_HTTPS, - CURLOPT_REDIR_PROTOCOLS => CURLPROTO_HTTPS, - CURLOPT_TIMEOUT => 2, - CURLOPT_USERAGENT => 'Misuzu TwitterClient/20230105', - ]); - - if($method === 'GET') - curl_setopt($curl, CURLOPT_HTTPGET, true); - elseif($method === 'HEAD') { - curl_setopt($curl, CURLOPT_HEADER, true); - curl_setopt($curl, CURLOPT_NOBODY, true); - } elseif($method === 'POST') - curl_setopt($curl, CURLOPT_POST, true); - else - curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); - - if(!empty($bodyFields)) { - if($bodyAsJson) { - $headers[] = 'Content-Type: application/json'; - $bodyFields = json_encode($bodyFields); - } elseif(is_array($bodyFields)) { - $headers[] = 'Content-Type: application/x-www-form-urlencoded'; - $bodyFields = http_build_query($bodyFields, '', null, PHP_QUERY_RFC3986); - } - - curl_setopt($curl, CURLOPT_POSTFIELDS, $bodyFields); - } - - if(!empty($headers)) - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - - $out = curl_exec($curl); - curl_close($curl); - - return $out; - } - - public static function create(IConfig $config): self { - return new static( - TwitterClientId::load($config->scopeTo('oauth2')), - TwitterAccessToken::load($config->scopeTo('access')) - ); - } -} diff --git a/src/Twitter/TwitterClientId.php b/src/Twitter/TwitterClientId.php deleted file mode 100644 index ca92344..0000000 --- a/src/Twitter/TwitterClientId.php +++ /dev/null @@ -1,35 +0,0 @@ -clientId !== '' && $this->clientSecret !== ''; - } - - public function getClientId(): string { - return $this->clientId; - } - - public function getClientSecret(): string { - return $this->clientSecret; - } - - public function __toString(): string { - return 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret); - } - - public static function load(IConfig $config): self { - return new static( - $config->getValue('clientId', IConfig::T_STR), - $config->getValue('clientSecret', IConfig::T_STR) - ); - } -} diff --git a/src/Twitter/TwitterRoutes.php b/src/Twitter/TwitterRoutes.php deleted file mode 100644 index ff8acd1..0000000 --- a/src/Twitter/TwitterRoutes.php +++ /dev/null @@ -1,53 +0,0 @@ -context = $ctx; - $this->config = $config; - - $router->get('/_twitter/callback', [$this, 'callback']); - } - - private function getClientId(): TwitterClientId { - if($this->clientId === null) - $this->clientId = TwitterClientId::load($this->config->scopeTo('oauth2')); - return $this->clientId; - } - - public function callback($response, $request) { - $qState = (string)$request->getParam('state'); - $qCode = (string)$request->getParam('code'); - $cVerifier = (string)$request->getCookie('msz_twitter'); - - if(empty($qState) || empty($qCode) || empty($cVerifier)) - return 400; - - $response->removeCookie('msz_twitter', '/', msz_cookie_domain(), !empty($_SERVER['HTTPS']), true); - - $clientId = $this->getClientId(); - if(!TwitterAuthorisation::verifyState($clientId, $qState)) - return 403; - - $accessToken = TwitterAccessToken::empty(); - $client = new TwitterClient($clientId, $accessToken); - - $redirect = url_prefix(false) . url('twitter-callback'); - $tokenInfo = TwitterAccessToken::fromTwitterResponse($client->token($qCode, $cVerifier, $redirect)); - TwitterAccessToken::save($this->config->scopeTo('access'), $tokenInfo); - - $response->redirect(url('manage-general-twitter')); - } -} diff --git a/src/manage.php b/src/manage.php index a0f9dad..6a19ac6 100644 --- a/src/manage.php +++ b/src/manage.php @@ -15,8 +15,6 @@ function manage_get_menu(int $userId): array { $menu['General']['Emoticons'] = url('manage-general-emoticons'); if(perms_check_user(MSZ_PERMS_GENERAL, $userId, MSZ_PERM_GENERAL_MANAGE_CONFIG)) $menu['General']['Settings'] = url('manage-general-settings'); - if(perms_check_user(MSZ_PERMS_GENERAL, $userId, MSZ_PERM_GENERAL_MANAGE_TWITTER)) - $menu['General']['Twitter Connection'] = url('manage-general-twitter'); if(perms_check_user(MSZ_PERMS_USER, $userId, MSZ_PERM_USER_MANAGE_USERS)) $menu['Users & Roles']['Users'] = url('manage-users'); @@ -135,11 +133,6 @@ function manage_perms_list(array $rawPerms): array { 'title' => 'Can manage general Misuzu settings.', 'perm' => MSZ_PERM_GENERAL_MANAGE_CONFIG, ], - [ - 'section' => 'manage-twitter', - 'title' => 'Can manage Twitter connection.', - 'perm' => MSZ_PERM_GENERAL_MANAGE_TWITTER, - ], ], ], [ diff --git a/src/perms.php b/src/perms.php index 76c3f8a..1c9c1dc 100644 --- a/src/perms.php +++ b/src/perms.php @@ -6,7 +6,7 @@ define('MSZ_PERM_GENERAL_MANAGE_EMOTES', 0x00000004); define('MSZ_PERM_GENERAL_MANAGE_CONFIG', 0x00000008); //define('MSZ_PERM_GENERAL_IS_TESTER', 0x00000010); Has been unused for a while //define('MSZ_PERM_GENERAL_MANAGE_BLACKLIST', 0x00000020); Blacklist has been removed for now to reduce overhead and because it was broken(?) -define('MSZ_PERM_GENERAL_MANAGE_TWITTER', 0x00000040); +//define('MSZ_PERM_GENERAL_MANAGE_TWITTER', 0x00000040); Twitter integration has been removed define('MSZ_PERMS_USER', 'user'); define('MSZ_PERM_USER_EDIT_PROFILE', 0x00000001); diff --git a/src/url.php b/src/url.php index 0adf4c0..dc00a4f 100644 --- a/src/url.php +++ b/src/url.php @@ -85,13 +85,10 @@ define('MSZ_URLS', [ 'comment-pin' => ['/comments.php', ['c' => '', 'csrf' => '{csrf}', 'm' => 'pin']], 'comment-unpin' => ['/comments.php', ['c' => '', 'csrf' => '{csrf}', 'm' => 'unpin']], - 'twitter-callback' => ['/_twitter/callback'], - 'manage-index' => ['/manage'], 'manage-general-overview' => ['/manage/general'], 'manage-general-logs' => ['/manage/general/logs.php'], - 'manage-general-twitter' => ['/manage/general/twitter.php'], 'manage-general-emoticons' => ['/manage/general/emoticons.php'], 'manage-general-emoticon' => ['/manage/general/emoticon.php', ['e' => '']], diff --git a/templates/_layout/meta.twig b/templates/_layout/meta.twig index 739e917..b4fb0d2 100644 --- a/templates/_layout/meta.twig +++ b/templates/_layout/meta.twig @@ -1,6 +1,5 @@ {% apply spaceless %} {% set description = description|default(globals.site_description) %} - {% set site_twitter = site_twitter|default(globals.site_twitter) %} {% if title is defined %} {% set browser_title = title ~ ' :: ' ~ globals.site_name %} @@ -10,22 +9,15 @@ {{ browser_title }} - {% if description|length > 0 %} - {% endif %} - {% if site_twitter|length > 0 %} - - {% endif %} - - {% if image is defined %} {% if image|slice(0, 1) == '/' %} @@ -37,7 +29,6 @@ {% endif %} {% if image|length > 0 %} - {% endif %} {% endif %} diff --git a/templates/manage/general/twitter.twig b/templates/manage/general/twitter.twig deleted file mode 100644 index f114ad1..0000000 --- a/templates/manage/general/twitter.twig +++ /dev/null @@ -1,40 +0,0 @@ -{% extends 'manage/general/master.twig' %} -{% from 'macros.twig' import container_title %} - -{% block manage_content %} -
- {{ container_title(' Twitter Connection') }} - -
- Manages the Twitter connection for announcing news posts on the Twitter account. -
- - {% if twitter_has_oauth2 %} - {% if twitter_has_access %} -
- A Twitter user has been authenticated. - Current access token expires . -
-
- {% if twitter_has_refresh %} - Refresh Access - {% endif %} - Revoke Access -
- {% else %} -
- No Twitter user has been authorised yet. - Before beginning authorization, make sure you're logged into Twitter with the desired user. -
- - {% endif %} - {% else %} -
- Twitter OAuth2 credentials have not been registered. - Add them through Settings as twitter.oauth2.clientId and twitter.oauth2.clientSecret. -
- {% endif %} -
-{% endblock %} diff --git a/templates/master.twig b/templates/master.twig index 2b0872b..efe3c5a 100644 --- a/templates/master.twig +++ b/templates/master.twig @@ -48,11 +48,6 @@ 'title': 'Rules', 'url': url('info', {'title': 'rules'}), }, - { - 'title': 'Twitter', - 'url': 'https://twitter.com/' ~ globals.site_twitter|default(''), - 'display': globals.site_twitter is defined and globals.site_twitter is not empty, - }, ], }, {