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
|
def image_source_icon(source) do
|
||||||
site_domains =
|
site_domains =
|
||||||
String.split(Application.get_env(:philomena, :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)
|
uri = URI.parse(source)
|
||||||
|
|
||||||
case uri.host do
|
case uri.host do
|
||||||
"twitter.com" ->
|
u when u in ["twitter.com", "www.twitter.com", "pbs.twimg.com", "twimg.com"] ->
|
||||||
"fab fa-twitter"
|
"fab fa-twitter"
|
||||||
|
|
||||||
"www.twitter.com" ->
|
u when u in ["deviantart.com", "www.deviantart.com", "sta.sh", "www.sta.sh"] ->
|
||||||
"fab fa-twitter"
|
|
||||||
|
|
||||||
"pbs.twimg.com" ->
|
|
||||||
"fab fa-twitter"
|
|
||||||
|
|
||||||
"twimg.com" ->
|
|
||||||
"fab fa-twitter"
|
|
||||||
|
|
||||||
"deviantart.com" ->
|
|
||||||
"fab fa-deviantart"
|
"fab fa-deviantart"
|
||||||
|
|
||||||
"www.deviantart.com" ->
|
u when u in ["cdn.discordapp.com", "discordapp.com", "discord.com"] ->
|
||||||
"fab fa-deviantart"
|
|
||||||
|
|
||||||
"sta.sh" ->
|
|
||||||
"fab fa-deviantart"
|
|
||||||
|
|
||||||
"www.sta.sh" ->
|
|
||||||
"fab fa-deviantart"
|
|
||||||
|
|
||||||
"cdn.discordapp.com" ->
|
|
||||||
"fab fa-discord"
|
"fab fa-discord"
|
||||||
|
|
||||||
"discordapp.com" ->
|
u
|
||||||
"fab fa-discord"
|
when u in [
|
||||||
|
"derpibooru.org",
|
||||||
"discord.com" ->
|
"www.derpibooru.org",
|
||||||
"fab fa-discord"
|
"trixiebooru.org",
|
||||||
|
"www.trixiebooru.org",
|
||||||
"derpibooru.org" ->
|
"derpicdn.net"
|
||||||
"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" ->
|
|
||||||
"fab fa-phoenix-framework"
|
"fab fa-phoenix-framework"
|
||||||
|
|
||||||
link ->
|
link ->
|
||||||
|
|
Loading…
Reference in a new issue