import { Controller, Get, Header } from "@nestjs/common"; import { ConfigService } from "@nestjs/config"; import { ApiOkResponse, ApiOperation, ApiTags } from "@nestjs/swagger"; import { AppConfig } from "../config/app.config"; import { Public } from "../auth/public.decorator"; import { ManifestDto } from "./manifest.dto"; @ApiTags("manifest") @Controller() export class ManifestController { constructor(private readonly config: ConfigService) {} @Get("manifest.json") @Public() // Clients cache the manifest themselves; the browser just revalidates it (ETag) @Header("Cache-Control", "no-cache") @ApiOperation({ summary: "Public client configuration and app version" }) @ApiOkResponse({ type: ManifestDto }) manifest(): ManifestDto { return { name: this.config.get("APP_NAME"), version: this.config.get("APP_VERSION"), auth: { enabled: this.config.get("AUTH_ENABLED") }, runLogs: { dataLimits: { bytes: this.config.get("RUN_LOG_DATA_COLLAPSE_BYTES"), lines: this.config.get("RUN_LOG_DATA_COLLAPSE_LINES"), }, }, }; } }