Skip to content

Commit 257effe

Browse files
committed
fix(cli): update to use 127.0.0.1
1 parent 6b3e006 commit 257effe

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

app/composables/useConnector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export const useConnector = createSharedComposable(function useConnector() {
7171
lastExecutionTime: null,
7272
}))
7373

74-
const baseUrl = computed(() => `http://localhost:${config.value?.port ?? DEFAULT_PORT}`)
74+
const baseUrl = computed(() => `http://127.0.0.1:${config.value?.port ?? DEFAULT_PORT}`)
7575

7676
const route = useRoute()
7777
const router = useRouter()
@@ -109,7 +109,7 @@ export const useConnector = createSharedComposable(function useConnector() {
109109
state.value.error = null
110110

111111
try {
112-
const response = await $fetch<ConnectResponse>(`http://localhost:${port}/connect`, {
112+
const response = await $fetch<ConnectResponse>(`http://127.0.0.1:${port}/connect`, {
113113
method: 'POST',
114114
body: { token },
115115
timeout: 5000,

cli/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { initLogger, showToken, logInfo, logWarning, logError } from './logger.t
1111

1212
const DEFAULT_PORT = 31415
1313
const DEFAULT_FRONTEND_URL = 'https://npmx.dev/'
14-
const DEV_FRONTEND_URL = 'http://localhost:3000/'
14+
const DEV_FRONTEND_URL = 'http://127.0.0.1:3000/'
1515

1616
async function runNpmLogin(): Promise<boolean> {
1717
return new Promise(resolve => {

cli/src/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function generateOperationId(): string {
5353
}
5454

5555
const corsOptions: CorsOptions = {
56-
origin: ['https://npmx.dev', /^http:\/\/localhost:\d+$/],
56+
origin: ['https://npmx.dev', /^http:\/\/localhost:\d+$/, /^http:\/\/127.0.0.1:\d+$/],
5757
methods: ['GET', 'POST', 'DELETE', 'OPTIONS'],
5858
allowHeaders: ['Content-Type', 'Authorization'],
5959
}

0 commit comments

Comments
 (0)