Merge branch 'develop' into rework-addon-class

This commit is contained in:
Art4 2025-05-14 07:53:31 +00:00
commit 08b60c2558
3 changed files with 67 additions and 22 deletions

View file

@ -8,7 +8,6 @@
namespace Friendica\Core; namespace Friendica\Core;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\Strings; use Friendica\Util\Strings;
/** /**
@ -267,12 +266,6 @@ class Addon
if ($type == "author" || $type == "maintainer") { if ($type == "author" || $type == "maintainer") {
$r = preg_match("|([^<]+)<([^>]+)>|", $v, $m); $r = preg_match("|([^<]+)<([^>]+)>|", $v, $m);
if ($r) { if ($r) {
if (!empty($m[2]) && empty(parse_url($m[2], PHP_URL_SCHEME))) {
$contact = Contact::getByURL($m[2], false);
if (!empty($contact['url'])) {
$m[2] = $contact['url'];
}
}
$info[$type][] = ['name' => $m[1], 'link' => $m[2]]; $info[$type][] = ['name' => $m[1], 'link' => $m[2]];
} else { } else {
$info[$type][] = ['name' => $v]; $info[$type][] = ['name' => $v];

View file

@ -10,6 +10,7 @@ namespace Friendica\Module\Admin\Addons;
use Friendica\Content\Text\Markdown; use Friendica\Content\Text\Markdown;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Module\BaseAdmin; use Friendica\Module\BaseAdmin;
use Friendica\Util\Strings; use Friendica\Util\Strings;
@ -92,6 +93,35 @@ class Details extends BaseAdmin
$addonInfo = $addonHelper->getAddonInfo($addon); $addonInfo = $addonHelper->getAddonInfo($addon);
$addonAuthors = [];
foreach ($addonInfo->getAuthors() as $addonAuthor) {
$addonAuthor['link'] = 'foo@bar.com';
if (array_key_exists('link', $addonAuthor) && empty(parse_url($addonAuthor['link'], PHP_URL_SCHEME))) {
$contact = Contact::getByURL($addonAuthor['link'], false);
if (!empty($contact['url'])) {
$addonAuthor['link'] = $contact['url'];
}
}
$addonAuthors[] = $addonAuthor;
}
$addonMaintainers = [];
foreach ($addonInfo->getMaintainers() as $addonMaintainer) {
if (array_key_exists('link', $addonMaintainer) && empty(parse_url($addonMaintainer['link'], PHP_URL_SCHEME))) {
$contact = Contact::getByURL($addonMaintainer['link'], false);
if (!empty($contact['url'])) {
$addonMaintainer['link'] = $contact['url'];
}
}
$addonMaintainers[] = $addonMaintainer;
}
$t = Renderer::getMarkupTemplate('admin/addons/details.tpl'); $t = Renderer::getMarkupTemplate('admin/addons/details.tpl');
return Renderer::replaceMacros($t, [ return Renderer::replaceMacros($t, [
@ -107,8 +137,8 @@ class Details extends BaseAdmin
'name' => $addonInfo->getName(), 'name' => $addonInfo->getName(),
'version' => $addonInfo->getVersion(), 'version' => $addonInfo->getVersion(),
'description' => $addonInfo->getDescription(), 'description' => $addonInfo->getDescription(),
'author' => $addonInfo->getAuthors(), 'author' => $addonAuthors,
'maintainer' => $addonInfo->getMaintainers(), 'maintainer' => $addonMaintainers,
], ],
'$str_author' => DI::l10n()->t('Author: '), '$str_author' => DI::l10n()->t('Author: '),
'$str_maintainer' => DI::l10n()->t('Maintainer: '), '$str_maintainer' => DI::l10n()->t('Maintainer: '),

View file

@ -23,6 +23,7 @@ use Friendica\Module\Response;
use Friendica\Profile\ProfileField\Repository\ProfileField; use Friendica\Profile\ProfileField\Repository\ProfileField;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Profiler; use Friendica\Util\Profiler;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
@ -56,9 +57,29 @@ class Index extends BaseModule
private $pConfig; private $pConfig;
/** @var Mode */ /** @var Mode */
private $mode; private $mode;
private EventDispatcherInterface $eventDispatcher;
public function __construct(Mode $mode, IManagePersonalConfigValues $pConfig, Conversation $conversation, DateTimeFormat $dateTimeFormat, ProfileField $profileField, Page $page, IManageConfigValues $config, IHandleUserSessions $session, AppHelper $appHelper, Database $database, L10n $l10n, BaseURL $baseUrl, Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = []) public function __construct(
{ Mode $mode,
IManagePersonalConfigValues $pConfig,
Conversation $conversation,
DateTimeFormat $dateTimeFormat,
ProfileField $profileField,
Page $page,
IManageConfigValues $config,
IHandleUserSessions $session,
AppHelper $appHelper,
Database $database,
EventDispatcherInterface $eventDispatcher,
L10n $l10n,
BaseURL $baseUrl,
Arguments $args,
LoggerInterface $logger,
Profiler $profiler,
Response $response,
array $server,
array $parameters = []
) {
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->database = $database; $this->database = $database;
@ -71,11 +92,12 @@ class Index extends BaseModule
$this->conversation = $conversation; $this->conversation = $conversation;
$this->pConfig = $pConfig; $this->pConfig = $pConfig;
$this->mode = $mode; $this->mode = $mode;
$this->eventDispatcher = $eventDispatcher;
} }
protected function rawContent(array $request = []) protected function rawContent(array $request = [])
{ {
(new Profile($this->profileField, $this->page, $this->config, $this->session, $this->appHelper, $this->database, $this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters))->rawContent(); (new Profile($this->profileField, $this->page, $this->config, $this->session, $this->appHelper, $this->database, $this->eventDispatcher, $this->l10n, $this->baseUrl, $this->args, $this->logger, $this->profiler, $this->response, $this->server, $this->parameters))->rawContent();
} }
protected function content(array $request = []): string protected function content(array $request = []): string