forked from boos/BoosAPI
chore: align oauth defaults with cliproxyapi
This commit is contained in:
@@ -38,14 +38,14 @@ describe('buildConfig', () => {
|
||||
expect(config.telegramApiBaseUrl).toBe('https://api.telegram.org');
|
||||
});
|
||||
|
||||
it('does not embed OAuth client credentials by default', () => {
|
||||
it('ships CLI-aligned OAuth defaults', () => {
|
||||
const config = buildConfig({});
|
||||
|
||||
expect(config.codexClientId).toBe('');
|
||||
expect(config.claudeClientId).toBe('');
|
||||
expect(config.codexClientId).toBe('app_EMoamEEZ73f0CkXaXp7hrann');
|
||||
expect(config.claudeClientId).toBe('9d1c250a-e61b-44d9-88ed-5944d1962f5e');
|
||||
expect(config.claudeClientSecret).toBe('');
|
||||
expect(config.geminiCliClientId).toBe('');
|
||||
expect(config.geminiCliClientSecret).toBe('');
|
||||
expect(config.geminiCliClientId).toBe('681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com');
|
||||
expect(config.geminiCliClientSecret).toBe('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');
|
||||
});
|
||||
|
||||
it('accepts JSON request bodies larger than Fastify default 1 MiB', async () => {
|
||||
|
||||
@@ -2,6 +2,10 @@ import 'dotenv/config';
|
||||
import type { FastifyServerOptions } from 'fastify';
|
||||
|
||||
const DEFAULT_REQUEST_BODY_LIMIT = 20 * 1024 * 1024;
|
||||
const DEFAULT_CODEX_CLIENT_ID = 'app_EMoamEEZ73f0CkXaXp7hrann';
|
||||
const DEFAULT_CLAUDE_CLIENT_ID = '9d1c250a-e61b-44d9-88ed-5944d1962f5e';
|
||||
const DEFAULT_GEMINI_CLI_CLIENT_ID = '681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com';
|
||||
const DEFAULT_GEMINI_CLI_CLIENT_SECRET = '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';
|
||||
|
||||
function parseBoolean(value: string | undefined, fallback = false): boolean {
|
||||
if (value === undefined) return fallback;
|
||||
@@ -45,11 +49,11 @@ export function buildConfig(env: NodeJS.ProcessEnv) {
|
||||
return {
|
||||
authToken: env.AUTH_TOKEN || 'change-me-admin-token',
|
||||
proxyToken: env.PROXY_TOKEN || 'change-me-proxy-sk-token',
|
||||
codexClientId: parseOptionalSecret(env.CODEX_CLIENT_ID),
|
||||
claudeClientId: parseOptionalSecret(env.CLAUDE_CLIENT_ID),
|
||||
codexClientId: parseOptionalSecret(env.CODEX_CLIENT_ID) || DEFAULT_CODEX_CLIENT_ID,
|
||||
claudeClientId: parseOptionalSecret(env.CLAUDE_CLIENT_ID) || DEFAULT_CLAUDE_CLIENT_ID,
|
||||
claudeClientSecret: parseOptionalSecret(env.CLAUDE_CLIENT_SECRET),
|
||||
geminiCliClientId: parseOptionalSecret(env.GEMINI_CLI_CLIENT_ID),
|
||||
geminiCliClientSecret: parseOptionalSecret(env.GEMINI_CLI_CLIENT_SECRET),
|
||||
geminiCliClientId: parseOptionalSecret(env.GEMINI_CLI_CLIENT_ID) || DEFAULT_GEMINI_CLI_CLIENT_ID,
|
||||
geminiCliClientSecret: parseOptionalSecret(env.GEMINI_CLI_CLIENT_SECRET) || DEFAULT_GEMINI_CLI_CLIENT_SECRET,
|
||||
systemProxyUrl: env.SYSTEM_PROXY_URL || '',
|
||||
accountCredentialSecret: env.ACCOUNT_CREDENTIAL_SECRET || env.AUTH_TOKEN || 'change-me-admin-token',
|
||||
checkinCron: env.CHECKIN_CRON || '0 8 * * *',
|
||||
|
||||
@@ -27,10 +27,6 @@ describe('oauth routes', { timeout: 15_000 }, () => {
|
||||
beforeAll(async () => {
|
||||
dataDir = mkdtempSync(join(tmpdir(), 'metapi-oauth-routes-'));
|
||||
process.env.DATA_DIR = dataDir;
|
||||
process.env.CODEX_CLIENT_ID = 'test-codex-client-id';
|
||||
process.env.CLAUDE_CLIENT_ID = 'test-claude-client-id';
|
||||
process.env.GEMINI_CLI_CLIENT_ID = 'test-gemini-client-id';
|
||||
process.env.GEMINI_CLI_CLIENT_SECRET = 'test-gemini-client-secret';
|
||||
|
||||
await import('../../db/migrate.js');
|
||||
const dbModule = await import('../../db/index.js');
|
||||
@@ -56,10 +52,6 @@ describe('oauth routes', { timeout: 15_000 }, () => {
|
||||
afterAll(async () => {
|
||||
await app.close();
|
||||
delete process.env.DATA_DIR;
|
||||
delete process.env.CODEX_CLIENT_ID;
|
||||
delete process.env.CLAUDE_CLIENT_ID;
|
||||
delete process.env.GEMINI_CLI_CLIENT_ID;
|
||||
delete process.env.GEMINI_CLI_CLIENT_SECRET;
|
||||
});
|
||||
|
||||
it('lists multi-provider oauth metadata', async () => {
|
||||
|
||||
Reference in New Issue
Block a user