Skip to content

Commit

Permalink
ImageView: add more hosts for source icons (#212)
Browse files Browse the repository at this point in the history
* ImageView: add more hosts for source icons

* fix compile errors
  • Loading branch information
mdashlw authored Mar 23, 2024
1 parent 89aa180 commit 3395cd1
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions lib/philomena_web/views/image_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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"] ->
Expand All @@ -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"] ->
Expand All @@ -354,7 +372,8 @@ defmodule PhilomenaWeb.ImageView do
"furbooru.org",
"inkbunny.net",
"e621.net",
"e926.net"
"e926.net",
"sofurry.com"
] ->
"fa fa-paw"

Expand All @@ -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
Expand Down

0 comments on commit 3395cd1

Please sign in to comment.