mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
Update update.ts (#4357)
* Update update.ts * Update update.ts * Update update.ts * Update update.ts
This commit is contained in:
parent
ab56f91c40
commit
9589886d3f
1 changed files with 22 additions and 10 deletions
|
@ -159,7 +159,7 @@ export const meta = {
|
|||
message: 'The file specified as a banner is not an image.',
|
||||
code: 'BANNER_NOT_AN_IMAGE',
|
||||
id: '75aedb19-2afd-4e6d-87fc-67941256fa60'
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -192,12 +192,16 @@ export default define(meta, async (ps, user, app) => {
|
|||
if (avatar == null) throw new ApiError(meta.errors.noSuchAvatar);
|
||||
if (!avatar.contentType.startsWith('image/')) throw new ApiError(meta.errors.avatarNotAnImage);
|
||||
|
||||
if (avatar.metadata.deletedAt) {
|
||||
updates.avatarUrl = null;
|
||||
} else {
|
||||
updates.avatarUrl = getDriveFileUrl(avatar, true);
|
||||
|
||||
if (avatar.metadata.properties.avgColor) {
|
||||
updates.avatarColor = avatar.metadata.properties.avgColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ps.bannerId) {
|
||||
const banner = await DriveFile.findOne({
|
||||
|
@ -207,12 +211,16 @@ export default define(meta, async (ps, user, app) => {
|
|||
if (banner == null) throw new ApiError(meta.errors.noSuchBanner);
|
||||
if (!banner.contentType.startsWith('image/')) throw new ApiError(meta.errors.bannerNotAnImage);
|
||||
|
||||
if (banner.metadata.deletedAt) {
|
||||
updates.bannerUrl = null;
|
||||
} else {
|
||||
updates.bannerUrl = getDriveFileUrl(banner, false);
|
||||
|
||||
if (banner.metadata.properties.avgColor) {
|
||||
updates.bannerColor = banner.metadata.properties.avgColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ps.wallpaperId !== undefined) {
|
||||
if (ps.wallpaperId === null) {
|
||||
|
@ -225,6 +233,9 @@ export default define(meta, async (ps, user, app) => {
|
|||
|
||||
if (wallpaper == null) throw new Error('wallpaper not found');
|
||||
|
||||
if (wallpaper.metadata.deletedAt) {
|
||||
updates.wallpaperUrl = null;
|
||||
} else {
|
||||
updates.wallpaperUrl = getDriveFileUrl(wallpaper);
|
||||
|
||||
if (wallpaper.metadata.properties.avgColor) {
|
||||
|
@ -232,6 +243,7 @@ export default define(meta, async (ps, user, app) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#region emojis/tags
|
||||
if (updates.name != null || updates.description != null) {
|
||||
|
|
Loading…
Reference in a new issue