mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-06 23:04:28 +02:00
Merge pull request #14945 from annando/jetstream
Some checks are pending
Code Quality / PHP-CS-Fixer (PHP 8.3) (push) Waiting to run
Code Quality / PHPStan (PHP 8.4) (push) Waiting to run
Code Quality / PHPStan in addons (PHP 8.4) (push) Waiting to run
Code Quality / PHPMD (PHP 8.4) (push) Waiting to run
CI tests / Unit-Tests (PHP 7.4) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.0) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.1) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.2) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.3) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.4) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.5) (push) Waiting to run
CI tests / Database-Tests (PHP 7.4) (push) Waiting to run
CI tests / Database-Tests (PHP 8.0) (push) Waiting to run
CI tests / Database-Tests (PHP 8.1) (push) Waiting to run
CI tests / Database-Tests (PHP 8.2) (push) Waiting to run
CI tests / Database-Tests (PHP 8.3) (push) Waiting to run
CI tests / Database-Tests (PHP 8.4) (push) Waiting to run
CI tests / Database-Tests (PHP 8.5) (push) Waiting to run
Some checks are pending
Code Quality / PHP-CS-Fixer (PHP 8.3) (push) Waiting to run
Code Quality / PHPStan (PHP 8.4) (push) Waiting to run
Code Quality / PHPStan in addons (PHP 8.4) (push) Waiting to run
Code Quality / PHPMD (PHP 8.4) (push) Waiting to run
CI tests / Unit-Tests (PHP 7.4) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.0) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.1) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.2) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.3) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.4) (push) Waiting to run
CI tests / Unit-Tests (PHP 8.5) (push) Waiting to run
CI tests / Database-Tests (PHP 7.4) (push) Waiting to run
CI tests / Database-Tests (PHP 8.0) (push) Waiting to run
CI tests / Database-Tests (PHP 8.1) (push) Waiting to run
CI tests / Database-Tests (PHP 8.2) (push) Waiting to run
CI tests / Database-Tests (PHP 8.3) (push) Waiting to run
CI tests / Database-Tests (PHP 8.4) (push) Waiting to run
CI tests / Database-Tests (PHP 8.5) (push) Waiting to run
Avoid warnings in the Jetstream process
This commit is contained in:
commit
3e3f49219d
5 changed files with 139 additions and 61 deletions
|
@ -13,6 +13,9 @@ if (php_sapi_name() !== 'cli') {
|
|||
exit();
|
||||
}
|
||||
|
||||
// Ensure that te console is executed from the base path of the installation
|
||||
chdir(dirname(__DIR__));
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
|
||||
$container = \Friendica\Core\DiceContainer::fromBasePath(dirname(__DIR__));
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
"patrickschur/language-detection": "^5.0.0",
|
||||
"pear/console_table": "^1.3",
|
||||
"phpseclib/phpseclib": "^3.0",
|
||||
"phrity/websocket": "^1.7",
|
||||
"pragmarx/google2fa": "^5.0",
|
||||
"pragmarx/recovery": "^0.2",
|
||||
"psr/clock": "^1.0",
|
||||
|
@ -76,7 +77,6 @@
|
|||
"seld/cli-prompt": "^1.0",
|
||||
"smarty/smarty": "^4",
|
||||
"symfony/event-dispatcher": "^5.4",
|
||||
"textalk/websocket": "^1.6",
|
||||
"ua-parser/uap-php": "^3.9",
|
||||
"xemlock/htmlpurifier-html5": "^0.1.11"
|
||||
},
|
||||
|
|
178
composer.lock
generated
178
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "8aa73e21ed198d8013c09de14e8230cd",
|
||||
"content-hash": "897b878d6db24b9a6437bd9f971478be",
|
||||
"packages": [
|
||||
{
|
||||
"name": "asika/simple-console",
|
||||
|
@ -2860,6 +2860,66 @@
|
|||
],
|
||||
"time": "2024-03-03T02:14:58+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phrity/net-stream",
|
||||
"version": "1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sirn-se/phrity-net-stream.git",
|
||||
"reference": "9105931b65ad90c75f4885a40b268b0f65802e3e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sirn-se/phrity-net-stream/zipball/9105931b65ad90c75f4885a40b268b0f65802e3e",
|
||||
"reference": "9105931b65ad90c75f4885a40b268b0f65802e3e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 | ^8.0",
|
||||
"phrity/util-errorhandler": "^1.0",
|
||||
"psr/http-factory": "^1.0",
|
||||
"psr/http-message": "^1.0 | ^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^2.0",
|
||||
"phpunit/phpunit": "^9.0 | ^10.0",
|
||||
"phrity/net-uri": "^1.1",
|
||||
"squizlabs/php_codesniffer": "^3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Phrity\\Net\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Sören Jensen",
|
||||
"email": "sirn@sirn.se",
|
||||
"homepage": "https://phrity.sirn.se"
|
||||
}
|
||||
],
|
||||
"description": "Socket stream classes implementing PSR-7 Stream and PSR-17 StreamFactory",
|
||||
"homepage": "https://phrity.sirn.se/net-stream",
|
||||
"keywords": [
|
||||
"Socket",
|
||||
"client",
|
||||
"psr-17",
|
||||
"psr-7",
|
||||
"server",
|
||||
"stream",
|
||||
"stream factory"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sirn-se/phrity-net-stream/issues",
|
||||
"source": "https://github.com/sirn-se/phrity-net-stream/tree/1.3.0"
|
||||
},
|
||||
"time": "2023-10-22T10:47:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phrity/net-uri",
|
||||
"version": "1.3.0",
|
||||
|
@ -2958,6 +3018,67 @@
|
|||
],
|
||||
"time": "2024-09-12T06:49:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phrity/websocket",
|
||||
"version": "1.7.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sirn-se/websocket-php.git",
|
||||
"reference": "8a525da4457b599ab1960f24183f25626c96ce3c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sirn-se/websocket-php/zipball/8a525da4457b599ab1960f24183f25626c96ce3c",
|
||||
"reference": "8a525da4457b599ab1960f24183f25626c96ce3c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 | ^8.0",
|
||||
"phrity/net-stream": "^1.2",
|
||||
"phrity/net-uri": "^1.2",
|
||||
"phrity/util-errorhandler": "^1.0",
|
||||
"psr/http-message": "^1.1 | ^2.0",
|
||||
"psr/log": "^1.0 | ^2.0 | ^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^2.0",
|
||||
"phpunit/phpunit": "^9.0 | ^10.0",
|
||||
"phrity/net-mock": "^1.3",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WebSocket\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"ISC"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fredrik Liljegren"
|
||||
},
|
||||
{
|
||||
"name": "Sören Jensen",
|
||||
"email": "sirn@sirn.se",
|
||||
"homepage": "https://phrity.sirn.se"
|
||||
}
|
||||
],
|
||||
"description": "WebSocket client and server",
|
||||
"homepage": "https://phrity.sirn.se/websocket",
|
||||
"keywords": [
|
||||
"client",
|
||||
"server",
|
||||
"websocket"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sirn-se/websocket-php/issues",
|
||||
"source": "https://github.com/sirn-se/websocket-php/tree/1.7.3"
|
||||
},
|
||||
"time": "2024-05-31T13:43:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "pragmarx/google2fa",
|
||||
"version": "v5.0.0",
|
||||
|
@ -4140,57 +4261,6 @@
|
|||
],
|
||||
"time": "2024-09-09T11:45:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "textalk/websocket",
|
||||
"version": "1.6.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Textalk/websocket-php.git",
|
||||
"reference": "67de79745b1a357caf812bfc44e0abf481cee012"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Textalk/websocket-php/zipball/67de79745b1a357caf812bfc44e0abf481cee012",
|
||||
"reference": "67de79745b1a357caf812bfc44e0abf481cee012",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 | ^8.0",
|
||||
"phrity/net-uri": "^1.0",
|
||||
"phrity/util-errorhandler": "^1.0",
|
||||
"psr/http-message": "^1.0",
|
||||
"psr/log": "^1.0 | ^2.0 | ^3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-coveralls/php-coveralls": "^2.0",
|
||||
"phpunit/phpunit": "^9.0",
|
||||
"squizlabs/php_codesniffer": "^3.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"WebSocket\\": "lib"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"ISC"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fredrik Liljegren"
|
||||
},
|
||||
{
|
||||
"name": "Sören Jensen"
|
||||
}
|
||||
],
|
||||
"description": "WebSocket client and server",
|
||||
"support": {
|
||||
"issues": "https://github.com/Textalk/websocket-php/issues",
|
||||
"source": "https://github.com/Textalk/websocket-php/tree/1.6.3"
|
||||
},
|
||||
"time": "2022-11-07T18:59:33+00:00"
|
||||
},
|
||||
{
|
||||
"name": "ua-parser/uap-php",
|
||||
"version": "v3.9.14",
|
||||
|
@ -7698,9 +7768,9 @@
|
|||
"ext-simplexml": "*",
|
||||
"ext-xml": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"platform-dev": {},
|
||||
"platform-overrides": {
|
||||
"php": "7.4"
|
||||
},
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ class Actor
|
|||
}
|
||||
|
||||
$directory = $this->atprotocol->get(ATProtocol::DIRECTORY . '/' . $profile->did);
|
||||
if (!empty($directory)) {
|
||||
if (!empty($directory->service)) {
|
||||
foreach ($directory->service as $service) {
|
||||
if (($service->id == '#atproto_pds') && ($service->type == 'AtprotoPersonalDataServer') && !empty($service->serviceEndpoint)) {
|
||||
$fields['baseurl'] = $service->serviceEndpoint;
|
||||
|
|
|
@ -84,6 +84,8 @@ class Jetstream
|
|||
$timeout_limit = 10;
|
||||
$timestamp = $this->keyValue->get('jetstream_timestamp') ?? 0;
|
||||
$cursor = '';
|
||||
$this->logger->notice('Start listening');
|
||||
|
||||
while (true) {
|
||||
if ($timestamp) {
|
||||
$cursor = '&cursor=' . $timestamp;
|
||||
|
@ -97,7 +99,7 @@ class Jetstream
|
|||
$this->client->setTimeout($timeout);
|
||||
$this->client->setLogger($this->logger);
|
||||
} catch (\WebSocket\ConnectionException $e) {
|
||||
$this->logger->error('Error while trying to establish the connection', ['code' => $e->getCode(), 'message' => $e->getMessage()]);
|
||||
$this->logger->error('Error while trying to establish the connection', ['code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
|
||||
echo "Connection wasn't established.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
@ -105,7 +107,8 @@ class Jetstream
|
|||
$last_timeout = time();
|
||||
while (true) {
|
||||
try {
|
||||
$message = @$this->client->receive();
|
||||
$message = $this->client->receive();
|
||||
|
||||
if (empty($message)) {
|
||||
$this->logger->notice('Empty message received');
|
||||
break;
|
||||
|
@ -128,8 +131,9 @@ class Jetstream
|
|||
break;
|
||||
}
|
||||
$this->logger->notice('Timeout', ['duration' => $timeout_duration, 'timestamp' => $timestamp, 'code' => $e->getCode(), 'message' => $e->getMessage()]);
|
||||
break;
|
||||
} else {
|
||||
$this->logger->error('Error', ['code' => $e->getCode(), 'message' => $e->getMessage()]);
|
||||
$this->logger->error('Error while trying to receive a message', ['code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -138,9 +142,10 @@ class Jetstream
|
|||
try {
|
||||
$this->client->close();
|
||||
} catch (\WebSocket\ConnectionException $e) {
|
||||
$this->logger->error('Error while trying to close the connection', ['code' => $e->getCode(), 'message' => $e->getMessage()]);
|
||||
$this->logger->error('Error while trying to close the connection', ['code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
|
||||
}
|
||||
}
|
||||
$this->logger->notice('Stop listening');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,7 +241,7 @@ class Jetstream
|
|||
try {
|
||||
$this->client->send(json_encode($update));
|
||||
} catch (\WebSocket\ConnectionException $e) {
|
||||
$this->logger->error('Error while trying to send options.', ['code' => $e->getCode(), 'message' => $e->getMessage()]);
|
||||
$this->logger->error('Error while trying to send options.', ['code' => $e->getCode(), 'message' => $e->getMessage(), 'file' => $e->getFile(), 'line' => $e->getLine()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue