1
0
Fork 0

Fix forced updates on the display page

This commit is contained in:
Michael 2022-06-07 17:34:19 +00:00
parent 79205b8377
commit d665b78ea8
2 changed files with 15 additions and 11 deletions

View file

@ -160,15 +160,19 @@ function display_content(App $a, $update = false, $update_uid = 0)
}
$parent_uri_id = $item['parent-uri-id'];
}
$browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval'));
if (!empty($browser_update)) {
$update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500));
if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) {
Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
return '';
} else {
Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
}
if (empty($_REQUEST['force'])) {
$browser_update = intval(DI::pConfig()->get($update_uid, 'system', 'update_interval'));
if (!empty($browser_update)) {
$update_date = date(DateTimeFormat::MYSQL, time() - ($browser_update / 500));
if (!Post::exists(["`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parent_uri_id, 0, $update_uid, $update_date])) {
Logger::debug('No updated content', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
return '';
} else {
Logger::debug('Updated content found', ['uri-id' => $uri_id, 'uid' => $update_uid, 'updated' => $update_date]);
}
}
} else {
Logger::debug('Forced content update', ['uri-id' => $uri_id, 'uid' => $update_uid]);
}
} else {
$uri_id = ((DI::args()->getArgc() > 2) ? DI::args()->getArgv()[2] : 0);

View file

@ -233,7 +233,7 @@ return [
'/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]],
'/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
'/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]],
'/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]], // not supported
'/instance/rules' => [Module\Api\Mastodon\Instance\Rules::class, [R::GET ]],
'/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]],
'/lists/{id:\d+}' => [Module\Api\Mastodon\Lists::class, [R::GET, R::PUT, R::DELETE]],
'/lists/{id:\d+}/accounts' => [Module\Api\Mastodon\Lists\Accounts::class, [R::GET, R::POST, R::DELETE]],
@ -244,7 +244,7 @@ return [
'/notifications/{id:\d+}' => [Module\Api\Mastodon\Notifications::class, [R::GET ]],
'/notifications/clear' => [Module\Api\Mastodon\Notifications\Clear::class, [ R::POST]],
'/notifications/{id:\d+}/dismiss' => [Module\Api\Mastodon\Notifications\Dismiss::class, [ R::POST]],
'/polls/{id:\d+}' => [Module\Api\Mastodon\Polls::class, [R::GET ]], // not supported
'/polls/{id:\d+}' => [Module\Api\Mastodon\Polls::class, [R::GET ]],
'/polls/{id:\d+}/votes' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/preferences' => [Module\Api\Mastodon\Preferences::class, [R::GET ]],
'/push/subscription' => [Module\Api\Mastodon\PushSubscription::class, [R::GET, R::POST, R::PUT, R::DELETE]],