Add api version check to client
This commit is contained in:
parent
b1826907e7
commit
3ed2e4f666
10 changed files with 52 additions and 3 deletions
|
|
@ -16,3 +16,5 @@ pub const DEFAULT_LOG_DIRECTORY: &str = "logs";
|
|||
pub const DEFAULT_LOG_ROTATION_INTERVAL: Duration = Duration::from_secs(60 * 60 * 24); // 1 day
|
||||
|
||||
pub const DEFAULT_MERGEABLE_FILE_EXTENSIONS: &[&str] = &["md", "txt"];
|
||||
|
||||
pub const SUPPORTED_API_VERSION: u32 = 1;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use serde::Deserialize;
|
|||
use super::{auth::auth, responses::PingResponse};
|
||||
use crate::{
|
||||
app_state::{AppState, database::models::VaultId},
|
||||
consts::SUPPORTED_API_VERSION,
|
||||
errors::SyncServerError,
|
||||
utils::normalize::normalize,
|
||||
};
|
||||
|
|
@ -34,5 +35,6 @@ pub async fn ping(
|
|||
server_version: env!("CARGO_PKG_VERSION").to_owned(),
|
||||
is_authenticated,
|
||||
mergeable_file_extensions: state.config.server.mergeable_file_extensions.clone(),
|
||||
supported_api_version: SUPPORTED_API_VERSION,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ pub struct PingResponse {
|
|||
|
||||
/// List of file extensions that are allowed to be merged.
|
||||
pub mergeable_file_extensions: Vec<String>,
|
||||
|
||||
/// API version ensuring backwards & forwards compatibility between the client
|
||||
/// and server.
|
||||
pub supported_api_version: u32,
|
||||
}
|
||||
|
||||
/// Response to a fetch latest documents request.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue