File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,11 @@ const APP_PATH = '/settings:settings:sys/ask';
22
33// Fetch initial data and populate the UI
44function init ( ) {
5- fetch ( '/our' )
6- . then ( response => response . text ( ) )
5+ fetch ( APP_PATH )
6+ . then ( response => response . json ( ) )
77 . then ( data => {
8- const our = data + '@settings:settings:sys' ;
9- fetch ( APP_PATH )
10- . then ( response => response . json ( ) )
11- . then ( data => {
12- console . log ( data ) ;
13- populate ( data ) ;
14- } ) ;
8+ console . log ( data ) ;
9+ populate ( data ) ;
1510 } ) ;
1611}
1712
@@ -158,7 +153,8 @@ document.getElementById('ping-peer').addEventListener('submit', (e) => {
158153} )
159154
160155// Setup WebSocket connection
161- const ws = new WebSocket ( "ws://" + location . host + "/settings:settings:sys/" ) ;
156+ const wsProtocol = location . protocol === 'https:' ? 'wss://' : 'ws://' ;
157+ const ws = new WebSocket ( wsProtocol + location . host + "/settings:settings:sys/" ) ;
162158ws . onmessage = event => {
163159 const data = JSON . parse ( event . data ) ;
164160 console . log ( data ) ;
Original file line number Diff line number Diff line change @@ -249,6 +249,7 @@ fn handle_http_request(
249249 state : & mut SettingsState ,
250250 http_request : & http:: IncomingHttpRequest ,
251251) -> anyhow:: Result < ( ) > {
252+ state. fetch ( ) ?;
252253 match http_request. method ( ) ?. as_str ( ) {
253254 "GET" => Ok ( http:: send_response (
254255 http:: StatusCode :: OK ,
You can’t perform that action at this time.
0 commit comments