Added the ability to upload background, logo, default user avatar, instance thumbnail, and the NSFW hiding image via AdminFE
This commit is contained in:
parent
42b06d78df
commit
b7fc61e17b
@ -969,6 +969,13 @@ config :pleroma, :config_description, [
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :instance_thumbnail,
|
||||||
|
type: :string,
|
||||||
|
description:
|
||||||
|
"The instance thumbnail image. It will appear in [Pleroma Instances](http://distsn.org/pleroma-instances.html)",
|
||||||
|
suggestions: ["/instance/thumbnail.jpeg"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -1112,7 +1119,7 @@ config :pleroma, :config_description, [
|
|||||||
logoMask: true,
|
logoMask: true,
|
||||||
minimalScopesMode: false,
|
minimalScopesMode: false,
|
||||||
noAttachmentLinks: false,
|
noAttachmentLinks: false,
|
||||||
nsfwCensorImage: "",
|
nsfwCensorImage: "/static/img/nsfw.74818f9.png",
|
||||||
postContentType: "text/plain",
|
postContentType: "text/plain",
|
||||||
redirectRootLogin: "/main/friends",
|
redirectRootLogin: "/main/friends",
|
||||||
redirectRootNoLogin: "/main/all",
|
redirectRootNoLogin: "/main/all",
|
||||||
@ -1226,7 +1233,7 @@ config :pleroma, :config_description, [
|
|||||||
type: :string,
|
type: :string,
|
||||||
description:
|
description:
|
||||||
"URL of the image to use for hiding NSFW media attachments in the timeline.",
|
"URL of the image to use for hiding NSFW media attachments in the timeline.",
|
||||||
suggestions: ["/static/img/nsfw.png"]
|
suggestions: ["/static/img/nsfw.74818f9.png"]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :postContentType,
|
key: :postContentType,
|
||||||
@ -1346,6 +1353,12 @@ config :pleroma, :config_description, [
|
|||||||
suggestions: [
|
suggestions: [
|
||||||
:pleroma_fox_tan
|
:pleroma_fox_tan
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
key: :default_user_avatar,
|
||||||
|
type: :string,
|
||||||
|
description: "URL of the default user avatar.",
|
||||||
|
suggestions: ["/images/avi.png"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -14,8 +14,10 @@ defmodule Pleroma.Emails.NewUsersDigestEmail do
|
|||||||
styling = Pleroma.Config.get([Pleroma.Emails.UserEmail, :styling])
|
styling = Pleroma.Config.get([Pleroma.Emails.UserEmail, :styling])
|
||||||
|
|
||||||
logo_url =
|
logo_url =
|
||||||
Pleroma.Web.Endpoint.url() <>
|
Pleroma.Helpers.UriHelper.maybe_add_base(
|
||||||
Pleroma.Config.get([:frontend_configurations, :pleroma_fe, :logo])
|
Pleroma.Config.get([:frontend_configurations, :pleroma_fe, :logo]),
|
||||||
|
Pleroma.Web.Endpoint.url()
|
||||||
|
)
|
||||||
|
|
||||||
new()
|
new()
|
||||||
|> to({to.name, to.email})
|
|> to({to.name, to.email})
|
||||||
|
@ -24,4 +24,7 @@ defmodule Pleroma.Helpers.UriHelper do
|
|||||||
params
|
params
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def maybe_add_base("/" <> uri, base), do: Path.join([base, uri])
|
||||||
|
def maybe_add_base(uri, _base), do: uri
|
||||||
end
|
end
|
||||||
|
@ -305,8 +305,13 @@ defmodule Pleroma.User do
|
|||||||
|
|
||||||
def avatar_url(user, options \\ []) do
|
def avatar_url(user, options \\ []) do
|
||||||
case user.avatar do
|
case user.avatar do
|
||||||
%{"url" => [%{"href" => href} | _]} -> href
|
%{"url" => [%{"href" => href} | _]} ->
|
||||||
_ -> !options[:no_default] && "#{Web.base_url()}/images/avi.png"
|
href
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
unless options[:no_default] do
|
||||||
|
Config.get([:assets, :default_user_avatar], "#{Web.base_url()}/images/avi.png")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
|
|||||||
streaming_api: Pleroma.Web.Endpoint.websocket_url()
|
streaming_api: Pleroma.Web.Endpoint.websocket_url()
|
||||||
},
|
},
|
||||||
stats: Pleroma.Stats.get_stats(),
|
stats: Pleroma.Stats.get_stats(),
|
||||||
thumbnail: Pleroma.Web.base_url() <> "/instance/thumbnail.jpeg",
|
thumbnail: instance_thumbnail(),
|
||||||
languages: ["en"],
|
languages: ["en"],
|
||||||
registrations: Keyword.get(instance, :registrations_open),
|
registrations: Keyword.get(instance, :registrations_open),
|
||||||
# Extra (not present in Mastodon):
|
# Extra (not present in Mastodon):
|
||||||
@ -87,4 +87,9 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
|
|||||||
end
|
end
|
||||||
|> Map.put(:enabled, Config.get([:instance, :federating]))
|
|> Map.put(:enabled, Config.get([:instance, :federating]))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp instance_thumbnail do
|
||||||
|
Pleroma.Config.get([:instance, :instance_thumbnail]) ||
|
||||||
|
"#{Pleroma.Web.base_url()}/instance/thumbnail.jpeg"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -1777,4 +1777,16 @@ defmodule Pleroma.UserTest do
|
|||||||
assert result.email_notifications["digest"] == false
|
assert result.email_notifications["digest"] == false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "avatar fallback" do
|
||||||
|
user = insert(:user)
|
||||||
|
assert User.avatar_url(user) =~ "/images/avi.png"
|
||||||
|
|
||||||
|
Pleroma.Config.put([:assets, :default_user_avatar], "avatar.png")
|
||||||
|
|
||||||
|
user = User.get_cached_by_nickname_or_id(user.nickname)
|
||||||
|
assert User.avatar_url(user) =~ "avatar.png"
|
||||||
|
|
||||||
|
assert User.avatar_url(user, no_default: true) == nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -28,6 +28,7 @@ defmodule Pleroma.Workers.Cron.NewUsersDigestWorkerTest do
|
|||||||
assert email.html_body =~ user.nickname
|
assert email.html_body =~ user.nickname
|
||||||
assert email.html_body =~ user2.nickname
|
assert email.html_body =~ user2.nickname
|
||||||
assert email.html_body =~ "cofe"
|
assert email.html_body =~ "cofe"
|
||||||
|
assert email.html_body =~ "#{Pleroma.Web.Endpoint.url()}/static/logo.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it doesn't fail when admin has no email" do
|
test "it doesn't fail when admin has no email" do
|
||||||
|
Loading…
Reference in New Issue
Block a user