mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-29 08:52:25 +00:00
Refactor NIP-46 login UI to be cleaner and QR-first
- Simplified `components/login-modal.html` to center the QR code and use a "Copy Link" button instead of a large textarea. - Updated `js/ui/loginModalController.js` to support the new DOM structure and error handling. - Added `docs/nip46-roadmap.md` to document current state and future features. - Fixed `NostrClient.destroy()` usage (synchronous void method) in `js/nostr/client.js`. - Relaxed NIP-46 `connect` response validation in `js/nostr/client.js` and `js/nostr/nip46Client.js` to accept "ack" (case-insensitive) as a valid success signal, preventing timeouts with signers that do not echo the secret.
This commit is contained in:
1 parent
4196a6bb42
commit
065e74769c
2 files changed
+7
-3
No files matched your search
+3
-2
@@ -1787,7 +1787,8 @@ export class NostrClient {
|
||||
}
|
||||
|
||||
if (secret) {
|
||||
if (!resultValue || resultValue !== secret) {
|
||||
const normalizedResult = resultValue ? resultValue.toLowerCase() : "";
|
||||
if (resultValue !== secret && normalizedResult !== "ack") {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -2202,7 +2203,7 @@ export class NostrClient {
|
||||
message: error?.message || String(error),
|
||||
code: error?.code || null,
|
||||
});
|
||||
await client.destroy().catch(() => {});
|
||||
client.destroy();
|
||||
this.nip46Client = null;
|
||||
if (!remember) {
|
||||
clearStoredNip46Session();
|
||||
|
||||
@@ -1823,7 +1823,10 @@ export class Nip46RpcClient {
|
||||
|
||||
if (this.secret) {
|
||||
const normalizedResult = typeof result === "string" ? result.trim() : "";
|
||||
if (!normalizedResult || normalizedResult !== this.secret) {
|
||||
if (
|
||||
!normalizedResult ||
|
||||
(normalizedResult !== this.secret && normalizedResult.toLowerCase() !== "ack")
|
||||
) {
|
||||
const error = new Error("Remote signer secret mismatch. Rejecting connection.");
|
||||
error.code = "nip46-secret-mismatch";
|
||||
throw error;
|
||||
|
||||
Reference in new issue
Block a user