From 6bc69f335368edd985ba312fce810a9a0e33b7fc Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 12 Feb 2022 18:27:58 +0100 Subject: [PATCH] Workaround for timing problems / Avoid a notice in the scheduled posts --- src/Object/Api/Mastodon/ScheduledStatus.php | 2 +- src/Util/HTTPSignature.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Object/Api/Mastodon/ScheduledStatus.php b/src/Object/Api/Mastodon/ScheduledStatus.php index e93c1c07b3..759cd6e4e0 100644 --- a/src/Object/Api/Mastodon/ScheduledStatus.php +++ b/src/Object/Api/Mastodon/ScheduledStatus.php @@ -71,7 +71,7 @@ class ScheduledStatus extends BaseDataTransferObject 'media_ids' => $media_ids, 'sensitive' => null, 'spoiler_text' => $parameters['item']['title'] ?? '', - 'visibility' => $visibility[$parameters['item']['private']], + 'visibility' => $visibility[$parameters['item']['private'] ?? 1], 'scheduled_at' => $this->scheduled_at, 'poll' => null, 'idempotency' => null, diff --git a/src/Util/HTTPSignature.php b/src/Util/HTTPSignature.php index 7603b622b7..68f6cb1dd7 100644 --- a/src/Util/HTTPSignature.php +++ b/src/Util/HTTPSignature.php @@ -627,7 +627,8 @@ class HTTPSignature if (!empty($created)) { $current = time(); - if ($created > $current) { + // Calculate with a grace period of 60 seconds to avoid slight time differences between the servers + if (($created - 60) > $current) { Logger::notice('Signature created in the future', ['created' => date(DateTimeFormat::MYSQL, $created), 'expired' => date(DateTimeFormat::MYSQL, $expired), 'current' => date(DateTimeFormat::MYSQL, $current)]); return false; }