Settings page for adding verified nostr pubkeys

This commit is contained in:
Râu Cao
2023-03-08 13:44:18 +07:00
parent bc4d9ff528
commit 49de4007ab
21 changed files with 621 additions and 233 deletions

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" height="48" viewBox="0 96 960 960" width="48" class="material-science <%= custom_class %>" fill="currentColor"><path d="M172 936q-41.777 0-59.388-39Q95 858 124 826l248-280V276h-52q-12.75 0-21.375-8.675-8.625-8.676-8.625-21.5 0-12.825 8.625-21.325T320 216h320q12.75 0 21.375 8.675 8.625 8.676 8.625 21.5 0 12.825-8.625 21.325T640 276h-52v270l248 280q29 32 11.388 71-17.611 39-59.388 39H172Zm-12-60h640L528 568V276h-96v292L160 876Zm318-300Z"/></svg>

After

Width:  |  Height:  |  Size: 488 B

View File

@@ -0,0 +1,62 @@
<section>
<h3>Nostr</h3>
<h4 class="mb-0">Public Key</h4>
<div data-controller="settings--nostr-pubkey"
data-settings--nostr-pubkey-user-address-value="<%= current_user.address %>"
data-settings--nostr-pubkey-shared-secret-value="<%= session[:shared_secret] %>"
data-settings--nostr-pubkey-pubkey-hex-value="<%= current_user.nostr_pubkey %>">
<p class="mt-2 <%= current_user.nostr_pubkey.present? ? "" : "hidden" %>">
<input type="text" class="w-full" value="<%= current_user.nostr_pubkey %>"
data-settings--nostr-pubkey-target="pubkeyBech32Input" disabled />
</p>
<% unless current_user.nostr_pubkey.present? %>
<p class="my-4">
If you use any apps on the Nostr network, you can verify your public key
with us in order to enable Nostr-specific features for your account.
</p>
<% end %>
<div data-settings--nostr-pubkey-target="noExtension"
class="hidden rounded-md bg-blue-50 p-4">
<div class="flex">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-blue-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<h3 class="mb-0 text-sm font-bold text-blue-800">
No browser extension found
</h3>
<div class="mt-2 mb-0 text-sm text-blue-800">
<p>
We recommend Alby, which you can also use for your Lightning
Wallet.
</p>
</div>
<div class="mt-4">
<div class="-mx-2 -my-1.5 flex">
<a href="https://getalby.com" target="_blank"
class="rounded-md bg-blue-50 px-2 py-1.5 text-sm
font-bold text-blue-800 hover:bg-blue-100
focus:outline-none focus:ring-2 focus:ring-blue-600
focus:ring-offset-2 focus:ring-offset-blue-50">
Get Alby
</a>
</div>
</div>
</div>
</div>
</div>
<p class="mt-8">
<button class="btn-md btn-gray" disabled
data-settings--nostr-pubkey-target="setPubkey"
data-action="settings--nostr-pubkey#setPubkey">
Get public key from browser extension
</button>
</p>
</div>
</section>

View File

@@ -18,3 +18,9 @@
active: @settings_section.to_s == "lightning"
) %>
<% end %>
<% if Setting.nostr_enabled %>
<%= render SidenavLinkComponent.new(
name: "Experiments", path: setting_path(:experiments), icon: "science",
active: @settings_section.to_s == "experiments"
) %>
<% end %>