File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -6,20 +6,26 @@ async function main() {
66 let url = "" ;
77
88 // Detect if we're running in the (production) webserver included in the matter server or not.
9- const isProductionServer = location . href . includes ( ":5580" ) || location . href . includes ( "hassio_ingress" ) || location . href . includes ( "/api/ingress/" ) ;
9+ const isProductionServer = location . origin . includes ( ":5580" ) || location . href . includes ( "hassio_ingress" ) || location . href . includes ( "/api/ingress/" ) ;
1010
1111 if ( ! isProductionServer ) {
1212 // development server, ask for url to matter server
1313 let storageUrl = localStorage . getItem ( "matterURL" ) ;
1414 if ( ! storageUrl ) {
15+ const urlParams = new URLSearchParams ( window . location . search ) ;
16+ const suggestedUrl = urlParams . get ( 'url' ) ;
1517 storageUrl = prompt (
1618 "Enter Websocket URL to a running Matter Server" ,
17- "ws://localhost:5580/ws"
19+ suggestedUrl || "ws://localhost:5580/ws"
1820 ) ;
1921 if ( ! storageUrl ) {
2022 alert ( "Unable to connect without URL" ) ;
2123 return ;
2224 }
25+ if ( suggestedUrl ) {
26+ // Remove suggested url from address without redirecting
27+ history . pushState ( { } , "" , window . location . pathname ) ;
28+ }
2329 localStorage . setItem ( "matterURL" , storageUrl ) ;
2430 }
2531 url = storageUrl ;
You can’t perform that action at this time.
0 commit comments