mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 16:38: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"
|
visibility = "public"
|
||||||
# Default language for new notes (ISO code)
|
# Default language for new notes (ISO code)
|
||||||
language = "en"
|
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 = ""
|
avatar = ""
|
||||||
# Default header, must be a valid URL or "" for none
|
# Default header, must be a valid URL or "" for none
|
||||||
header = ""
|
header = ""
|
||||||
|
# A style name from https://www.dicebear.com/styles
|
||||||
|
placeholder_style = "thumbs"
|
||||||
|
|
||||||
[federation]
|
[federation]
|
||||||
# This is a list of domain names, such as "mastodon.social" or "pleroma.site"
|
# 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
|
* @returns The raw URL for the user's avatar
|
||||||
*/
|
*/
|
||||||
export const getAvatarUrl = (user: User, config: Config) => {
|
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);
|
return getUrl(user.avatar, config);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,9 @@ export interface Config {
|
||||||
|
|
||||||
/** @default "" */
|
/** @default "" */
|
||||||
header: string;
|
header: string;
|
||||||
|
|
||||||
|
/** @default "thumbs" */
|
||||||
|
placeholder_style: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
federation: {
|
federation: {
|
||||||
|
|
@ -540,6 +543,7 @@ export const defaultConfig: Config = {
|
||||||
language: "en",
|
language: "en",
|
||||||
avatar: "",
|
avatar: "",
|
||||||
header: "",
|
header: "",
|
||||||
|
placeholder_style: "thumbs",
|
||||||
},
|
},
|
||||||
federation: {
|
federation: {
|
||||||
blocked: [],
|
blocked: [],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue