Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions common/kubuno-db/src/schema_admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ pub enum AdminError {
Sqlx(#[from] sqlx::Error),
/// A row count mismatch after a copy: the destination did not receive every
/// source row, so the caller must not switch the pointer to it.
#[error("copie incomplète de la table {table} : {expected} lignes attendues, {got} copiées")]
#[error("Incomplete copy of table {table}: expected {expected} rows, copied {got}")]
RowCountMismatch {
table: String,
expected: i64,
got: i64,
},
#[error("préfixe de schéma invalide : {0}")]
#[error("Invalid schema prefix: {0}")]
BadPrefix(String),
/// A prefix rename would land on a namespace that already exists - possibly
/// another instance's on a shared server. Refused before anything moves.
#[error("le schéma cible {0} existe déjà : renommage refusé pour ne pas mélanger deux instances")]
#[error("Target schema {0} already exists: rename refused to avoid mixing two instances")]
TargetExists(String),
/// A MySQL database holds views, routines or events, which `RENAME TABLE`
/// cannot carry and the final `DROP DATABASE` would destroy.
#[error("la base {schema} contient {count} vue(s), routine(s) ou évènement(s) qu'un renommage ne peut pas déplacer")]
#[error("Database {schema} contains {count} views, routines, or events that a rename cannot move")]
UnmovableObjects { schema: String, count: i64 },
/// A type-poor source value could not be reconstructed into the destination
/// column's strict logical type. Returned instead of mis-storing, so the copy
Expand Down
4 changes: 2 additions & 2 deletions common/kubuno-mcp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub async fn handle_message(
let params = msg.get("params").cloned().unwrap_or(Value::Null);
let name = params.get("name").and_then(|n| n.as_str()).unwrap_or("");
if name.is_empty() {
return Some(rpc_error(id, -32602, "Paramètre 'name' manquant"));
return Some(rpc_error(id, -32602, "Missing 'name' parameter"));
}
let args = params.get("arguments").cloned().unwrap_or(json!({}));
let res = provider.call_tool(name, args, user_id).await;
Expand All @@ -98,6 +98,6 @@ pub async fn handle_message(
})))
}

