Skip to content

Privacy-first password manager with built-in email aliasing. Fully encrypted and self-hostable.

Update MIN_SERVER_VERSION to 0.31.0 in all client apps

Leendert de Borstad1ed8be8d18
diff --git a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/utils/AppInfo.kt b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/utils/AppInfo.kt
index 9e144dec3..2710dd2db 100644
--- a/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/utils/AppInfo.kt
+++ b/apps/mobile-app/android/app/src/main/java/net/aliasvault/app/utils/AppInfo.kt
@@ -14,7 +14,7 @@ object AppInfo {
* tells the user to update it. Raise it when a client starts to depend on an endpoint or a response shape that
* older servers lack.
*/
- const val MIN_SERVER_VERSION = "0.12.0-dev"
+ const val MIN_SERVER_VERSION = "0.31.0-alpha"
/**
* The default AliasVault web client URL.
diff --git a/apps/mobile-app/ios/VaultStoreKit/AppInfo.swift b/apps/mobile-app/ios/VaultStoreKit/AppInfo.swift
index 8753e509f..a435a2b09 100644
--- a/apps/mobile-app/ios/VaultStoreKit/AppInfo.swift
+++ b/apps/mobile-app/ios/VaultStoreKit/AppInfo.swift
@@ -10,7 +10,7 @@ public enum AppInfo {
/// The minimum supported AliasVault server (API) version. A client refuses to work against an older server and
/// tells the user to update it. Raise it when a client starts to depend on an endpoint or a response shape that
/// older servers lack.
- public static let minServerVersion = "0.12.0-dev"
+ public static let minServerVersion = "0.31.0-alpha"
/// The default AliasVault web client URL.
public static let defaultClientUrl = "https://app.aliasvault.com"
diff --git a/core/models/src/defaults/AppDefaults.ts b/core/models/src/defaults/AppDefaults.ts
index 6d0609f07..b2f5eddaf 100644
--- a/core/models/src/defaults/AppDefaults.ts
+++ b/core/models/src/defaults/AppDefaults.ts
@@ -13,7 +13,7 @@
* tells the user to update it. Raise it when a client starts to depend on an endpoint or a response shape that
* older servers lack.
*/
-export const MIN_SERVER_VERSION = '0.12.0-dev';
+export const MIN_SERVER_VERSION = '0.31.0-alpha';
/** The default AliasVault web client URL. */
export const DEFAULT_CLIENT_URL = 'https://app.aliasvault.com';
diff --git a/core/rust/src/vault_sync/migration.rs b/core/rust/src/vault_sync/migration.rs
index ea563e0bb..ef6acbf1b 100644
--- a/core/rust/src/vault_sync/migration.rs
+++ b/core/rust/src/vault_sync/migration.rs
@@ -8,7 +8,7 @@ use super::errors::{Failure, SyncError, SyncResult};
use super::push::{self, PushStatus, WriteKind};
use super::state::{self, Ctx};
use super::types::{FullSyncResult, MigrateManifestResult, MigrationKind, MigrationStatusResult};
-use super::{keys, legacy, pull};
+use super::{http, keys, legacy, pull};
/// Where the local vault's schema stands against the current one.
pub(crate) async fn schema_state(ctx: &mut Ctx) -> SyncResult<SchemaState> {
@@ -75,6 +75,7 @@ pub(crate) async fn migration_status(ctx: &mut Ctx) -> MigrationStatusResult {
pub(crate) async fn migrate_manifest(ctx: &mut Ctx) -> MigrateManifestResult {
let migrated: SyncResult<bool> = async {
if !keys::has_cached_key_chain(&ctx.host).await? {
+ ensure_server_ready(ctx).await?;
return legacy::upgrade_account_to_manifest_v1(ctx).await;
}
migrate_schema(ctx).await
@@ -89,6 +90,14 @@ pub(crate) async fn migrate_manifest(ctx: &mut Ctx) -> MigrateManifestResult {
}
}
+/// Refuse the one-time account upgrade before it touches the local vault unless the server is reachable and serves the v2 API.
+async fn ensure_server_ready(ctx: &Ctx) -> SyncResult<()> {
+ if http::get_status(&ctx.host).await?.server_version == http::SERVER_UNREACHABLE_VERSION {
+ return Err(SyncError::Network("the server is unreachable; the migration needs it".to_string()));
+ }
+ Ok(())
+}
+
/// The permanent migration: rebuild a stale local schema onto the current one and push it. Returns whether the
/// push reached the server; a vault already on the current schema counts as pushed.
pub(crate) async fn migrate_schema(ctx: &mut Ctx) -> SyncResult<bool> {
diff --git a/core/rust/src/vault_sync/tests/test_host.rs b/core/rust/src/vault_sync/tests/test_host.rs
index 18b473e93..a9a177938 100644
--- a/core/rust/src/vault_sync/tests/test_host.rs
+++ b/core/rust/src/vault_sync/tests/test_host.rs
@@ -328,7 +328,7 @@ pub fn request_json(operation: &str, key: &str, dirty: bool, mutation_sequence:
"mutationSequence": mutation_sequence,
"dirtyScopes": if dirty { vec!["Main"] } else { vec![] },
"privateEmailDomains": ["private.io"],
- "minServerVersion": "0.12.0-dev",
+ "minServerVersion": "0.31.0-alpha",
})
}