you-apps / WallYou

Privacy focused wallpaper app built with MD3
https://you-apps.net
GNU General Public License v3.0
618 stars 33 forks source link

feat: support for lemmy #121

Closed Bnyro closed 1 year ago

SuhasDissa commented 1 year ago

Btw just wondering, don't we have to change base url to access posts from another instance?

Bnyro commented 1 year ago

No, due to federation between instances we don't need to. We can just pass communitname@exampleinstance.com as community_name and it will work if they are federated (lemmy.ml is the official instance and federated to almost all other public lemmy instances).

We could also change base url, but that would require us to recreate a retrofit instance each time the user changes the instance of the community.

Now, we rely on the official instance to always be up though - not sure what's better. We should probably directly connect to the instance the community lives on - in a separate PR.

SuhasDissa commented 1 year ago

Using the official instance seems good enough.

Anyway you don't have to recreate the retrofit instance every time you change the instance. Instead you can do something like this

@GET("https://{instance}/api/v3/post/list")
    suspend fun getLemmyData(
        @Path("instance") instance: String,
        @Query("community_name") community: String,
        @Query("sort") sort: String
    ): LemmyResponse

Which is more efficient than recreating retrofit IMO

Bnyro commented 1 year ago

Yeah, true.

Bnyro commented 1 year ago

We can also use @Url url: String btw :)