From fdf51a885528354190fa53eae49493c32a2c1989 Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 27 Dec 2022 10:13:44 -0600 Subject: [PATCH] chore(server) Increase cache-control time (#1189) * chore(server) Increase cache-control time * Update version for openapi --- server/apps/immich/src/api-v1/asset/asset.controller.ts | 4 ++-- server/apps/immich/src/api-v1/user/user.controller.ts | 2 ++ server/immich-openapi-specs.json | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/apps/immich/src/api-v1/asset/asset.controller.ts b/server/apps/immich/src/api-v1/asset/asset.controller.ts index 7148376bfb..f9a0c109ab 100644 --- a/server/apps/immich/src/api-v1/asset/asset.controller.ts +++ b/server/apps/immich/src/api-v1/asset/asset.controller.ts @@ -110,7 +110,7 @@ export class AssetController { } @Get('/file/:assetId') - @Header('Cache-Control', 'max-age=3600') + @Header('Cache-Control', 'max-age=31536000') async serveFile( @GetAuthUser() authUser: AuthUserDto, @Headers() headers: Record, @@ -123,7 +123,7 @@ export class AssetController { } @Get('/thumbnail/:assetId') - @Header('Cache-Control', 'max-age=3600') + @Header('Cache-Control', 'max-age=31536000') async getAssetThumbnail( @GetAuthUser() authUser: AuthUserDto, @Headers() headers: Record, diff --git a/server/apps/immich/src/api-v1/user/user.controller.ts b/server/apps/immich/src/api-v1/user/user.controller.ts index 46f8a943ef..2d630625f9 100644 --- a/server/apps/immich/src/api-v1/user/user.controller.ts +++ b/server/apps/immich/src/api-v1/user/user.controller.ts @@ -13,6 +13,7 @@ import { Response, ParseBoolPipe, StreamableFile, + Header, } from '@nestjs/common'; import { UserService } from './user.service'; import { Authenticated } from '../../decorators/authenticated.decorator'; @@ -111,6 +112,7 @@ export class UserController { } @Get('/profile-image/:userId') + @Header('Cache-Control', 'max-age=86400') async getProfileImage(@Param('userId') userId: string, @Response({ passthrough: true }) res: Res): Promise { const readableStream = await this.userService.getUserProfileImage(userId); res.set({ diff --git a/server/immich-openapi-specs.json b/server/immich-openapi-specs.json index bb13cf0c0f..866b275767 100644 --- a/server/immich-openapi-specs.json +++ b/server/immich-openapi-specs.json @@ -2288,7 +2288,7 @@ "info": { "title": "Immich", "description": "Immich API", - "version": "1.39.0", + "version": "1.40.0", "contact": {} }, "tags": [],