From afd1dba7743f20e5c6569e1cbc3579539f38d55b Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Dec 2022 19:50:10 +0000 Subject: [PATCH 1/4] Issue 12338: Use redirect for "about" and "about/more" --- src/App.php | 4 ++++ static/routes.config.php | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/App.php b/src/App.php index 0d4e8880d..d4120bcc2 100644 --- a/src/App.php +++ b/src/App.php @@ -717,6 +717,10 @@ class App $this->baseURL->redirect('search'); } + if (in_array($moduleName, ['about', 'about/more'])) { + $this->baseURL->redirect('friendica'); + } + // Initialize module that can set the current theme in the init() method, either directly or via App->setProfileOwner $page['page_title'] = $moduleName; diff --git a/static/routes.config.php b/static/routes.config.php index e3c87f150..f33cd9581 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -318,8 +318,6 @@ return [ '/proofs' => [Module\Api\Mastodon\Proofs::class, [R::GET ]], // Dummy, not supported ], - '/about[/more]' => [Module\Friendica::class, [R::GET]], - '/admin' => [ '[/]' => [Module\Admin\Summary::class, [R::GET]], From d05910a6e5f2605f29c1b5156a9106d42024457c Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 11 Dec 2022 22:48:43 +0000 Subject: [PATCH 2/4] API: Allow permissions for status posts --- src/Module/Api/Twitter/Statuses/Update.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Module/Api/Twitter/Statuses/Update.php b/src/Module/Api/Twitter/Statuses/Update.php index d071675e8..e1c734038 100644 --- a/src/Module/Api/Twitter/Statuses/Update.php +++ b/src/Module/Api/Twitter/Statuses/Update.php @@ -49,6 +49,8 @@ class Update extends BaseApi self::checkAllowedScope(self::SCOPE_WRITE); $uid = self::getCurrentUserID(); + $owner = User::getOwnerDataById($uid); + $request = self::getRequest([ 'htmlstatus' => '', 'status' => '', @@ -59,9 +61,11 @@ class Update extends BaseApi 'media_ids' => '', 'source' => '', 'include_entities' => false, - ], $request); - - $owner = User::getOwnerDataById($uid); + 'contact_allow' => $owner['allow_cid'], + 'group_allow' => $owner['allow_gid'], + 'contact_deny' => $owner['deny_cid'], + 'group_deny' => $owner['deny_gid'], + ], $request); if (!empty($request['htmlstatus'])) { $body = HTML::toBBCodeVideo($request['htmlstatus']); @@ -96,10 +100,11 @@ class Update extends BaseApi $item['coord'] = sprintf("%s %s", $request['lat'], $request['long']); } - $item['allow_cid'] = $owner['allow_cid'] ?? ''; - $item['allow_gid'] = $owner['allow_gid'] ?? ''; - $item['deny_cid'] = $owner['deny_cid'] ?? ''; - $item['deny_gid'] = $owner['deny_gid'] ?? ''; + $aclFormatter = DI::aclFormatter(); + $item['allow_cid'] = $aclFormatter->toString($request['contact_allow']); + $item['allow_gid'] = $aclFormatter->toString($request['group_allow']); + $item['deny_cid'] = $aclFormatter->toString($request['contact_deny']); + $item['deny_gid'] = $aclFormatter->toString($request['group_deny']); if (!empty($item['allow_cid'] . $item['allow_gid'] . $item['deny_cid'] . $item['deny_gid'])) { $item['private'] = Item::PRIVATE; From 7dfe517c77c3f2499b7340ace74cb623c6263824 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 12 Dec 2022 11:24:20 +0000 Subject: [PATCH 3/4] Redirect in a different way --- src/App.php | 4 ---- src/Module/About.php | 35 +++++++++++++++++++++++++++++++++++ static/routes.config.php | 2 ++ 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 src/Module/About.php diff --git a/src/App.php b/src/App.php index d4120bcc2..0d4e8880d 100644 --- a/src/App.php +++ b/src/App.php @@ -717,10 +717,6 @@ class App $this->baseURL->redirect('search'); } - if (in_array($moduleName, ['about', 'about/more'])) { - $this->baseURL->redirect('friendica'); - } - // Initialize module that can set the current theme in the init() method, either directly or via App->setProfileOwner $page['page_title'] = $moduleName; diff --git a/src/Module/About.php b/src/Module/About.php new file mode 100644 index 000000000..dd58450fb --- /dev/null +++ b/src/Module/About.php @@ -0,0 +1,35 @@ +. + * + */ + +namespace Friendica\Module; + +use Friendica\BaseModule; + +/** + * Redirect to the friendica page + */ +class About extends BaseModule +{ + protected function rawContent(array $request = []) + { + $this->baseUrl->redirect('friendica'); + } +} diff --git a/static/routes.config.php b/static/routes.config.php index f33cd9581..70d230c2a 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -318,6 +318,8 @@ return [ '/proofs' => [Module\Api\Mastodon\Proofs::class, [R::GET ]], // Dummy, not supported ], + '/about[/more]' => [Module\About::class, [R::GET]], + '/admin' => [ '[/]' => [Module\Admin\Summary::class, [R::GET]], From 0209c39e0a2050ac7b6550ad489149d5b3bd394b Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 12 Dec 2022 15:51:14 +0100 Subject: [PATCH 4/4] Update src/Module/Api/Twitter/Statuses/Update.php Co-authored-by: Hypolite Petovan --- src/Module/Api/Twitter/Statuses/Update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Api/Twitter/Statuses/Update.php b/src/Module/Api/Twitter/Statuses/Update.php index e1c734038..5f01de59a 100644 --- a/src/Module/Api/Twitter/Statuses/Update.php +++ b/src/Module/Api/Twitter/Statuses/Update.php @@ -65,7 +65,7 @@ class Update extends BaseApi 'group_allow' => $owner['allow_gid'], 'contact_deny' => $owner['deny_cid'], 'group_deny' => $owner['deny_gid'], - ], $request); + ], $request); if (!empty($request['htmlstatus'])) { $body = HTML::toBBCodeVideo($request['htmlstatus']);