Skip to content

Self-hosted personal gallery application with online photo management and albums, supporting Live/Motion Photos, EXIF parsing, geolocation recognition, and an explore map.

663 B
Raw Blame
import { getQuery, getRouterParam, createError } from 'h3'
import {
  LEGAL_KINDS,
  LEGAL_LOCALES,
  legalDocument,
  type LegalKind,
  type LegalLocale,
} from '../../../../../packages/platform/src/legal'
import {
  definePlatformHandler,
  platformDatabase,
} from '../../../../shared/platform/runtime'
export default definePlatformHandler(async (event) => {
  const kind = getRouterParam(event, 'kind') as LegalKind
  const locale = (getQuery(event).locale ?? 'en') as LegalLocale
  if (!LEGAL_KINDS.includes(kind) || !LEGAL_LOCALES.includes(locale))
    throw createError({ statusCode: 404 })
  return legalDocument(platformDatabase(event), kind, locale)
})