mirror of
https://github.com/benbusby/farside.git
synced 2025-04-29 23:20:03 +00:00
Add support for BreezeWiki
Includes nightly build support for automatically pulling the most up to date instance list. Closes #104
This commit is contained in:
parent
dd51523faf
commit
0ce0832a28
4 changed files with 56 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
defmodule Farside do
|
||||
@service_prefix Application.fetch_env!(:farside, :service_prefix)
|
||||
@fallback_suffix Application.fetch_env!(:farside, :fallback_suffix)
|
||||
@previous_suffix Application.fetch_env!(:farside, :previous_suffix)
|
||||
@service_prefix Application.compile_env!(:farside, :service_prefix)
|
||||
@fallback_suffix Application.compile_env!(:farside, :fallback_suffix)
|
||||
@previous_suffix Application.compile_env!(:farside, :previous_suffix)
|
||||
|
||||
# Define relation between available services and their parent service.
|
||||
# This enables Farside to redirect with links such as:
|
||||
|
@ -19,6 +19,7 @@ defmodule Farside do
|
|||
@imdb_regex ~r/imdb.com|libremdb/
|
||||
@quora_regex ~r/quora.com|quetre/
|
||||
@gsearch_regex ~r/google.com\/search|whoogle/
|
||||
@fandom_regex ~r/fandom.com|breezewiki/
|
||||
|
||||
@parent_services %{
|
||||
@youtube_regex => ["invidious", "piped"],
|
||||
|
@ -33,7 +34,8 @@ defmodule Farside do
|
|||
@tiktok_regex => ["proxitok"],
|
||||
@imdb_regex => ["libremdb"],
|
||||
@quora_regex => ["quetre"],
|
||||
@gsearch_regex => ["whoogle"]
|
||||
@gsearch_regex => ["whoogle"],
|
||||
@fandom_regex => ["breezewiki"]
|
||||
}
|
||||
|
||||
def get_services_map do
|
||||
|
@ -127,6 +129,15 @@ defmodule Farside do
|
|||
else
|
||||
instance
|
||||
end
|
||||
String.match?(service, @fandom_regex) ->
|
||||
# Fandom links require the subdomain to be preserved, otherwise the
|
||||
# requested path won't work.
|
||||
if String.contains?(service, ".fandom.com") do
|
||||
wiki = String.replace(service, ".fandom.com", "")
|
||||
"#{instance}/#{wiki}"
|
||||
else
|
||||
instance
|
||||
end
|
||||
true ->
|
||||
instance
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue