Remove sync-lib

This commit is contained in:
Andras Schmelczer 2025-07-12 12:36:08 +01:00
parent 0ce5787858
commit da60f8c005
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
24 changed files with 67 additions and 443 deletions

View file

@ -7,8 +7,6 @@ license.workspace = true
repository.workspace = true
[dependencies]
sync_lib = { path = "../sync_lib" }
serde = { workspace = true }
thiserror = { workspace = true }
@ -35,6 +33,7 @@ clap-verbosity-flag = "3.0.3"
bimap = "0.6.3"
ts-rs = { version = "10.1", features = ["uuid-impl", "chrono-impl"] }
serde_with = "3.12.0"
base64 = "0.22.1"
reconcile-text = "0.4.10"
[lints]

View file

@ -1,6 +1,6 @@
use base64::{Engine as _, engine::general_purpose::STANDARD};
use chrono::{DateTime, Utc};
use serde::Serialize;
use sync_lib::bytes_to_base64;
use ts_rs::TS;
pub type VaultId = String;
@ -80,7 +80,7 @@ impl From<StoredDocumentVersion> for DocumentVersion {
document_id: value.document_id,
relative_path: value.relative_path,
updated_date: value.updated_date,
content_base64: bytes_to_base64(&value.content),
content_base64: STANDARD.encode(&value.content),
is_deleted: value.is_deleted,
user_id: value.user_id,
device_id: value.device_id,

View file

@ -8,7 +8,6 @@ use axum_typed_multipart::TypedMultipart;
use log::info;
use reconcile_text::{BuiltinTokenizer, is_binary, reconcile};
use serde::Deserialize;
use sync_lib::is_file_type_mergable;
use super::{
device_id_header::DeviceIdHeader, requests::UpdateDocumentVersion,
@ -21,7 +20,10 @@ use crate::{
},
config::user_config::User,
errors::{SyncServerError, not_found_error, server_error},
utils::{dedup_paths::dedup_paths, normalize::normalize, sanitize_path::sanitize_path},
utils::{
dedup_paths::dedup_paths, is_filetype_mergable::is_file_type_mergable,
normalize::normalize, sanitize_path::sanitize_path,
},
};
#[derive(Deserialize)]

View file

@ -1,3 +1,4 @@
pub mod dedup_paths;
pub mod is_filetype_mergable;
pub mod normalize;
pub mod sanitize_path;

View file

@ -0,0 +1,23 @@
pub fn is_file_type_mergable(path_or_file_name: &str) -> bool {
let file_extension = path_or_file_name.split('.').next_back().unwrap_or_default();
matches!(file_extension.to_lowercase().as_str(), "md" | "txt")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_is_file_type_mergable() {
assert!(is_file_type_mergable(".md"));
assert!(is_file_type_mergable("hi.md"));
assert!(is_file_type_mergable("my/path/to/my/document.md"));
assert!(is_file_type_mergable("hi.MD"));
assert!(is_file_type_mergable("my/path/to/my/DOCUMENT.MD"));
assert!(!is_file_type_mergable(".json"));
assert!(!is_file_type_mergable("HELLO.JSON"));
assert!(!is_file_type_mergable("my/config.yml"));
}
}