ImageView: add more hosts for source icons (#212)

* ImageView: add more hosts for source icons

* fix compile errors
This commit is contained in:
mdashlw 2024-03-23 18:56:07 +03:00 committed by GitHub
parent 89aa180c8e
commit 3395cd1470
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -305,13 +305,24 @@ defmodule PhilomenaWeb.ImageView do
uri = URI.parse(source)
case uri.host do
u when u in ["twitter.com", "www.twitter.com", "pbs.twimg.com", "twimg.com"] ->
u
when u in [
"twitter.com",
"www.twitter.com",
"mobile.twitter.com",
"x.com",
"mobile.x.com",
"pbs.twimg.com",
"twimg.com"
] ->
"fab fa-twitter"
u when u in ["deviantart.com", "www.deviantart.com", "sta.sh", "www.sta.sh"] ->
u
when u in ["deviantart.com", "sta.sh", "www.sta.sh"] ->
"fab fa-deviantart"
u when u in ["cdn.discordapp.com", "discordapp.com", "discord.com"] ->
u
when u in ["cdn.discordapp.com", "discordapp.com", "discord.com", "media.discordapp.net"] ->
"fab fa-discord"
u when u in ["youtube.com", "www.youtube.com"] ->
@ -329,7 +340,14 @@ defmodule PhilomenaWeb.ImageView do
u when u in ["patreon.com", "www.patreon.com"] ->
"fab fa-patreon"
u when u in ["ych.art", "ych.commishes.com", "commishes.com"] ->
u
when u in [
"ych.art",
"ych.commishes.com",
"commishes.com",
"portfolio.commishes.com",
"commishes.io"
] ->
"fa fa-palette"
u when u in ["artstation.com", "www.artstation.com"] ->
@ -354,7 +372,8 @@ defmodule PhilomenaWeb.ImageView do
"furbooru.org",
"inkbunny.net",
"e621.net",
"e926.net"
"e926.net",
"sofurry.com"
] ->
"fa fa-paw"
@ -373,16 +392,24 @@ defmodule PhilomenaWeb.ImageView do
"vulpine.club",
"yiff.life",
"socel.net",
"octodon.social"
"octodon.social",
"filly.social",
"pone.social",
"hooves.social"
] ->
"fab fa-mastodon"
u
when u in ["tumbex.com", "www.tumbex.com", "tumblr.com"] ->
"fab fa-tumblr"
link ->
cond do
Enum.member?(site_domains, link) -> "favicon-home"
String.contains?(link, "tumblr") -> "fab fa-tumblr"
String.contains?(link, "deviantart") -> "fab fa-deviantart"
String.contains?(link, "sofurry") -> "fa fa-paw"
String.ends_with?(link, ".tumblr.com") -> "fab fa-tumblr"
String.ends_with?(link, ".deviantart.com") -> "fab fa-deviantart"
String.ends_with?(link, ".sofurry.com") -> "fa fa-paw"
String.ends_with?(link, ".userapi.com") -> "fab fa-vk"
true -> "fa fa-link"
end
end