45af56d9cf
Also added: - Memory API endpoints - Briefs API endpoints - AnveVoice stats API - Claude spawn API - TTS proxy - Cleopatra voice widget - api-auth middleware
31 lines
932 B
TypeScript
31 lines
932 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import fs from 'fs';
|
|
import path from 'path';
|
|
|
|
const API_SECRET = process.env.API_SECRET || 'horus-mc-secret-2026';
|
|
|
|
export async function GET(
|
|
request: Request,
|
|
{ params }: { params: Promise<{ date: string }> }
|
|
) {
|
|
// Check auth
|
|
const authHeader = request.headers.get('authorization');
|
|
if (authHeader !== `Bearer ${API_SECRET}`) {
|
|
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
|
}
|
|
|
|
try {
|
|
const { date } = await params;
|
|
const filePath = `/root/.openclaw/workspace/briefs/eod/${date}.md`;
|
|
|
|
if (!fs.existsSync(filePath)) {
|
|
return NextResponse.json({ content: 'No EOD brief for this date' }, { status: 404 });
|
|
}
|
|
|
|
const content = fs.readFileSync(filePath, 'utf8');
|
|
return NextResponse.json({ date, content });
|
|
} catch (error) {
|
|
return NextResponse.json({ error: 'Failed to load' }, { status: 500 });
|
|
}
|
|
}
|