mirror of
https://github.com/uqbar-dao/nectar.git
synced 2024-11-29 15:24:30 +03:00
hotfix: settings page work on secure connections
This commit is contained in:
parent
da036ea6af
commit
4637b1f500
@ -2,16 +2,11 @@ const APP_PATH = '/settings:settings:sys/ask';
|
||||
|
||||
// Fetch initial data and populate the UI
|
||||
function init() {
|
||||
fetch('/our')
|
||||
.then(response => response.text())
|
||||
fetch(APP_PATH)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
const our = data + '@settings:settings:sys';
|
||||
fetch(APP_PATH)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log(data);
|
||||
populate(data);
|
||||
});
|
||||
console.log(data);
|
||||
populate(data);
|
||||
});
|
||||
}
|
||||
|
||||
@ -158,7 +153,8 @@ document.getElementById('ping-peer').addEventListener('submit', (e) => {
|
||||
})
|
||||
|
||||
// Setup WebSocket connection
|
||||
const ws = new WebSocket("ws://" + location.host + "/settings:settings:sys/");
|
||||
const wsProtocol = location.protocol === 'https:' ? 'wss://' : 'ws://';
|
||||
const ws = new WebSocket(wsProtocol + location.host + "/settings:settings:sys/");
|
||||
ws.onmessage = event => {
|
||||
const data = JSON.parse(event.data);
|
||||
console.log(data);
|
||||
|
@ -249,6 +249,7 @@ fn handle_http_request(
|
||||
state: &mut SettingsState,
|
||||
http_request: &http::IncomingHttpRequest,
|
||||
) -> anyhow::Result<()> {
|
||||
state.fetch()?;
|
||||
match http_request.method()?.as_str() {
|
||||
"GET" => Ok(http::send_response(
|
||||
http::StatusCode::OK,
|
||||
|
Loading…
Reference in New Issue
Block a user