mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
Add new default placeholder avatars
This commit is contained in:
parent
6917def011
commit
e4f82e2fa9
|
|
@ -246,10 +246,12 @@ allowed_mime_types = [
|
|||
visibility = "public"
|
||||
# Default language for new notes (ISO code)
|
||||
language = "en"
|
||||
# Default avatar, must be a valid URL or "" for none
|
||||
# Default avatar, must be a valid URL or "" for a placeholder avatar
|
||||
avatar = ""
|
||||
# Default header, must be a valid URL or "" for none
|
||||
header = ""
|
||||
# A style name from https://www.dicebear.com/styles
|
||||
placeholder_style = "thumbs"
|
||||
|
||||
[federation]
|
||||
# This is a list of domain names, such as "mastodon.social" or "pleroma.site"
|
||||
|
|
|
|||
|
|
@ -34,7 +34,11 @@ export type UserWithRelations = Prisma.UserGetPayload<typeof userRelations2>;
|
|||
* @returns The raw URL for the user's avatar
|
||||
*/
|
||||
export const getAvatarUrl = (user: User, config: Config) => {
|
||||
if (!user.avatar) return config.defaults.avatar;
|
||||
if (!user.avatar)
|
||||
return (
|
||||
config.defaults.avatar ||
|
||||
`https://api.dicebear.com/8.x/${config.defaults.placeholder_style}/svg?seed=${user.username}`
|
||||
);
|
||||
return getUrl(user.avatar, config);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -260,6 +260,9 @@ export interface Config {
|
|||
|
||||
/** @default "" */
|
||||
header: string;
|
||||
|
||||
/** @default "thumbs" */
|
||||
placeholder_style: string;
|
||||
};
|
||||
|
||||
federation: {
|
||||
|
|
@ -540,6 +543,7 @@ export const defaultConfig: Config = {
|
|||
language: "en",
|
||||
avatar: "",
|
||||
header: "",
|
||||
placeholder_style: "thumbs",
|
||||
},
|
||||
federation: {
|
||||
blocked: [],
|
||||
|
|
|
|||
Loading…
Reference in a new issue