global update and global fix
This commit is contained in:
31
apps/docs/components/bot-code-tabs.tsx
Normal file
31
apps/docs/components/bot-code-tabs.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { buildBotExamples } from '@/lib/bot-examples';
|
||||
import { fetchPublicSettingsClient } from '@/lib/api';
|
||||
import { resolveOAuthApiBase } from '@/lib/oauth-url';
|
||||
import { CodeExampleTabs } from '@/components/code-example-tabs';
|
||||
|
||||
export function BotCodeTabs() {
|
||||
const [apiBase, setApiBase] = useState('http://localhost:3000');
|
||||
|
||||
useEffect(() => {
|
||||
void fetchPublicSettingsClient()
|
||||
.then((settings) => setApiBase(resolveOAuthApiBase(settings)))
|
||||
.catch(() => undefined);
|
||||
}, []);
|
||||
|
||||
const examples = useMemo(() => buildBotExamples(apiBase), [apiBase]);
|
||||
|
||||
return (
|
||||
<div className="space-y-3">
|
||||
<p className="text-sm text-zinc-500 dark:text-zinc-400">
|
||||
Базовый URL Bot API:{' '}
|
||||
<code className="rounded bg-zinc-100 px-1.5 py-0.5 dark:bg-zinc-800">{apiBase}/bot{'{token}'}/{'{method}'}</code>
|
||||
{' — '}
|
||||
подставляется из <strong>PUBLIC_API_URL</strong> (как для OAuth).
|
||||
</p>
|
||||
<CodeExampleTabs examples={examples} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import type { DocBlock } from '@/lib/docs-pages';
|
||||
import { OAuthCodeTabs } from '@/components/oauth-code-tabs';
|
||||
import { AuthLoginCodeTabs } from '@/components/auth-code-tabs';
|
||||
import { AuthLdapCodeTabs } from '@/components/auth-ldap-code-tabs';
|
||||
import { BotCodeTabs } from '@/components/bot-code-tabs';
|
||||
import { ApiReferenceSection } from '@/components/api-endpoint-card';
|
||||
import { CodeBlock } from '@/components/code-block';
|
||||
import { cn } from '@/lib/utils';
|
||||
@@ -70,6 +71,8 @@ export function DocBlockRenderer({ block }: { block: DocBlock }) {
|
||||
return <AuthLoginCodeTabs />;
|
||||
case 'auth-ldap-examples':
|
||||
return <AuthLdapCodeTabs />;
|
||||
case 'bot-examples':
|
||||
return <BotCodeTabs />;
|
||||
case 'api-reference':
|
||||
return <ApiReferenceSection />;
|
||||
default:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
'use client';
|
||||
|
||||
import Link from 'next/link';
|
||||
import { ArrowRight, BookOpen, Code2, Rocket, Shield } from 'lucide-react';
|
||||
import { ArrowRight, BookOpen, Bot, Code2, Rocket, Shield } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import { docNavigation, groupDocNavigation } from '@/lib/navigation';
|
||||
@@ -16,10 +16,16 @@ const highlights = [
|
||||
},
|
||||
{
|
||||
icon: Code2,
|
||||
title: 'OAuth 2.0',
|
||||
description: 'Примеры интеграции на JavaScript, Python, PHP, Go и других языках.',
|
||||
title: 'OAuth 2.0 / OIDC',
|
||||
description: 'Стандартный OpenID Connect: Discovery, client_id, PKCE, form-urlencoded token. Примеры для PHP без доработки OidcProvider.',
|
||||
href: '/docs/oauth'
|
||||
},
|
||||
{
|
||||
icon: Bot,
|
||||
title: 'Telegram Bot API',
|
||||
description: 'Telegraf, BotFather, профиль бота, setChatMenuButton и Mini Apps — совместимость с Telegram без смены кода.',
|
||||
href: '/docs/bot-api'
|
||||
},
|
||||
{
|
||||
icon: Shield,
|
||||
title: 'Безопасность',
|
||||
|
||||
Reference in New Issue
Block a user