Endpoint resolution should be done on each "login"
Describe the bug At present the application performs some initial steps to determine the correct endpoint to use for the API.
This is only done once at the point a user adds an account to the application (see here). After the endpoint is resolved it is stored in the users account and used going forward for all API calls.
This works but will break in the future should Lemmy introduce a new /v4 route which has been discussed as part of the upcoming 0.19.0 changes, although does not appear to be the current plan.
At some stage in the future however we should expect a new version of the API to appear, at which point all users would be stuck on the version they initially created their account on 🙈
Expected Behavior Instead of only resolving the correct API endpoint at account creation endpoint resolution should be attempted on app start-up / login for a user to ensure we catch changes to API version used by their instance.
Actual Behavior
Existing accounts will always use their original API endpoint, eg <instance>/api/v3/<route>
To Reproduce
As of today all instances are using /v3 so it's not one that can be easily reproduced, just an observation that our logic is flawed and will break at some time in the future.
Mlem Information:
latest dev, but been like this since the beginning
Looks like v4 may happen sometime soon. We should look into supporting that.
https://github.com/LemmyNet/lemmy/issues/4428
In Mlem v2 we store the base URL of the account instance, excluding the /api/v3 path. We then append the api/v3 when the ApiClient is created.