Files
private_image/backend/src/modules/upload/controllers/HotlinkImageController.ts
T
nobswebdev 915d62f09a Trust nginx proxy and drop hotlink response headers from Nest.
Rate limits use X-Forwarded-For behind prod nginx; hotlink security headers are set on /i/ in nginx only.
2026-10-28 20:56:21 +01:00

16 lines
608 B
TypeScript

import { Controller, Get, Param, StreamableFile } from '@nestjs/common';
import { HotlinkImageParamsDto } from '../dto/HotlinkImageParamsDto';
import { UploadService } from '../services/UploadService';
@Controller('i')
export class HotlinkImageController {
constructor(private readonly uploadService: UploadService) {}
@Get(':id/:secret')
async getImage(@Param() params: HotlinkImageParamsDto): Promise<StreamableFile> {
const { body, mimeType } = await this.uploadService.getHotlinkImage(params.id, params.secret);
return new StreamableFile(body, { type: mimeType });
}
}