diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 512e74ef..e7f12b7c 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -98,6 +98,13 @@ fn secure_load(key: String) -> Result { } } +#[tauri::command] +fn secure_remove(key: String) -> Result<(), ()> { + let entry = Entry::new("lume", &key).expect("Failed to create entry"); + let _ = entry.delete_password(); + Ok(()) +} + fn main() { tauri::Builder::default() .plugin(tauri_plugin_app::init()) @@ -140,7 +147,8 @@ fn main() { .invoke_handler(tauri::generate_handler![ opengraph, secure_save, - secure_load + secure_load, + secure_remove ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); diff --git a/src/app.css b/src/app.css index f52ee2e8..b425d849 100644 --- a/src/app.css +++ b/src/app.css @@ -46,7 +46,7 @@ input::-ms-clear { } .ProseMirror p.is-empty::before { - @apply text-white/50; + @apply text-neutral-600 dark:text-neutral-400; content: attr(data-placeholder); float: left; height: 0; diff --git a/src/app.tsx b/src/app.tsx index 2b132f4f..65360885 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,5 +1,4 @@ import { message } from '@tauri-apps/plugin-dialog'; -import { fetch } from '@tauri-apps/plugin-http'; import { RouterProvider, createBrowserRouter, defer, redirect } from 'react-router-dom'; import { ReactFlowProvider } from 'reactflow'; diff --git a/src/app/auth/components/features/followList.tsx b/src/app/auth/components/features/followList.tsx index 77fafabd..8901fac5 100644 --- a/src/app/auth/components/features/followList.tsx +++ b/src/app/auth/components/features/followList.tsx @@ -46,7 +46,7 @@ export function FollowList() { ))} {data.length > 16 ? ( -
+
+{data.length}
) : null} diff --git a/src/app/auth/import.tsx b/src/app/auth/import.tsx index 5a20cba9..7b86be3f 100644 --- a/src/app/auth/import.tsx +++ b/src/app/auth/import.tsx @@ -1,3 +1,4 @@ +import { readText } from '@tauri-apps/plugin-clipboard-manager'; import { motion } from 'framer-motion'; import { nip19 } from 'nostr-tools'; import { useState } from 'react'; @@ -46,6 +47,11 @@ export function ImportAccountScreen() { } }; + const pasteNsec = async () => { + const tempNsec = await readText(); + setNsec(tempNsec); + }; + const submitNsec = async () => { if (savedPrivkey) return; if (nsec.length > 50 && nsec.startsWith('nsec1')) { @@ -61,7 +67,7 @@ export function ImportAccountScreen() { return (
-
+
{!created ? ( +
+ setNsec(e.target.value)} + spellCheck={false} + autoComplete="off" + autoCorrect="off" + autoCapitalize="off" + placeholder="nsec1" + className="h-11 w-full rounded-lg bg-neutral-200 px-3 placeholder:text-neutral-500 dark:bg-neutral-800 dark:placeholder:text-neutral-400" + /> + {nsec.length < 5 ? ( +
+ +
+ ) : null} +
+ {nsec.length > 5 ? ( + + ) : null}
@@ -195,12 +216,14 @@ export function ImportAccountScreen() { 1. In case you store private key in Lume

- Lume will put your nsec to{' '} - {db.platform === 'macos' - ? 'Apple Keychain (macOS)' - : db.platform === 'windows' - ? 'Credential Manager (Windows)' - : 'Secret Service (Linux)'} + Lume will put your private key to{' '} + + {db.platform === 'macos' + ? 'Apple Keychain (macOS)' + : db.platform === 'windows' + ? 'Credential Manager (Windows)' + : 'Secret Service (Linux)'} + , it will be secured by your OS

diff --git a/src/app/chats/chat.tsx b/src/app/chats/chat.tsx index dd03aee0..52571662 100644 --- a/src/app/chats/chat.tsx +++ b/src/app/chats/chat.tsx @@ -29,12 +29,7 @@ export function ChatScreen() { const renderItem = useCallback( (message: NDKEvent) => { return ( - + ); }, [data] @@ -91,17 +86,12 @@ export function ChatScreen() {

) : ( - + {data.map((message) => renderItem(message))} )}
-
+
@@ -105,14 +109,14 @@ export const UserWithDrawer = memo(function UserWithDrawer({ )} Message diff --git a/src/app/notes/article.tsx b/src/app/notes/article.tsx index 21e6cb74..5374736b 100644 --- a/src/app/notes/article.tsx +++ b/src/app/notes/article.tsx @@ -1,7 +1,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { writeText } from '@tauri-apps/plugin-clipboard-manager'; import { nip19 } from 'nostr-tools'; -import { AddressPointer, EventPointer } from 'nostr-tools/lib/nip19'; +import { AddressPointer, EventPointer } from 'nostr-tools/lib/types/nip19'; import { useRef, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; @@ -58,7 +58,7 @@ export function ArticleNoteScreen() { }; return ( -
+
@@ -66,20 +66,20 @@ export function ArticleNoteScreen() { -
+
@@ -101,19 +101,19 @@ export function ArticleNoteScreen() {
) : ( <> -
-
+
+
{renderKind(data)}
-
+
-
+
diff --git a/src/app/notes/text.tsx b/src/app/notes/text.tsx index 7b2c8e16..1d08cdae 100644 --- a/src/app/notes/text.tsx +++ b/src/app/notes/text.tsx @@ -1,7 +1,7 @@ import { NDKEvent, NDKKind } from '@nostr-dev-kit/ndk'; import { writeText } from '@tauri-apps/plugin-clipboard-manager'; import { nip19 } from 'nostr-tools'; -import { EventPointer } from 'nostr-tools/lib/nip19'; +import { EventPointer } from 'nostr-tools/lib/types/nip19'; import { useRef, useState } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; @@ -18,7 +18,6 @@ import { UnknownNote, } from '@shared/notes'; import { RepliesList } from '@shared/notes/replies/list'; -import { NoteSkeleton } from '@shared/notes/skeleton'; import { User } from '@shared/user'; import { useEvent } from '@utils/hooks/useEvent'; @@ -28,6 +27,9 @@ export function TextNoteScreen() { const replyRef = useRef(null); const { id } = useParams(); + + console.log(id); + const { db } = useStorage(); const { status, data } = useEvent(id); @@ -62,7 +64,7 @@ export function TextNoteScreen() { }; return ( -
+
@@ -70,20 +72,20 @@ export function TextNoteScreen() { -
+
@@ -99,20 +101,20 @@ export function TextNoteScreen() {
{status === 'loading' ? (
-
- +
+ Loading...
) : ( -
-
+
+
{renderKind(data)}
-
+
-
+
)}
diff --git a/src/app/nwc/components/alby.tsx b/src/app/nwc/components/alby.tsx index 7c465077..317b9e5c 100644 --- a/src/app/nwc/components/alby.tsx +++ b/src/app/nwc/components/alby.tsx @@ -56,24 +56,26 @@ export function NWCAlby() {
-
+
-
Alby
-

Require alby account

+
Alby
+

+ Require alby account +

- +
diff --git a/src/app/nwc/components/other.tsx b/src/app/nwc/components/other.tsx index e0e7bfd5..92d949c4 100644 --- a/src/app/nwc/components/other.tsx +++ b/src/app/nwc/components/other.tsx @@ -71,12 +71,14 @@ export function NWCOther() {
-
+
-
URI String
-

+

+ URI String +
+

Using format nostr+walletconnect:

@@ -84,14 +86,14 @@ export function NWCOther() {
- +
diff --git a/src/app/nwc/index.tsx b/src/app/nwc/index.tsx index 2cbda92e..03228715 100644 --- a/src/app/nwc/index.tsx +++ b/src/app/nwc/index.tsx @@ -1,36 +1,50 @@ +import { useEffect, useState } from 'react'; + import { NWCAlby } from '@app/nwc/components/alby'; import { NWCOther } from '@app/nwc/components/other'; +import { useStorage } from '@libs/storage/provider'; + import { CheckCircleIcon } from '@shared/icons'; export function NWCScreen() { - const walletConnectURL = 'test'; + const { db } = useStorage(); + const [walletConnectURL, setWalletConnectURL] = useState(null); const remove = async () => { - // setWalletConnectURL(''); - // await db.secureSave('walletConnectURL', '', 'nwc'); + await db.secureRemove('nwc'); + setWalletConnectURL(null); }; + useEffect(() => { + async function getNWC() { + const nwc = await db.secureLoad('nwc'); + if (nwc) setWalletConnectURL(nwc); + } + + getNWC(); + }, []); + return ( -
+

Nostr Wallet Connect (Beta)

-

+

Sending tips easily via Bitcoin Lightning.

{!walletConnectURL ? ( -
+
) : ( -
-
+
+

You're using nostr wallet connect

@@ -38,12 +52,12 @@ export function NWCScreen() {