File tree Expand file tree Collapse file tree
core/src/node/rpc/anonymous Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,12 +5,14 @@ import c from 'ansis'
55export interface DevToolsAuthInput {
66 authId : string
77 ua : string
8+ origin : string
89}
910
1011export interface DevToolsAuthReturn {
1112 isTrusted : boolean
1213}
1314
15+ // TODO: Replace with a proper storage solution
1416const TEMPORARY_STORAGE = new Map < string , {
1517 authId : string
1618 ua : string
@@ -39,6 +41,7 @@ export const anonymousAuth = defineRpcFunction({
3941 `A browser is requesting permissions to connect to the Vite DevTools.` ,
4042
4143 `User Agent: ${ c . yellow ( c . bold ( query . ua || 'Unknown' ) ) } ` ,
44+ `Origin : ${ c . cyan ( c . bold ( query . origin || 'Unknown' ) ) } ` ,
4245 `Identifier: ${ c . green ( c . bold ( query . authId ) ) } ` ,
4346 '' ,
4447 'This will allow the browser to interact with the server, make file changes and run commands.' ,
@@ -64,13 +67,13 @@ export const anonymousAuth = defineRpcFunction({
6467 session . meta . clientAuthId = query . authId
6568 session . meta . isTrusted = true
6669
67- p . outro ( c . green ( c . bold ( ' You have granted permissions to this client.' ) ) )
70+ p . outro ( c . green ( c . bold ( ` You have granted permissions to ${ c . bold ( query . authId ) } ` ) ) )
6871 return {
6972 isTrusted : true ,
7073 }
7174 }
7275
73- p . outro ( c . red ( c . bold ( ' You have denied permissions to this client.' ) ) )
76+ p . outro ( c . red ( c . bold ( ` You have denied permissions to ${ c . bold ( query . authId ) } ` ) ) )
7477 return {
7578 isTrusted : false ,
7679 }
Original file line number Diff line number Diff line change @@ -188,6 +188,7 @@ export async function getDevToolsRpcClient(
188188 const result = await serverRpc . $call ( 'vite:anonymous:auth' , {
189189 authId,
190190 ua,
191+ origin : location . origin ,
191192 } )
192193
193194 isTrusted = result . isTrusted
You can’t perform that action at this time.
0 commit comments