Merge branch 'feature/nostr-remote_signing' into live

This commit is contained in:
raucao committed 2026-11-27 18:31:09 +04:00
commit a5cf96bbf6
2 files changed
+12 -4

No files matched your search

@@ -3,7 +3,7 @@ import { csrfToken } from "lib/csrf"
// Connects to data-controller="nostr-login"
export default class extends Controller {
static targets = [ "loginButton", "extensionOption" ]
static targets = [ "extensionOption" ]
static values = { site: String, sharedSecret: String }
connect() {
@@ -11,8 +11,8 @@ export default class extends Controller {
this.element.classList.remove("hidden")
if (this.hasExtensionOptionTarget) {
this.extensionOptionTarget.classList.remove("hidden")
this.extensionOptionTarget.disabled = false
}
this.loginButtonTarget.disabled = false
}
}
@@ -23,7 +23,7 @@ export default class extends Controller {
}
async login () {
this.loginButtonTarget.disabled = true
if (this.hasExtensionOptionTarget) this.extensionOptionTarget.disabled = true
try {
// Auth based on NIP-42
@@ -52,7 +52,7 @@ export default class extends Controller {
} catch (error) {
console.warn('Unable to authenticate:', error.message)
} finally {
this.loginButtonTarget.disabled = false
if (this.hasExtensionOptionTarget) this.extensionOptionTarget.disabled = false
}
}
}
@@ -36,6 +36,14 @@ RSpec.describe NostrLoginComponent, type: :component do
expect(extension["class"]).to include("hidden")
end
it "wires the login action to the extension option button" do
rendered = render_component
extension = rendered.css("[data-nostr-login-target='extensionOption']").first
expect(extension.name).to eq("button")
expect(extension["data-action"]).to eq("nostr-login#login")
end
it "omits the Nostr Connect option when the user is remembered" do
rendered = render_component(remembered_user: Object.new)