FriendsOfFlarum / direct-links

Adds direct links to various Flarum actions (plus composer url auto-fill parameters).
MIT License
0 stars 1 forks source link

Possible incompatibility with `sycho-private-facade:v0.1.16` #1

Open SKevo18 opened 5 months ago

SKevo18 commented 5 months ago

Bug Report

Current Behavior Flarum encounters a boot error when accessing /login. This seems to be an incompatibility between the private forum facade extension (sycho-private-facade).

Steps to Reproduce

  1. Enable the extension
  2. Go to /login

Expected Behavior The URL redirects to the login modal.

Screenshots Not applicable.

Environment

Flarum core: 1.8.5
PHP version: 8.3.7
MySQL version: 11.1.5-MariaDB-ubu2204
Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, curl, FFI, ftp, fileinfo, gd, gettext, gmp, mbstring, exif, PDO, mysqlnd, mysqli, pdo_mysql, Phar, SimpleXML, tokenizer, sockets, dom, xsl, zip, xml, calendar, ctype, iconv, posix, readline, shmop, sysvmsg, sysvsem, sysvshm, xmlreader, xmlwriter, Zend OPcache
+---------------------------+---------+--------+
| Flarum Extensions         |         |        |
+---------------------------+---------+--------+
| ID                        | Version | Commit |
+---------------------------+---------+--------+
| flarum-tags               | v1.8.0  |        |
| flarum-suspend            | v1.8.1  |        |
| flarum-lock               | v1.8.0  |        |
| fof-follow-tags           | 1.2.2   |        |
| fof-ban-ips               | 1.1.1   |        |
| fof-oauth                 | 1.6.9   |        |
| afrux-forum-widgets-core  | v0.1.7  |        |
| v17development-blog       | v0.7.7  |        |
| the-turk-flamoji          | 1.0.4   |        |
| sycho-private-facade      | v0.1.16 |        |
| malago-achievements       | 0.5.6   |        |
| kilowhat-audit-free       | 1.7.0   |        |
| justoverclock-infocards   | 0.1.5   |        |
| justoverclock-hashtag     | 1.0.1   |        |
| ianm-follow-users         | 1.4.6   |        |
| fof-upload                | 1.5.4   |        |
| fof-reactions             | 1.4.1   |        |
| fof-nightmode             | 1.5.3   |        |
| fof-geoip                 | 1.4.2   |        |
| fof-formatting            | 1.0.3   |        |
| fof-drafts                | 1.2.10  |        |
| fof-anti-spam             | 1.1.2   |        |
| flarum-markdown           | v1.8.0  |        |
| flarum-emoji              | v1.8.0  |        |
| flarum-bbcode             | v1.8.0  |        |
| datlechin-oauth-spotify   | v0.1.0  |        |
| blomstra-welcome-login    | 0.1.0   |        |
| blomstra-spam-prevention  | 1.5.0   |        |
| askvortsov-auto-moderator | v0.1.3  |        |
| afrux-news-widget         | v0.1.1  |        |
| afrux-forum-stats-widget  | v0.1.1  |        |
| acpl-mobile-tab           | 1.4.3   |        |
| 2nrwls-audio              | v3.0    |        |
+---------------------------+---------+--------+
Base URL: https://apitest.flarum.cloud
Installation path: /data/host/apitest
Queue driver: sync
Session driver: file
Scheduler status: core.admin.dashboard.status.scheduler.never-run
Mail driver: mail
Debug mode: off

Possible solution(s) Put all routes into one common root route /direct/. That way, you could do /direct/login, and it would not conflict with core or extensions.

Additional Context An user at FreeFlarum requested the ability to redirect users to the signup modal. I have tested whether that's possible with this extension. The error occurred.

Logs:

flarum.ERROR: FastRoute\BadRouteException: Cannot register two routes matching "/login" for method "GET" in /data/host/skeleton/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php:55
Stack trace:
#0 /data/host/skeleton/vendor/nikic/fast-route/src/DataGenerator/RegexBasedAbstract.php(18): FastRoute\DataGenerator\RegexBasedAbstract->addStaticRoute()
#1 /data/host/skeleton/vendor/flarum/core/src/Http/RouteCollection.php(101): FastRoute\DataGenerator\RegexBasedAbstract->addRoute()
#2 /data/host/skeleton/vendor/flarum/core/src/Http/RouteCollection.php(118): Flarum\Http\RouteCollection->applyRoutes()
#3 /data/host/skeleton/vendor/flarum/core/src/Forum/ForumServiceProvider.php(221): Flarum\Http\RouteCollection->getRouteData()
#4 /data/host/skeleton/vendor/flarum/core/src/Forum/ForumServiceProvider.php(59): Flarum\Forum\ForumServiceProvider->setDefaultRoute()
#5 /data/host/skeleton/vendor/illuminate/container/Container.php(1265): Flarum\Forum\ForumServiceProvider->Flarum\Forum\{closure}()
#6 /data/host/skeleton/vendor/illuminate/container/Container.php(1229): Illuminate\Container\Container->fireCallbackArray()
#7 /data/host/skeleton/vendor/illuminate/container/Container.php(1215): Illuminate\Container\Container->fireAfterResolvingCallbacks()
#8 /data/host/skeleton/vendor/illuminate/container/Container.php(778): Illuminate\Container\Container->fireResolvingCallbacks()
#9 /data/host/skeleton/vendor/illuminate/container/Container.php(694): Illuminate\Container\Container->resolve()
#10 /data/host/skeleton/vendor/flarum/core/src/Forum/ForumServiceProvider.php(48): Illuminate\Container\Container->make()
#11 /data/host/skeleton/vendor/illuminate/container/Container.php(767): Flarum\Forum\ForumServiceProvider->Flarum\Forum\{closure}()
#12 /data/host/skeleton/vendor/illuminate/container/Container.php(694): Illuminate\Container\Container->resolve()
#13 /data/host/skeleton/vendor/flarum/core/src/Frontend/FrontendServiceProvider.php(177): Illuminate\Container\Container->make()
#14 /data/host/skeleton/vendor/illuminate/container/BoundMethod.php(36): Flarum\Frontend\FrontendServiceProvider->boot()
#15 /data/host/skeleton/vendor/illuminate/container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#16 /data/host/skeleton/vendor/illuminate/container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#17 /data/host/skeleton/vendor/illuminate/container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#18 /data/host/skeleton/vendor/illuminate/container/Container.php(653): Illuminate\Container\BoundMethod::call()
#19 /data/host/skeleton/vendor/flarum/core/src/Foundation/Application.php(290): Illuminate\Container\Container->call()
#20 /data/host/skeleton/vendor/flarum/core/src/Foundation/Application.php(273): Flarum\Foundation\Application->bootProvider()
#21 [internal function]: Flarum\Foundation\Application->Flarum\Foundation\{closure}()
#22 /data/host/skeleton/vendor/flarum/core/src/Foundation/Application.php(272): array_walk()
#23 /data/host/skeleton/vendor/flarum/core/src/Foundation/InstalledSite.php(151): Flarum\Foundation\Application->boot()
#24 /data/host/skeleton/vendor/flarum/core/src/Foundation/InstalledSite.php(82): Flarum\Foundation\InstalledSite->bootLaravel()
#25 /data/host/skeleton/vendor/flarum/core/src/Http/Server.php(59): Flarum\Foundation\InstalledSite->bootApp()
#26 /data/host/skeleton/vendor/flarum/core/src/Http/Server.php(36): Flarum\Http\Server->safelyBootAndGetHandler()
#27 /data/host/apitest/public/index.php(34): Flarum\Http\Server->listen()
#28 {main}  
DavideIadeluca commented 3 months ago

Thanks @SKevo18 for the bug report. Adding a /direct prefix would break backwards compatibility for extensions already relying on those routes.

If we assume the incompatibilities with the /login & /signup routes are resolved (no matter how), the only really useful route would be /composer. So I'm actually inclined to add sycho-private-facade to the composer conflict field of this extension.

Thoughts?

SKevo18 commented 3 months ago

So I'm actually inclined to add sycho-private-facade to the composer conflict field of this extension.

Thank you for your response! This is good as a temporary solution until a more robust one appears that allows both extensions to co-exist without bugs. This is because marking this as conflicting rules one of these extensions at hosting services like FreeFlarum for the time being.

DavideIadeluca commented 3 months ago

@SKevo18 Well I just realized that adding sycho/flarum-private-facade to the conflict field would mean that only either one of those extensions could be installed in the first place, no matter if enabled in Flarum or not.. I guess that would be kinda a dealbreaker for FreeFlarum?

SKevo18 commented 3 months ago

@SKevo18 Well I just realized that adding sycho/flarum-private-facade to the conflict field would mean that only either one of those extensions could be installed in the first place, no matter if enabled in Flarum or not.. I guess that would be kinda a dealbreaker for FreeFlarum?

Yes, that is correct. You can put it in the conflict field temporarily, until you find a better solution - this extension is not present at FreeFlarum at the moment because of this bug, so it isn't installed either way. Marking it as conflicting would signal other members of the community (who self-host) that these two can't be used together for now.

DavideIadeluca commented 3 months ago

Fixed in 1.0.1. I'll leave this issue open for the actual fix.