Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions kinode/packages/settings/pkg/ui/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ function api_call(body) {

function shutdown() {
api_call("Shutdown");
setTimeout(() => {
window.location.reload();
}, 1000);
}

function populate(data) {
Expand Down
2 changes: 1 addition & 1 deletion kinode/packages/settings/settings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ simulation-mode = []
anyhow = "1.0"
base64 = "0.22.0"
bincode = "1.3.3"
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "830a86c" }
kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "7820481" }
rmp-serde = "1.2.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
6 changes: 3 additions & 3 deletions kinode/packages/settings/settings/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ fn initialize(our: Address) {
.unwrap();

// Serve the index.html and other UI files found in pkg/ui at the root path.
http::serve_ui(&our, "ui", true, false, vec!["/"]).unwrap();
http::bind_http_path("/ask", true, false).unwrap();
http::bind_ws_path("/", true, false).unwrap();
http::secure_serve_ui(&our, "ui", vec!["/"]).unwrap();
http::secure_bind_http_path("/ask").unwrap();
http::secure_bind_ws_path("/", false).unwrap();

// Grab our state, then enter the main event loop.
let mut state: SettingsState = SettingsState::new(our);
Expand Down
10 changes: 7 additions & 3 deletions kinode/src/http/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ <h1 style="font-family: 'Futura', sans-serif; letter-spacing: 0.4em; font-size:
</svg>
</div>
<form id="signup-form" class="flex flex-col">
<h3 class="flex flex-col ml-2 text-lg"> ${node} </h3>
<h3 id="node-and-domain" class="flex flex-col ml-2 text-lg"></h3>
<div class="flex mt-2 mb-2"> Enter Password </div>
<input autofocus type="password" id="password" required="" minlength="6" name="password" placeholder="Password"
oninput="document.getElementById('password-err').style.display = 'none';" value="" class="self-stretch mb-2">
Expand All @@ -1193,6 +1193,9 @@ <h3>Logging in...</h3>
document.getElementById("fake-or-not").innerHTML = "To change your networking info, please restart your node.";
}

const firstPathItem = window.location.pathname.split('/')[1];
document.getElementById("node-and-domain").innerText = "${node} " + firstPathItem;

async function login(password) {
document.getElementById("signup-form").style.display = "none";
document.getElementById("loading").style.display = "flex";
Expand All @@ -1203,11 +1206,12 @@ <h3>Logging in...</h3>
const result = await fetch("/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ password_hash: hashHex }),
body: JSON.stringify({ password_hash: hashHex, subdomain: firstPathItem }),
});

if (result.status == 200) {
window.location.href = "/";
// reload page
window.location.reload();
} else {
document.getElementById("signup-form").style.display = "flex";
document.getElementById("loading").style.display = "none";
Expand Down
Loading