Skip to content
Snippets Groups Projects
Verified Commit 8d28e882 authored by Adrian Paschkowski's avatar Adrian Paschkowski :thinking:
Browse files

Don't guard images behing auth

You can't just add headers to clientside image requests without
basically manually fetching and drawing it to a canvas,
and the UUIDs are random enough that they won't be brute forced.
So, for vastly more simple client code, remove the auth guard.
parent d5db3438
No related branches found
No related tags found
No related merge requests found
import {
Controller,
Get,
Header,
HttpCode,
Param,
Res,
UseGuards,
} from '@nestjs/common';
import { Controller, Get, Param, Res } from '@nestjs/common';
import { Response } from 'express';
import { join } from 'path';
import { WebAuthGuard } from './auth/web-auth.guard';
@Controller('images')
@UseGuards(WebAuthGuard)
export class ImageController {
@Get(':id')
public image(@Param('id') id: string, @Res() res: Response) {
res.sendFile(join(process.cwd(), 'photos', `${id}.jpg`));
res.sendFile(
join(process.cwd(), 'photos', `${id.replace(/\.jpg$/, '')}.jpg`),
);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment