Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat(desktop): atomic write for registry persistence (#5658)
Shreyas87d1cccb824b
diff --git a/packages/hoppscotch-common/package.json b/packages/hoppscotch-common/package.jsonindex 4a42e6ba3..36089addc 100644--- a/packages/hoppscotch-common/package.json+++ b/packages/hoppscotch-common/package.json@@ -40,7 +40,7 @@"@hoppscotch/httpsnippet": "3.0.9","@hoppscotch/js-sandbox": "workspace:^","@hoppscotch/kernel": "workspace:^",- "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#e05861959938b57479a1a81fa796735ebbd08c7c",+ "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#52744a8f35bf81b039410522efd4168bd06d4f35","@hoppscotch/ui": "0.2.5","@hoppscotch/vue-toasted": "0.1.0","@lezer/highlight": "1.2.1",diff --git a/packages/hoppscotch-desktop/package.json b/packages/hoppscotch-desktop/package.jsonindex 1fc694ca7..0ac74d0f4 100644--- a/packages/hoppscotch-desktop/package.json+++ b/packages/hoppscotch-desktop/package.json@@ -24,7 +24,7 @@"@fontsource-variable/roboto-mono": "5.2.8","@hoppscotch/common": "workspace:^","@hoppscotch/kernel": "workspace:^",- "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#e05861959938b57479a1a81fa796735ebbd08c7c",+ "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#52744a8f35bf81b039410522efd4168bd06d4f35","@hoppscotch/ui": "0.2.5","@tauri-apps/api": "2.1.1","@tauri-apps/plugin-fs": "2.0.2",diff --git a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/registry.rs b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/registry.rsindex 91733b817..70383f221 100644--- a/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/registry.rs+++ b/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload/src/storage/registry.rs@@ -1,7 +1,6 @@use chrono::{DateTime, Utc};use serde::{Deserialize, Serialize};use std::collections::HashMap;-use tokio::fs;use url::Url;use super::error::Result;@@ -30,13 +29,18 @@ impl Registry {});}- let content = fs::read_to_string(layout.registry_path()).await?;+ let content = tokio::fs::read_to_string(layout.registry_path()).await?;Ok(serde_json::from_str(&content)?)}pub async fn save(&self, layout: &StorageLayout) -> Result<()> {let content = serde_json::to_string_pretty(self)?;- fs::write(layout.registry_path(), content).await?;+ let path = layout.registry_path();+ let temp_path = path.with_extension("json.tmp");++ tokio::fs::write(&temp_path, &content).await?;+ tokio::fs::rename(&temp_path, &path).await?;+Ok(())}diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.lock b/packages/hoppscotch-desktop/src-tauri/Cargo.lockindex d3c053d00..cde405daf 100644--- a/packages/hoppscotch-desktop/src-tauri/Cargo.lock+++ b/packages/hoppscotch-desktop/src-tauri/Cargo.lock@@ -2426,7 +2426,7 @@ dependencies = ["libc","percent-encoding","pin-project-lite",- "socket2 0.6.1",+ "socket2 0.5.10","system-configuration","tokio","tower-service",@@ -2446,7 +2446,7 @@ dependencies = ["js-sys","log","wasm-bindgen",- "windows-core 0.57.0",+ "windows-core 0.61.2",][[package]]@@ -3719,7 +3719,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"dependencies = ["libc",- "windows-sys 0.61.2",+ "windows-sys 0.48.0",][[package]]@@ -4180,7 +4180,7 @@ dependencies = ["quinn-udp","rustc-hash","rustls",- "socket2 0.6.1",+ "socket2 0.5.10","thiserror 2.0.17","tokio","tracing",@@ -4217,7 +4217,7 @@ dependencies = ["cfg_aliases","libc","once_cell",- "socket2 0.6.1",+ "socket2 0.5.10","tracing","windows-sys 0.60.2",]@@ -5568,7 +5568,7 @@ dependencies = [[[package]]name = "tauri-plugin-appload"version = "0.1.0"-source = "git+https://github.com/CuriousCorrelation/tauri-plugin-appload?rev=e05861959938b57479a1a81fa796735ebbd08c7c#e05861959938b57479a1a81fa796735ebbd08c7c"+source = "git+https://github.com/CuriousCorrelation/tauri-plugin-appload?rev=52744a8f35bf81b039410522efd4168bd06d4f35#52744a8f35bf81b039410522efd4168bd06d4f35"dependencies = ["base64 0.22.1","blake3",@@ -6903,7 +6903,7 @@ version = "0.1.11"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"dependencies = [- "windows-sys 0.61.2",+ "windows-sys 0.48.0",][[package]]diff --git a/packages/hoppscotch-desktop/src-tauri/Cargo.toml b/packages/hoppscotch-desktop/src-tauri/Cargo.tomlindex d7bdb0240..5009fd16b 100644--- a/packages/hoppscotch-desktop/src-tauri/Cargo.toml+++ b/packages/hoppscotch-desktop/src-tauri/Cargo.toml@@ -29,7 +29,7 @@ tauri-plugin-store = "2.4.1"tauri-plugin-dialog = "2.4.2"tauri-plugin-fs = "2.4.4"tauri-plugin-deep-link = "2.4.5"-tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "e05861959938b57479a1a81fa796735ebbd08c7c" }+tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload", rev = "52744a8f35bf81b039410522efd4168bd06d4f35" }tauri-plugin-relay = { git = "https://github.com/CuriousCorrelation/tauri-plugin-relay", rev = "7cf09c1ad31e228758738c2f4e1c8fe9cc141291" }axum = "0.8.7"tower-http = { version = "0.6.6", features = ["cors"] }diff --git a/packages/hoppscotch-selfhost-web/package.json b/packages/hoppscotch-selfhost-web/package.jsonindex 4f75b9c9c..1b09830c7 100644--- a/packages/hoppscotch-selfhost-web/package.json+++ b/packages/hoppscotch-selfhost-web/package.json@@ -29,7 +29,7 @@"@hoppscotch/common": "workspace:^","@hoppscotch/data": "workspace:^","@hoppscotch/kernel": "workspace:^",- "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#e05861959938b57479a1a81fa796735ebbd08c7c",+ "@hoppscotch/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload#52744a8f35bf81b039410522efd4168bd06d4f35","@hoppscotch/ui": "0.2.5","@import-meta-env/unplugin": "0.6.3","@tauri-apps/api": "2.1.1",diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 539723d6d..af47616d3 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -534,8 +534,8 @@ importers:specifier: workspace:^version: link:../hoppscotch-kernel'@hoppscotch/plugin-appload':- specifier: github:CuriousCorrelation/tauri-plugin-appload#e05861959938b57479a1a81fa796735ebbd08c7c- version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/e05861959938b57479a1a81fa796735ebbd08c7c'+ specifier: github:CuriousCorrelation/tauri-plugin-appload#52744a8f35bf81b039410522efd4168bd06d4f35+ version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/52744a8f35bf81b039410522efd4168bd06d4f35''@hoppscotch/ui':specifier: 0.2.5version: 0.2.5([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))@@ -1022,8 +1022,8 @@ importers:specifier: workspace:^version: link:../hoppscotch-kernel'@hoppscotch/plugin-appload':- specifier: github:CuriousCorrelation/tauri-plugin-appload#e05861959938b57479a1a81fa796735ebbd08c7c- version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/e05861959938b57479a1a81fa796735ebbd08c7c'+ specifier: github:CuriousCorrelation/tauri-plugin-appload#52744a8f35bf81b039410522efd4168bd06d4f35+ version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/52744a8f35bf81b039410522efd4168bd06d4f35''@hoppscotch/ui':specifier: 0.2.5version: 0.2.5([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))@@ -1325,8 +1325,8 @@ importers:specifier: workspace:^version: link:../hoppscotch-kernel'@hoppscotch/plugin-appload':- specifier: github:CuriousCorrelation/tauri-plugin-appload#e05861959938b57479a1a81fa796735ebbd08c7c- version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/e05861959938b57479a1a81fa796735ebbd08c7c'+ specifier: github:CuriousCorrelation/tauri-plugin-appload#52744a8f35bf81b039410522efd4168bd06d4f35+ version: '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/52744a8f35bf81b039410522efd4168bd06d4f35''@hoppscotch/ui':specifier: 0.2.5version: 0.2.5([email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected]))([email protected]([email protected]))@@ -1691,8 +1691,8 @@ packages:graphql:optional: true- '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/e05861959938b57479a1a81fa796735ebbd08c7c':- resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/e05861959938b57479a1a81fa796735ebbd08c7c}+ '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/52744a8f35bf81b039410522efd4168bd06d4f35':+ resolution: {tarball: https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/52744a8f35bf81b039410522efd4168bd06d4f35}version: 0.1.0'@CuriousCorrelation/plugin-relay@https://codeload.github.com/CuriousCorrelation/tauri-plugin-relay/tar.gz/7cf09c1ad31e228758738c2f4e1c8fe9cc141291':@@ -13239,7 +13239,7 @@ snapshots:optionalDependencies:graphql: 16.12.0- '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/e05861959938b57479a1a81fa796735ebbd08c7c':+ '@CuriousCorrelation/plugin-appload@https://codeload.github.com/CuriousCorrelation/tauri-plugin-appload/tar.gz/52744a8f35bf81b039410522efd4168bd06d4f35':dependencies:'@tauri-apps/api': 2.1.1