Fix main & improve cursor sync #101

Merged
schmelczer merged 16 commits from asch/fix-main into main 2025-08-25 17:15:52 +01:00
9 changed files with 22 additions and 19 deletions
Showing only changes of commit 063ee2a2c0 - Show all commits

Use non-nightly rust

Andras Schmelczer 2025-08-17 22:41:48 +01:00
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C

View file

@ -25,9 +25,7 @@ jobs:
- name: Setup rust - name: Setup rust
run: | run: |
rustup update cargo install sqlx-cli cargo-machete
rustup install nightly && rustup default nightly
cargo install sqlx-cli
cd sync-server cd sync-server
sqlx database create --database-url sqlite://db.sqlite3 sqlx database create --database-url sqlite://db.sqlite3
sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3 sqlx migrate run --source src/app_state/database/migrations --database-url sqlite://db.sqlite3
@ -37,6 +35,7 @@ jobs:
cd sync-server cd sync-server
cargo clippy --all-targets --all-features cargo clippy --all-targets --all-features
cargo fmt --all -- --check cargo fmt --all -- --check
cargo machete
- name: Test sync-server - name: Test sync-server
run: | run: |

View file

@ -1,6 +1,6 @@
[package] [package]
name = "sync_server" name = "sync_server"
rust-version = "1.87.0" rust-version = "1.89.0"
authors = ["Andras Schmelczer <andras@schmelczer.dev>"] authors = ["Andras Schmelczer <andras@schmelczer.dev>"]
edition = "2024" edition = "2024"
license = "MIT" license = "MIT"

View file

@ -1,4 +1,4 @@
[toolchain] [toolchain]
channel = "nightly" channel = "1.89.0"
targets = [ "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl" ] targets = [ "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl" ]
profile = "default" profile = "default"

View file

@ -1,8 +0,0 @@
imports_granularity = "crate"
condense_wildcard_suffixes = true
fn_single_line = true
format_strings = true
reorder_impl_items = true
group_imports = "StdExternalCrate"
use_field_init_shorthand = true
wrap_comments=true

View file

@ -126,5 +126,7 @@ impl ClientCursorsWithTimeToLive {
} }
} }
pub fn is_expired(&self, ttl: Duration) -> bool { self.last_updated.elapsed() > ttl } pub fn is_expired(&self, ttl: Duration) -> bool {
self.last_updated.elapsed() > ttl
}
} }

View file

@ -23,7 +23,9 @@ pub struct StoredDocumentVersion {
} }
impl PartialEq<Self> for StoredDocumentVersion { impl PartialEq<Self> for StoredDocumentVersion {
fn eq(&self, other: &Self) -> bool { self.vault_update_id == other.vault_update_id } fn eq(&self, other: &Self) -> bool {
self.vault_update_id == other.vault_update_id
}
} }
#[derive(TS, Debug, Clone, Serialize)] #[derive(TS, Debug, Clone, Serialize)]

View file

@ -179,6 +179,10 @@ async fn shutdown_signal() {
} }
} }
async fn handle_404() -> impl IntoResponse { not_found_error(anyhow!("Page not found")) } async fn handle_404() -> impl IntoResponse {
not_found_error(anyhow!("Page not found"))
}
async fn handle_405() -> impl IntoResponse { client_error(anyhow!("Method not allowed")) } async fn handle_405() -> impl IntoResponse {
client_error(anyhow!("Method not allowed"))
}

View file

@ -6,7 +6,9 @@ pub struct DeviceIdHeader(pub String);
pub static DEVICE_ID_HEADER_NAME: HeaderName = HeaderName::from_static("device-id"); pub static DEVICE_ID_HEADER_NAME: HeaderName = HeaderName::from_static("device-id");
impl Header for DeviceIdHeader { impl Header for DeviceIdHeader {
fn name() -> &'static HeaderName { &DEVICE_ID_HEADER_NAME } fn name() -> &'static HeaderName {
&DEVICE_ID_HEADER_NAME
}
fn decode<'i, I>(values: &mut I) -> Result<Self, headers::Error> fn decode<'i, I>(values: &mut I) -> Result<Self, headers::Error>
where where

View file

@ -8,4 +8,6 @@ where
Ok(normalize_string(&s)) Ok(normalize_string(&s))
} }
pub fn normalize_string(s: &str) -> String { s.trim().to_lowercase() } pub fn normalize_string(s: &str) -> String {
s.trim().to_lowercase()
}