mirror of
https://github.com/benbusby/farside.git
synced 2025-04-20 02:48:42 +00:00
parent
7f26ab3bbf
commit
99b13b3aa6
4 changed files with 20 additions and 35 deletions
|
@ -8,7 +8,7 @@ defmodule Farside do
|
|||
# farside.link/https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
||||
@youtube_regex ~r/youtu(.be|be.com)|invidious|piped/
|
||||
@reddit_regex ~r/reddit.com|libreddit|redlib/
|
||||
@instagram_regex ~r/instagram.com|bibliogram/
|
||||
@instagram_regex ~r/instagram.com|proxigram/
|
||||
@twitter_regex ~r/twitter.com|nitter/
|
||||
@wikipedia_regex ~r/wikipedia.org|wikiless/
|
||||
@medium_regex ~r/medium.com|scribe/
|
||||
|
@ -23,7 +23,7 @@ defmodule Farside do
|
|||
@parent_services %{
|
||||
@youtube_regex => ["invidious", "piped"],
|
||||
@reddit_regex => ["libreddit", "redlib"],
|
||||
@instagram_regex => ["bibliogram"],
|
||||
@instagram_regex => ["proxigram"],
|
||||
@twitter_regex => ["nitter"],
|
||||
@wikipedia_regex => ["wikiless"],
|
||||
@medium_regex => ["scribe"],
|
||||
|
@ -114,24 +114,6 @@ defmodule Farside do
|
|||
instance
|
||||
end
|
||||
|
||||
def amend_instance(instance, service, path) do
|
||||
cond do
|
||||
String.match?(service, @instagram_regex) ->
|
||||
# Bibliogram doesn't have a 1:1 matching to Instagram URLs for users,
|
||||
# so a "/u" is appended if the requested path doesn't explicitly include
|
||||
# "/p" for a post or an empty path for the home page.
|
||||
if String.length(path) > 0 and
|
||||
!String.starts_with?(path, "p/") and
|
||||
!String.starts_with?(path, "u/") do
|
||||
"#{instance}/u"
|
||||
else
|
||||
instance
|
||||
end
|
||||
true ->
|
||||
instance
|
||||
end
|
||||
end
|
||||
|
||||
def get_last_updated do
|
||||
CubDB.get(CubDB, "last_updated")
|
||||
end
|
||||
|
|
|
@ -62,7 +62,6 @@ defmodule Farside.Router do
|
|||
true ->
|
||||
instance = Farside.get_service(service_name)
|
||||
|> Farside.pick_instance
|
||||
|> Farside.amend_instance(service_name, path)
|
||||
|
||||
# Redirect to the available instance
|
||||
conn
|
||||
|
|
|
@ -65,15 +65,17 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"type": "bibliogram",
|
||||
"type": "proxigram",
|
||||
"test_url": "/p/Ch2WRmiLMjj",
|
||||
"fallback": "https://bibliogram.1d4.us",
|
||||
"fallback": "https://ig.opnxng.com",
|
||||
"instances": [
|
||||
"https://bibliogram.1d4.us",
|
||||
"https://bibliogram.froth.zone",
|
||||
"https://bibliogram.priv.pw",
|
||||
"https://ig.femboy.hu",
|
||||
"https://ig.tokhmi.xyz"
|
||||
"https://ig.opnxng.com",
|
||||
"https://proxigram.lunar.icu",
|
||||
"https://gram.whatever.social",
|
||||
"https://ig.snine.nl",
|
||||
"https://ig.floppa.one",
|
||||
"https://proxigram.kyun.li",
|
||||
"https://proxigram.ducks.party"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -58,15 +58,17 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"type": "bibliogram",
|
||||
"type": "proxigram",
|
||||
"test_url": "/p/Ch2WRmiLMjj",
|
||||
"fallback": "https://bibliogram.1d4.us",
|
||||
"fallback": "https://ig.opnxng.com",
|
||||
"instances": [
|
||||
"https://bibliogram.1d4.us",
|
||||
"https://bibliogram.froth.zone",
|
||||
"https://bibliogram.priv.pw",
|
||||
"https://ig.femboy.hu",
|
||||
"https://ig.tokhmi.xyz"
|
||||
"https://ig.opnxng.com",
|
||||
"https://proxigram.lunar.icu",
|
||||
"https://gram.whatever.social",
|
||||
"https://ig.snine.nl",
|
||||
"https://ig.floppa.one",
|
||||
"https://proxigram.kyun.li",
|
||||
"https://proxigram.ducks.party"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue