feat: post variants, transforms, image generation, AI ideas, channel edit page with image style settings
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { requireUser } from '@/lib/session';
|
||||
import { engine } from '@/lib/engine';
|
||||
|
||||
export async function POST(req) {
|
||||
const user = await requireUser();
|
||||
if (!user) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
||||
const body = await req.json();
|
||||
try {
|
||||
const result = await engine.generatePostImage(user.id, body);
|
||||
return NextResponse.json(result);
|
||||
} catch (e) {
|
||||
return NextResponse.json({ error: e.message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { requireUser } from '@/lib/session';
|
||||
import { engine } from '@/lib/engine';
|
||||
|
||||
export async function POST(req) {
|
||||
const user = await requireUser();
|
||||
if (!user) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
||||
const body = await req.json();
|
||||
try {
|
||||
const result = await engine.topicsIdeas(user.id, body);
|
||||
return NextResponse.json(result);
|
||||
} catch (e) {
|
||||
return NextResponse.json({ error: e.message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { requireUser } from '@/lib/session';
|
||||
import { engine } from '@/lib/engine';
|
||||
|
||||
export async function POST(req) {
|
||||
const user = await requireUser();
|
||||
if (!user) return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
||||
const body = await req.json();
|
||||
try {
|
||||
const result = await engine.transformPost(user.id, body);
|
||||
return NextResponse.json(result);
|
||||
} catch (e) {
|
||||
return NextResponse.json({ error: e.message }, { status: 500 });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { notFound, redirect } from 'next/navigation';
|
||||
import { requireUser } from '@/lib/session';
|
||||
import { engine } from '@/lib/engine';
|
||||
import Header from '@/components/Header';
|
||||
import ChannelEdit from '@/components/ChannelEdit';
|
||||
|
||||
export default async function ChannelEditPage({ params }) {
|
||||
const user = await requireUser();
|
||||
if (!user) redirect('/login');
|
||||
const { id } = await params;
|
||||
let channel;
|
||||
try { channel = await engine.getChannel(user.id, id); } catch { notFound(); }
|
||||
if (!channel) notFound();
|
||||
return (
|
||||
<>
|
||||
<Header user={user} />
|
||||
<ChannelEdit channel={channel} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user