feat: upgrade to tauri v2 rc

This commit is contained in:
reya
2024-08-10 16:45:56 +07:00
parent 4c6d1c768a
commit e2103ae23a
32 changed files with 5517 additions and 5551 deletions

View File

@@ -9,7 +9,7 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@getalby/bitcoin-connect-react": "^3.5.3", "@getalby/bitcoin-connect-react": "^3.6.1",
"@lume/icons": "workspace:^", "@lume/icons": "workspace:^",
"@lume/system": "workspace:^", "@lume/system": "workspace:^",
"@lume/ui": "workspace:^", "@lume/ui": "workspace:^",
@@ -21,40 +21,40 @@
"@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.0", "@radix-ui/react-tabs": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.2",
"@tanstack/query-persist-client-core": "^5.51.9", "@tanstack/query-persist-client-core": "^5.51.21",
"@tanstack/react-query": "^5.51.9", "@tanstack/react-query": "^5.51.23",
"@tanstack/react-router": "^1.45.4", "@tanstack/react-router": "^1.47.1",
"embla-carousel-react": "^8.1.6", "embla-carousel-react": "^8.1.8",
"i18next": "^23.12.1", "i18next": "^23.12.2",
"i18next-resources-to-backend": "^1.2.1", "i18next-resources-to-backend": "^1.2.1",
"minidenticons": "^4.2.1", "minidenticons": "^4.2.1",
"nanoid": "^5.0.7", "nanoid": "^5.0.7",
"nostr-tools": "^2.7.1", "nostr-tools": "^2.7.2",
"react": "^18.3.1", "react": "^18.3.1",
"react-currency-input-field": "^3.8.0", "react-currency-input-field": "^3.8.0",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-hook-form": "^7.52.1", "react-hook-form": "^7.52.2",
"react-i18next": "^14.1.3", "react-i18next": "^15.0.1",
"react-string-replace": "^1.1.1", "react-string-replace": "^1.1.1",
"slate": "^0.103.0", "slate": "^0.103.0",
"slate-react": "^0.105.0", "slate-react": "^0.107.1",
"use-debounce": "^10.0.1", "use-debounce": "^10.0.2",
"virtua": "^0.31.0" "virtua": "^0.33.4"
}, },
"devDependencies": { "devDependencies": {
"@lume/tailwindcss": "workspace:^", "@lume/tailwindcss": "workspace:^",
"@lume/tsconfig": "workspace:^", "@lume/tsconfig": "workspace:^",
"@lume/types": "workspace:^", "@lume/types": "workspace:^",
"@tanstack/router-devtools": "^1.45.4", "@tanstack/router-devtools": "^1.47.1",
"@tanstack/router-vite-plugin": "^1.45.3", "@tanstack/router-vite-plugin": "^1.47.0",
"@types/react": "^18.3.3", "@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"@vitejs/plugin-react-swc": "^3.7.0", "@vitejs/plugin-react-swc": "^3.7.0",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.20",
"postcss": "^8.4.39", "postcss": "^8.4.41",
"tailwindcss": "^3.4.6", "tailwindcss": "^3.4.9",
"typescript": "^5.5.3", "typescript": "^5.5.4",
"vite": "^5.3.4", "vite": "^5.4.0",
"vite-tsconfig-paths": "^4.3.2" "vite-tsconfig-paths": "^5.0.1"
} }
} }

View File

@@ -10,17 +10,17 @@
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"@astrojs/check": "^0.5.10", "@astrojs/check": "^0.9.2",
"@astrojs/tailwind": "^5.1.0", "@astrojs/tailwind": "^5.1.0",
"@fontsource/alice": "^5.0.13", "@fontsource/alice": "^5.0.13",
"astro": "^4.11.6", "astro": "^4.13.3",
"astro-seo-meta": "^4.1.1", "astro-seo-meta": "^4.1.1",
"astro-seo-schema": "^4.0.2", "astro-seo-schema": "^4.0.2",
"schema-dts": "^1.1.2", "schema-dts": "^1.1.2",
"tailwindcss": "^3.4.6", "tailwindcss": "^3.4.9",
"typescript": "^5.5.3" "typescript": "^5.5.4"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/typography": "^0.5.13" "@tailwindcss/typography": "^0.5.14"
} }
} }

View File

@@ -6,30 +6,30 @@
"build": "turbo run build", "build": "turbo run build",
"dev": "turbo run dev", "dev": "turbo run dev",
"web:dev": "turbo run dev --filter web", "web:dev": "turbo run dev --filter web",
"desktop:dev": "turbo run dev --filter desktop2", "desktop:dev": "turbo run dev --filter @lume/desktop2",
"desktop:build": "turbo run build --filter desktop2", "desktop:build": "turbo run build --filter @lume/desktop2",
"tauri": "tauri" "tauri": "tauri"
}, },
"devDependencies": { "devDependencies": {
"@biomejs/biome": "^1.8.3", "@biomejs/biome": "^1.8.3",
"@tauri-apps/cli": "2.0.0-beta.22", "@tauri-apps/cli": "2.0.0-rc.1",
"turbo": "^1.13.4" "turbo": "^2.0.12"
}, },
"packageManager": "pnpm@8.9.0", "packageManager": "pnpm@8.9.0",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
}, },
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.0.0-beta.15", "@tauri-apps/api": "2.0.0-rc.0",
"@tauri-apps/plugin-clipboard-manager": "2.1.0-beta.5", "@tauri-apps/plugin-clipboard-manager": "2.0.0-rc.0",
"@tauri-apps/plugin-dialog": "2.0.0-beta.7", "@tauri-apps/plugin-dialog": "2.0.0-rc.0",
"@tauri-apps/plugin-fs": "2.0.0-beta.7", "@tauri-apps/plugin-fs": "2.0.0-rc.0",
"@tauri-apps/plugin-http": "2.0.0-beta.8", "@tauri-apps/plugin-http": "2.0.0-rc.0",
"@tauri-apps/plugin-os": "2.0.0-beta.7", "@tauri-apps/plugin-os": "2.0.0-rc.0",
"@tauri-apps/plugin-process": "2.0.0-beta.7", "@tauri-apps/plugin-process": "2.0.0-rc.0",
"@tauri-apps/plugin-shell": "2.0.0-beta.8", "@tauri-apps/plugin-shell": "2.0.0-rc.0",
"@tauri-apps/plugin-updater": "2.0.0-beta.7", "@tauri-apps/plugin-updater": "2.0.0-rc.0",
"@tauri-apps/plugin-upload": "2.0.0-beta.8", "@tauri-apps/plugin-upload": "2.0.0-rc.0",
"@tauri-apps/plugin-window-state": "2.0.0-beta.8" "@tauri-apps/plugin-window-state": "2.0.0-rc.0"
} }
} }

View File

