feat: ADD password protection via URL query #34

This commit is contained in:
Caffeine Fueled 2026-09-02 17:27:29 +02:00
parent 8dbe149970
commit 5fb0af99e2
Signed by: cf7
GPG key ID: CA295D643074C68C
2 changed files with 15 additions and 0 deletions

7
app.py
View file

@ -448,6 +448,13 @@ function connect(){
isAuthed = true;
hideOverlay();
ver = msg.ver; ta.value = msg.text; updateGutter();
// ?pw= on an unprotected pad sets the password instead of unlocking.
// Guard on !isProtected: the server re-sends init after a successful
// auth, and that init lands here too without the guard every unlock
// would re-hash the same password and re-broadcast protected_changed.
if (urlPw && !isProtected) {
ws.send(JSON.stringify({type: "set_password", password: urlPw}));
}
}
} else if (msg.type === "auth_ok") {
isAuthed = true;