Skip to content

Conversation

@olorin99
Copy link
Contributor

@olorin99 olorin99 commented Jan 22, 2026

I believe I've switched all the navigation across to using auto_route now. Next step is to make sure all the paths make sense and that path parameters match up.

I've also started on making sure it works on web. Two biggest issues so far seem to be with file io and checking the platform. Apparently Platform.isAndroid, Platform.isLinux etc don't work on web so I've had to add some util functions that check if it is web before checking the platform. Haven't switched out all the platform checks yet so some pages might throw errors but the main feed should show up on web now.

It looks like a really big diff but most (~13K) of the added lines come from adding a file for drift to work on web. 'web/drift_worker.dart.js'

Add routes for post,user,community,message.
Ensure all modlog links use router.
Ensure all links in context menus use router.
Switch to router in navdrawer, userscreen and explore item.
Switch some routes to use router.
Switch some routes to use router.
Switch some routes to use router.
dart format lib/src/
Add helper for differences in accessing sqlite on web and native.
Disable import/export database on web, hopefully temporary.
Add helper function to push appropriate post route depending on post type.
Update gradle so is compatible with flutter_web_auth_2 dependency.
@olorin99
Copy link
Contributor Author

Should be ready for review now.

The linux build is failing because to handle oauth redirects in the browser I added a package which has a dependency on webkit2gtk-4.1 which will need to be added to the workflow script.

@olorin99 olorin99 marked this pull request as ready for review January 29, 2026 04:03
@olorin99 olorin99 requested a review from jwr1 January 29, 2026 04:03
Copy link
Member

@jwr1 jwr1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I'm sure this migration took a while to work on! Here's my initial review.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we try to make some of these routes more consistent with existing frontends? For example, almost every platform uses /u/namehere for users and /c/namehere for communities (except Mbin of course).

I also think there's an issue with the numeric id routes (threads, microblogs, comments), where they are not server agnostic, which would be an issue if you tried to copy-paste a link from one server to another. Some Lemmy frontends solve this by having the server domain in the path. I also think it would be nice to have the community name in the path as well.

Just as a reference, here are a few example links from other frontends:

Voyager:
https://vger.app/posts/lemmy.zip/u/Stamets@lemmy.dbzer0.com
https://vger.app/posts/lemmy.zip/c/whitepeopletwitter@sh.itjust.works/comments/57940056

Blorp:
https://blorpblorp.xyz/home/c/technology@lemmy.world/posts/https%3A%2F%2Flemmy.world%2Fpost%2F42282750
(blorp interestingly uses the AP-id in the URL)

Alexandrite:
https://a.lemmy.world/lemmy.world/post/42382934

I realize these would probably be some pretty big changes though, so we could definitely save it for a different PR, especially considering this one is already huge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it would be good to be consistent with the other frontends. I think blorp's way of using the apid is probably the best from a compatibility with different servers standpoint. Especially for sharing links. But we would have to support fetching via the apid rather than server specific id, so maybe down the road.

Should we do something like
https://interstellar.com/${instance}/u/${user_name}
https://interstellar.com/${instance}/c/${community_name}/thread/${postId}
https://interstellar.com/${instance}/c/${community_name}/microblog/${postId}

I also want to add routes for the different feed filters. e.g. /all, /subscribed, /moderated etc.
So yeah this PR should be for getting it working and then in another PR we can make sure the routes are consistent and comprehensive.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think it would be nice to support a "default" instance, in case Interstellar is set up as an alternative frontend. For example, if I set up Interstellar running at i.kbin.earth, it would be nice if I could set kbin.earth to be the default server, and the URL path not include the domain if you are signed into kbin.earth. I think the path would look cleaner this way, and I could see this being useful if you want to view a link on the alternative frontend, just by changing the domain in your browser. So you might be able to do the following:

https://kbin.earth/u/jwr1 -> https://i.kbin.earth/u/jwr1
https://kbin.earth/m/steamdeck@sopuli.xyz/t/2360294/ -> https://i.kbin.earth/m/steamdeck@sopuli.xyz/t/2360294/ -> https://i.kbin.earth/c/steamdeck@sopuli.xyz/thread/2360294/ (we could set up a redirect in the router to make this once work.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be neat. Like being able to switch between old.reddit.com and reddit.com without changing the rest of the url.

Update redirect uri to be more general.
Remove unneeded comment in main.
Update .gitignore to ignore generated route files.
@jwr1
Copy link
Member

jwr1 commented Jan 30, 2026

The linux build is failing because to handle oauth redirects in the browser I added a package which has a dependency on webkit2gtk-4.1 which will need to be added to the workflow script.

It looks like that dependency is required to create a web view on Linux, which we don't need. I'm assuming we will still have to include webkit2gtk? It would be nice if there were a way to mark it as unneeded.

@jwr1
Copy link
Member

jwr1 commented Feb 1, 2026

Can you try signing in again? I just removed our custom HTTP server, and it was working fine on my device (Linux). Are you using Linux or Windows?

@olorin99
Copy link
Contributor Author

olorin99 commented Feb 2, 2026

Can confirm it works for me on linux.

# Conflicts:
#	lib/src/screens/settings/debug/debug_screen.dart
#	lib/src/widgets/content_item/content_info.dart
#	lib/src/widgets/content_item/content_item.dart
#	lib/src/widgets/tags/tag_screen.dart
#	pubspec.lock
#	pubspec.yaml
@jwr1
Copy link
Member

jwr1 commented Feb 2, 2026

Unfortuently, due to the oauth callback url being different on Android, iOS, and macOS, users will need to sign out and back in to all their Mbin accounts again. I haven't tested, but I think we could still use localhost for iOS and macOS, but I did try using it with Android to no luck. Should we test if localhost would work for iOS and macOS, and change it back if so?

@olorin99
Copy link
Contributor Author

olorin99 commented Feb 3, 2026

Getting people to sign out and back in again will be a hassle. Would it be viable to add a migration which sets the oauthIdentifiers from the servers table to null. Which should then prompt the user to relog when a request fails.

@jwr1
Copy link
Member

jwr1 commented Feb 3, 2026

Getting people to sign out and back in again will be a hassle. Would it be viable to add a migration which sets the oauthIdentifiers from the servers table to null. Which should then prompt the user to relog when a request fails.

I hadn't thought about that, but if you think you could make it work, it definitely sounds better than making users remove all of their accounts and log back in one by one. Actually, now that you mention it, it's not a bad idea to have a system like that in place for future similar occurrences as well, such as OAuth scope changes.

I'll go ahead and get this merged though.

@jwr1 jwr1 merged commit c2c3c92 into main Feb 3, 2026
2 checks passed
@jwr1 jwr1 deleted the navigation_update branch February 3, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants