chore(post.html): drop post links to mastodon
This commit is contained in:
parent
c40dcbac2b
commit
6936a96053
5 changed files with 1 additions and 25 deletions
|
@ -50,9 +50,7 @@ abstract class ApiHandler
|
|||
],
|
||||
];
|
||||
|
||||
if (in_array($method, ["POST", "PATCH"]) && $body) {
|
||||
$options["json"] = $body;
|
||||
}
|
||||
if ($method === "POST" && $body) $options["json"] = $body;
|
||||
|
||||
$response = (new Client())->request($method, $url, $options);
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ class MastodonPostHandler extends ApiHandler
|
|||
if ($mastodonPostUrl) {
|
||||
if (strpos($item["link"], $this->baseUrl . "/posts") !== false) {
|
||||
$slug = str_replace($this->baseUrl, "", $item["link"]);
|
||||
$this->updatePostWithMastodonUrl($slug, $mastodonPostUrl);
|
||||
echo "Posted and stored URL: {$item["link"]}\n";
|
||||
}
|
||||
} else {
|
||||
|
@ -209,15 +208,6 @@ class MastodonPostHandler extends ApiHandler
|
|||
}
|
||||
}
|
||||
|
||||
private function updatePostWithMastodonUrl(
|
||||
string $slug,
|
||||
string $mastodonPostUrl
|
||||
): void {
|
||||
$data = ["mastodon_url" => $mastodonPostUrl];
|
||||
|
||||
$this->fetchFromPostgREST("posts", "slug=eq.{urlencode($slug)}&mastodon_url=is.null", "PATCH", $data);
|
||||
}
|
||||
|
||||
private function truncateContent(
|
||||
string $title,
|
||||
string $description,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue