1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-05-04 17:40:02 +00:00

Prepend /u/ for Bibliogram redirects if not present

Bibliogram links require a "/u/" prefix when viewing a user's profile,
which does not match Instagram's URL paradigm. This adds a bit of logic
for Bibliogram links to prepend this prefix if the user is not visiting
a post (indicated by a "/p/" prefix, which Bibliogram and Instagram BOTH
use) or the home page of an instance (indicated by an empty path value).
This commit is contained in:
Ben Busby 2022-06-21 15:53:16 -06:00
parent 52833ef89e
commit d280f961f5
No known key found for this signature in database
GPG key ID: B9B7231E01D924A1
2 changed files with 39 additions and 10 deletions

View file

@ -66,9 +66,11 @@ defmodule Farside.Router do
conn.assigns[:throttle] != nil ->
Farside.get_service(service_name)
|> Farside.last_instance
|> Farside.amend_instance(service_name, path)
true ->
Farside.get_service(service_name)
|> Farside.pick_instance
|> Farside.amend_instance(service_name, path)
end
# Redirect to the available instance