From 5a6b2bd8747b51eae947c0dd5372505ad16f9abf Mon Sep 17 00:00:00 2001 From: mdashlw Date: Fri, 5 Apr 2024 15:07:54 +0300 Subject: [PATCH] feat: more icons for source urls (#220) --- lib/philomena_web/views/image_view.ex | 63 ++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 11 deletions(-) diff --git a/lib/philomena_web/views/image_view.ex b/lib/philomena_web/views/image_view.ex index a0d5308e..dc9d9be8 100644 --- a/lib/philomena_web/views/image_view.ex +++ b/lib/philomena_web/views/image_view.ex @@ -323,15 +323,22 @@ defmodule PhilomenaWeb.ImageView do "sta.sh", "www.sta.sh", "images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com", - "wixmp-ed30a86b8c4ca887773594c2.wixmp.com" + "wixmp-ed30a86b8c4ca887773594c2.wixmp.com", + "api-da.wixmp.com", + "fav.me" ] -> "fab fa-deviantart" u - when u in ["cdn.discordapp.com", "discordapp.com", "discord.com", "media.discordapp.net"] -> + when u in [ + "cdn.discordapp.com", + "discordapp.com", + "discord.com", + "discord.gg" + ] -> "fab fa-discord" - u when u in ["youtube.com", "www.youtube.com", "youtu.be"] -> + u when u in ["youtube.com", "www.youtube.com", "youtu.be", "m.youtube.com"] -> "fab fa-youtube" u when u in ["pillowfort.social", "www.pillowfort.social"] -> @@ -340,9 +347,13 @@ defmodule PhilomenaWeb.ImageView do u when u in ["vk.com", "vk.ru"] -> "fab fa-vk" - u when u in ["pixiv.net", "www.pixiv.net", "artfight.net", "www.artfight.net"] -> + u + when u in ["artfight.net", "www.artfight.net", "newgrounds.com"] -> "fa fa-paintbrush" + u when u in ["pixiv.net", "www.pixiv.net", "pixiv.me"] -> + "fab fa-pixiv" + u when u in ["patreon.com", "www.patreon.com"] -> "fab fa-patreon" @@ -382,7 +393,7 @@ defmodule PhilomenaWeb.ImageView do ] -> "fab fa-reddit" - u when u in ["facebook.com", "www.facebook.com", "fb.me", "www.fb.me"] -> + u when u in ["facebook.com", "www.facebook.com", "fb.me", "www.fb.me", "m.facebook.com"] -> "fab fa-facebook" u when u in ["tiktok.com", "www.tiktok.com"] -> @@ -391,12 +402,14 @@ defmodule PhilomenaWeb.ImageView do u when u in [ "furaffinity.net", - "www.furaffinity.net", "furbooru.org", "inkbunny.net", "e621.net", "e926.net", - "sofurry.com" + "sofurry.com", + "weasyl.com", + "www.weasyl.com", + "cdn.weasyl.com" ] -> "fa fa-paw" @@ -423,9 +436,15 @@ defmodule PhilomenaWeb.ImageView do "fab fa-mastodon" u - when u in ["tumbex.com", "www.tumbex.com", "tumblr.com"] -> + when u in ["tumbex.com", "www.tumbex.com", "tumblr.com", "tmblr.co"] -> "fab fa-tumblr" + u when u in ["flickr.com", "www.flickr.com"] -> + "fab fa-flickr" + + u when u in ["etsy.com", "www.etsy.com"] -> + "fab fa-etsy" + link -> cond do Enum.member?(site_domains, link) -> @@ -434,18 +453,40 @@ defmodule PhilomenaWeb.ImageView do String.ends_with?(link, ".tumblr.com") -> "fab fa-tumblr" - String.ends_with?(link, ".deviantart.com") -> + String.ends_with?(link, ".deviantart.com") or String.ends_with?(link, ".deviantart.net") -> "fab fa-deviantart" - String.ends_with?(link, ".sofurry.com") -> + String.ends_with?(link, ".furaffinity.net") or String.ends_with?(link, ".sofurry.com") or + String.ends_with?(link, ".facdn.net") -> "fa fa-paw" - String.ends_with?(link, ".userapi.com") -> + String.ends_with?(link, ".userapi.com") or String.ends_with?(link, ".vk.me") -> "fab fa-vk" String.ends_with?(link, ".patreonusercontent.com") -> "fab fa-patreon" + String.ends_with?(link, ".discordapp.net") -> + "fab fa-discord" + + String.ends_with?(link, ".ytimg.com") -> + "fab fa-youtube" + + String.ends_with?(link, ".fbcdn.net") -> + "fab fa-facebook" + + String.ends_with?(link, ".newgrounds.com") or String.ends_with?(link, ".ngfiles.com") -> + "fa fa-paintbrush" + + String.ends_with?(link, ".apple.com") -> + "fab fa-apple" + + String.ends_with?(link, ".staticflickr.com") -> + "fab fa-flickr" + + String.ends_with?(link, ".etsystatic.com") -> + "fab fa-etsy" + true -> "fa fa-link" end