1
0
Fork 0
mirror of https://github.com/benbusby/farside.git synced 2025-06-08 02:16:36 +00:00

Use "_" path prefix, update readme

This commit is contained in:
Ben Busby 2022-01-27 11:42:39 -07:00
parent 2d90b9e43a
commit 4067ef431a
No known key found for this signature in database
GPG key ID: B9B7231E01D924A1
2 changed files with 7 additions and 1 deletions

View file

@ -55,6 +55,12 @@ Farside's routing is very minimal, with only the following routes:
URL>/r/popular` URL>/r/popular`
- Note that a path is not required. `/libreddit` for example will still - Note that a path is not required. `/libreddit` for example will still
redirect the user to a working libreddit instance redirect the user to a working libreddit instance
- `/_/:service/*glob`
- Achieves the same redirect as the main `/:service/*glob` endpoint, but
preserves a short landing page in the browser's history to allow quickly
jumping between instances by navigating back.
- Ex: `/_/nitter` -> nitter instance A -> (navigate back one page) -> nitter
instance B -> ...
When a service is requested with the `/:service/...` endpoint, Farside requests When a service is requested with the `/:service/...` endpoint, Farside requests
the list of working instances from Redis and returns a random one from the list the list of working instances from Redis and returns a random one from the list

View file

@ -25,7 +25,7 @@ defmodule Farside.Router do
send_resp(conn, 200, resp) send_resp(conn, 200, resp)
end end
get "/r/:service/*glob" do get "/_/:service/*glob" do
r_path = String.slice(conn.request_path, 2..-1) r_path = String.slice(conn.request_path, 2..-1)
resp = resp =