From 4067ef431a86c0d4fd85a40eac673ff8e67a425f Mon Sep 17 00:00:00 2001 From: Ben Busby Date: Thu, 27 Jan 2022 11:42:39 -0700 Subject: [PATCH] Use "_" path prefix, update readme --- README.md | 6 ++++++ lib/farside/router.ex | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2c0bd9f..643dafb 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,12 @@ Farside's routing is very minimal, with only the following routes: URL>/r/popular` - Note that a path is not required. `/libreddit` for example will still 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 the list of working instances from Redis and returns a random one from the list diff --git a/lib/farside/router.ex b/lib/farside/router.ex index c5e8567..2f0216c 100644 --- a/lib/farside/router.ex +++ b/lib/farside/router.ex @@ -25,7 +25,7 @@ defmodule Farside.Router do send_resp(conn, 200, resp) end - get "/r/:service/*glob" do + get "/_/:service/*glob" do r_path = String.slice(conn.request_path, 2..-1) resp =