|
|
|
@@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
// 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 **/
|
|
|
|
@@ -13,10 +14,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async connectRelay(relay: string) : Promise<Result<boolean, string>> {
|
|
|
|
async connectRelay(relay: string) : Promise<Result<boolean, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("connect_relay", { relay }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -24,10 +22,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async removeRelay(relay: string) : Promise<Result<boolean, string>> {
|
|
|
|
async removeRelay(relay: string) : Promise<Result<boolean, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("remove_relay", { relay }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -43,10 +38,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async saveBootstrapRelays(relays: string) : Promise<Result<null, string>> {
|
|
|
|
async saveBootstrapRelays(relays: string) : Promise<Result<null, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("save_bootstrap_relays", { relays }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -68,29 +60,17 @@ export const commands = {
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async saveAccount(
|
|
|
|
async saveAccount(nsec: string, password: string) : Promise<Result<string, string>> {
|
|
|
|
nsec: string,
|
|
|
|
|
|
|
|
password: string,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("save_account", { nsec, password }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getEncryptedKey(
|
|
|
|
async getEncryptedKey(npub: string, password: string) : Promise<Result<string, string>> {
|
|
|
|
npub: string,
|
|
|
|
|
|
|
|
password: string,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_encrypted_key", { npub, password }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -98,10 +78,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getPrivateKey(npub: string) : Promise<Result<string, string>> {
|
|
|
|
async getPrivateKey(npub: string) : Promise<Result<string, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_private_key", { npub }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -109,24 +86,15 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async connectRemoteAccount(uri: string) : Promise<Result<string, string>> {
|
|
|
|
async connectRemoteAccount(uri: string) : Promise<Result<string, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("connect_remote_account", { uri }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async loadAccount(
|
|
|
|
async loadAccount(npub: string, bunker: string | null) : Promise<Result<boolean, string>> {
|
|
|
|
npub: string,
|
|
|
|
|
|
|
|
bunker: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<boolean, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("load_account", { npub, bunker }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -158,39 +126,15 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async setContactList(publicKeys: string[]) : Promise<Result<boolean, string>> {
|
|
|
|
async setContactList(publicKeys: string[]) : Promise<Result<boolean, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("set_contact_list", { publicKeys }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async createProfile(
|
|
|
|
async createProfile(name: string, displayName: string, about: string, picture: string, banner: string, nip05: string, lud16: string, website: string) : Promise<Result<string, string>> {
|
|
|
|
name: string,
|
|
|
|
|
|
|
|
displayName: string,
|
|
|
|
|
|
|
|
about: string,
|
|
|
|
|
|
|
|
picture: string,
|
|
|
|
|
|
|
|
banner: string,
|
|
|
|
|
|
|
|
nip05: string,
|
|
|
|
|
|
|
|
lud16: string,
|
|
|
|
|
|
|
|
website: string,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("create_profile", { name, displayName, about, picture, banner, nip05, lud16, website }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -198,10 +142,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async isContactListEmpty() : Promise<Result<boolean, null>> {
|
|
|
|
async isContactListEmpty() : Promise<Result<boolean, null>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("is_contact_list_empty") };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -209,24 +150,15 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async checkContact(hex: string) : Promise<Result<boolean, null>> {
|
|
|
|
async checkContact(hex: string) : Promise<Result<boolean, null>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("check_contact", { hex }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async toggleContact(
|
|
|
|
async toggleContact(hex: string, alias: string | null) : Promise<Result<string, string>> {
|
|
|
|
hex: string,
|
|
|
|
|
|
|
|
alias: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("toggle_contact", { hex, alias }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -240,15 +172,9 @@ export const commands = {
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async setNstore(
|
|
|
|
async setNstore(key: string, content: string) : Promise<Result<string, string>> {
|
|
|
|
key: string,
|
|
|
|
|
|
|
|
content: string,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("set_nstore", { key, content }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -278,31 +204,17 @@ export const commands = {
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async zapProfile(
|
|
|
|
async zapProfile(id: string, amount: string, message: string) : Promise<Result<boolean, string>> {
|
|
|
|
id: string,
|
|
|
|
|
|
|
|
amount: string,
|
|
|
|
|
|
|
|
message: string,
|
|
|
|
|
|
|
|
): Promise<Result<boolean, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("zap_profile", { id, amount, message }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async zapEvent(
|
|
|
|
async zapEvent(id: string, amount: string, message: string) : Promise<Result<boolean, string>> {
|
|
|
|
id: string,
|
|
|
|
|
|
|
|
amount: string,
|
|
|
|
|
|
|
|
message: string,
|
|
|
|
|
|
|
|
): Promise<Result<boolean, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("zap_event", { id, amount, message }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -310,10 +222,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async friendToFriend(npub: string) : Promise<Result<boolean, string>> {
|
|
|
|
async friendToFriend(npub: string) : Promise<Result<boolean, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("friend_to_friend", { npub }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -337,24 +246,15 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async setNewSettings(settings: string) : Promise<Result<null, null>> {
|
|
|
|
async setNewSettings(settings: string) : Promise<Result<null, null>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("set_new_settings", { settings }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async verifyNip05(
|
|
|
|
async verifyNip05(key: string, nip05: string) : Promise<Result<boolean, string>> {
|
|
|
|
key: string,
|
|
|
|
|
|
|
|
nip05: string,
|
|
|
|
|
|
|
|
): Promise<Result<boolean, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("verify_nip05", { key, nip05 }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -362,10 +262,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getEventMeta(content: string) : Promise<Result<Meta, null>> {
|
|
|
|
async getEventMeta(content: string) : Promise<Result<Meta, null>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_event_meta", { content }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -379,15 +276,9 @@ export const commands = {
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getEventFrom(
|
|
|
|
async getEventFrom(id: string, relayHint: string) : Promise<Result<RichEvent, string>> {
|
|
|
|
id: string,
|
|
|
|
|
|
|
|
relayHint: string,
|
|
|
|
|
|
|
|
): Promise<Result<RichEvent, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_event_from", { id, relayHint }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -403,10 +294,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async listenEventReply(id: string) : Promise<Result<null, string>> {
|
|
|
|
async listenEventReply(id: string) : Promise<Result<null, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("listen_event_reply", { id }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -414,108 +302,63 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async unlistenEventReply(id: string) : Promise<Result<null, null>> {
|
|
|
|
async unlistenEventReply(id: string) : Promise<Result<null, null>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("unlisten_event_reply", { id }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("unlisten_event_reply", { id }),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
if(e instanceof Error) throw e;
|
|
|
|
if(e instanceof Error) throw e;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getEventsBy(
|
|
|
|
async getEventsBy(publicKey: string, asOf: string | null) : Promise<Result<RichEvent[], string>> {
|
|
|
|
publicKey: string,
|
|
|
|
|
|
|
|
asOf: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<RichEvent[], string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_events_by", { publicKey, asOf }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getLocalEvents(
|
|
|
|
async getLocalEvents(until: string | null) : Promise<Result<RichEvent[], string>> {
|
|
|
|
until: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<RichEvent[], string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_local_events", { until }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getGroupEvents(
|
|
|
|
async getGroupEvents(publicKeys: string[], until: string | null) : Promise<Result<RichEvent[], string>> {
|
|
|
|
publicKeys: string[],
|
|
|
|
|
|
|
|
until: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<RichEvent[], string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_group_events", { publicKeys, until }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getGlobalEvents(
|
|
|
|
async getGlobalEvents(until: string | null) : Promise<Result<RichEvent[], string>> {
|
|
|
|
until: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<RichEvent[], string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_global_events", { until }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getHashtagEvents(
|
|
|
|
async getHashtagEvents(hashtags: string[], until: string | null) : Promise<Result<RichEvent[], string>> {
|
|
|
|
hashtags: string[],
|
|
|
|
|
|
|
|
until: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<RichEvent[], string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_hashtag_events", { hashtags, until }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async publish(
|
|
|
|
async publish(content: string, warning: string | null, difficulty: number | null) : Promise<Result<string, string>> {
|
|
|
|
content: string,
|
|
|
|
|
|
|
|
warning: string | null,
|
|
|
|
|
|
|
|
difficulty: number | null,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("publish", { content, warning, difficulty }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async reply(
|
|
|
|
async reply(content: string, to: string, root: string | null) : Promise<Result<string, string>> {
|
|
|
|
content: string,
|
|
|
|
|
|
|
|
to: string,
|
|
|
|
|
|
|
|
root: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("reply", { content, to, root }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -531,10 +374,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async eventToBech32(id: string) : Promise<Result<string, string>> {
|
|
|
|
async eventToBech32(id: string) : Promise<Result<string, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("event_to_bech32", { id }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -542,10 +382,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async userToBech32(user: string) : Promise<Result<string, string>> {
|
|
|
|
async userToBech32(user: string) : Promise<Result<string, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("user_to_bech32", { user }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -556,10 +393,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async createColumn(column: Column) : Promise<Result<string, string>> {
|
|
|
|
async createColumn(column: Column) : Promise<Result<string, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("create_column", { column }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -567,40 +401,23 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async closeColumn(label: string) : Promise<Result<boolean, string>> {
|
|
|
|
async closeColumn(label: string) : Promise<Result<boolean, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("close_column", { label }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async repositionColumn(
|
|
|
|
async repositionColumn(label: string, x: number, y: number) : Promise<Result<null, string>> {
|
|
|
|
label: string,
|
|
|
|
|
|
|
|
x: number,
|
|
|
|
|
|
|
|
y: number,
|
|
|
|
|
|
|
|
): Promise<Result<null, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("reposition_column", { label, x, y }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async resizeColumn(
|
|
|
|
async resizeColumn(label: string, width: number, height: number) : Promise<Result<null, string>> {
|
|
|
|
label: string,
|
|
|
|
|
|
|
|
width: number,
|
|
|
|
|
|
|
|
height: number,
|
|
|
|
|
|
|
|
): Promise<Result<null, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("resize_column", { label, width, height }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -608,10 +425,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async openWindow(window: Window) : Promise<Result<null, string>> {
|
|
|
|
async openWindow(window: Window) : Promise<Result<null, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("open_window", { window }) };
|
|
|
|
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;
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
else return { status: "error", error: e as any };
|
|
|
|
@@ -622,59 +436,26 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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 statics **/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** user-defined types **/
|
|
|
|
/** user-defined types **/
|
|
|
|
|
|
|
|
|
|
|
|
export type Account = { npub: string; nsec: string };
|
|
|
|
export type Account = { npub: string; nsec: string }
|
|
|
|
export type Column = {
|
|
|
|
export type Column = { label: string; url: string; x: number; y: number; width: number; height: number }
|
|
|
|
label: string;
|
|
|
|
export type Meta = { content: string; images: string[]; videos: string[]; events: string[]; mentions: string[]; hashtags: string[] }
|
|
|
|
url: string;
|
|
|
|
export type Relays = { connected: string[]; read: string[] | null; write: string[] | null; both: string[] | null }
|
|
|
|
x: number;
|
|
|
|
export type RichEvent = { raw: string; parsed: Meta | null }
|
|
|
|
y: number;
|
|
|
|
export type Settings = { proxy: string | null; image_resize_service: string | null; use_relay_hint: boolean; content_warning: boolean; display_avatar: boolean; display_zap_button: boolean; display_repost_button: boolean; display_media: boolean }
|
|
|
|
width: number;
|
|
|
|
export type Window = { label: string; title: string; url: string; width: number; height: number; maximizable: boolean; minimizable: boolean; hidden_title: boolean }
|
|
|
|
height: number;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
export type Meta = {
|
|
|
|
|
|
|
|
content: string;
|
|
|
|
|
|
|
|
images: string[];
|
|
|
|
|
|
|
|
videos: string[];
|
|
|
|
|
|
|
|
events: string[];
|
|
|
|
|
|
|
|
mentions: string[];
|
|
|
|
|
|
|
|
hashtags: string[];
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
export type Relays = {
|
|
|
|
|
|
|
|
connected: string[];
|
|
|
|
|
|
|
|
read: string[] | null;
|
|
|
|
|
|
|
|
write: string[] | null;
|
|
|
|
|
|
|
|
both: string[] | null;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
export type RichEvent = { raw: string; parsed: Meta | null };
|
|
|
|
|
|
|
|
export type Settings = {
|
|
|
|
|
|
|
|
proxy: string | null;
|
|
|
|
|
|
|
|
image_resize_service: string | null;
|
|
|
|
|
|
|
|
use_relay_hint: boolean;
|
|
|
|
|
|
|
|
content_warning: boolean;
|
|
|
|
|
|
|
|
display_avatar: boolean;
|
|
|
|
|
|
|
|
display_zap_button: boolean;
|
|
|
|
|
|
|
|
display_repost_button: boolean;
|
|
|
|
|
|
|
|
display_media: boolean;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
export type Window = {
|
|
|
|
|
|
|
|
label: string;
|
|
|
|
|
|
|
|
title: string;
|
|
|
|
|
|
|
|
url: string;
|
|
|
|
|
|
|
|
width: number;
|
|
|
|
|
|
|
|
height: number;
|
|
|
|
|
|
|
|
maximizable: boolean;
|
|
|
|
|
|
|
|
minimizable: boolean;
|
|
|
|
|
|
|
|
hidden_title: boolean;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** tauri-specta globals **/
|
|
|
|
/** tauri-specta globals **/
|
|
|
|
|
|
|
|
|
|
|
|
@@ -684,10 +465,10 @@ import { type WebviewWindow as __WebviewWindow__ } from "@tauri-apps/api/webview
|
|
|
|
|
|
|
|
|
|
|
|
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>
|
|
|
|
@@ -699,7 +480,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 {
|
|
|
|
@@ -729,6 +510,8 @@ function __makeEvents__<T extends Record<string, any>>(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|