diff --git a/mastodonapi.php b/mastodonapi.php index 81dd9d3..beb060c 100644 --- a/mastodonapi.php +++ b/mastodonapi.php @@ -1,8 +1,8 @@ yellow = $yellow; $this->yellow->system->setDefault("mastodonapiInstanceUrl", "https://example.social"); $this->yellow->system->setDefault("mastodonapiAccountId", ""); - $this->yellow->system->setDefault("mastodonapiAccessToken", ""); $this->yellow->system->setDefault("mastodonapiHashtag", ""); $this->yellow->system->setDefault("mastodonapiAuthor", "YellowUser"); $this->yellow->system->setDefault("mastodonapiTag", "Fediverse"); @@ -50,13 +49,12 @@ class YellowMastodonAPI { private function processMastodonFeed() { $instanceUrl = $this->yellow->system->get("mastodonapiInstanceUrl"); $accountId = $this->yellow->system->get("mastodonapiAccountId"); - $accessToken = $this->yellow->system->get("mastodonapiAccessToken"); $hashtag = ltrim($this->yellow->system->get("mastodonapiHashtag"), '#'); $defaultAuthor = $this->yellow->system->get("mastodonapiAuthor"); $defaultTag = $this->yellow->system->get("mastodonapiTag"); $targetFolder = $this->yellow->system->get("mastodonapiFolder"); - if (empty($instanceUrl) || empty($accountId) || empty($accessToken)) { + if (empty($instanceUrl) || empty($accountId)) { error_log("ERROR: MastodonAPI: Missing configuration values."); return false; } @@ -65,8 +63,7 @@ class YellowMastodonAPI { $context = stream_context_create([ 'http' => [ 'method' => "GET", - 'header' => "Authorization: Bearer " . $accessToken . "\r\n" . - "User-Agent: YellowMastodonAPI\r\n", + 'header' => "User-Agent: YellowMastodonAPI\r\n", 'timeout' => 30 ], 'ssl' => [ @@ -95,7 +92,7 @@ class YellowMastodonAPI { $createdAt = $post['created_at']; $tags = array_column($post['tags'], 'name'); - if (!empty($hashtag) && !in_array($hashtag, array_map('strtolower', $tags))) { + if (!empty($hashtag) && !in_array(strtolower($hashtag), array_map('strtolower', $tags))) { continue; }