add missing ws.js and introduce save check for both sides

This commit is contained in:
Schluffe committed 2026-10-22 23:29:55 +02:00
1 parent ff7b84af02
commit 1bfeb9843a
4 files changed
+189 -37

No files matched your search

+6 -6
View File
@@ -23,20 +23,20 @@ const answer = ref('');
const receiveCode = ref('');
const check = ref<Check>();
const confirmSend = ref<() => void>();
const confirmCheck = ref<() => void>();
const log = ref<string[]>([]);
const events: Events = {
log: (message) => log.value.push(`${new Date().toISOString().slice(11, 23)} ${message}`),
check: (result, confirm) => {
check.value = result;
confirmSend.value = confirm;
confirmCheck.value = confirm;
},
};
function onConfirm() {
confirmSend.value?.();
confirmSend.value = undefined;
confirmCheck.value?.();
confirmCheck.value = undefined;
}
let acceptAnswer: ((answer: string) => Promise<void>) | undefined;
@@ -110,8 +110,8 @@ function onReceive() {
<p v-if="check">
Security check, you: <output id="check-local">{{ check.local }}</output>, peer:
<output id="check-remote">{{ check.remote }}</output>. The other side must show the same two codes swapped.
<button v-if="confirmSend" id="confirm" @click="onConfirm">Codes match, send</button>
<output id="check-remote">{{ check.remote }}</output>. The other side must show the same two codes swapped. Both sides confirm, nothing is transferred before.
<button v-if="confirmCheck" id="confirm" @click="onConfirm">Codes match</button>
</p>
<h2>Log</h2>