2021-11-12 17:04:34 -07:00
|
|
|

|
2021-11-08 17:30:45 -07:00
|
|
|
|
2021-11-12 18:51:50 -07:00
|
|
|
[](https://github.com/benbusby/farside/releases)
|
|
|
|
[](http://opensource.org/licenses/MIT)
|
2021-10-26 21:26:09 -06:00
|
|
|
[](https://github.com/benbusby/privacy-revolver/actions/workflows/elixir.yml)
|
|
|
|
|
2021-11-12 18:51:50 -07:00
|
|
|
A redirecting service for FOSS alternative frontends.
|
|
|
|
|
|
|
|
[Farside](https://farside.link) provides links that automatically redirect to
|
|
|
|
working instances of privacy-oriented alternative frontends, such as Nitter,
|
|
|
|
Libreddit, etc. This allows for users to have more reliable access to the
|
|
|
|
available public instances for a particular service, while also helping to
|
|
|
|
distribute traffic more evenly across all instances and avoid performance
|
|
|
|
bottlenecks and rate-limiting.
|
|
|
|
|
|
|
|
## Demo
|
|
|
|
|
2021-12-16 09:24:14 -07:00
|
|
|
Farside's links work with the following structure: `farside.link/<service>/<path>`
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
2021-11-12 18:51:50 -07:00
|
|
|
| Service | Page | Farside Link |
|
|
|
|
| -- | -- | -- |
|
|
|
|
| [Libreddit](https://github.com/spikecodes/libreddit) | /r/popular | https://farside.link/libreddit/r/popular
|
2021-12-16 09:21:38 -07:00
|
|
|
| [Teddit](https://codeberg.org/teddit/teddit) | /r/popular | https://farside.link/teddit/r/popular
|
2021-11-12 18:51:50 -07:00
|
|
|
| [Nitter](https://github.com/zedeus/nitter) | User Profile | https://farside.link/nitter/josevalim
|
|
|
|
| [Invidious](https://github.com/iv-org/invidious) | Home Page | https://farside.link/invidious
|
2021-12-16 09:21:38 -07:00
|
|
|
| [Piped](https://github.com/TeamPiped/Piped) | Video Page | https://farside.link/piped/watch?v=eBGIQ7ZuuiU
|
2021-11-12 18:51:50 -07:00
|
|
|
| [Bibliogram](https://sr.ht/~cadence/bibliogram/) | User Profile | https://farside.link/bibliogram/u/kbdfans
|
2021-12-21 00:01:36 -07:00
|
|
|
| [Whoogle](https://github.com/benbusby/whoogle-search) | Search "Elixir" | https://farside.link/whoogle/search?q=elixir&lang_interface=en
|
2021-11-15 19:07:06 -07:00
|
|
|
| [Searx](https://github.com/searx/searx) | Search "Redis" | https://farside.link/searx/search?q=redis
|
2021-12-16 09:21:38 -07:00
|
|
|
| [SimplyTranslate](https://git.sr.ht/~metalune/simplytranslate_web) | Translate "hola" | https://farside.link/simplytranslate/?engine=google&text=hola
|
2021-12-17 09:45:06 -07:00
|
|
|
| [Lingva](https://github.com/TheDavidDelta/lingva-translate) | Translate "bonjour" | https://farside.link/lingva/auto/en/bonjour
|
2021-11-12 18:51:50 -07:00
|
|
|
|
|
|
|
## How It Works
|
|
|
|
|
2021-11-24 09:35:21 -07:00
|
|
|
The app runs with an internally scheduled cron task that queries all instances
|
|
|
|
for services defined in [services.json](services.json) every 5 minutes. For
|
|
|
|
each instance, as long as the instance takes <5 seconds to respond and returns
|
2021-12-28 12:33:04 -07:00
|
|
|
a successful response code, the instance is added to a list of available
|
|
|
|
instances for that particular service. If not, it is discarded until the next
|
|
|
|
update period.
|
2021-11-12 18:51:50 -07:00
|
|
|
|
|
|
|
Farside's routing is very minimal, with only the following routes:
|
2021-11-07 12:29:06 -07:00
|
|
|
|
2021-11-12 18:51:50 -07:00
|
|
|
- `/`
|
|
|
|
- The app home page, displaying all live instances for every service
|
|
|
|
- `/ping`
|
|
|
|
- A passthrough "ping" to redis to ensure both app and redis are working
|
|
|
|
- `/:service/*glob`
|
|
|
|
- The main endpoint for redirecting a user to a working instance of a
|
|
|
|
particular service with the specified path
|
|
|
|
- Ex: `/libreddit/r/popular` would navigate to `<libreddit instance
|
|
|
|
URL>/r/popular`
|
|
|
|
- Note that a path is not required. `/libreddit` for example will still
|
|
|
|
redirect the user to a working libreddit instance
|
|
|
|
|
|
|
|
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
|
|
|
|
and adds that instance as a new entry in Redis to remove from subsequent
|
|
|
|
requests for that service. For example:
|
|
|
|
|
|
|
|
A user navigates to `/nitter` and is redirected to `nitter.net`. The next user
|
|
|
|
to request `/nitter` will be guaranteed to not be directed to `nitter.net`, and
|
|
|
|
will instead be redirected to a separate (random) working instance. That
|
|
|
|
instance will now take the place of `nitter.net` as the "reserved" instance, and
|
2021-12-09 15:33:58 -07:00
|
|
|
`nitter.net` will be returned to the list of available Nitter instances.
|
2021-11-12 18:51:50 -07:00
|
|
|
|
|
|
|
This "reserving" of previously chosen instances is performed in an attempt to
|
|
|
|
ensure better distribution of traffic to available instances for each service.
|
|
|
|
|
|
|
|
Farside also has built-in IP ratelimiting for all requests, enforcing only one
|
|
|
|
request per second per IP.
|
|
|
|
|
|
|
|
## Development
|
2021-11-07 12:29:06 -07:00
|
|
|
|
|
|
|
- Install [redis](https://redis.io)
|
|
|
|
- Install [elixir](https://elixir-lang.org/install.html)
|
|
|
|
- Start redis: `redis-server /usr/local/etc/redis.conf`
|
|
|
|
- Install dependencies: `mix deps.get`
|
2021-11-24 09:35:21 -07:00
|
|
|
- Initialize redis contents: `mix run -e Farside.Instances.sync`
|
2021-11-07 12:29:06 -07:00
|
|
|
- Run Farside: `mix run --no-halt`
|
|
|
|
- Uses localhost:4001
|
2021-11-12 18:51:50 -07:00
|
|
|
|
2021-11-15 20:09:34 -07:00
|
|
|
### Environment Variables
|
|
|
|
|
|
|
|
| Name | Purpose |
|
|
|
|
| -- | -- |
|
2021-12-09 15:33:58 -07:00
|
|
|
| FARSIDE_TEST | If enabled, bypasses the instance availability check and adds all instances to the pool. |
|