mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-19 14:17:59 +01:00
nicer code
This commit is contained in:
parent
4d3310eef7
commit
613d316d68
1 changed files with 12 additions and 41 deletions
|
@ -294,57 +294,28 @@ defmodule PhilomenaWeb.ImageView do
|
|||
def image_source_icon(source) do
|
||||
site_domains =
|
||||
String.split(Application.get_env(:philomena, :site_domains), ",") ++
|
||||
Application.get_env(:philomena, :cdn_host)
|
||||
[Application.get_env(:philomena, :cdn_host)]
|
||||
|
||||
uri = URI.parse(source)
|
||||
|
||||
case uri.host do
|
||||
"twitter.com" ->
|
||||
u when u in ["twitter.com", "www.twitter.com", "pbs.twimg.com", "twimg.com"] ->
|
||||
"fab fa-twitter"
|
||||
|
||||
"www.twitter.com" ->
|
||||
"fab fa-twitter"
|
||||
|
||||
"pbs.twimg.com" ->
|
||||
"fab fa-twitter"
|
||||
|
||||
"twimg.com" ->
|
||||
"fab fa-twitter"
|
||||
|
||||
"deviantart.com" ->
|
||||
u when u in ["deviantart.com", "www.deviantart.com", "sta.sh", "www.sta.sh"] ->
|
||||
"fab fa-deviantart"
|
||||
|
||||
"www.deviantart.com" ->
|
||||
"fab fa-deviantart"
|
||||
|
||||
"sta.sh" ->
|
||||
"fab fa-deviantart"
|
||||
|
||||
"www.sta.sh" ->
|
||||
"fab fa-deviantart"
|
||||
|
||||
"cdn.discordapp.com" ->
|
||||
u when u in ["cdn.discordapp.com", "discordapp.com", "discord.com"] ->
|
||||
"fab fa-discord"
|
||||
|
||||
"discordapp.com" ->
|
||||
"fab fa-discord"
|
||||
|
||||
"discord.com" ->
|
||||
"fab fa-discord"
|
||||
|
||||
"derpibooru.org" ->
|
||||
"fab fa-phoenix-framework"
|
||||
|
||||
"www.derpibooru.org" ->
|
||||
"fab fa-phoenix-framework"
|
||||
|
||||
"trixiebooru.org" ->
|
||||
"fab fa-phoenix-framework"
|
||||
|
||||
"www.trixiebooru.org" ->
|
||||
"fab fa-phoenix-framework"
|
||||
|
||||
"derpicdn.net" ->
|
||||
u
|
||||
when u in [
|
||||
"derpibooru.org",
|
||||
"www.derpibooru.org",
|
||||
"trixiebooru.org",
|
||||
"www.trixiebooru.org",
|
||||
"derpicdn.net"
|
||||
] ->
|
||||
"fab fa-phoenix-framework"
|
||||
|
||||
link ->
|
||||
|
|
Loading…
Reference in a new issue