feat: ADD password protection via URL query #34
This commit is contained in:
parent
8dbe149970
commit
5fb0af99e2
2 changed files with 15 additions and 0 deletions
7
app.py
7
app.py
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue