Merge pull request 'Statistics: inbound / outbound for Tumblr and Bluesky' (#1529) from heluecht/friendica-addons:stats into 2024.06-rc

Reviewed-on: https://git.friendi.ca/friendica/friendica-addons/pulls/1529
pull/1530/head
Tobias Diekershoff 2024-08-09 13:55:51 +02:00
commit a97cccb6b2
2 changed files with 4 additions and 0 deletions

View File

@ -1946,6 +1946,7 @@ function bluesky_post(int $uid, string $url, string $params, array $headers): ?s
return null; return null;
} }
Item::incrementOutbound(Protocol::BLUESKY);
try { try {
$curlResult = DI::httpClient()->post($pds . $url, $params, $headers); $curlResult = DI::httpClient()->post($pds . $url, $params, $headers);
} catch (\Exception $e) { } catch (\Exception $e) {
@ -1982,6 +1983,7 @@ function bluesky_xrpc_get(int $uid, string $url, array $parameters = []): ?stdCl
function bluesky_get(string $url, string $accept_content = HttpClientAccept::DEFAULT, array $opts = []): ?stdClass function bluesky_get(string $url, string $accept_content = HttpClientAccept::DEFAULT, array $opts = []): ?stdClass
{ {
Item::incrementInbound(Protocol::BLUESKY);
try { try {
$curlResult = DI::httpClient()->get($url, $accept_content, $opts); $curlResult = DI::httpClient()->get($url, $accept_content, $opts);
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@ -1326,6 +1326,7 @@ function tumblr_get_contact_by_url(string $url, int $uid): ?array
*/ */
function tumblr_get(int $uid, string $url, array $parameters = []): stdClass function tumblr_get(int $uid, string $url, array $parameters = []): stdClass
{ {
Item::incrementInbound(Protocol::TUMBLR);
$url = 'https://api.tumblr.com/v2/' . $url; $url = 'https://api.tumblr.com/v2/' . $url;
if ($uid == 0) { if ($uid == 0) {
@ -1355,6 +1356,7 @@ function tumblr_get(int $uid, string $url, array $parameters = []): stdClass
*/ */
function tumblr_post(int $uid, string $url, array $parameters): stdClass function tumblr_post(int $uid, string $url, array $parameters): stdClass
{ {
Item::incrementOutbound(Protocol::TUMBLR);
$url = 'https://api.tumblr.com/v2/' . $url; $url = 'https://api.tumblr.com/v2/' . $url;
$curlResult = DI::httpClient()->post($url, $parameters, ['Authorization' => ['Bearer ' . tumblr_get_token($uid)]]); $curlResult = DI::httpClient()->post($url, $parameters, ['Authorization' => ['Bearer ' . tumblr_get_token($uid)]]);