Files
gooseek/apps/auth-mcs/src/app/dashboard/page.tsx
home 783569b8e7 feat: монорепо миграция, Discover/SearxNG улучшения
- Миграция на монорепозиторий (apps/frontend, apps/chat-service, etc.)
- Discover: проверка SearxNG, понятное empty state при ненастроенном поиске
- searxng.ts: валидация URL, проверка JSON-ответа, авто-добавление http://
- docker/searxng-config: настройки для JSON API SearxNG

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-20 17:03:45 +03:00

102 lines
3.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { redirect } from 'next/navigation';
import { headers } from 'next/headers';
import { auth } from '@/lib/auth';
import { SignOutButton } from './SignOutButton';
export default async function DashboardPage() {
const session = await auth.api.getSession({
headers: await headers(),
});
if (!session) {
redirect('/sign-in');
}
const discoveryUrl = `${process.env.BETTER_AUTH_URL || 'http://localhost:3001'}/api/auth/.well-known/openid-configuration`;
return (
<div
style={{
minHeight: '100vh',
padding: 32,
background: '#f8fafc',
}}
>
<div style={{ maxWidth: 800, margin: '0 auto' }}>
<div
style={{
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: 32,
}}
>
<h1 style={{ margin: 0, fontSize: 28, fontWeight: 700 }}>
Auth Service Identity Provider
</h1>
<SignOutButton />
</div>
<div
style={{
background: '#fff',
padding: 24,
borderRadius: 12,
boxShadow: '0 1px 3px rgba(0,0,0,0.1)',
marginBottom: 24,
}}
>
<h2 style={{ margin: '0 0 16px', fontSize: 18 }}>Ваш профиль</h2>
<p style={{ margin: 0, color: '#64748b' }}>
<strong>Email:</strong> {session.user.email}
</p>
<p style={{ margin: '8px 0 0', color: '#64748b' }}>
<strong>Имя:</strong> {session.user.name || '—'}
</p>
</div>
<div
style={{
background: '#fff',
padding: 24,
borderRadius: 12,
boxShadow: '0 1px 3px rgba(0,0,0,0.1)',
}}
>
<h2 style={{ margin: '0 0 16px', fontSize: 18 }}>
Интеграция с приложениями
</h2>
<p style={{ margin: '0 0 16px', color: '#64748b', fontSize: 14 }}>
Этот сервис выступает как OIDC Identity Provider. Подключите ваши
приложения, указав следующие параметры:
</p>
<pre
style={{
padding: 16,
background: '#1e293b',
color: '#e2e8f0',
borderRadius: 8,
overflow: 'auto',
fontSize: 13,
}}
>
{`Authorization URL: ${process.env.BETTER_AUTH_URL || 'http://localhost:3001'}/api/auth/oauth2/authorize
Token URL: ${process.env.BETTER_AUTH_URL || 'http://localhost:3001'}/api/auth/oauth2/token
UserInfo URL: ${process.env.BETTER_AUTH_URL || 'http://localhost:3001'}/api/auth/oauth2/userinfo
Discovery: ${discoveryUrl}
Scopes: openid profile email`}
</pre>
<p style={{ margin: '16px 0 0', color: '#64748b', fontSize: 14 }}>
Зарегистрируйте клиента через API{' '}
<code style={{ background: '#f1f5f9', padding: '2px 6px', borderRadius: 4 }}>
POST /api/auth/oauth2/register
</code>{' '}
или настройте trusted clients в конфигурации сервиса.
</p>
</div>
</div>
</div>
);
}