other => Some(rpc_error(id, -32601, &format!("Méthode inconnue: {other}"))),
other => Some(rpc_error(id, -32601, &format!("Unknown method: {other}"))),
}
}
2 changes: 1 addition & 1 deletion common/kubuno-storage/src/backend/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl LocalStorage {

if !normalized.starts_with(&canonical_base) {
return Err(StorageError::InvalidPath(format!(
"Chemin '{path}' hors de la zone de stockage autorisée"
"Path '{path}' is outside the allowed storage area"
)));
}
Ok(normalized)
Expand Down
34 changes: 17 additions & 17 deletions common/kubuno-storage/src/backend/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,58 +9,58 @@ pub struct S3Storage;
#[async_trait]
impl StorageBackend for S3Storage {
async fn put(&self, _path: &str, _data: Bytes) -> StorageResult<()> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn put_stream(&self, _path: &str, _stream: ByteStream, _size_hint: Option<u64>) -> StorageResult<()> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn get(&self, _path: &str) -> StorageResult<Bytes> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn get_stream(&self, _path: &str) -> StorageResult<ByteStream> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn get_range(&self, _path: &str, _start: u64, _end: u64) -> StorageResult<ByteStream> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn delete(&self, _path: &str) -> StorageResult<()> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn delete_dir(&self, _path: &str) -> StorageResult<()> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn exists(&self, _path: &str) -> StorageResult<bool> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn size(&self, _path: &str) -> StorageResult<u64> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn list(&self, _prefix: &str) -> StorageResult<Vec<StorageObject>> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn copy(&self, _from: &str, _to: &str) -> StorageResult<()> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn init_multipart(&self, _path: &str) -> StorageResult<String> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn put_part(&self, _path: &str, _upload_id: &str, _part_number: u32, _data: Bytes) -> StorageResult<String> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn complete_multipart(&self, _path: &str, _upload_id: &str, _parts: Vec<MultipartPart>) -> StorageResult<()> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn abort_multipart(&self, _path: &str, _upload_id: &str) -> StorageResult<()> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
async fn create_dir(&self, _path: &str) -> StorageResult<()> {
// S3 n'a pas de répertoires - no-op
Ok(())
}
async fn mv_dir(&self, _from: &str, _to: &str) -> StorageResult<()> {
Err(StorageError::Internal("mv_dir non implémenté pour S3".into()))
Err(StorageError::Internal("mv_dir is not implemented for S3".into()))
}
async fn presign_get(&self, _path: &str, _ttl_seconds: u64) -> StorageResult<String> {
Err(StorageError::Internal("Backend S3 non configuré".into()))
Err(StorageError::Internal("S3 backend is not configured".into()))
}
}
12 changes: 6 additions & 6 deletions common/kubuno-storage/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#[derive(Debug, thiserror::Error)]
pub enum StorageError {
#[error("Fichier introuvable: {0}")]
#[error("File not found: {0}")]
NotFound(String),

#[error("Chemin invalide: {0}")]
#[error("Invalid path: {0}")]
InvalidPath(String),

#[error("Erreur I/O: {0}")]
#[error("I/O error: {0}")]
Io(#[from] std::io::Error),

#[error("Erreur S3: {0}")]
#[error("S3 error: {0}")]
S3(String),

#[error("Upload multipart introuvable: {0}")]
#[error("Multipart upload not found: {0}")]
MultipartNotFound(String),

#[error("Erreur interne: {0}")]
#[error("Internal error: {0}")]
Internal(String),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ pub fn set_event_handler(handler: impl Fn(AccountEvent) + Send + 'static) {
}

fn owner() -> Result<(&'static Session, Arc<TokenOwner>)> {
let session = SESSION.get().ok_or_else(|| anyhow!("les comptes ne sont pas démarrés"))?;
let session = SESSION.get().ok_or_else(|| anyhow!("Accounts have not been started"))?;
match &session.mode {
Mode::Owner(o) => Ok((session, o.clone())),
Mode::Client => bail!("Kubuno Desktop est déjà ouvert : utilisez sa fenêtre (zone de notification)."),
Mode::Client => bail!("Kubuno Desktop is already open: use its window from the notification area."),
}
}

Expand All @@ -196,10 +196,10 @@ fn api_for(server: &str) -> Result<ApiClient> {
/// A user-facing reason for a failed sign-in (never the server's raw body).
fn sign_in_error(e: kubuno_desktop_api_client::ApiError) -> anyhow::Error {
match e.status() {
Some(401) | Some(403) => anyhow!("Identifiant, mot de passe ou code incorrect."),
Some(429) => anyhow!("Trop de tentatives : réessayez dans une minute."),
Some(code) => anyhow!("Connexion refusée par le serveur (HTTP {code})."),
None => anyhow!("Serveur injoignable : {e}"),
Some(401) | Some(403) => anyhow!("Incorrect username, password, or code."),
Some(429) => anyhow!("Too many attempts: try again in a minute."),
Some(code) => anyhow!("Sign-in refused by the server (HTTP {code})."),
None => anyhow!("Server unreachable: {e}"),
}
}

Expand Down Expand Up @@ -279,10 +279,10 @@ pub enum SignOutOutcome {
fn export_dir(instance: &str) -> Result<PathBuf> {
let base = match paths::sandbox_dir() {
Some(s) => s.join("exports"),
None => documents_dir().ok_or_else(|| anyhow!("le dossier Documents est introuvable"))?,
None => documents_dir().ok_or_else(|| anyhow!("The Documents folder was not found"))?,
};
let stamp = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs()).unwrap_or(0);
Ok(base.join(format!("Kubuno - modifications non envoyées - {instance} - {stamp}")))
Ok(base.join(format!("Kubuno - unsent changes - {instance} - {stamp}")))
}

/// The user's Documents folder, as the platform knows it (`crate::platform::Folders`).
Expand Down
32 changes: 16 additions & 16 deletions desktop/common/kubuno-desktop-sync/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ pub enum AuthFailure {
impl std::fmt::Display for AuthFailure {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
AuthFailure::Genuine => write!(f, "session rejetée - reconnexion nécessaire"),
AuthFailure::Transient => write!(f, "rafraîchissement temporairement indisponible"),
AuthFailure::Genuine => write!(f, "Session rejected: sign in again"),
AuthFailure::Transient => write!(f, "Token refresh is temporarily unavailable"),
}
}
}
Expand Down Expand Up @@ -468,7 +468,7 @@ impl Api {
pub fn delta(&mut self, cursor: i64, limit: i64) -> Result<Delta> {
let resp = self.get(&format!("/api/v1/drive/sync/delta?cursor={cursor}&limit={limit}"))?;
if !resp.status().is_success() {
bail!("récupération du delta : HTTP {}", resp.status());
bail!("Retrieving changes: HTTP {}", resp.status());
}
Ok(resp.json()?)
}
Expand All @@ -478,7 +478,7 @@ impl Api {
pub fn modules(&mut self) -> Result<serde_json::Value> {
let resp = self.get("/api/v1/modules")?;
if !resp.status().is_success() {
bail!("récupération des modules : HTTP {}", resp.status());
bail!("Retrieving modules: HTTP {}", resp.status());
}
Ok(resp.json()?)
}
Expand Down Expand Up @@ -519,7 +519,7 @@ impl Api {
/// One auto-refresh retry on 401, like the other helpers; transport failures are errors.
pub fn request(&mut self, method: &str, path: &str, headers: &[(String, String)], body: Option<Vec<u8>>) -> Result<RawResponse> {
let url = format!("{}{}", self.base, path);
let method = reqwest::Method::from_bytes(method.as_bytes()).map_err(|e| anyhow::anyhow!("méthode HTTP invalide : {e}"))?;
let method = reqwest::Method::from_bytes(method.as_bytes()).map_err(|e| anyhow::anyhow!("Invalid HTTP method: {e}"))?;
let attempt = |http: &reqwest::blocking::Client, token: &str| {
let mut req = http.request(method.clone(), &url).bearer_auth(token);
for (k, v) in headers {
Expand Down Expand Up @@ -573,7 +573,7 @@ impl Api {
resp
};
if !resp.status().is_success() {
bail!("enregistrement des préférences : HTTP {}", resp.status());
bail!("Saving preferences: HTTP {}", resp.status());
}
Ok(())
}
Expand All @@ -583,7 +583,7 @@ impl Api {
pub fn get_bytes(&mut self, path: &str) -> Result<Vec<u8>> {
let resp = self.get(path)?;
if !resp.status().is_success() {
bail!("téléchargement : HTTP {}", resp.status());
bail!("Download: HTTP {}", resp.status());
}
Ok(resp.bytes()?.to_vec())
}
Expand All @@ -592,7 +592,7 @@ impl Api {
pub fn me(&mut self) -> Result<(User, Privileges)> {
let resp = self.get("/api/v1/me")?;
if !resp.status().is_success() {
bail!("récupération du profil : HTTP {}", resp.status());
bail!("Retrieving profile: HTTP {}", resp.status());
}
let env: MeEnvelope = resp.json()?;
Ok((env.user, env.privileges))
Expand All @@ -607,7 +607,7 @@ impl Api {
}
let resp = self.get("/api/v1/labels")?;
if !resp.status().is_success() {
bail!("étiquettes : HTTP {}", resp.status());
bail!("Labels: HTTP {}", resp.status());
}
Ok(resp.json::<Envelope>()?.labels)
}
Expand All @@ -625,7 +625,7 @@ impl Api {
resp = { let token = self.bearer()?; attempt(&self.http, &token)? };
}
if !resp.status().is_success() {
bail!("création d'étiquette : HTTP {}", resp.status());
bail!("Creating label: HTTP {}", resp.status());
}
Ok(())
}
Expand Down Expand Up @@ -656,7 +656,7 @@ impl Api {
resp = { let token = self.bearer()?; attempt(&self.http, &token)? };
}
if !resp.status().is_success() {
bail!("modification d'étiquette : HTTP {}", resp.status());
bail!("Updating label: HTTP {}", resp.status());
}
Ok(())
}
Expand All @@ -673,7 +673,7 @@ impl Api {
resp = { let token = self.bearer()?; attempt(&self.http, &token)? };
}
if !resp.status().is_success() && resp.status() != reqwest::StatusCode::NOT_FOUND {
bail!("suppression d'étiquette : HTTP {}", resp.status());
bail!("Deleting label: HTTP {}", resp.status());
}
Ok(())
}
Expand Down Expand Up @@ -730,7 +730,7 @@ impl Api {
}
let resp = self.get("/api/v1/admin/settings")?;
if !resp.status().is_success() {
bail!("paramètres : HTTP {}", resp.status());
bail!("Settings: HTTP {}", resp.status());
}
Ok(resp.json::<Env>()?.settings)
}
Expand Down Expand Up @@ -831,7 +831,7 @@ impl Api {
}
let resp = self.get("/api/v1/admin/org-units")?;
if !resp.status().is_success() {
bail!("unités : HTTP {}", resp.status());
bail!("Organisational units: HTTP {}", resp.status());
}
Ok(resp.json::<Env>()?.org_units)
}
Expand Down Expand Up @@ -879,7 +879,7 @@ impl Api {
pub fn download(&mut self, file_id: &str) -> Result<Vec<u8>> {
let resp = self.get(&format!("/api/v1/drive/{file_id}/download"))?;
if !resp.status().is_success() {
bail!("téléchargement {file_id} : HTTP {}", resp.status());
bail!("Downloading {file_id}: HTTP {}", resp.status());
}
Ok(resp.bytes()?.to_vec())
}
Expand Down Expand Up @@ -980,7 +980,7 @@ impl Api {
resp = { let token = self.bearer()?; attempt(&self.http, &token)? };
}
if !resp.status().is_success() {
bail!("création dossier '{name}' : HTTP {}", resp.status());
bail!("Creating folder '{name}': HTTP {}", resp.status());
}
let v: serde_json::Value = resp.json()?;
let f = &v["folder"];
Expand Down
20 changes: 10 additions & 10 deletions desktop/common/kubuno-desktop-sync/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,16 @@ where
if p.conflicts > 0 {
on_event(id, SyncEvent {
kind: "conflict".into(),
title: "Conflit de synchronisation".into(),
body: format!("{} fichier(s) en conflit - une copie a été conservée.", p.conflicts),
title: "Sync conflict".into(),
body: format!("{} conflicting files: a copy was kept.", p.conflicts),
});
}
let sent = p.uploaded + p.modified + p.deleted;
if sent > 0 {
on_event(id, SyncEvent {
kind: "synced".into(),
title: "Modifications envoyées".into(),
body: format!("{} créé(s), {} modifié(s), {} supprimé(s).", p.uploaded, p.modified, p.deleted),
title: "Changes uploaded".into(),
body: format!("{} created, {} modified, {} deleted.", p.uploaded, p.modified, p.deleted),
});
}
}
Expand All @@ -194,7 +194,7 @@ where
eprintln!(" push : {e}");
cycle_error = Some(SyncEvent {
kind: "error".into(),
title: "Erreur de synchronisation".into(),
title: "Sync error".into(),
body: e.to_string(),
});
}
Expand All @@ -207,8 +207,8 @@ where
);
on_event(id, SyncEvent {
kind: "synced".into(),
title: "Fichiers reçus".into(),
body: format!("{} téléchargé(s), {} dossier(s), {} supprimé(s).", s.downloaded, s.folders, s.deleted),
title: "Files received".into(),
body: format!("{} downloaded, {} folders, {} deleted.", s.downloaded, s.folders, s.deleted),
});
}
Ok(_) => {}
Expand All @@ -217,7 +217,7 @@ where
eprintln!(" pull : {e}");
cycle_error = Some(SyncEvent {
kind: "error".into(),
title: "Erreur de synchronisation".into(),
title: "Sync error".into(),
body: e.to_string(),
});
}
Expand Down Expand Up @@ -257,8 +257,8 @@ where
tracing::warn!(instance = id, "session expired: file sync paused until the account signs in again");
on_event(id, SyncEvent {
kind: "expired".into(),
title: "Session expirée".into(),
body: "La synchronisation est en pause : reconnectez-vous. Vos fichiers locaux sont conservés.".into(),
title: "Session expired".into(),
body: "Sync is paused: sign in again. Your local files are kept.".into(),
});
}
false
Expand Down
Loading