thunder-app / thunder

Thunder - An open-source cross-platform Lemmy client for iOS and Android built with Flutter
https://thunderapp.dev
GNU Affero General Public License v3.0
732 stars 62 forks source link

Open lemmy links in this app #60

Closed BardiaB8 closed 2 days ago

BardiaB8 commented 11 months ago

Is your feature request related to a problem? Please describe. It currently isn't possible to open a post from a link in this app.

Describe the solution you'd like Thunder to appear as an option to open Lemmy links.

Describe alternatives you've considered Thunder could appear as an app that you can share links to, and open them if they are Lemmy links.

hjiangsu commented 11 months ago

For this, did you mean that a lemmy link outside of Thunder (e.g., on the browser) should be redirected to Thunder?

BardiaB8 commented 11 months ago

Yes, that's exactly what I mean.

hjiangsu commented 11 months ago

Ahh, okay - for that, it might take a bit more time to integrate that feature as I'm not too familiar with it. If there is anyone that might know how this could be implemented, feel free to discuss about it here

However, I agree that it would be a nice addition! I'll keep it in mind but it might be lower priority as compared to some other features (unless the community votes otherwise)

suoko commented 11 months ago

I would Also like to share to thunder the links I visit with my browser

everdred commented 8 months ago

If there is anyone that might know how this could be implemented, feel free to discuss about it here

@hjiangsu On the Android side, here's how a couple of other open source Android clients implement it:

https://github.com/dessalines/jerboa/blob/main/app/src/main/AndroidManifest.xml https://codeberg.org/Bazsalanszky/Eternity/src/branch/master/app/src/main/AndroidManifest.xml

Those apps seem to include ~50 of the most common instances. The user can then go in to the OS's App Info (for the client) > Open by default > Add link, and check or uncheck as many of the listed domains as they want.

micahmo commented 8 months ago

Looks like Jerboa queries https://api.fediverse.observer to auto-generate that list. Not a bad idea!

https://github.com/dessalines/jerboa/blob/d3c61ac712b171d2411f017142c5e82435f29886/app/update_instances.gradle.kts#L17-L21

As a fallback, we could also allow any link to be shared with Thunder, and if we detect that it's a Lemmy link, we can do smart navigation.

P.S. This same technique (either a hard-coded list, or auto-detect, or a combination) can be used for in-app nav from links in posts.


EDIT

If we want to follow a similar approach, we can use curl to perform a GraphQL query on https://api.fediverse.observer and then throw the results in a file. We should probably check their API terms, but right now it seems free with no limits. Here's an example query.

curl -H 'Content-Type: application/json' -X POST \
-d '{"query": "query {nodes(softwarename: \"lemmy\") {domain active_users_monthly}}"}' https://api.fediverse.observer 2> /dev/null | \
jq -r '.data.nodes | .[] | select(.active_users_monthly > 50) | .domain'
---
beehaw.org
www.hexbear.net
geddit.social
dataterm.digital
lemmy.ml
...

For handling these links in-app, looks like the app_links package is a good one-stop shop, although there is still platform-specific setup required.

hjiangsu commented 6 months ago

This should now be done for Android with the nightly versions (0.2.5-x). Still working on iOS support in https://github.com/thunder-app/thunder/pull/868 so I'll keep this as in-progress