@@ -9,6 +9,6 @@
"devDependencies": { "devDependencies": {
"@lume/tsconfig": "workspace:*", "@lume/tsconfig": "workspace:*",
"@types/react": "^18.3.3", "@types/react": "^18.3.3",
"typescript": "^5.5.3" "typescript": "^5.5.4"
} }
} }

View File

@@ -5,15 +5,15 @@
"main": "./src/index.ts", "main": "./src/index.ts",
"dependencies": { "dependencies": {
"@lume/utils": "workspace:^", "@lume/utils": "workspace:^",
"@tanstack/query-persist-client-core": "^5.51.9", "@tanstack/query-persist-client-core": "^5.51.21",
"@tanstack/react-query": "^5.51.9", "@tanstack/react-query": "^5.51.23",
"nostr-tools": "^2.7.1", "nostr-tools": "^2.7.2",
"react": "^18.3.1" "react": "^18.3.1"
}, },
"devDependencies": { "devDependencies": {
"@lume/tsconfig": "workspace:^", "@lume/tsconfig": "workspace:^",
"@lume/types": "workspace:^", "@lume/types": "workspace:^",
"@types/react": "^18.3.3", "@types/react": "^18.3.3",
"typescript": "^5.5.3" "typescript": "^5.5.4"
} }
} }

View File

@@ -1,11 +1,12 @@
// This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually. // This file was generated by [tauri-specta](https://github.com/oscartbeaumont/tauri-specta). Do not edit this file manually.
/** user-defined commands **/ /** user-defined commands **/
export const commands = {
export const commands = {
async getRelays() : Promise<Result<Relays, string>> { async getRelays() : Promise<Result<Relays, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_relays") }; return { status: "ok", data: await TAURI_INVOKE("get_relays") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -13,7 +14,7 @@ try {
} }
}, },
async connectRelay(relay: string) : Promise<Result<boolean, string>> { async connectRelay(relay: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("connect_relay", { relay }) }; return { status: "ok", data: await TAURI_INVOKE("connect_relay", { relay }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -21,7 +22,7 @@ try {
} }
}, },
async removeRelay(relay: string) : Promise<Result<boolean, string>> { async removeRelay(relay: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("remove_relay", { relay }) }; return { status: "ok", data: await TAURI_INVOKE("remove_relay", { relay }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -29,7 +30,7 @@ try {
} }
}, },
async getBootstrapRelays() : Promise<Result<string[], string>> { async getBootstrapRelays() : Promise<Result<string[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_bootstrap_relays") }; return { status: "ok", data: await TAURI_INVOKE("get_bootstrap_relays") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -37,7 +38,7 @@ try {
} }
}, },
async saveBootstrapRelays(relays: string) : Promise<Result<null, string>> { async saveBootstrapRelays(relays: string) : Promise<Result<null, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("save_bootstrap_relays", { relays }) }; return { status: "ok", data: await TAURI_INVOKE("save_bootstrap_relays", { relays }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -45,10 +46,10 @@ try {
} }
}, },
async getAccounts() : Promise<string[]> { async getAccounts() : Promise<string[]> {
return await TAURI_INVOKE("get_accounts"); return await TAURI_INVOKE("get_accounts");
}, },
async createAccount() : Promise<Result<Account, string>> { async createAccount() : Promise<Result<Account, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("create_account") }; return { status: "ok", data: await TAURI_INVOKE("create_account") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -56,7 +57,7 @@ try {
} }
}, },
async saveAccount(nsec: string, password: string) : Promise<Result<string, string>> { async saveAccount(nsec: string, password: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("save_account", { nsec, password }) }; return { status: "ok", data: await TAURI_INVOKE("save_account", { nsec, password }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -64,7 +65,7 @@ try {
} }
}, },
async getEncryptedKey(npub: string, password: string) : Promise<Result<string, string>> { async getEncryptedKey(npub: string, password: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_encrypted_key", { npub, password }) }; return { status: "ok", data: await TAURI_INVOKE("get_encrypted_key", { npub, password }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -72,7 +73,7 @@ try {
} }
}, },
async getPrivateKey(npub: string) : Promise<Result<string, string>> { async getPrivateKey(npub: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_private_key", { npub }) }; return { status: "ok", data: await TAURI_INVOKE("get_private_key", { npub }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -80,7 +81,7 @@ try {
} }
}, },
async connectRemoteAccount(uri: string) : Promise<Result<string, string>> { async connectRemoteAccount(uri: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("connect_remote_account", { uri }) }; return { status: "ok", data: await TAURI_INVOKE("connect_remote_account", { uri }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -88,7 +89,7 @@ try {
} }
}, },
async loadAccount(npub: string, bunker: string | null) : Promise<Result<boolean, string>> { async loadAccount(npub: string, bunker: string | null) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("load_account", { npub, bunker }) }; return { status: "ok", data: await TAURI_INVOKE("load_account", { npub, bunker }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -96,7 +97,7 @@ try {
} }
}, },
async getCurrentProfile() : Promise<Result<string, string>> { async getCurrentProfile() : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_current_profile") }; return { status: "ok", data: await TAURI_INVOKE("get_current_profile") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -104,7 +105,7 @@ try {
} }
}, },
async getProfile(id: string) : Promise<Result<string, string>> { async getProfile(id: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_profile", { id }) }; return { status: "ok", data: await TAURI_INVOKE("get_profile", { id }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -112,7 +113,7 @@ try {
} }
}, },
async getContactList() : Promise<Result<string[], string>> { async getContactList() : Promise<Result<string[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_contact_list") }; return { status: "ok", data: await TAURI_INVOKE("get_contact_list") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -120,7 +121,7 @@ try {
} }
}, },
async setContactList(publicKeys: string[]) : Promise<Result<boolean, string>> { async setContactList(publicKeys: string[]) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("set_contact_list", { publicKeys }) }; return { status: "ok", data: await TAURI_INVOKE("set_contact_list", { publicKeys }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -128,7 +129,7 @@ try {
} }
}, },
async createProfile(name: string, displayName: string, about: string, picture: string, banner: string, nip05: string, lud16: string, website: string) : Promise<Result<string, string>> { async createProfile(name: string, displayName: string, about: string, picture: string, banner: string, nip05: string, lud16: string, website: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("create_profile", { name, displayName, about, picture, banner, nip05, lud16, website }) }; return { status: "ok", data: await TAURI_INVOKE("create_profile", { name, displayName, about, picture, banner, nip05, lud16, website }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -136,7 +137,7 @@ try {
} }
}, },
async isContactListEmpty() : Promise<Result<boolean, null>> { async isContactListEmpty() : Promise<Result<boolean, null>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("is_contact_list_empty") }; return { status: "ok", data: await TAURI_INVOKE("is_contact_list_empty") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -144,7 +145,7 @@ try {
} }
}, },
async checkContact(hex: string) : Promise<Result<boolean, string>> { async checkContact(hex: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("check_contact", { hex }) }; return { status: "ok", data: await TAURI_INVOKE("check_contact", { hex }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -152,7 +153,7 @@ try {
} }
}, },
async toggleContact(hex: string, alias: string | null) : Promise<Result<string, string>> { async toggleContact(hex: string, alias: string | null) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("toggle_contact", { hex, alias }) }; return { status: "ok", data: await TAURI_INVOKE("toggle_contact", { hex, alias }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -160,7 +161,7 @@ try {
} }
}, },
async getNstore(key: string) : Promise<Result<string, string>> { async getNstore(key: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_nstore", { key }) }; return { status: "ok", data: await TAURI_INVOKE("get_nstore", { key }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -168,7 +169,7 @@ try {
} }
}, },
async setNstore(key: string, content: string) : Promise<Result<string, string>> { async setNstore(key: string, content: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("set_nstore", { key, content }) }; return { status: "ok", data: await TAURI_INVOKE("set_nstore", { key, content }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -176,7 +177,7 @@ try {
} }
}, },
async setWallet(uri: string) : Promise<Result<boolean, string>> { async setWallet(uri: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("set_wallet", { uri }) }; return { status: "ok", data: await TAURI_INVOKE("set_wallet", { uri }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -184,7 +185,7 @@ try {
} }
}, },
async loadWallet() : Promise<Result<string, string>> { async loadWallet() : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("load_wallet") }; return { status: "ok", data: await TAURI_INVOKE("load_wallet") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -192,7 +193,7 @@ try {
} }
}, },
async removeWallet() : Promise<Result<null, null>> { async removeWallet() : Promise<Result<null, null>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("remove_wallet") }; return { status: "ok", data: await TAURI_INVOKE("remove_wallet") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -200,7 +201,7 @@ try {
} }
}, },
async zapProfile(id: string, amount: string, message: string) : Promise<Result<boolean, string>> { async zapProfile(id: string, amount: string, message: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("zap_profile", { id, amount, message }) }; return { status: "ok", data: await TAURI_INVOKE("zap_profile", { id, amount, message }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -208,7 +209,7 @@ try {
} }
}, },
async zapEvent(id: string, amount: string, message: string) : Promise<Result<boolean, string>> { async zapEvent(id: string, amount: string, message: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("zap_event", { id, amount, message }) }; return { status: "ok", data: await TAURI_INVOKE("zap_event", { id, amount, message }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -216,7 +217,7 @@ try {
} }
}, },
async friendToFriend(npub: string) : Promise<Result<boolean, string>> { async friendToFriend(npub: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("friend_to_friend", { npub }) }; return { status: "ok", data: await TAURI_INVOKE("friend_to_friend", { npub }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -224,7 +225,7 @@ try {
} }
}, },
async getNotifications() : Promise<Result<string[], string>> { async getNotifications() : Promise<Result<string[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_notifications") }; return { status: "ok", data: await TAURI_INVOKE("get_notifications") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -232,7 +233,7 @@ try {
} }
}, },
async getSettings() : Promise<Result<Settings, null>> { async getSettings() : Promise<Result<Settings, null>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_settings") }; return { status: "ok", data: await TAURI_INVOKE("get_settings") };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -240,7 +241,7 @@ try {
} }
}, },
async setNewSettings(settings: string) : Promise<Result<null, null>> { async setNewSettings(settings: string) : Promise<Result<null, null>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("set_new_settings", { settings }) }; return { status: "ok", data: await TAURI_INVOKE("set_new_settings", { settings }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -248,7 +249,7 @@ try {
} }
}, },
async verifyNip05(key: string, nip05: string) : Promise<Result<boolean, string>> { async verifyNip05(key: string, nip05: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("verify_nip05", { key, nip05 }) }; return { status: "ok", data: await TAURI_INVOKE("verify_nip05", { key, nip05 }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -256,7 +257,7 @@ try {
} }
}, },
async getEventMeta(content: string) : Promise<Result<Meta, null>> { async getEventMeta(content: string) : Promise<Result<Meta, null>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_event_meta", { content }) }; return { status: "ok", data: await TAURI_INVOKE("get_event_meta", { content }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -264,7 +265,7 @@ try {
} }
}, },
async getEvent(id: string) : Promise<Result<RichEvent, string>> { async getEvent(id: string) : Promise<Result<RichEvent, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_event", { id }) }; return { status: "ok", data: await TAURI_INVOKE("get_event", { id }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -272,7 +273,7 @@ try {
} }
}, },
async getEventFrom(id: string, relayHint: string) : Promise<Result<RichEvent, string>> { async getEventFrom(id: string, relayHint: string) : Promise<Result<RichEvent, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_event_from", { id, relayHint }) }; return { status: "ok", data: await TAURI_INVOKE("get_event_from", { id, relayHint }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -280,7 +281,7 @@ try {
} }
}, },
async getReplies(id: string) : Promise<Result<RichEvent[], string>> { async getReplies(id: string) : Promise<Result<RichEvent[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_replies", { id }) }; return { status: "ok", data: await TAURI_INVOKE("get_replies", { id }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -288,7 +289,7 @@ try {
} }
}, },
async listenEventReply(id: string) : Promise<Result<null, string>> { async listenEventReply(id: string) : Promise<Result<null, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("listen_event_reply", { id }) }; return { status: "ok", data: await TAURI_INVOKE("listen_event_reply", { id }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -296,7 +297,7 @@ try {
} }
}, },
async getEventsBy(publicKey: string, asOf: string | null) : Promise<Result<RichEvent[], string>> { async getEventsBy(publicKey: string, asOf: string | null) : Promise<Result<RichEvent[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_events_by", { publicKey, asOf }) }; return { status: "ok", data: await TAURI_INVOKE("get_events_by", { publicKey, asOf }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -304,7 +305,7 @@ try {
} }
}, },
async getLocalEvents(until: string | null) : Promise<Result<RichEvent[], string>> { async getLocalEvents(until: string | null) : Promise<Result<RichEvent[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_local_events", { until }) }; return { status: "ok", data: await TAURI_INVOKE("get_local_events", { until }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -312,7 +313,7 @@ try {
} }
}, },
async listenLocalEvent(label: string) : Promise<Result<null, string>> { async listenLocalEvent(label: string) : Promise<Result<null, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("listen_local_event", { label }) }; return { status: "ok", data: await TAURI_INVOKE("listen_local_event", { label }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -320,7 +321,7 @@ try {
} }
}, },
async getGroupEvents(publicKeys: string[], until: string | null) : Promise<Result<RichEvent[], string>> { async getGroupEvents(publicKeys: string[], until: string | null) : Promise<Result<RichEvent[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_group_events", { publicKeys, until }) }; return { status: "ok", data: await TAURI_INVOKE("get_group_events", { publicKeys, until }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -328,7 +329,7 @@ try {
} }
}, },
async getGlobalEvents(until: string | null) : Promise<Result<RichEvent[], string>> { async getGlobalEvents(until: string | null) : Promise<Result<RichEvent[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_global_events", { until }) }; return { status: "ok", data: await TAURI_INVOKE("get_global_events", { until }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -336,7 +337,7 @@ try {
} }
}, },
async getHashtagEvents(hashtags: string[], until: string | null) : Promise<Result<RichEvent[], string>> { async getHashtagEvents(hashtags: string[], until: string | null) : Promise<Result<RichEvent[], string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("get_hashtag_events", { hashtags, until }) }; return { status: "ok", data: await TAURI_INVOKE("get_hashtag_events", { hashtags, until }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -344,7 +345,7 @@ try {
} }
}, },
async publish(content: string, warning: string | null, difficulty: number | null) : Promise<Result<string, string>> { async publish(content: string, warning: string | null, difficulty: number | null) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("publish", { content, warning, difficulty }) }; return { status: "ok", data: await TAURI_INVOKE("publish", { content, warning, difficulty }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -352,7 +353,7 @@ try {
} }
}, },
async reply(content: string, to: string, root: string | null) : Promise<Result<string, string>> { async reply(content: string, to: string, root: string | null) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("reply", { content, to, root }) }; return { status: "ok", data: await TAURI_INVOKE("reply", { content, to, root }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -360,7 +361,7 @@ try {
} }
}, },
async repost(raw: string) : Promise<Result<string, string>> { async repost(raw: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("repost", { raw }) }; return { status: "ok", data: await TAURI_INVOKE("repost", { raw }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -368,7 +369,7 @@ try {
} }
}, },
async eventToBech32(id: string) : Promise<Result<string, string>> { async eventToBech32(id: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("event_to_bech32", { id }) }; return { status: "ok", data: await TAURI_INVOKE("event_to_bech32", { id }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -376,7 +377,7 @@ try {
} }
}, },
async userToBech32(user: string) : Promise<Result<string, string>> { async userToBech32(user: string) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("user_to_bech32", { user }) }; return { status: "ok", data: await TAURI_INVOKE("user_to_bech32", { user }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -384,7 +385,7 @@ try {
} }
}, },
async unlisten(id: string) : Promise<Result<null, null>> { async unlisten(id: string) : Promise<Result<null, null>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("unlisten", { id }) }; return { status: "ok", data: await TAURI_INVOKE("unlisten", { id }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -392,7 +393,7 @@ try {
} }
}, },
async createColumn(column: Column) : Promise<Result<string, string>> { async createColumn(column: Column) : Promise<Result<string, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("create_column", { column }) }; return { status: "ok", data: await TAURI_INVOKE("create_column", { column }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -400,7 +401,7 @@ try {
} }
}, },
async closeColumn(label: string) : Promise<Result<boolean, string>> { async closeColumn(label: string) : Promise<Result<boolean, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("close_column", { label }) }; return { status: "ok", data: await TAURI_INVOKE("close_column", { label }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -408,7 +409,7 @@ try {
} }
}, },
async repositionColumn(label: string, x: number, y: number) : Promise<Result<null, string>> { async repositionColumn(label: string, x: number, y: number) : Promise<Result<null, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("reposition_column", { label, x, y }) }; return { status: "ok", data: await TAURI_INVOKE("reposition_column", { label, x, y }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -416,7 +417,7 @@ try {
} }
}, },
async resizeColumn(label: string, width: number, height: number) : Promise<Result<null, string>> { async resizeColumn(label: string, width: number, height: number) : Promise<Result<null, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("resize_column", { label, width, height }) }; return { status: "ok", data: await TAURI_INVOKE("resize_column", { label, width, height }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -424,7 +425,7 @@ try {
} }
}, },
async reloadColumn(label: string) : Promise<Result<null, string>> { async reloadColumn(label: string) : Promise<Result<null, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("reload_column", { label }) }; return { status: "ok", data: await TAURI_INVOKE("reload_column", { label }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -432,7 +433,7 @@ try {
} }
}, },
async openWindow(window: Window) : Promise<Result<null, string>> { async openWindow(window: Window) : Promise<Result<null, string>> {
try { try {
return { status: "ok", data: await TAURI_INVOKE("open_window", { window }) }; return { status: "ok", data: await TAURI_INVOKE("open_window", { window }) };
} catch (e) { } catch (e) {
if(e instanceof Error) throw e; if(e instanceof Error) throw e;
@@ -440,21 +441,21 @@ try {
} }
}, },
async openMainWindow() : Promise<void> { async openMainWindow() : Promise<void> {
await TAURI_INVOKE("open_main_window"); await TAURI_INVOKE("open_main_window");
}, },
async forceQuit() : Promise<void> { async forceQuit() : Promise<void> {
await TAURI_INVOKE("force_quit"); await TAURI_INVOKE("force_quit");
}, },
async setBadge(count: number) : Promise<void> { async setBadge(count: number) : Promise<void> {
await TAURI_INVOKE("set_badge", { count }); await TAURI_INVOKE("set_badge", { count });
} }
} }
/** user-defined events **/ /** user-defined events **/
/** user-defined statics **/ /** user-defined constants **/
@@ -470,16 +471,19 @@ export type Window = { label: string; title: string; url: string; width: number;
/** tauri-specta globals **/ /** tauri-specta globals **/
import { invoke as TAURI_INVOKE } from "@tauri-apps/api/core"; import {
invoke as TAURI_INVOKE,
Channel as TAURI_CHANNEL,
} from "@tauri-apps/api/core";
import * as TAURI_API_EVENT from "@tauri-apps/api/event"; import * as TAURI_API_EVENT from "@tauri-apps/api/event";
import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow"; import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webviewWindow";
type __EventObj__<T> = { type __EventObj__<T> = {
listen: ( listen: (
cb: TAURI_API_EVENT.EventCallback<T> cb: TAURI_API_EVENT.EventCallback<T>,
) => ReturnType<typeof TAURI_API_EVENT.listen<T>>; ) => ReturnType<typeof TAURI_API_EVENT.listen<T>>;
once: ( once: (
cb: TAURI_API_EVENT.EventCallback<T> cb: TAURI_API_EVENT.EventCallback<T>,
) => ReturnType<typeof TAURI_API_EVENT.once<T>>; ) => ReturnType<typeof TAURI_API_EVENT.once<T>>;
emit: T extends null emit: T extends null
? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit> ? (payload?: T) => ReturnType<typeof TAURI_API_EVENT.emit>
@@ -491,7 +495,7 @@ export type Result<T, E> =
| { status: "error"; error: E }; | { status: "error"; error: E };
function __makeEvents__<T extends Record<string, any>>( function __makeEvents__<T extends Record<string, any>>(
mappings: Record<keyof T, string> mappings: Record<keyof T, string>,
) { ) {
return new Proxy( return new Proxy(
{} as unknown as { {} as unknown as {
@@ -521,8 +525,6 @@ function __makeEvents__<T extends Record<string, any>>(
}, },
}); });
}, },
} },
); );
} }

View File

@@ -12,10 +12,10 @@
"devDependencies": { "devDependencies": {
"@evilmartians/harmony": "^1.2.0", "@evilmartians/harmony": "^1.2.0",
"@tailwindcss/forms": "^0.5.7", "@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.13", "@tailwindcss/typography": "^0.5.14",
"tailwind-gradient-mask-image": "^1.2.0", "tailwind-gradient-mask-image": "^1.2.0",
"tailwind-scrollbar": "^3.1.0", "tailwind-scrollbar": "^3.1.0",
"tailwindcss": "^3.4.6", "tailwindcss": "^3.4.9",
"tailwindcss-content-visibility": "^0.2.0" "tailwindcss-content-visibility": "^0.2.0"
} }
} }

View File

@@ -9,6 +9,6 @@
"access": "public" "access": "public"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^5.5.3" "typescript": "^5.5.4"
} }
} }

View File

@@ -15,7 +15,7 @@
"@lume/tsconfig": "workspace:^", "@lume/tsconfig": "workspace:^",
"@lume/types": "workspace:^", "@lume/types": "workspace:^",
"@types/react": "^18.3.3", "@types/react": "^18.3.3",
"tailwindcss": "^3.4.6", "tailwindcss": "^3.4.9",
"typescript": "^5.5.3" "typescript": "^5.5.4"
} }
} }

View File

@@ -10,13 +10,13 @@
"dependencies": { "dependencies": {
"bitcoin-units": "^1.0.0", "bitcoin-units": "^1.0.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"dayjs": "^1.11.11", "dayjs": "^1.11.12",
"light-bolt11-decoder": "^3.1.1", "light-bolt11-decoder": "^3.1.1",
"nostr-tools": "^2.7.1", "nostr-tools": "^2.7.2",
"react": "^18.3.1", "react": "^18.3.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"slate": "^0.103.0", "slate": "^0.103.0",
"slate-react": "^0.105.0" "slate-react": "^0.107.1"
}, },
"devDependencies": { "devDependencies": {
"@lume/tsconfig": "workspace:^", "@lume/tsconfig": "workspace:^",
@@ -24,6 +24,6 @@
"@types/react": "^18.3.3", "@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.0",
"tailwind-merge": "^2.4.0", "tailwind-merge": "^2.4.0",
"typescript": "^5.5.3" "typescript": "^5.5.4"
} }
} }

1604
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,7 @@
# Generated by Cargo # Generated by Cargo
# will have compiled files and executables # will have compiled files and executables
/target/ /target/
# Generated by Tauri
# will have schema files for capabilities auto-completion
/gen/schemas

648
src-tauri/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,37 +8,37 @@ edition = "2021"
rust-version = "1.70" rust-version = "1.70"
[build-dependencies] [build-dependencies]
tauri-build = { version = "2.0.0-beta", features = [] } tauri-build = { version = "2.0.0-rc", features = [] }
[dependencies] [dependencies]
nostr-sdk = { version = "0.33", features = ["sqlite"] } nostr-sdk = { git = "https://github.com/rust-nostr/nostr", features = [
"sqlite",
] }
tokio = { version = "1", features = ["full"] } tokio = { version = "1", features = ["full"] }
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2.0.0-beta", features = [ tauri = { version = "2.0.0-rc", features = [
"unstable", "unstable",
"tray-icon", "tray-icon",
"macos-private-api", "macos-private-api",
"native-tls-vendored",
"protocol-asset", "protocol-asset",
] } ] }
tauri-plugin-window-state = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-window-state = "2.0.0-rc"
tauri-plugin-clipboard-manager = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-clipboard-manager = "2.0.0-rc"
tauri-plugin-dialog = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-dialog = "2.0.0-rc"
tauri-plugin-fs = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-fs = "2.0.0-rc"
tauri-plugin-http = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-http = "2.0.0-rc"
tauri-plugin-notification = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-notification = "2.0.0-rc"
tauri-plugin-os = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-os = "2.0.0-rc"
tauri-plugin-process = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-process = "2.0.0-rc"
tauri-plugin-shell = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-shell = "2.0.0-rc"
tauri-plugin-updater = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-updater = "2.0.0-rc"
tauri-plugin-upload = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" } tauri-plugin-upload = "2.0.0-rc"
tauri-specta = { git = "https://github.com/reyamir/tauri-specta", branch = "feat/tauri-v2", features = [
"typescript",
] }
tauri-plugin-theme = "0.4.1" tauri-plugin-theme = "0.4.1"
tauri-plugin-decorum = "0.1.6" tauri-plugin-decorum = "1.0.0"
specta = "^2.0.0-rc.12" tauri-specta = { version = "2.0.0-rc.15", features = ["derive", "typescript"] }
specta = "^2.0.0-rc.20"
specta-typescript = "0.0.7"
reqwest = "0.12.4" reqwest = "0.12.4"
url = "2.5.0" url = "2.5.0"
futures = "0.3.30" futures = "0.3.30"

View File

