"fetchFull" is replaced by "get" #1535

Merged
tobias merged 1 commit from heluecht/friendica-addons:fetchfull into develop 2024-09-06 07:22:59 +02:00
2 changed files with 18 additions and 16 deletions
Showing only changes of commit e9f8e968ac - Show all commits

View file

@ -6,7 +6,6 @@
* Author: Matthew Exon <http://mat.exon.name>
*/
use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
@ -16,12 +15,11 @@ use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Model\User;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
use Friendica\Protocol\Activity;
use Friendica\Util\DateTimeFormat;
/**
* Sets up the addon hooks and the database table
@ -53,10 +51,12 @@ function mailstream_addon_admin(string &$o)
{
$frommail = DI::config()->get('mailstream', 'frommail');
$template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/');
$config = ['frommail',
$config = [
'frommail',
DI::l10n()->t('From Address'),
$frommail,
DI::l10n()->t('Email address that stream items will appear to be from.')];
DI::l10n()->t('Email address that stream items will appear to be from.')
];
$o .= Renderer::replaceMacros($template, [
'$frommail' => $config,
'$submit' => DI::l10n()->t('Save Settings')
@ -198,10 +198,13 @@ function mailstream_do_images(array &$item, array &$attachments)
$cookiejar = tempnam(System::getTempPath(), 'cookiejar-mailstream-');
try {
$curlResult = DI::httpClient()->fetchFull($url, HttpClientAccept::DEFAULT, 0, $cookiejar);
$curlResult = DI::httpClient()->get($url, HttpClientAccept::DEFAULT, [HttpClientOptions::COOKIEJAR => $cookiejar]);
if (!$curlResult->isSuccess()) {
Logger::debug('mailstream: fetch image url failed', [
'url' => $url, 'item_id' => $item['id'], 'return_code' => $curlResult->getReturnCode()]);
'url' => $url,
'item_id' => $item['id'],
'return_code' => $curlResult->getReturnCode()
]);
continue;
}
} catch (InvalidArgumentException $e) {
@ -409,7 +412,8 @@ function mailstream_send(string $message_id, array $item, array $user): bool
'$upstream' => DI::l10n()->t('Upstream'),
'$uri' => DI::l10n()->t('URI'),
'$local' => DI::l10n()->t('Local'),
'$item' => $item]);
'$item' => $item
]);
$mail->Body = mailstream_html_wrap($mail->Body);
if (!$mail->Send()) {
throw new Exception($mail->ErrorInfo);

View file

@ -1,5 +1,4 @@
<?php
/*
* Name: Mastodon Custom Emojis
* Description: Replace emojis shortcodes in Mastodon posts with their originating server custom emojis images.
@ -9,7 +8,6 @@
* Status: Unsupported
*/
use Friendica\App;
use Friendica\Content\Smilies;
use Friendica\Core\Cache\Enum\Duration;
use Friendica\Core\Hook;
@ -78,7 +76,7 @@ function mastodoncustomemojis_fetch_custom_emojis_for_url($api_base_url)
$api_url = $api_base_url . '/api/v1/custom_emojis';
$fetchResult = DI::httpClient()->fetchFull($api_url);
$fetchResult = DI::httpClient()->get($api_url);
if ($fetchResult->isSuccess()) {
$emojis_array = json_decode($fetchResult->getBodyString(), true);