Add GET /i/:id/:secret hotlink image decrypt stream.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user