|
|
@ -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, null>> {
|
|
|
|
async connectRelay(relay: string) : Promise<Result<boolean, null>> {
|
|
|
|
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, null>> {
|
|
|
|
async removeRelay(relay: string) : Promise<Result<boolean, null>> {
|
|
|
|
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,66 +78,39 @@ 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 };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async eventToBech32(
|
|
|
|
async eventToBech32(id: string, relays: string[]) : Promise<Result<string, null>> {
|
|
|
|
id: string,
|
|
|
|
|
|
|
|
relays: string[],
|
|
|
|
|
|
|
|
): Promise<Result<string, null>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("event_to_bech32", { id, relays }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("event_to_bech32", { id, 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 };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async userToBech32(
|
|
|
|
async userToBech32(key: string, relays: string[]) : Promise<Result<string, null>> {
|
|
|
|
key: string,
|
|
|
|
|
|
|
|
relays: string[],
|
|
|
|
|
|
|
|
): Promise<Result<string, null>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("user_to_bech32", { key, relays }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("user_to_bech32", { key, 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 };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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 };
|
|
|
@ -165,10 +118,7 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async getCurrentUserProfile() : Promise<Result<string, string>> {
|
|
|
|
async getCurrentUserProfile() : Promise<Result<string, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_current_user_profile") };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("get_current_user_profile"),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} 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 };
|
|
|
@ -192,53 +142,23 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async setContactList(pubkeys: string[]) : Promise<Result<boolean, string>> {
|
|
|
|
async setContactList(pubkeys: string[]) : Promise<Result<boolean, string>> {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("set_contact_list", { pubkeys }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("set_contact_list", { pubkeys }),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} 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 };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async follow(
|
|
|
|
async follow(id: string, alias: string | null) : Promise<Result<string, string>> {
|
|
|
|
id: string,
|
|
|
|
|
|
|
|
alias: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("follow", { id, alias }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("follow", { id, 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 };
|
|
|
@ -260,15 +180,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 };
|
|
|
@ -298,31 +212,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 };
|
|
|
@ -330,10 +230,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 };
|
|
|
@ -363,70 +260,41 @@ export const commands = {
|
|
|
|
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<string[], string>> {
|
|
|
|
publicKey: string,
|
|
|
|
|
|
|
|
asOf: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<string[], 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(pubkeys: string[], until: string | null) : Promise<Result<string[], string>> {
|
|
|
|
pubkeys: string[],
|
|
|
|
|
|
|
|
until: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<string[], string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("get_local_events", { pubkeys, until }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("get_local_events", { pubkeys, 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<string[], string>> {
|
|
|
|
until: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<string[], 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<string[], string>> {
|
|
|
|
hashtags: string[],
|
|
|
|
|
|
|
|
until: string | null,
|
|
|
|
|
|
|
|
): Promise<Result<string[], 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, tags: string[][]) : Promise<Result<string, string>> {
|
|
|
|
content: string,
|
|
|
|
|
|
|
|
tags: string[][],
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("publish", { content, tags }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("publish", { content, tags }),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} 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 };
|
|
|
@ -443,26 +311,9 @@ export const commands = {
|
|
|
|
async showInFolder(path: string) : Promise<void> {
|
|
|
|
async showInFolder(path: string) : Promise<void> {
|
|
|
|
await TAURI_INVOKE("show_in_folder", { path });
|
|
|
|
await TAURI_INVOKE("show_in_folder", { path });
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async createColumn(
|
|
|
|
async createColumn(label: string, x: number, y: number, width: number, height: number, url: string) : Promise<Result<string, string>> {
|
|
|
|
label: string,
|
|
|
|
|
|
|
|
x: number,
|
|
|
|
|
|
|
|
y: number,
|
|
|
|
|
|
|
|
width: number,
|
|
|
|
|
|
|
|
height: number,
|
|
|
|
|
|
|
|
url: string,
|
|
|
|
|
|
|
|
): Promise<Result<string, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("create_column", { label, x, y, width, height, url }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("create_column", {
|
|
|
|
|
|
|
|
label,
|
|
|
|
|
|
|
|
x,
|
|
|
|
|
|
|
|
y,
|
|
|
|
|
|
|
|
width,
|
|
|
|
|
|
|
|
height,
|
|
|
|
|
|
|
|
url,
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} 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 };
|
|
|
@ -470,63 +321,31 @@ export const commands = {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async closeColumn(label: string) : Promise<Result<boolean, null>> {
|
|
|
|
async closeColumn(label: string) : Promise<Result<boolean, null>> {
|
|
|
|
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 };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async openWindow(
|
|
|
|
async openWindow(label: string, title: string, url: string, width: number, height: number) : Promise<Result<null, string>> {
|
|
|
|
label: string,
|
|
|
|
|
|
|
|
title: string,
|
|
|
|
|
|
|
|
url: string,
|
|
|
|
|
|
|
|
width: number,
|
|
|
|
|
|
|
|
height: number,
|
|
|
|
|
|
|
|
): Promise<Result<null, string>> {
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
return {
|
|
|
|
return { status: "ok", data: await TAURI_INVOKE("open_window", { label, title, url, width, height }) };
|
|
|
|
status: "ok",
|
|
|
|
|
|
|
|
data: await TAURI_INVOKE("open_window", {
|
|
|
|
|
|
|
|
label,
|
|
|
|
|
|
|
|
title,
|
|
|
|
|
|
|
|
url,
|
|
|
|
|
|
|
|
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 };
|
|
|
@ -534,22 +353,21 @@ 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 Relays = {
|
|
|
|
export type Relays = { connected: string[]; read: string[] | null; write: string[] | null; both: string[] | null }
|
|
|
|
connected: string[];
|
|
|
|
|
|
|
|
read: string[] | null;
|
|
|
|
|
|
|
|
write: string[] | null;
|
|
|
|
|
|
|
|
both: string[] | null;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** tauri-specta globals **/
|
|
|
|
/** tauri-specta globals **/
|
|
|
|
|
|
|
|
|
|
|
@ -559,10 +377,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>
|
|
|
@ -574,7 +392,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 {
|
|
|
@ -604,6 +422,8 @@ function __makeEvents__<T extends Record<string, any>>(
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|