Fixed bugs
This commit is contained in:
@@ -22,6 +22,7 @@ fn accounts_file_path(app: &AppHandle) -> Result<std::path::PathBuf, String> {
|
||||
.path()
|
||||
.app_data_dir()
|
||||
.map_err(|e| format!("Failed to resolve app data dir: {e}"))?;
|
||||
|
||||
fs::create_dir_all(&dir).map_err(|e| format!("Failed to create app data dir: {e}"))?;
|
||||
Ok(dir.join("accounts.json"))
|
||||
}
|
||||
|
||||
@@ -41,10 +41,9 @@ pub fn save_server_list(app: AppHandle, servers: ServerList) -> Result<(), Strin
|
||||
#[tauri::command]
|
||||
pub fn get_server_list(app: AppHandle) -> Result<ServerList, String> {
|
||||
let path = servers_file_path(&app)?;
|
||||
println!("{path:?}");
|
||||
|
||||
if !path.exists() {
|
||||
fs::write(&path, "[]").map_err(|e| format!("Failed to write first server list: {e}"))?;
|
||||
|
||||
return Ok(ServerList::new());
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -66,10 +66,14 @@ export default class Enclave {
|
||||
}
|
||||
|
||||
if (
|
||||
this.serverList[hostname]?.publicKey !==
|
||||
this.serverList[hostname] &&
|
||||
this.serverList[hostname].publicKey !==
|
||||
base58.encode(this.server.serverPublicKey)
|
||||
) {
|
||||
console.error("Server's new public key doesn't match old one");
|
||||
console.error("Server's new public key doesn't match old one", {
|
||||
old: this.serverList[hostname].publicKey,
|
||||
new: base58.encode(this.server.serverPublicKey),
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,9 +43,9 @@ export function RenderCategory({ channel }: { channel: Channel }) {
|
||||
export function RenderChannels({ channels }: { channels: Channel[] }) {
|
||||
return channels.map((channel) =>
|
||||
channel.kind === "category" ? (
|
||||
<RenderCategory channel={channel} />
|
||||
<RenderCategory key={channel.id} channel={channel} />
|
||||
) : (
|
||||
<div className="w-full hover:bg-accent px-2.5 py-1.5 rounded-md flex gap-2.5 items-center select-none cursor-default text-sm text-muted-foreground">
|
||||
<div key={channel.id} className="w-full hover:bg-accent px-2.5 py-1.5 rounded-md flex gap-2.5 items-center select-none cursor-default text-sm text-muted-foreground">
|
||||
<ChannelIcon kind={channel.kind} />
|
||||
{channel.name}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user