@@ -11,8 +11,8 @@
"column-*" "column-*"
], ],
"permissions": [ "permissions": [
"resources:default", "core:resources:default",
"tray:default", "core:tray:default",
"os:allow-locale", "os:allow-locale",
"os:allow-os-type", "os:allow-os-type",
"clipboard-manager:allow-write-text", "clipboard-manager:allow-write-text",
@@ -20,9 +20,9 @@
"dialog:allow-ask", "dialog:allow-ask",
"dialog:allow-message", "dialog:allow-message",
"fs:allow-read-file", "fs:allow-read-file",
"menu:default", "core:menu:default",
"menu:allow-new", "core:menu:allow-new",
"menu:allow-popup", "core:menu:allow-popup",
"http:default", "http:default",
"shell:allow-open", "shell:allow-open",
{ {

View File

@@ -18,13 +18,13 @@
"editor-*" "editor-*"
], ],
"permissions": [ "permissions": [
"path:default", "core:path:default",
"event:default", "core:event:default",
"window:default", "core:window:default",
"app:default", "core:app:default",
"resources:default", "core:resources:default",
"menu:default", "core:menu:default",
"tray:default", "core:tray:default",
"notification:allow-is-permission-granted", "notification:allow-is-permission-granted",
"notification:allow-request-permission", "notification:allow-request-permission",
"notification:default", "notification:default",
@@ -34,25 +34,25 @@
"updater:default", "updater:default",
"updater:allow-check", "updater:allow-check",
"updater:allow-download-and-install", "updater:allow-download-and-install",
"window:allow-start-dragging", "core:window:allow-start-dragging",
"window:allow-create", "core:window:allow-create",
"window:allow-close", "core:window:allow-close",
"window:allow-destroy", "core:window:allow-destroy",
"window:allow-set-focus", "core:window:allow-set-focus",
"window:allow-center", "core:window:allow-center",
"window:allow-minimize", "core:window:allow-minimize",
"window:allow-maximize", "core:window:allow-maximize",
"window:allow-set-size", "core:window:allow-set-size",
"window:allow-set-focus", "core:window:allow-set-focus",
"window:allow-start-dragging", "core:window:allow-start-dragging",
"decorum:allow-show-snap-overlay", "decorum:allow-show-snap-overlay",
"clipboard-manager:allow-write-text", "clipboard-manager:allow-write-text",
"clipboard-manager:allow-read-text", "clipboard-manager:allow-read-text",
"webview:allow-create-webview-window", "core:webview:allow-create-webview-window",
"webview:allow-create-webview", "core:webview:allow-create-webview",
"webview:allow-set-webview-size", "core:webview:allow-set-webview-size",
"webview:allow-set-webview-position", "core:webview:allow-set-webview-position",
"webview:allow-webview-close", "core:webview:allow-webview-close",
"dialog:allow-open", "dialog:allow-open",
"dialog:allow-ask", "dialog:allow-ask",
"dialog:allow-message", "dialog:allow-message",
@@ -61,8 +61,8 @@
"fs:allow-read-file", "fs:allow-read-file",
"theme:allow-set-theme", "theme:allow-set-theme",
"theme:allow-get-theme", "theme:allow-get-theme",
"menu:allow-new", "core:menu:allow-new",
"menu:allow-popup", "core:menu:allow-popup",
"http:default", "http:default",
"shell:allow-open", "shell:allow-open",
{ {

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","local":true,"windows":["main","panel","settings","search-*","zap-*","event-*","user-*","editor-*"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","os:allow-os-type","updater:default","updater:allow-check","updater:allow-download-and-install","window:allow-start-dragging","window:allow-create","window:allow-close","window:allow-destroy","window:allow-set-focus","window:allow-center","window:allow-minimize","window:allow-maximize","window:allow-set-size","window:allow-set-focus","window:allow-start-dragging","decorum:allow-show-snap-overlay","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","webview:allow-create-webview-window","webview:allow-create-webview","webview:allow-set-webview-size","webview:allow-set-webview-position","webview:allow-webview-close","dialog:allow-open","dialog:allow-ask","dialog:allow-message","process:allow-restart","process:allow-exit","fs:allow-read-file","theme:allow-set-theme","theme:allow-get-theme","menu:allow-new","menu:allow-popup","http:default","shell:allow-open",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"},{"path":"$RESOURCE/resources/*"}]}],"platforms":["linux","macOS","windows"]}} {"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","local":true,"windows":["main","panel","settings","search-*","zap-*","event-*","user-*","editor-*"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","os:allow-os-type","updater:default","updater:allow-check","updater:allow-download-and-install","core:window:allow-start-dragging","core:window:allow-create","core:window:allow-close","core:window:allow-destroy","core:window:allow-set-focus","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-start-dragging","decorum:allow-show-snap-overlay","clipboard-manager:allow-write-text","clipboard-manager:allow-read-text","core:webview:allow-create-webview-window","core:webview:allow-create-webview","core:webview:allow-set-webview-size","core:webview:allow-set-webview-position","core:webview:allow-webview-close","dialog:allow-open","dialog:allow-ask","dialog:allow-message","process:allow-restart","process:allow-exit","fs:allow-read-file","theme:allow-set-theme","theme:allow-get-theme","core:menu:allow-new","core:menu:allow-popup","http:default","shell:allow-open",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"},{"path":"$RESOURCE/resources/*"}]}],"platforms":["linux","macOS","windows"]}}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,11 @@
use std::{str::FromStr, time::Duration};
use futures::future::join_all; use futures::future::join_all;
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use serde::Serialize; use serde::Serialize;
use specta::Type; use specta::Type;
use std::{str::FromStr, time::Duration};
use tauri::State; use tauri::State;
use crate::nostr::utils::{create_event_tags, dedup_event, parse_event, Meta}; use crate::common::{create_event_tags, dedup_event, parse_event, Meta};
use crate::{Nostr, FETCH_LIMIT}; use crate::{Nostr, FETCH_LIMIT};
#[derive(Debug, Clone, Serialize, Type)] #[derive(Debug, Clone, Serialize, Type)]

View File

@@ -1,9 +1,7 @@
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
use crate::commands::tray::create_tray_panel; use crate::commands::tray::create_tray_panel;
use crate::nostr::event::RichEvent; use crate::common::{get_user_settings, init_nip65, parse_event};
use crate::nostr::internal::{get_user_settings, init_nip65}; use crate::{Nostr, RichEvent, NEWSFEED_NEG_LIMIT, NOTIFICATION_NEG_LIMIT};
use crate::nostr::utils::parse_event;
use crate::{Nostr, NEWSFEED_NEG_LIMIT, NOTIFICATION_NEG_LIMIT};
use keyring::Entry; use keyring::Entry;
use keyring_search::{Limit, List, Search}; use keyring_search::{Limit, List, Search};

View File

@@ -1,13 +1,11 @@
use std::{str::FromStr, time::Duration};
use keyring::Entry; use keyring::Entry;
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use std::{str::FromStr, time::Duration};
use tauri::State; use tauri::State;
use crate::common::get_latest_event;
use crate::{Nostr, Settings}; use crate::{Nostr, Settings};
use super::get_latest_event;
#[tauri::command] #[tauri::command]
#[specta::specta] #[specta::specta]
pub async fn get_current_profile(state: State<'_, Nostr>) -> Result<String, String> { pub async fn get_current_profile(state: State<'_, Nostr>) -> Result<String, String> {

View File

@@ -1,5 +1,7 @@
#[cfg(target_os = "macos")] pub mod event;
pub mod fns; pub mod keys;
pub mod metadata;
pub mod relay;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub mod tray; pub mod tray;
pub mod window; pub mod window;

View File

@@ -7,7 +7,7 @@ use tauri::{
use tauri::{AppHandle, Manager, WebviewUrl}; use tauri::{AppHandle, Manager, WebviewUrl};
use tauri_nspanel::ManagerExt; use tauri_nspanel::ManagerExt;
use super::fns::{ use crate::macos::{
position_menubar_panel, set_corner_radius, setup_menubar_panel_listeners, position_menubar_panel, set_corner_radius, setup_menubar_panel_listeners,
swizzle_to_menubar_panel, swizzle_to_menubar_panel,
}; };

View File

@@ -1,13 +1,12 @@
use linkify::LinkFinder;
use nostr_sdk::prelude::*;
use reqwest::Client as ReqClient;
use serde::Serialize;
use specta::Type;
use std::collections::HashSet; use std::collections::HashSet;
use std::str::FromStr; use std::str::FromStr;
use linkify::LinkFinder; use crate::Settings;
use nostr_sdk::prelude::Nip19Event;
use nostr_sdk::{Alphabet, Event, EventId, FromBech32, PublicKey, SingleLetterTag, Tag, TagKind};
use reqwest::Client;
use serde::Serialize;
use specta::Type;
use url::Url;
#[derive(Debug, Clone, Serialize, Type)] #[derive(Debug, Clone, Serialize, Type)]
pub struct Meta { pub struct Meta {
@@ -46,6 +45,90 @@ const NOSTR_MENTIONS: [&str; 10] = [
const IMAGES: [&str; 7] = ["jpg", "jpeg", "gif", "png", "webp", "avif", "tiff"]; const IMAGES: [&str; 7] = ["jpg", "jpeg", "gif", "png", "webp", "avif", "tiff"];
const VIDEOS: [&str; 5] = ["mp4", "mov", "avi", "webm", "mkv"]; const VIDEOS: [&str; 5] = ["mp4", "mov", "avi", "webm", "mkv"];
pub async fn init_nip65(client: &Client) {
let signer = match client.signer().await {
Ok(signer) => signer,
Err(e) => {
eprintln!("Failed to get signer: {:?}", e);
return;
}
};
let public_key = match signer.public_key().await {
Ok(public_key) => public_key,
Err(e) => {
eprintln!("Failed to get public key: {:?}", e);
return;
}
};
let filter = Filter::new()
.author(public_key)
.kind(Kind::RelayList)
.limit(1);
if let Ok(events) = client.get_events_of(vec![filter], None).await {
if let Some(event) = events.first() {
let relay_list = nip65::extract_relay_list(event);
for (url, metadata) in relay_list {
let opts = match metadata {
Some(RelayMetadata::Read) => RelayOptions::new().read(true).write(false),
Some(_) => RelayOptions::new().write(true).read(false),
None => RelayOptions::default(),
};
if let Err(e) = client.add_relay_with_opts(&url.to_string(), opts).await {
eprintln!("Failed to add relay {}: {:?}", url, e);
}
if let Err(e) = client.connect_relay(url.to_string()).await {
eprintln!("Failed to connect to relay {}: {:?}", url, e);
} else {
println!("Connecting to relay: {} - {:?}", url, metadata);
}
}
}
} else {
eprintln!("Failed to get events for RelayList.");
}
}
pub async fn get_user_settings(client: &Client) -> Result<Settings, String> {
let ident = "lume:settings";
let signer = client
.signer()
.await
.map_err(|e| format!("Failed to get signer: {:?}", e))?;
let public_key = signer
.public_key()
.await
.map_err(|e| format!("Failed to get public key: {:?}", e))?;
let filter = Filter::new()
.author(public_key)
.kind(Kind::ApplicationSpecificData)
.identifier(ident)
.limit(1);
match client.get_events_of(vec![filter], None).await {
Ok(events) => {
if let Some(event) = events.first() {
let content = event.content();
match signer.nip44_decrypt(public_key, content).await {
Ok(decrypted) => match serde_json::from_str(&decrypted) {
Ok(parsed) => Ok(parsed),
Err(_) => Err("Could not parse settings payload".into()),
},
Err(e) => Err(format!("Failed to decrypt settings content: {:?}", e)),
}
} else {
Err("Settings not found.".into())
}
}
Err(e) => Err(format!(
"Failed to get events for ApplicationSpecificData: {:?}",
e
)),
}
}
pub fn get_latest_event(events: &[Event]) -> Option<&Event> { pub fn get_latest_event(events: &[Event]) -> Option<&Event> {
events.iter().next() events.iter().next()
} }
@@ -102,7 +185,7 @@ pub async fn parse_event(content: &str) -> Meta {
let mut text = content.to_string(); let mut text = content.to_string();
if !urls.is_empty() { if !urls.is_empty() {
let client = Client::new(); let client = ReqClient::new();
for url in urls { for url in urls {
let url_str = url.as_str(); let url_str = url.as_str();

View File

@@ -1,5 +1,4 @@
use std::ffi::CString; use std::ffi::CString;
use tauri::{AppHandle, Emitter, Listener, Manager, WebviewWindow}; use tauri::{AppHandle, Emitter, Listener, Manager, WebviewWindow};
use tauri_nspanel::{ use tauri_nspanel::{
block::ConcreteBlock, block::ConcreteBlock,

View File

@@ -11,22 +11,27 @@ extern crate objc;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
use border::WebviewWindowExt as BorderWebviewWindowExt; use border::WebviewWindowExt as BorderWebviewWindowExt;
use commands::{event::*, keys::*, metadata::*, relay::*, window::*};
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use specta::Type; use specta::Type;
use std::sync::Mutex; use specta_typescript::Typescript;
use std::time::Duration;
use std::{ use std::{
fs, fs,
io::{self, BufRead}, io::{self, BufRead},
str::FromStr, str::FromStr,
sync::Mutex,
time::Duration,
}; };
use tauri::{path::BaseDirectory, Manager}; use tauri::{path::BaseDirectory, Manager};
#[cfg(not(target_os = "linux"))] #[cfg(not(target_os = "linux"))]
use tauri_plugin_decorum::WebviewWindowExt; use tauri_plugin_decorum::WebviewWindowExt;
use tauri_specta::{collect_commands, Builder};
pub mod commands; pub mod commands;
pub mod nostr; pub mod common;
#[cfg(target_os = "macos")]
pub mod macos;
#[derive(Serialize)] #[derive(Serialize)]
pub struct Nostr { pub struct Nostr {
@@ -70,84 +75,86 @@ pub const NEWSFEED_NEG_LIMIT: usize = 256;
pub const NOTIFICATION_NEG_LIMIT: usize = 64; pub const NOTIFICATION_NEG_LIMIT: usize = 64;
fn main() { fn main() {
let mut ctx = tauri::generate_context!(); let builder = Builder::<tauri::Wry>::new()
// Then register them (separated by a comma)
let invoke_handler = { .commands(collect_commands![
let builder = tauri_specta::ts::builder().commands(tauri_specta::collect_commands![ get_relays,
nostr::relay::get_relays, connect_relay,
nostr::relay::connect_relay, remove_relay,
nostr::relay::remove_relay, get_bootstrap_relays,
nostr::relay::get_bootstrap_relays, save_bootstrap_relays,
nostr::relay::save_bootstrap_relays, get_accounts,
nostr::keys::get_accounts, create_account,
nostr::keys::create_account, save_account,
nostr::keys::save_account, get_encrypted_key,
nostr::keys::get_encrypted_key, get_private_key,
nostr::keys::get_private_key, connect_remote_account,
nostr::keys::connect_remote_account, load_account,
nostr::keys::load_account, get_current_profile,
nostr::metadata::get_current_profile, get_profile,
nostr::metadata::get_profile, get_contact_list,
nostr::metadata::get_contact_list, set_contact_list,
nostr::metadata::set_contact_list, create_profile,
nostr::metadata::create_profile, is_contact_list_empty,
nostr::metadata::is_contact_list_empty, check_contact,
nostr::metadata::check_contact, toggle_contact,
nostr::metadata::toggle_contact, get_nstore,
nostr::metadata::get_nstore, set_nstore,
nostr::metadata::set_nstore, set_wallet,
nostr::metadata::set_wallet, load_wallet,
nostr::metadata::load_wallet, remove_wallet,
nostr::metadata::remove_wallet, zap_profile,
nostr::metadata::zap_profile, zap_event,
nostr::metadata::zap_event, friend_to_friend,
nostr::metadata::friend_to_friend, get_notifications,
nostr::metadata::get_notifications, get_settings,
nostr::metadata::get_settings, set_new_settings,
nostr::metadata::set_new_settings, verify_nip05,
nostr::metadata::verify_nip05, get_event_meta,
nostr::event::get_event_meta, get_event,
nostr::event::get_event, get_event_from,
nostr::event::get_event_from, get_replies,
nostr::event::get_replies, listen_event_reply,
nostr::event::listen_event_reply, get_events_by,
nostr::event::get_events_by, get_local_events,
nostr::event::get_local_events, listen_local_event,
nostr::event::listen_local_event, get_group_events,
nostr::event::get_group_events, get_global_events,
nostr::event::get_global_events, get_hashtag_events,
nostr::event::get_hashtag_events, publish,
nostr::event::publish, reply,
nostr::event::reply, repost,
nostr::event::repost, event_to_bech32,
nostr::event::event_to_bech32, user_to_bech32,
nostr::event::user_to_bech32, unlisten,
nostr::event::unlisten, create_column,
commands::window::create_column, close_column,
commands::window::close_column, reposition_column,
commands::window::reposition_column, resize_column,
commands::window::resize_column, reload_column,
commands::window::reload_column, open_window,
commands::window::open_window, open_main_window,
commands::window::open_main_window, force_quit,
commands::window::force_quit, set_badge
commands::window::set_badge
]); ]);
#[cfg(debug_assertions)] builder
let builder = builder.path("../packages/system/src/commands.ts"); .export(Typescript::default(), "../packages/system/src/commands.ts")
.expect("Failed to export typescript bindings");
builder.build().unwrap()
};
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
let builder = tauri::Builder::default().plugin(tauri_nspanel::init()); let tauri_builder = tauri::Builder::default().plugin(tauri_nspanel::init());
#[cfg(not(target_os = "macos"))] #[cfg(not(target_os = "macos"))]
let builder = tauri::Builder::default(); let tauri_builder = tauri::Builder::default();
let mut ctx = tauri::generate_context!();
tauri_builder
.invoke_handler(builder.invoke_handler())
.setup(move |app| {
builder.mount_events(app);
builder
.setup(|app| {
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
app.handle().plugin(tauri_nspanel::init()).unwrap(); app.handle().plugin(tauri_nspanel::init()).unwrap();
@@ -257,7 +264,6 @@ fn main() {
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_upload::init()) .plugin(tauri_plugin_upload::init())
.plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_updater::Builder::new().build())
.invoke_handler(invoke_handler)
.run(ctx) .run(ctx)
.expect("error while running tauri application"); .expect("error while running tauri application");
} }

View File

@@ -1,86 +0,0 @@
use crate::Settings;
use nostr_sdk::prelude::*;
pub async fn init_nip65(client: &Client) {
let signer = match client.signer().await {
Ok(signer) => signer,
Err(e) => {
eprintln!("Failed to get signer: {:?}", e);
return;
}
};
let public_key = match signer.public_key().await {
Ok(public_key) => public_key,
Err(e) => {
eprintln!("Failed to get public key: {:?}", e);
return;
}
};
let filter = Filter::new()
.author(public_key)
.kind(Kind::RelayList)
.limit(1);
if let Ok(events) = client.get_events_of(vec![filter], None).await {
if let Some(event) = events.first() {
let relay_list = nip65::extract_relay_list(event);
for (url, metadata) in relay_list {
let opts = match metadata {
Some(RelayMetadata::Read) => RelayOptions::new().read(true).write(false),
Some(_) => RelayOptions::new().write(true).read(false),
None => RelayOptions::default(),
};
if let Err(e) = client.add_relay_with_opts(&url.to_string(), opts).await {
eprintln!("Failed to add relay {}: {:?}", url, e);
}
if let Err(e) = client.connect_relay(url.to_string()).await {
eprintln!("Failed to connect to relay {}: {:?}", url, e);
} else {
println!("Connecting to relay: {} - {:?}", url, metadata);
}
}
}
} else {
eprintln!("Failed to get events for RelayList.");
}
}
pub async fn get_user_settings(client: &Client) -> Result<Settings, String> {
let ident = "lume:settings";
let signer = client
.signer()
.await
.map_err(|e| format!("Failed to get signer: {:?}", e))?;
let public_key = signer
.public_key()
.await
.map_err(|e| format!("Failed to get public key: {:?}", e))?;
let filter = Filter::new()
.author(public_key)
.kind(Kind::ApplicationSpecificData)
.identifier(ident)
.limit(1);
match client.get_events_of(vec![filter], None).await {
Ok(events) => {
if let Some(event) = events.first() {
let content = event.content();
match signer.nip44_decrypt(public_key, content).await {
Ok(decrypted) => match serde_json::from_str(&decrypted) {
Ok(parsed) => Ok(parsed),
Err(_) => Err("Could not parse settings payload".into()),
},
Err(e) => Err(format!("Failed to decrypt settings content: {:?}", e)),
}
} else {
Err("Settings not found.".into())
}
}
Err(e) => Err(format!(
"Failed to get events for ApplicationSpecificData: {:?}",
e
)),
}
}

View File

@@ -1,7 +0,0 @@
pub mod event;
mod internal;
pub mod keys;
pub mod metadata;
pub mod relay;
mod utils;
pub use utils::get_latest_event;

View File

@@ -1,8 +1,10 @@
{ {
"$schema": "https://turbo.build/schema.json", "$schema": "https://turbo.build/schema.json",
"pipeline": { "tasks": {
"build": { "build": {
"outputs": ["dist/**"], "outputs": [
"dist/**"
],
"cache": false "cache": false
}, },
"dev": { "dev": {