Skip to content

Commit e619934

Browse files
committed
Freebuff login is via freebuff.com
1 parent 6259c17 commit e619934

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

cli/src/hooks/use-fetch-login-url.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useMutation } from '@tanstack/react-query'
22
import { safeOpen } from '../utils/open-url'
33

4-
import { WEBSITE_URL } from '../login/constants'
4+
import { LOGIN_WEBSITE_URL } from '../login/constants'
55
import { generateLoginUrl } from '../login/login-flow'
66
import { logger } from '../utils/logger'
77

@@ -32,7 +32,7 @@ export function useFetchLoginUrl({
3232
logger,
3333
},
3434
{
35-
baseUrl: WEBSITE_URL,
35+
baseUrl: LOGIN_WEBSITE_URL,
3636
fingerprintId,
3737
},
3838
)

cli/src/hooks/use-login-polling.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useEffect, useRef } from 'react'
22

3-
import { WEBSITE_URL } from '../login/constants'
3+
import { LOGIN_WEBSITE_URL } from '../login/constants'
44
import { pollLoginStatus } from '../login/login-flow'
55
import { logger } from '../utils/logger'
66

@@ -66,7 +66,7 @@ export function useLoginPolling({
6666
logger,
6767
},
6868
{
69-
baseUrl: WEBSITE_URL,
69+
baseUrl: LOGIN_WEBSITE_URL,
7070
fingerprintId,
7171
fingerprintHash,
7272
expiresAt,

cli/src/login/constants.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
import { env } from '@codebuff/common/env'
1+
import { env, IS_DEV } from '@codebuff/common/env'
22

33
import { IS_FREEBUFF } from '../utils/constants'
44

55
// Get the website URL from environment or use default
66
export const WEBSITE_URL = env.NEXT_PUBLIC_CODEBUFF_APP_URL
77

8+
// Freebuff login flow uses the freebuff web app instead of codebuff.com
9+
const FREEBUFF_WEB_URL = IS_DEV ? 'http://localhost:3002' : 'https://freebuff.com'
10+
export const LOGIN_WEBSITE_URL = IS_FREEBUFF ? FREEBUFF_WEB_URL : WEBSITE_URL
11+
812
// Codebuff ASCII Logo - compact version for 80-width terminals
913
const LOGO_CODEBUFF = `
1014
██████╗ ██████╗ ██████╗ ███████╗██████╗ ██╗ ██╗███████╗███████╗

cli/src/login/plain-login.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { cyan, green, red, yellow, bold } from 'picocolors'
22

3-
import { WEBSITE_URL } from './constants'
3+
import { LOGIN_WEBSITE_URL } from './constants'
44
import { generateLoginUrl, pollLoginStatus } from './login-flow'
55
import { generateFingerprintId } from './utils'
66
import { saveUserCredentials } from '../utils/auth'
@@ -29,7 +29,7 @@ export async function runPlainLogin(): Promise<void> {
2929
try {
3030
loginData = await generateLoginUrl(
3131
{ logger },
32-
{ baseUrl: WEBSITE_URL, fingerprintId },
32+
{ baseUrl: LOGIN_WEBSITE_URL, fingerprintId },
3333
)
3434
} catch (error) {
3535
console.error(
@@ -59,7 +59,7 @@ export async function runPlainLogin(): Promise<void> {
5959
const result = await pollLoginStatus(
6060
{ sleep, logger },
6161
{
62-
baseUrl: WEBSITE_URL,
62+
baseUrl: LOGIN_WEBSITE_URL,
6363
fingerprintId,
6464
fingerprintHash: loginData.fingerprintHash,
6565
expiresAt: loginData.expiresAt,

0 commit comments

Comments
 (0)