sunaurus,

Hey! Do I understand correctly that your app is trying to fetch any /post/<id> directly from its source instance API? If so, I have a few ideas:

  1. If you detect anything that looks like a Lemmy post URL (<host>/post/<id>), you could first try to make a request to <host>/version, and only treat the post as a Lemmy post if you get a JSON response from that endpoint where .software.name === ‘lemmy’. Otherwise, open that URL in the browser.

  2. The above will already “fix” the issue, but custom frontends on subdomains is actually quite common, so if you want to handle those links without resorting to a browser, then: in cases where <host>/version is not a Lemmy response, but <host> includes a subdomain, you could repeat the same logic from step 1 for the parent domain as well. If you detect a Lemmy API at the parent domain, then just use that to fetch the post.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • summit@lemmy.world
  • modclub
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • everett
  • InstantRegret
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • anitta
  • kavyap
  • GTA5RPClips
  • cubers
  • JUstTest
  • osvaldo12
  • tacticalgear
  • Durango
  • khanakhh
  • ngwrru68w68
  • provamag3
  • Leos
  • tester
  • cisconetworking
  • ethstaker
  • megavids
  • normalnudes
  • lostlight
  • All magazines