caelum0x 1970baebde refactor(ritgram): one site-domain module for Ritgram web (RIT-OPS)
RIT-2 from the architecture scan: 3 named env/const sources for the
product's own domain (NEXT_PUBLIC_SITE_URL, NEXT_PUBLIC_GITEA_BASE_URL,
and a local RITHUB_DEFAULT_BASE_URL const that turned out not to be a
real env var) plus ~20 files hardcoding one of two domains directly.

Verified by curl (follow redirects, check body) which hosts are actually
live: rithub.dev (20KB, the Rithub engine) and ritgram.rithub.dev (18KB,
this app) both answer 200; app.ritgram.rithub.dev (hardcoded in the
install-page copy) does not resolve at all (curl: 000) - a real dead
literal, not just an inconsistency.

Added apps/ritgram/web/lib/site-config.ts as the single module: it still
reads the existing env var names as fallback inputs (NEXT_PUBLIC_SITE_URL,
NEXT_PUBLIC_GITEA_BASE_URL) so already-configured live deploys don't
change behavior, but now every consumer imports RITGRAM_SITE_URL /
RITHUB_ENGINE_URL / RITGRAM_SUPPORT_EMAIL / RITGRAM_LEGAL_EMAIL from one
place instead of re-reading env or re-typing a domain. Note: the two
constants intentionally stay separate values (Ritgram's own site vs. the
Rithub engine host used for the Rithub OAuth redirect) - merging them
into a single literal would have broken the "Sign in with Rithub" button.

Updated: layout.tsx/sitemap.ts/robots.ts/badge route (site URL), login
and register pages (Rithub OAuth base URL), terms/about contact emails,
install-page copy (fixed the dead app.ritgram.rithub.dev subdomain to the
real ritgram.rithub.dev host), settings/account's placeholder const.

tsc --noEmit (apps/ritgram/web): 0 errors before and after.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 01:09:32 +03:00

38 lines
1018 B
TypeScript

import type { MetadataRoute } from 'next'
import { RITGRAM_SITE_URL as SITE_URL } from '@/lib/site-config'
// There was no robots.txt (static or dynamic) anywhere in the app, so search
// engines had no explicit crawl directives and no sitemap reference for this
// site. Authenticated/private surfaces (messages, settings, admin, etc.) are
// disallowed; public profile/repo/discovery pages remain crawlable.
export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
allow: '/',
disallow: [
'/api/',
'/admin',
'/settings',
'/messages',
'/notifications',
'/account',
'/create',
'/create-change-story',
'/create-story',
'/drafts',
'/edit',
'/backup',
'/compose',
'/camera',
'/chat',
'/follow-requests',
'/creator-studio',
'/api-test',
],
},
sitemap: `${SITE_URL}/sitemap.xml`,
host: SITE_URL,
}
}