security: respect global exifOnHover config in API
This commit is contained in:
@@ -8,8 +8,16 @@
|
|||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
import { immich } from '@/lib/immich';
|
import { immich } from '@/lib/immich';
|
||||||
import { decodeAssetId } from '@/lib/tokens';
|
import { decodeAssetId } from '@/lib/tokens';
|
||||||
|
import { getConfig } from '@/lib/config';
|
||||||
|
|
||||||
export async function GET(_request: Request, { params }: { params: Promise<{ id: string }> }) {
|
export async function GET(_request: Request, { params }: { params: Promise<{ id: string }> }) {
|
||||||
|
const config = getConfig();
|
||||||
|
|
||||||
|
// Security: If EXIF is globally disabled, do not serve it via API either
|
||||||
|
if (!config.exifOnHover) {
|
||||||
|
return NextResponse.json({ error: 'EXIF metadata is disabled' }, { status: 403 });
|
||||||
|
}
|
||||||
|
|
||||||
const { id: token } = await params;
|
const { id: token } = await params;
|
||||||
|
|
||||||
// Decode the opaque token back to an Immich asset ID
|
// Decode the opaque token back to an Immich asset ID
|
||||||
|
|||||||
Reference in New Issue
Block a user