Commit graph

19 commits

Author SHA1 Message Date
Ben Busby a843b322c9
Redirect x.com links to nitter instances
Closes #136
2023-09-28 14:24:01 -06:00
NoPlagiarism 9104650cfe
Add GotHub support (#116)
Adds support for GotHub, an alternative frontend for GitHub

---------

Co-authored-by: Ben Busby <contact@benbusby.com>
2023-07-17 15:15:51 -06:00
Ben Busby 6f647f52ae
Add support for Anonymous Overflow
A Stack Overflow frontend, see:
https://github.com/httpjamesm/AnonymousOverflow
2023-05-19 12:42:06 -06:00
Ben Busby 0ce0832a28
Add support for BreezeWiki
Includes nightly build support for automatically pulling the most up to
date instance list.

Closes #104
2023-05-19 10:57:43 -06:00
Ben Busby 7f430a5c41
Fix auto-redirect regex for gtranslate vs gsearch
The redirect regex for google search (~r/google.com) would also match
for google translate requests. This updates the search regex to also
require the "/search" path to be present in the original link.
2023-03-14 12:38:02 -06:00
FriendlyPigeon 16cc680c7d
Add parent relation for whoogle (#84) 2023-01-13 19:49:35 -07:00
Ben Busby 2a858b89d2
Ignore request types in router
Request types don't really matter in Farside, and should be ignored.
This updates the router to handle all request types (GET, HEAD, POST,
etc) the same as GET requests were handled previously.
2022-12-11 13:14:40 -07:00
Ben Busby e58d6e23ed
Remove Redis dep, replace w/ native Elixir lib
This removes the dependency on Redis for core app functionality. Rather
than using the key/value store provided by Redis, Farside now uses a
key/val store provided by [cubdb](https://github.com/lucaong/cubdb) for
identical functionality but without reliance on a non-Elixir service.

This solution was chosen instead of ets, because storing instance data
in memory leads to a period of broken functionality whenever the app
restarts and hasn't re-populated instance data yet. It was also chosen
instead of dets, because the documentation for dets was pretty hard to
understand at first glance.

Tests and the CI build were updated to reflect the removed dependency on
Redis.

New environment variable `FARSIDE_DATA_DIR` can be used to point to a
directory where the instance data can be stored by cubdb.

Co-authored-by: Jason Clark <mithereal@gmail.com>
2022-10-31 16:45:31 -06:00
alvv-z 431ea613d1
Fix spelling of quetre (#55) 2022-07-31 11:05:48 -06:00
Ben Busby 8fbe016cdb
Support libremdb and querte (imdb and quora alts)
Includes support for redirecting via full url, ie:

-> farside.link/https://www.imdb.com/title/tt0133093/

will redirect to a libremdb instance.

Closes #48
2022-07-27 17:14:15 -06:00
Ben Busby 32259f849b
Add proxitok (TikTok frontend)
Closes #19
2022-06-21 16:12:12 -06:00
Ben Busby d280f961f5
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).
2022-06-21 15:53:16 -06:00
Ben Busby 52833ef89e
Redirect youtu.be links to the correct instance
Farside was previously only looking for links containing "youtube.com"
when performing the redirect for full URLs to youtube, which obviously
doesn't work for youtu.be shortened links. This updates the matching
logic to use a regex element for every key in the services map in order
to match against multiple possible domains for each parent service.

Fixes #40
2022-06-21 15:01:23 -06:00
Ben Busby 5006b97dfa
Auto select frontend for links to "parent" service
Farside now supports redirecting based on a provided link to a "parent"
service, if such a parent service is supported.

For example, a link such as:

farside.link/https://www.youtube.com/watch?v=dQw4w9WgXcQ

will now redirect to any of the available YouTube related frontends.

This works by matching against a mapping of "parent" service domains
("youtube.com", "reddit.com", etc) to a list of their respective frontend
alternatives (["invidious", "piped"], ["libreddit", "teddit"], etc). A
random element is chosen from this list, and the remainder of Farside's
routing logic proceeds as if the user had chosen the service directly to
begin with.

Closes #37
2022-06-09 13:08:01 -06:00
Ben Busby 22e9135e0c
Reuse previous instance within rate-limit interval
Rather than blocking <1s back-to-back queries from the same IP, Farside
will now re-use the previously selected instance.

Fixes #20
2022-03-18 13:51:37 -06:00
Ben Busby 8ee4f308a4
Prevent same instance from being selected twice in a row
Introduces a new db key "<service>-previous" to track which instance was
last selected for a particular service. This allows for filtering the
list of available instances to exclude the instance that was last
picked, to ensure a (slightly) more even distribution of traffic.
There's still the possiblity of the following scenario, however:

:service instances > 2

/:service request #1 -> instance #1
/:service request #2 -> instance #2
/:service request #3 -> instance #1
/:service request #4 -> instance #2

where there are many ignored instances for a particular service. One
possible solution would be to implement the "<service>-previous" value
to be a list, rather than a single value, and push to that list until
only one element is left in the original "instance" array after
filtering, and then delete the "<service>-previous" key.
2021-11-10 12:19:37 -07:00
Ben Busby 71fb89e028
Move instance selection logic out of router
The process of selecting a random (working) instance for a specified
service has been moved out of the router and into lib/farside.ex. Moving
forward, the router itself should have very simple and easy to follow
logic for all paths.
2021-11-10 11:50:19 -07:00
Ben Busby 2189c9ddca
Simplify retrieval of service keys from redis
Can just use a wildcard in the initial keys query, rather than grabbing
all keys and filtering by service prefix.
2021-11-10 10:47:04 -07:00
Ben Busby 56b9c52528
Display list of available instances on home page
This introduces a number of new changes:
- Services are now inserted into redis with a prefix prepended to the
key name. This allows for easier filtering to get only live instances.
- The home page now uses an eex template for displaying all live
instances for every service, determined by the last update
- A "last_updated" field was added
- farside.ex was added to contain all functionality related to querying
for instances (WIP)
- Other improvements
2021-11-08 17:08:19 -07:00