]> git.mxchange.org Git - friendica.git/commitdiff
Workaround for timing problems / Avoid a notice in the scheduled posts
authorMichael Vogel <icarus@dabo.de>
Sat, 12 Feb 2022 17:27:58 +0000 (18:27 +0100)
committerMichael Vogel <icarus@dabo.de>
Sat, 12 Feb 2022 17:27:58 +0000 (18:27 +0100)
src/Object/Api/Mastodon/ScheduledStatus.php
src/Util/HTTPSignature.php

index e93c1c07b3acf21843170760888eb48f5fadda8f..759cd6e4e0666110dba6d7719d90aafcdd99d96a 100644 (file)
@@ -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,
index 7603b622b73e410b141a5e664282614136a3d695..68f6cb1dd777d1f6ffcfa20aad83580efef62393 100644 (file)
@@ -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;
                        }