summaryrefslogtreecommitdiff
path: root/src/server/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/api')
-rw-r--r--src/server/api/endpoints/i/update.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/server/api/endpoints/i/update.ts b/src/server/api/endpoints/i/update.ts
index b94f073d2c..1a1da997c9 100644
--- a/src/server/api/endpoints/i/update.ts
+++ b/src/server/api/endpoints/i/update.ts
@@ -45,6 +45,11 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
if (bannerIdErr) return rej('invalid bannerId param');
if (bannerId !== undefined) updates.bannerId = bannerId;
+ // Get 'wallpaperId' parameter
+ const [wallpaperId, wallpaperIdErr] = $.type(ID).optional().nullable().get(params.wallpaperId);
+ if (wallpaperIdErr) return rej('invalid wallpaperId param');
+ if (wallpaperId !== undefined) updates.wallpaperId = wallpaperId;
+
// Get 'isLocked' parameter
const [isLocked, isLockedErr] = $.bool.optional().get(params.isLocked);
if (isLockedErr) return rej('invalid isLocked param');
@@ -85,6 +90,16 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
}
}
+ if (wallpaperId) {
+ const wallpaper = await DriveFile.findOne({
+ _id: wallpaperId
+ });
+
+ if (wallpaper != null && wallpaper.metadata.properties.avgColor) {
+ updates.wallpaperColor = wallpaper.metadata.properties.avgColor;
+ }
+ }
+
await User.update(user._id, {
$set: updates
});