Skip to content

Commit

Permalink
wip user confirm
Browse files Browse the repository at this point in the history
TODO: timeout for the user confirmation.
  • Loading branch information
benma committed Jul 1, 2024
1 parent 13881ba commit 0dee604
Show file tree
Hide file tree
Showing 4 changed files with 409 additions and 30 deletions.
201 changes: 201 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions bitbox-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
license = "Apache-2.0"

[dependencies]
webbrowser = "1.0"
env_logger = "0.11"
futures = { workspace = true }
futures-util = { workspace = true }
Expand Down
20 changes: 20 additions & 0 deletions bitbox-bridge/resources/confirmation_dialog.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>BitBoxBridge</title>
</head>
<body>
<h1>BitBoxBridge</h1>
<p>{{ message }}</p>
<button onclick="sendResponse(true)">OK</button>
<button onclick="sendResponse(false)">Cancel</button>
<script>
function sendResponse(userChoice) {
fetch(`/confirm/response/{{ counter }}/${userChoice}`, { method: 'POST' })
.then(() => window.close()) // Optionally close the window/tab
.catch(err => console.error('Error sending response:', err));
}
</script>
</body>
</html>
Loading

0 comments on commit 0dee604

Please sign in to comment.