File tree Expand file tree Collapse file tree
plugins/data-inspector/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ import process from 'node:process'
1717import { fileURLToPath } from 'node:url'
1818import { cac } from 'cac'
1919import { createDevServer } from 'devframe/adapters/dev'
20- import { DEVFRAME_CONNECTION_META_FILENAME } from 'devframe/constants'
20+ import { DEVFRAME_AUTH_TOKEN_QUERY_PARAM , DEVFRAME_CONNECTION_META_FILENAME } from 'devframe/constants'
2121import { serveStaticNodeMiddleware } from 'devframe/utils/serve-static'
2222import { getPort } from 'get-port-please'
2323import pkg from '../package.json' with { type : 'json' }
@@ -103,7 +103,7 @@ export function createDataInspectorCli() {
103103 } )
104104 } )
105105 await new Promise < void > ( done => server . listen ( port , flags . host , done ) )
106- const url = `http://${ flags . host } :${ port } /${ token ? `?di_token =${ token } ` : '' } `
106+ const url = `http://${ flags . host } :${ port } /${ token ? `?${ DEVFRAME_AUTH_TOKEN_QUERY_PARAM } =${ token } ` : '' } `
107107 console . log ( `data-inspector attached to ${ websocket } ` )
108108 console . log ( `open ${ url } ` )
109109 } )
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import type {
2626 SuggestOutcome ,
2727} from '../../engine'
2828import { connectDevframe } from 'devframe/client'
29+ import { DEVFRAME_AUTH_TOKEN_QUERY_PARAM } from 'devframe/constants'
2930import { reactive , shallowRef } from 'vue'
3031import { runQuery , runQueryAtPath , skeletonOf , suggest as suggestQuery } from '../../engine'
3132
@@ -163,14 +164,15 @@ function createStaticBackend(dataset: StaticDataset): DataBackend {
163164
164165/**
165166 * Read and strip the pre-shared auth token the attach CLI appends to the SPA
166- * URL (`?di_token=…`), so it never lingers in the address bar or history.
167+ * URL (`?devframe_auth_token=…`), so it never lingers in the address bar or
168+ * history.
167169 */
168170function consumeAuthToken ( ) : string | undefined {
169171 const params = new URLSearchParams ( location . search )
170- const token = params . get ( 'di_token' )
172+ const token = params . get ( DEVFRAME_AUTH_TOKEN_QUERY_PARAM )
171173 if ( ! token )
172174 return undefined
173- params . delete ( 'di_token' )
175+ params . delete ( DEVFRAME_AUTH_TOKEN_QUERY_PARAM )
174176 const search = params . toString ( )
175177 history . replaceState ( null , '' , search ? `?${ search } ` : location . pathname )
176178 return token
You can’t perform that action at this time.
0 commit comments