mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 05:37:19 +01:00
Loki has run on AccountKit since 2026-11-01. The runtime mounts the shared sign-in (`bitbaum-signin`, SIGNIN_*) from env, and the compat layer can start it, but Loki's sign-in and sign-up pages had no button for it. The deploy check also expected only "email-password" on this runtime, so OrangeCat could vanish from /api/auth/providers without failing a deploy. - getEnabledAuthProviders().signin is AccountKit's signinBroker(env), on the AccountKit runtime only. Sign-in and sign-up show "Continue with Google, Apple, GitHub, X or Facebook" (AccountKit's own label) next to OrangeCat, started through next-auth/react like OrangeCat. - scripts/expected-auth-providers.ts expects, on AccountKit, the password form plus every OIDC client AccountKit mounts (oidcClients): orangecat with ORANGECAT_OAUTH_*, bitbaum-signin with SIGNIN_*. On Auth.js it behaves as before. - deploy-hetzner.sh reads the box's OIDC env for it from /opt/fleet/env and the app .env, a non-empty app line winning as in launch.sh. The issuers and client ids are passed as they are; each secret is passed only as "set". - scripts/test/deploy-expected-providers.ts covers both runtimes and the button. Claude-Session: https://claude.ai/code/session_019MDtmuJhiHPASaR5k8raL9 Co-authored-by: Claude <noreply@anthropic.com>
51 lines
2.2 KiB
TypeScript
51 lines
2.2 KiB
TypeScript
/**
|
|
* The provider ids a deploy must find in /api/auth/providers, derived from the
|
|
* same rules that mount them, so pausing or adding a provider never needs a
|
|
* second edit here. Prints them space-separated; scripts/deploy-hetzner.sh
|
|
* reads the line.
|
|
*
|
|
* npx tsx scripts/expected-auth-providers.ts # → "github email-password"
|
|
* AUTH_RUNTIME=accountkit npx tsx scripts/expected-auth-providers.ts
|
|
* # → "email-password"
|
|
*
|
|
* The env is the BOX's, as deploy-hetzner.sh reads it from /opt/fleet/env and
|
|
* /opt/loki/app/.env: AUTH_RUNTIME, the non-secret OIDC names
|
|
* (ORANGECAT_OAUTH_ISSUER/CLIENT_ID, SIGNIN_ISSUER/CLIENT_ID) and, for each
|
|
* secret, only whether it is set (never its value).
|
|
*
|
|
* - Auth.js runtime: GitHub, Google and X when not paused (PAUSED_PROVIDERS in
|
|
* src/lib/auth-providers.ts), plus the password form.
|
|
* - AccountKit runtime (AUTH_RUNTIME=accountkit, live since 2026-11-01):
|
|
* GitHub, Google and X are not mounted by design; the compat layer lists the
|
|
* password form and every OIDC client AccountKit mounts from env —
|
|
* `orangecat` with ORANGECAT_OAUTH_*, `bitbaum-signin` with SIGNIN_*
|
|
* (oidcClients). Expecting GitHub there failed every deploy after the
|
|
* switch with "auth provider missing: github" and rolled back a good build;
|
|
* not expecting OrangeCat let it vanish unnoticed.
|
|
*/
|
|
import { oidcClients } from "@bitbaum/accountkit/auth";
|
|
import { sharedRuntimeEnabled } from "@bitbaum/accountkit/auth/switch";
|
|
|
|
import { PAUSED_PROVIDERS } from "../src/lib/auth-providers";
|
|
|
|
/** Every provider production configures on Auth.js, by the id /api/auth/providers lists. */
|
|
const CONFIGURED = [
|
|
{ key: "github", id: "github" },
|
|
{ key: "google", id: "google" },
|
|
{ key: "x", id: "x-1a" },
|
|
] as const;
|
|
|
|
export function expectedAuthProviders(env: NodeJS.ProcessEnv = process.env): string[] {
|
|
if (sharedRuntimeEnabled(env)) {
|
|
return ["email-password", ...oidcClients(env).map((client) => client.providerId)];
|
|
}
|
|
return [
|
|
...CONFIGURED.filter(({ key }) => !PAUSED_PROVIDERS[key]).map(({ id }) => id),
|
|
"email-password",
|
|
];
|
|
}
|
|
|
|
if (process.argv[1]?.endsWith("expected-auth-providers.ts")) {
|
|
console.log(expectedAuthProviders().join(" "));
|
|
}
|