Browse Source

Update cache for thumbnail

Alex Tran 2 years ago
parent
commit
b3a82b1b20
1 changed files with 3 additions and 1 deletions
  1. 3 1
      server/apps/immich/src/api-v1/asset/asset.controller.ts

+ 3 - 1
server/apps/immich/src/api-v1/asset/asset.controller.ts

@@ -15,6 +15,7 @@ import {
   HttpCode,
   HttpCode,
   BadRequestException,
   BadRequestException,
   UploadedFile,
   UploadedFile,
+  Header,
 } from '@nestjs/common';
 } from '@nestjs/common';
 import { JwtAuthGuard } from '../../modules/immich-jwt/guards/jwt-auth.guard';
 import { JwtAuthGuard } from '../../modules/immich-jwt/guards/jwt-auth.guard';
 import { AssetService } from './asset.service';
 import { AssetService } from './asset.service';
@@ -143,6 +144,7 @@ export class AssetController {
   }
   }
 
 
   @Get('/thumbnail/:assetId')
   @Get('/thumbnail/:assetId')
+  @Header('Cache-Control', 'max-age=300')
   async getAssetThumbnail(
   async getAssetThumbnail(
     @Response({ passthrough: true }) res: Res,
     @Response({ passthrough: true }) res: Res,
     @Param('assetId') assetId: string,
     @Param('assetId') assetId: string,
@@ -260,7 +262,7 @@ export class AssetController {
   }
   }
 
 
   /**
   /**
-   * Checks if multiple assets exist on the server and returns all existing - used by background backup 
+   * Checks if multiple assets exist on the server and returns all existing - used by background backup
    */
    */
   @Post('/exist')
   @Post('/exist')
   @HttpCode(200)
   @HttpCode(200)