From c9c73152612f2dfa1373e340b14d1d67c47c2262 Mon Sep 17 00:00:00 2001 From: Shevchik Igor Date: Sun, 7 Jun 2026 06:05:43 +0000 Subject: [PATCH] refactor(docs): adapt server routes to b24jssdk (were copied from b24ui) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docs/server/routes/* handlers were copied from the sibling b24ui project and never adapted, so the raw-markdown surface (consumed by LLMs) described the wrong product. - raw/index.md: rewrite the hardcoded landing body to describe @bitrix24/b24jssdk (REST API SDK) instead of the b24ui component library — correct title/description, SDK feature list, real installation pages (vue/nuxt/react/nodejs/umd), real sections (getting-started, working-with-the-rest-api, frame/hook/oauth), the b24jssdk GitHub repo, and EN/RU community links (resolves the inline @todo). Drop the stale b24ui DOMAIN comment. - raw/[...slug].md: drop the stale b24ui DOMAIN comment; fold the two duplicated not-found responses into one helper. - sitemap.xml: drop the stale b24ui DOMAIN comment. - sitemap.md: audited — already b24jssdk-correct, no change. Out of scope for this issue (docs/server/routes only): residual b24ui cruft in docs/server/utils/transformMDC.ts, and the RU docs mirror (separate, English-only repo). Refs #133 https://claude.ai/code/session_01977J3EFoxeffXCHS2TE7Kw --- docs/server/routes/raw/[...slug].md.get.ts | 13 +++--- docs/server/routes/raw/index.md.get.ts | 46 +++++++++++----------- docs/server/routes/sitemap.xml.get.ts | 2 - 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/docs/server/routes/raw/[...slug].md.get.ts b/docs/server/routes/raw/[...slug].md.get.ts index a99e021f..ac641848 100644 --- a/docs/server/routes/raw/[...slug].md.get.ts +++ b/docs/server/routes/raw/[...slug].md.get.ts @@ -6,16 +6,18 @@ import collections from '#content/manifest' import { transformMDC } from '../../utils/transformMDC' import { clearMD } from '../../utils/clearMD' -// const DOMAIN = 'https://bitrix24.github.io/b24ui' - export default defineEventHandler(async (event) => { const config = useRuntimeConfig() const baseUrl = `${config.public.canonicalUrl}${config.public.baseUrl}` + const notFound = (reason: string) => { + setResponseHeader(event, 'Content-Type', 'text/markdown; charset=utf-8') + return `---\ntitle: Not Found\n---\n\n# Page Not Found\n\n${reason} Browse the [sitemap](${config.public.baseUrl}/sitemap.md) to find available pages.\n` + } + const slug = getRouterParams(event)['slug.md'] if (!slug?.endsWith('.md')) { - setResponseHeader(event, 'Content-Type', 'text/markdown; charset=utf-8') - return `---\ntitle: Not Found\n---\n\n# Page Not Found\n\nThe requested page does not exist. Browse the [sitemap](${config.public.baseUrl}/sitemap.md) to find available pages.\n` + return notFound('The requested page does not exist.') } let path = withLeadingSlash(slug.replace('.md', '')) @@ -34,8 +36,7 @@ export default defineEventHandler(async (event) => { } if (!page) { - setResponseHeader(event, 'Content-Type', 'text/markdown; charset=utf-8') - return `---\ntitle: Not Found\n---\n\n# Page Not Found\n\nThe page \`${config.public.baseUrl}${path}\` does not exist. Browse the [sitemap](${config.public.baseUrl}/sitemap.md) to find available pages.\n` + return notFound(`The page \`${config.public.baseUrl}${path}\` does not exist.`) } await transformMDC(event, page as any) diff --git a/docs/server/routes/raw/index.md.get.ts b/docs/server/routes/raw/index.md.get.ts index 15be08ca..844fead3 100644 --- a/docs/server/routes/raw/index.md.get.ts +++ b/docs/server/routes/raw/index.md.get.ts @@ -1,16 +1,14 @@ import { queryCollection } from '@nuxt/content/server' -// const DOMAIN = 'https://bitrix24.github.io/b24ui' - export default defineCachedEventHandler(async (event) => { const config = useRuntimeConfig() - const baseUrl = `${config.public.canonicalUrl}${config.public.baseUrl}` - const DOMAIN = baseUrl + const DOMAIN = `${config.public.canonicalUrl}${config.public.baseUrl}` - const page = await queryCollection(event, 'index').first() as any + const page = await queryCollection(event, 'index').first() as { title?: string, description?: string } | null - const title = page?.title || 'Bitrix24 UI' - const description = page?.description || 'A comprehensive Vue UI component library (Nuxt optional) with 125+ accessible, Tailwind CSS components for building modern web applications.' + const title = page?.title || 'Bitrix24 JS SDK' + const description = page?.description + || 'Bitrix24 JS SDK for using the Bitrix24 REST API in local, production applications or via webhooks.' const frontmatter = [ '---', @@ -22,36 +20,37 @@ export default defineCachedEventHandler(async (event) => { '' ].join('\n') - // - MCP Server Card: <${DOMAIN}/.well-known/mcp/server-card.json> - // - MCP endpoint: <${DOMAIN}/mcp> - // @todo fix tg en (https://t.me/b24_dev) | ru (https://t.me/bitrix24apps) - const body = `# ${title} > ${description} ## About -Bitrix24 UI is a free and open source Vue UI library powered by [Reka UI](https://reka-ui.com/) and [Tailwind CSS](https://tailwindcss.com/). It works with both Nuxt and plain Vue applications. +The Bitrix24 JS SDK (\`@bitrix24/b24jssdk\`) is a free and open-source JavaScript/TypeScript library for the Bitrix24 REST API. It runs in the browser inside Bitrix24 applications (B24Frame), on the server through inbound webhooks (B24Hook) or OAuth server apps (B24OAuth), and in any modern JavaScript runtime. -- 125+ accessible, production-ready components -- Built on Reka UI (WAI-ARIA compliant primitives) -- Tailwind CSS theming with CSS variables and Tailwind Variants -- TypeScript support with full auto-completion -- Server-side rendering (SSR) compatible -- Dark mode support and 19 languages via i18n +- Three authentication modes: B24Frame (embedded apps), B24Hook (webhooks), B24OAuth (server apps) +- REST API v2 and v3: single calls, list iteration, and batch requests +- Built-in request batching, rate-limit handling, and automatic retries +- Helper managers for profile, application, payment, license, currency and options data +- Pluggable logging (including Telegram) and structured error codes +- First-class TypeScript types with full auto-completion +- Works with Nuxt, Vue, React, Node.js and UMD builds ## Installation - Nuxt: <${DOMAIN}/raw/docs/getting-started/installation/nuxt.md> - Vue: <${DOMAIN}/raw/docs/getting-started/installation/vue.md> +- React: <${DOMAIN}/raw/docs/getting-started/installation/react.md> +- Node.js: <${DOMAIN}/raw/docs/getting-started/installation/nodejs.md> +- UMD (browser): <${DOMAIN}/raw/docs/getting-started/installation/umd.md> ## Explore - Getting started: <${DOMAIN}/raw/docs/getting-started.md> -- Components: <${DOMAIN}/raw/docs/components.md> -- Composables: <${DOMAIN}/raw/docs/composables/define-shortcuts.md> -- Typography: <${DOMAIN}/raw/docs/typography.md> +- Working with the REST API: <${DOMAIN}/raw/docs/working-with-the-rest-api.md> +- B24Frame (embedded apps): <${DOMAIN}/raw/docs/working-with-the-rest-api/frame.md> +- B24Hook (webhooks): <${DOMAIN}/raw/docs/working-with-the-rest-api/hook.md> +- B24OAuth (server apps): <${DOMAIN}/raw/docs/working-with-the-rest-api/oauth.md> - Sitemap: <${DOMAIN}/sitemap.md> - LLMs index: <${DOMAIN}/llms.txt> - Full LLMs documentation: <${DOMAIN}/llms-full.txt> @@ -59,8 +58,9 @@ Bitrix24 UI is a free and open source Vue UI library powered by [Reka UI](https: ## Links - Website: <${DOMAIN}> -- GitHub: -- Community: +- GitHub: +- Community (EN): +- Community (RU): ` setResponseHeader(event, 'Content-Type', 'text/markdown; charset=utf-8') diff --git a/docs/server/routes/sitemap.xml.get.ts b/docs/server/routes/sitemap.xml.get.ts index 207fcf37..b228ebfb 100644 --- a/docs/server/routes/sitemap.xml.get.ts +++ b/docs/server/routes/sitemap.xml.get.ts @@ -1,7 +1,5 @@ import { queryCollection } from '@nuxt/content/server' -// const DOMAIN = 'https://bitrix24.github.io/b24ui' - function xmlEscape(str: string): string { return str.replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''') }