899c54e1fc
Auth: drop localStorage session token entirely, talk to netrunner-backend via credentials:"include" HttpOnly cookies shared over the common parent domain, and redirect to the account subdomain (ЛК) after login instead of a dead local /profile route. Config: NEXT_PUBLIC_* values used by client components (API_URL, ACCOUNT_ORIGIN, BOT_USERNAME, PB_URL) get inlined into the JS bundle at image build time and can't be overridden by docker-compose environment at container start. Moved these reads into server components (page.tsx) and thread them down as props, so one built image can genuinely serve both prod and dev by config alone. CI/CD: split the old single auto-deploy-to-prod workflow into build.yml (build+push on every push to main) and deploy.yml with deploy-dev (auto, same VPS as netrunner-backend's dev environment) and deploy-prod (manual dispatch only) — mirrors netrunner-backend's pipeline shape. Added docker-compose.dev-remote.yml pointing at the dev backend. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
34 lines
1.5 KiB
TypeScript
34 lines
1.5 KiB
TypeScript
import { getDictionary } from "@/lib/dictionaries";
|
|
import { AuthClient } from "./auth-client";
|
|
|
|
// Читаются здесь, а не в auth-client.tsx: этот файл — серверный компонент,
|
|
// исполняется заново на каждый запрос, поэтому значения из `environment:`
|
|
// docker-compose реально доходят до рантайма (в отличие от `NEXT_PUBLIC_*`
|
|
// внутри "use client"-файла, которые Next.js зашивает в бандл при сборке
|
|
// образа — один и тот же образ иначе не смог бы обслуживать и прод, и dev).
|
|
// Намеренно НЕ NEXT_PUBLIC_* — этим переменным незачем попадать в клиентский
|
|
// бандл вообще, раз их и так читает только сервер.
|
|
export default async function AuthPage({
|
|
params,
|
|
}: {
|
|
params: Promise<{ lang: string }>;
|
|
}) {
|
|
const { lang } = await params;
|
|
const dict = await getDictionary(lang);
|
|
|
|
const accountOrigin =
|
|
process.env.ACCOUNT_ORIGIN || "https://account.netrunner-vpn.com";
|
|
const apiBase = process.env.API_URL || `${accountOrigin}/api/v1`;
|
|
const botUsername = process.env.BOT_USERNAME || "ntrnr_vpn_bot";
|
|
|
|
return (
|
|
<AuthClient
|
|
dict={dict.auth}
|
|
lang={lang}
|
|
accountOrigin={accountOrigin}
|
|
apiBase={apiBase}
|
|
botUsername={botUsername}
|
|
/>
|
|
);
|
|
}
|