Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

fix(config-sync): recover WebDAV setup from nested directories and stale credentials

vastsa0a6d9d145576
diff --git a/apps/desktop/src/components/settings/ConfigSyncError.tsx b/apps/desktop/src/components/settings/ConfigSyncError.tsx
new file mode 100644
index 000000000..07ed5c46b
--- /dev/null
+++ b/apps/desktop/src/components/settings/ConfigSyncError.tsx
@@ -0,0 +1,16 @@
+import { useTranslation } from "react-i18next";
+import { configSyncErrorKind } from "../../features/settings/config-sync-error";
+
+export function ConfigSyncError({ message }: { message: string }) {
+ const { t } = useTranslation();
+ return (
+ <div className="settings-config-sync-message error" role="alert">
+ <strong>{t("settings.configSync.errorTitle")}</strong>
+ <p>{t(`settings.configSync.errors.${configSyncErrorKind(message)}`)}</p>
+ <details>
+ <summary>{t("settings.configSync.errorDetails")}</summary>
+ <pre>{message}</pre>
+ </details>
+ </div>
+ );
+}
diff --git a/apps/desktop/src/components/settings/ConfigSyncPage.tsx b/apps/desktop/src/components/settings/ConfigSyncPage.tsx
index 809d1b286..520721b55 100644
--- a/apps/desktop/src/components/settings/ConfigSyncPage.tsx
+++ b/apps/desktop/src/components/settings/ConfigSyncPage.tsx
@@ -14,8 +14,14 @@ import { Badge, Button, Field, Input, PasswordInput, cx } from "../ui";
import { IconCloudDown, IconRefresh, IconShield, IconTrash } from "../icons";
import { SettingsCard, SettingsRow } from "../../features/settings/primitives";
import { configSyncProgressView } from "../../features/settings/config-sync-progress";
+import { ConfigSyncError } from "./ConfigSyncError";
import { SettingsMenuSelect } from "./SettingsMenuSelect";
+function formatStamp(value: string): string {
+ const date = new Date(value);
+ return Number.isNaN(date.getTime()) ? value : date.toLocaleString();
+}
+
const CATEGORIES: Array<{
id: Exclude<ConfigSyncCategory, "credentials" | "memory">;
label: string;
@@ -106,7 +112,12 @@ export function ConfigSyncPage() {
directory: next.directory ?? current.directory,
deviceLabel: next.deviceLabel ?? current.deviceLabel,
}));
- setSelection((current) => ({ ...current, ...next.categories }));
+ setSelection((current) => ({
+ ...current,
+ ...next.categories,
+ credentials: next.includeSecrets,
+ memory: next.includeMemory,
+ }));
if (!next.locked) {
try {
setHistory(await api.configSyncListHistory());
@@ -373,6 +384,10 @@ export function ConfigSyncPage() {
const configured = state?.configured === true;
const locked = state?.locked === true;
const categories = selection;
+ const vaultPasswordReady =
+ form.backupPassword.length === 0
+ ? configured && !locked
+ : form.backupPassword.length >= 8;
// The report only exists for a sync this page started: an automatic run stays
// quiet, and no report outlives the request that produced it. Enabling a
// vault runs the same full sync as "sync now", so both operations are watched.
@@ -383,6 +398,9 @@ export function ConfigSyncPage() {
return (
<div className="settings-stack settings-config-sync">
+ {error || state?.lastError ? (
+ <ConfigSyncError message={error ?? state?.lastError ?? ""} />
+ ) : null}
<SettingsCard
title={t("settings.configSync.connectionTitle")}
description={t("settings.configSync.connectionDescription")}
@@ -495,7 +513,7 @@ export function ConfigSyncPage() {
<Button
variant="primary"
onClick={() => void run("configure")}
- disabled={busy !== null || !form.endpoint || !form.backupPassword}
+ disabled={busy !== null || !form.endpoint || !vaultPasswordReady}
>
<IconCloudDown size={14} />
{configured ? t("settings.configSync.save") : t("settings.configSync.enable")}
@@ -579,18 +597,14 @@ export function ConfigSyncPage() {
detail={
state?.lastSuccessAt
? t("settings.configSync.lastSuccess", {
- date: state.lastSuccessAt,
+ date: formatStamp(state.lastSuccessAt),
})
: undefined
}
>
<Badge tone={statusTone(state.status)}>{statusLabel}</Badge>
</SettingsRow>
- {state?.lastError ? (
- <SettingsRow title={t("settings.configSync.lastError")}>
- <span className="settings-config-sync-error">{state.lastError}</span>
- </SettingsRow>
- ) : null}
+
{locked ? (
<SettingsRow
title={t("settings.configSync.unlockTitle")}
@@ -795,6 +809,16 @@ export function ConfigSyncPage() {
count: state.preview.mappingRequired,
})}
</span>
+ <span>
+ {t("settings.configSync.previewPending", {
+ count: state.preview.pendingActivation,
+ })}
+ </span>
+ <span>
+ {t("settings.configSync.previewConflicts", {
+ count: state.preview.conflicts,
+ })}
+ </span>
</div>
</SettingsCard>
) : null}
@@ -846,7 +870,8 @@ export function ConfigSyncPage() {
: entry.revisionId}
</div>
<div className="settings-config-sync-approval-meta">
- {entry.createdAt} · {entry.entityCount} {t("settings.configSync.historyItems")}
+ {formatStamp(entry.createdAt)} · {entry.entityCount}{" "}
+ {t("settings.configSync.historyItems")}
</div>
</div>
<Button
diff --git a/apps/desktop/src/features/settings/config-sync-error.ts b/apps/desktop/src/features/settings/config-sync-error.ts
new file mode 100644
index 000000000..8df52dd6f
--- /dev/null
+++ b/apps/desktop/src/features/settings/config-sync-error.ts
@@ -0,0 +1,27 @@
+const ERROR_KINDS = {
+ AUTH: "auth",
+ PERMISSION: "permission",
+ NOT_FOUND: "notFound",
+ CONFLICT: "conflict",
+ QUOTA: "quota",
+ RATE_LIMIT: "rateLimit",
+ SERVER: "server",
+ TIMEOUT: "network",
+ NETWORK: "network",
+ REDIRECT: "redirect",
+ UNSUPPORTED: "unsupported",
+ LOCKED: "locked",
+ INVALID: "invalid",
+ DECRYPT: "password",
+ PASSWORD: "password",
+ CRYPTO: "password",
+ LIMIT_EXCEEDED: "limit",
+} as const;
+
+/** Map a host error to a stable recovery message. Server text stays opt-in. */
+export function configSyncErrorKind(message: string): string {
+ const code = /CONFIG_SYNC_([A-Z0-9_]+)/.exec(message)?.[1];
+ return code && Object.hasOwn(ERROR_KINDS, code)
+ ? ERROR_KINDS[code as keyof typeof ERROR_KINDS]
+ : "unknown";
+}
diff --git a/apps/desktop/test/config-sync-error.test.mjs b/apps/desktop/test/config-sync-error.test.mjs
new file mode 100644
index 000000000..4d290936e
--- /dev/null
+++ b/apps/desktop/test/config-sync-error.test.mjs
@@ -0,0 +1,29 @@
+import assert from "node:assert/strict";
+import { register } from "node:module";
+import { dirname, join } from "node:path";
+import test from "node:test";
+import { fileURLToPath, pathToFileURL } from "node:url";
+
+const here = dirname(fileURLToPath(import.meta.url));
+register(pathToFileURL(join(here, "helpers/ts-import-hooks.mjs")));
+const { configSyncErrorKind } = await import(
+ "../src/features/settings/config-sync-error.ts"
+);
+
+test("cloud sync errors map to a recovery action", () => {
+ assert.equal(
+ configSyncErrorKind(
+ "CONFIG_SYNC_AUTH: enter the WebDAV app password for this server and account",
+ ),
+ "auth",
+ );
+ assert.equal(
+ configSyncErrorKind("CONFIG_SYNC_REDIRECT: use the direct WebDAV endpoint"),
+ "redirect",
+ );
+ assert.equal(
+ configSyncErrorKind("CONFIG_SYNC_CRYPTO: wrong vault password"),
+ "password",
+ );
+ assert.equal(configSyncErrorKind("socket hang up"), "unknown");
+});
diff --git a/crates/host-core/src/config_sync/engine.rs b/crates/host-core/src/config_sync/engine.rs
index d11909529..24fb22443 100644
--- a/crates/host-core/src/config_sync/engine.rs
+++ b/crates/host-core/src/config_sync/engine.rs
@@ -867,7 +867,7 @@ fn config_from_input(
.or_else(|| existing.map(|value| value.automatic_sync))
.unwrap_or(true),
enabled: true,
- paused: false,
+ paused: existing.is_some_and(|value| value.paused),
vault_id: header.vault_id.clone(),
vault_header: header,
last_run_at: existing.and_then(|value| value.last_run_at.clone()),
@@ -907,11 +907,15 @@ fn parse_remote_mode(value: &str) -> Result<RemoteMode> {
fn mark_error(config: &mut StoredConfig, error: &anyhow::Error) {
let message = error.to_string();
- config.last_error_code = if message.starts_with("CONFIG_SYNC_UNSUPPORTED") {
+ config.last_error_code = if message.starts_with("CONFIG_SYNC_UNSUPPORTED")
+ || message.starts_with("CONFIG_SYNC_REDIRECT")
+ {
Some("UNSUPPORTED_SERVER".into())
} else if message.starts_with("CONFIG_SYNC_CONFLICT") {
Some("CONFLICT".into())
- } else if message.starts_with("CONFIG_SYNC_CRYPTO")
+ } else if message.starts_with("CONFIG_SYNC_AUTH")
+ || message.starts_with("CONFIG_SYNC_PERMISSION")
+ || message.starts_with("CONFIG_SYNC_CRYPTO")
|| message.contains("401 Unauthorized")
|| message.contains("403 Forbidden")
|| message.contains("authentication")
diff --git a/crates/host-core/src/config_sync/handlers.rs b/crates/host-core/src/config_sync/handlers.rs
index 21a4428ee..059beedc8 100644
--- a/crates/host-core/src/config_sync/handlers.rs
+++ b/crates/host-core/src/config_sync/handlers.rs
@@ -59,13 +59,13 @@ pub(crate) async fn test(state: Arc<Mutex<AppState>>, params: Value) -> Result<V
.transpose()?
.or_else(|| existing.as_ref().map(|value| value.remote_mode))
.unwrap_or_default();
- let stored_password = st.secrets.get(WEBDAV_SECRET_REF)?;
- let password = params
- .get("appPassword")
- .and_then(Value::as_str)
- .map(str::to_string)
- .or(stored_password)
- .unwrap_or_default();
+ let password = connection_password(
+ &st,
+ existing.as_ref(),
+ endpoint.trim(),
+ username.trim(),
+ &params,
+ )?;
let vault_id = Uuid::new_v4().to_string();
let header = create_vault("temporary-test-password", &vault_id)?.0;
(
@@ -123,44 +123,45 @@ pub(crate) async fn configure(state: Arc<Mutex<AppState>>, params: Value) -> Res
let backup_password = params
.get("backupPassword")
.and_then(Value::as_str)
- .ok_or_else(|| anyhow!("CONFIG_SYNC_INVALID: backup password is required"))?;
- if backup_password.len() < 8 {
+ .unwrap_or("")
+ .trim();
+ if !backup_password.is_empty() && backup_password.len() < 8 {
bail!("CONFIG_SYNC_INVALID: backup password must be at least 8 characters");
}
let (mut config, mut key, transport_password, had_existing) = {
let st = state.lock().await;
let existing = load_config(&st)?;
- let vault_id = existing
- .as_ref()
- .map(|value| value.vault_id.clone())
- .unwrap_or_else(|| Uuid::new_v4().to_string());
- let (header, key) = if let Some(existing) = existing.as_ref() {
- (
- existing.vault_header.clone(),
- unlock_vault(&existing.vault_header, backup_password)?,
- )
+ let (header, key, had_existing) = if backup_password.is_empty() {
+ let saved = existing.as_ref().ok_or_else(|| {
+ anyhow!("CONFIG_SYNC_LOCKED: enter the vault password to set up sync")
+ })?;
+ let key = local_vault_key(&st, saved)?
+ .ok_or_else(|| anyhow!("CONFIG_SYNC_LOCKED: backup vault is locked"))?;
+ (saved.vault_header.clone(), key, true)
} else {
- create_vault(backup_password, &vault_id)?
+ let vault_id = existing
+ .as_ref()
+ .map(|value| value.vault_id.clone())
+ .unwrap_or_else(|| Uuid::new_v4().to_string());
+ let (header, key) = if let Some(saved) = existing.as_ref() {
+ (
+ saved.vault_header.clone(),
+ unlock_vault(&saved.vault_header, backup_password)?,
+ )
+ } else {
+ create_vault(backup_password, &vault_id)?
+ };
+ (header, key, existing.is_some())
};
let config = config_from_input(existing.as_ref(), &params, header)?;
- let stored_password = if existing
- .as_ref()
- .is_some_and(|value| value.username == config.username)
- {
- st.secrets.get(WEBDAV_SECRET_REF)?
- } else {
- None
- };
- let transport_password = params
- .get("appPassword")
- .and_then(Value::as_str)
- .map(str::to_string)
- .or(stored_password)
- .unwrap_or_default();
- if !config.username.is_empty() && transport_password.is_empty() {
- bail!("CONFIG_SYNC_INVALID: WebDAV app password is required");
- }
- (config, key, transport_password, existing.is_some())
+ let transport_password = connection_password(
+ &st,
+ existing.as_ref(),
+ &config.endpoint,
+ &config.username,
+ &params,
+ )?;
+ (config, key, transport_password, had_existing)
};
let app_password = params
.get("appPassword")
@@ -191,9 +192,7 @@ pub(crate) async fn configure(state: Arc<Mutex<AppState>>, params: Value) -> Res
if had_existing && config.vault_id != remote.vault_id {
bail!("CONFIG_SYNC_CONFLICT: selected WebDAV directory belongs to another vault");
}
- key = unlock_vault(&remote, backup_password)?;
- config.vault_id = remote.vault_id.clone();
- config.vault_header = remote;
+ adopt_remote_vault(&mut key, &mut config, remote, backup_password)?;
} else {
if config.remote_mode == RemoteMode::AppendOnly {
if had_existing {
@@ -213,9 +212,7 @@ pub(crate) async fn configure(state: Arc<Mutex<AppState>>, params: Value) -> Res
bail!("CONFIG_SYNC_REMOTE: vault header disappeared during initialization");
};
let remote: VaultHeader = serde_json::from_slice(&bytes)?;
- key = unlock_vault(&remote, backup_password)?;
- config.vault_id = remote.vault_id.clone();
- config.vault_header = remote;
+ adopt_remote_vault(&mut key, &mut config, remote, backup_password)?;
}
}
if config.remote_mode == RemoteMode::AppendOnly {
@@ -226,9 +223,7 @@ pub(crate) async fn configure(state: Arc<Mutex<AppState>>, params: Value) -> Res
if had_existing && config.vault_id != remote.vault_id {
bail!("CONFIG_SYNC_CONFLICT: selected WebDAV directory belongs to another vault");
}
- key = unlock_vault(&remote, backup_password)?;
- config.vault_id = remote.vault_id.clone();
- config.vault_header = remote;
+ adopt_remote_vault(&mut key, &mut config, remote, backup_password)?;
}
}
ensure_remote_collections(&transport, &config).await?;
@@ -522,3 +517,105 @@ pub(crate) async fn disconnect(state: Arc<Mutex<AppState>>) -> Result<Value> {
}
public_state(&mut st)
}
+
+/// A saved WebDAV password belongs to one endpoint and account. Changing either
+/// must not send the previous server's secret.
+fn connection_password(
+ st: &AppState,
+ existing: Option<&StoredConfig>,
+ endpoint: &str,
+ username: &str,
+ params: &Value,
+) -> Result<String> {
+ if username.is_empty() {
+ return Ok(String::new());
+ }
+ let explicit = params.get("appPassword").and_then(Value::as_str);
+ let password = match explicit {
+ Some(value) => Some(value.to_string()),
+ None if existing
+ .is_some_and(|saved| saved.endpoint == endpoint && saved.username == username) =>
+ {
+ st.secrets.get(WEBDAV_SECRET_REF)?
+ }
+ None => None,
+ };
+ password.filter(|value| !value.is_empty()).ok_or_else(|| {
+ anyhow!("CONFIG_SYNC_AUTH: enter the WebDAV app password for this server and account")
+ })
+}
+
+fn adopt_remote_vault(
+ key: &mut VaultKey,
+ config: &mut StoredConfig,
+ remote: VaultHeader,
+ password: &str,
+) -> Result<()> {
+ if password.is_empty() {
+ if config.vault_id != remote.vault_id {
+ bail!("CONFIG_SYNC_LOCKED: enter the vault password to open this backup");
+ }
+ config.vault_header = remote;
+ return Ok(());
+ }
+ *key = unlock_vault(&remote, password)?;
+ config.vault_id = remote.vault_id.clone();
+ config.vault_header = remote;
+ Ok(())
+}
+
+#[cfg(test)]
+mod credential_tests {
+ use super::*;
+
+ #[test]
+ fn stored_password_stays_on_its_server_and_pause_survives_a_resave() -> Result<()> {
+ let dir = tempfile::tempdir()?;
+ let state = AppState::open(dir.path())?;
+ state.secrets.set(WEBDAV_SECRET_REF, "original-secret")?;
+ let (header, _) = create_vault("backup-password", "test-vault")?;
+ let mut config = config_from_input(
+ None,
+ &json!({
+ "endpoint": "https://original.example/dav/",
+ "username": "alice",
+ "deviceLabel": "test"
+ }),
+ header.clone(),
+ )?;
+ config.paused = true;
+ assert_eq!(
+ connection_password(&state, Some(&config), &config.endpoint, "alice", &json!({}))?,
+ "original-secret"
+ );
+ let resent = config_from_input(
+ Some(&config),
+ &json!({
+ "endpoint": config.endpoint,
+ "username": "alice",
+ "deviceLabel": "test"
+ }),
+ header,
+ )?;
+ assert!(resent.paused);
+ for (endpoint, username) in [
+ ("https://other.example/dav/", "alice"),
+ ("https://original.example/dav/", "bob"),
+ ] {
+ let error = connection_password(&state, Some(&config), endpoint, username, &json!({}))
+ .unwrap_err();
+ assert!(error.to_string().starts_with("CONFIG_SYNC_AUTH:"));
+ }
+ assert_eq!(
+ connection_password(
+ &state,
+ Some(&config),
+ "https://other.example/",
+ "",
+ &json!({})
+ )?,
+ ""
+ );
+ Ok(())
+ }
+}
diff --git a/crates/host-core/src/config_sync/transport.rs b/crates/host-core/src/config_sync/transport.rs
index b61396471..02af4b231 100644
--- a/crates/host-core/src/config_sync/transport.rs
+++ b/crates/host-core/src/config_sync/transport.rs
@@ -1,5 +1,5 @@
use anyhow::{bail, Context, Result};
-use reqwest::header::{HeaderMap, HeaderValue, ETAG, IF_MATCH, IF_NONE_MATCH, LOCATION};
+use reqwest::header::{HeaderMap, HeaderValue, ETAG, IF_MATCH, IF_NONE_MATCH};
use reqwest::{Client, Method, StatusCode, Url};
use std::net::IpAddr;
use uuid::Uuid;
@@ -174,7 +174,17 @@ impl WebDavTransport {
body: Option<Vec<u8>>,
headers: HeaderMap,
) -> Result<reqwest::Response> {
- let url = self.url(relative)?;
+ self.send_url(method, self.url(relative)?, body, headers)
+ .await
+ }
+
+ async fn send_url(
+ &self,
+ method: Method,
+ url: Url,
+ body: Option<Vec<u8>>,
+ headers: HeaderMap,
+ ) -> Result<reqwest::Response> {
let mut request = self.client.request(method, url).headers(headers);
if let Some(body) = body {
request = request.body(body);
@@ -183,36 +193,52 @@ impl WebDavTransport {
.authenticated(request)
.send()
.await
- .context("WebDAV request failed")?;
- if response.headers().get(LOCATION).is_some() || response.status().is_redirection() {
- bail!("CONFIG_SYNC_SECURITY: WebDAV redirects are not permitted");
+ .map_err(request_error)?;
+ // A 201 often carries Location. Only a 3xx is a redirect, and the
+ // client is built not to follow one.
+ if response.status().is_redirection() {
+ bail!(
+ "CONFIG_SYNC_REDIRECT: use the direct WebDAV endpoint; redirects are not followed"
+ );
}
Ok(response)
}
- /// Create a single collection below the configured vault directory. A
- /// WebDAV server may report 405 when the collection already exists; that
- /// is a successful idempotent result for this helper. We intentionally do
- /// not follow redirects or try to infer a different root.
+ /// Create every missing collection from the selected endpoint down to
+ /// `relative`. A nested remote directory such as `backups/pi` otherwise
+ /// fails because its parent does not exist yet. Ancestors outside the
+ /// endpoint are never created.
pub async fn ensure_collection(&self, relative: &str) -> Result<()> {
- let response = self
- .send(
- Method::from_bytes(b"MKCOL").expect("MKCOL is a valid method"),
- relative,
- None,
- HeaderMap::new(),
- )
- .await?;
- match response.status() {
- status
- if status.is_success()
- || status == StatusCode::METHOD_NOT_ALLOWED
- || status == StatusCode::PRECONDITION_FAILED =>
- {
- Ok(())
+ let target = self.url(relative)?;
+ let base_path = self.base.path().trim_end_matches('/');
+ let suffix = target
+ .path()
+ .trim_end_matches('/')
+ .strip_prefix(base_path)
+ .ok_or_else(|| anyhow::anyhow!("CONFIG_SYNC_INVALID: collection escaped endpoint"))?;
+ let mut path = base_path.to_string();
+ for segment in suffix.split('/').filter(|segment| !segment.is_empty()) {
+ path.push('/');
+ path.push_str(segment);
+ let mut url = self.base.clone();
+ url.set_path(&path);
+ let response = self
+ .send_url(
+ Method::from_bytes(b"MKCOL").expect("MKCOL is a valid method"),
+ url,
+ None,
+ HeaderMap::new(),
+ )
+ .await?;
+ match response.status() {
+ status
+ if status.is_success()
+ || status == StatusCode::METHOD_NOT_ALLOWED
+ || status == StatusCode::PRECONDITION_FAILED => {}
+ status => return Err(status_error("collection create", status)),
}
- status => bail!("CONFIG_SYNC_REMOTE: WebDAV collection create returned {status}"),
}
+ Ok(())
}
async fn limited_bytes(response: reqwest::Response) -> Result<Vec<u8>> {
@@ -224,7 +250,7 @@ impl WebDavTransport {
}
let mut response = response;
let mut result = Vec::new();
- while let Some(chunk) = response.chunk().await.context("read WebDAV response")? {
+ while let Some(chunk) = response.chunk().await.map_err(request_error)? {
if result.len().saturating_add(chunk.len()) > MAX_REMOTE_OBJECT_BYTES {
bail!("CONFIG_SYNC_LIMIT_EXCEEDED: remote object is too large");
}
@@ -243,10 +269,7 @@ impl WebDavTransport {
return Ok(None);
}
if !response.status().is_success() {
- bail!(
- "CONFIG_SYNC_REMOTE: WebDAV GET returned {}",
- response.status()
- );
+ return Err(status_error("GET", response.status()));
}
let etag = strong_etag(response.headers());
Ok(Some((Self::limited_bytes(response).await?, etag)))
@@ -257,10 +280,7 @@ impl WebDavTransport {
.send(Method::PUT, relative, Some(body), HeaderMap::new())
.await?;
if !response.status().is_success() {
- bail!(
- "CONFIG_SYNC_REMOTE: WebDAV unconditional write returned {}",
- response.status()
- );
+ return Err(status_error("unconditional write", response.status()));
}
Ok(())
}
@@ -294,10 +314,7 @@ impl WebDavTransport {
bail!("CONFIG_SYNC_UNSUPPORTED: WebDAV directory listing is not supported");
}
if response.status().as_u16() != 207 && !response.status().is_success() {
- bail!(
- "CONFIG_SYNC_REMOTE: WebDAV directory listing returned {}",
- response.status()
- );
+ return Err(status_error("directory listing", response.status()));
}
let body = Self::limited_bytes(response).await?;
let text = String::from_utf8(body).context("decode WebDAV directory listing")?;
@@ -351,7 +368,7 @@ impl WebDavTransport {
match response.status() {
StatusCode::PRECONDITION_FAILED => Ok(false),
status if status.is_success() => Ok(true),
- status => bail!("CONFIG_SYNC_REMOTE: WebDAV create returned {status}"),
+ status => return Err(status_error("create", status)),
}
}
@@ -367,7 +384,7 @@ impl WebDavTransport {
match response.status() {
StatusCode::PRECONDITION_FAILED => Ok(false),
status if status.is_success() => Ok(true),
- status => bail!("CONFIG_SYNC_REMOTE: WebDAV conditional write returned {status}"),
+ status => return Err(status_error("conditional write", status)),
}
}
@@ -376,10 +393,7 @@ impl WebDavTransport {
.send(Method::DELETE, relative, None, HeaderMap::new())
.await?;
if response.status() != StatusCode::NOT_FOUND && !response.status().is_success() {
- bail!(
- "CONFIG_SYNC_REMOTE: WebDAV delete returned {}",
- response.status()
- );
+ return Err(status_error("delete", response.status()));
}
Ok(())
}
@@ -473,9 +487,41 @@ fn compatible_missing_object_status(value: Option<u16>) -> Option<StatusCode> {
(value == Some(StatusCode::BAD_GATEWAY.as_u16())).then_some(StatusCode::BAD_GATEWAY)
}
+fn request_error(error: reqwest::Error) -> anyhow::Error {
+ if error.is_timeout() {
+ anyhow::anyhow!("CONFIG_SYNC_TIMEOUT: WebDAV request timed out")
+ } else {
+ anyhow::anyhow!(
+ "CONFIG_SYNC_NETWORK: WebDAV connection failed; check the network and TLS certificate"
+ )
+ }
+}
+
+fn status_error(operation: &str, status: StatusCode) -> anyhow::Error {
+ let code = match status.as_u16() {
+ 401 => "AUTH",
+ 403 => "PERMISSION",
+ 404 => "NOT_FOUND",
+ 409 | 423 => "CONFLICT",
+ 413 | 507 => "QUOTA",
+ 429 => "RATE_LIMIT",
+ 500..=599 => "SERVER",
+ _ => "REMOTE",
+ };
+ anyhow::anyhow!("CONFIG_SYNC_{code}: WebDAV {operation} returned {status}")
+}
+
pub fn remote_error_is_offline(error: &anyhow::Error) -> bool {
let text = error.to_string().to_lowercase();
- text.contains("request failed")
+ [
+ "config_sync_network:",
+ "config_sync_timeout:",
+ "config_sync_server:",
+ "config_sync_rate_limit:",
+ ]
+ .iter()
+ .any(|prefix| text.starts_with(prefix))
+ || text.contains("request failed")
|| text.contains("timed out")
|| text.contains("dns")
|| text.contains("connect")
@@ -498,6 +544,7 @@ pub(crate) mod tests {
weak_etag: bool,
missing_status: Option<u16>,
ignore_preconditions: bool,
+ require_parent: bool,
}
async fn read_request(stream: &mut TcpStream) -> Option<(String, String, HeaderMap, Vec<u8>)> {
@@ -592,7 +639,20 @@ pub(crate) mod tests {
let mut state = state.lock().expect("fixture state");
match method.as_str() {
"MKCOL" => {
- if state.collections.insert(path) {
+ let normalized = path.trim_end_matches('/').to_string();
+ if state.require_parent {
+ let parent = normalized
+ .rsplit_once('/')
+ .map(|(parent, _)| parent)
+ .unwrap_or("");
+ if !parent.is_empty() && !state.collections.contains(parent) {
+ (409, Vec::new(), None)
+ } else if state.collections.insert(normalized) {
+ (201, Vec::new(), None)
+ } else {
+ (405, Vec::new(), None)
+ }
+ } else if state.collections.insert(path) {
(201, Vec::new(), None)
} else {
(405, Vec::new(), None)
@@ -692,17 +752,18 @@ pub(crate) mod tests {
}
pub(crate) async fn fixture(weak_etag: bool) -> Fixture {
- fixture_with_options(weak_etag, None, false).await
+ fixture_with_options(weak_etag, None, false, false).await
}
pub(crate) async fn fixture_ignoring_preconditions() -> Fixture {
- fixture_with_options(false, None, true).await
+ fixture_with_options(false, None, true, false).await
}
async fn fixture_with_options(
weak_etag: bool,
missing_status: Option<u16>,
ignore_preconditions: bool,
+ require_parent: bool,
) -> Fixture {
let listener = TcpListener::bind("127.0.0.1:0")
.await
@@ -712,6 +773,7 @@ pub(crate) mod tests {
weak_etag,
missing_status,
ignore_preconditions,
+ require_parent,
..FixtureState::default()
}));
let task = tokio::spawn(async move {
@@ -773,6 +835,24 @@ pub(crate) mod tests {
assert_eq!(strong_etag(&headers).as_deref(), Some("\"strong\""));
}
+ #[tokio::test]
+ async fn nested_directory_creates_missing_ancestors() {
+ let fixture = fixture_with_options(false, None, false, true).await;
+ let transport = WebDavTransport::new(&WebDavConfig {
+ endpoint: fixture.endpoint.clone(),
+ username: String::new(),
+ password: String::new(),
+ directory: "backups/pi/settings".into(),
+ allow_insecure_http: true,
+ missing_object_status: None,
+ })
+ .expect("transport");
+ transport
+ .ensure_collection("vault")
+ .await
+ .expect("nested collections");
+ }
+
#[tokio::test]
async fn local_fixture_proves_conditional_writes() {
let fixture = fixture(false).await;
@@ -785,7 +865,7 @@ pub(crate) mod tests {
#[tokio::test]
async fn probe_rejects_servers_that_ignore_conditional_headers() {
- let fixture = fixture_with_options(false, None, true).await;
+ let fixture = fixture_with_options(false, None, true, false).await;
let transport = fixture_transport(&fixture.endpoint);
let probe = transport.probe().await.expect("probe");
assert!(!probe.conditional_writes);
@@ -814,7 +894,7 @@ pub(crate) mod tests {
#[tokio::test]
async fn probe_records_bad_gateway_as_the_missing_object_status() {
- let fixture = fixture_with_options(false, Some(502), false).await;
+ let fixture = fixture_with_options(false, Some(502), false, false).await;
let transport = fixture_transport(&fixture.endpoint);
let probe = transport.probe().await.expect("probe");
assert!(probe.conditional_writes);
diff --git a/docs/spec/03-runtime/22-config-sync.md b/docs/spec/03-runtime/22-config-sync.md
index d4d1abb0a..51406fb28 100644
--- a/docs/spec/03-runtime/22-config-sync.md
+++ b/docs/spec/03-runtime/22-config-sync.md
@@ -120,9 +120,15 @@ HTTPS is required by default. The settings page may expose an explicit
LAN-risk acknowledgement for HTTP, but Host accepts that exception only for
localhost, `.local` names, or private/link-local IP addresses. Public HTTP
endpoints remain rejected. The warning explains that HTTP does not protect
-WebDAV credentials in transit. Redirects, endpoint userinfo, path traversal,
-unsafe remote names, oversized objects, weak ETags, and unbounded KDF
-parameters are rejected.
+WebDAV credentials in transit. Redirect responses are rejected and are not
+followed; a success response may still carry a Location header. Endpoint
+userinfo, path traversal, unsafe remote names, oversized objects, weak ETags,
+and unbounded KDF parameters are rejected. Missing collections under the
+selected endpoint, including a nested remote directory, are created in order.
+A stored WebDAV app password is reused only for the same endpoint and account.
+Saving sync settings keeps a pause that was already set. Host errors use stable
+`CONFIG_SYNC_*` codes so the settings page can show a recovery action without
+treating the server text as the only message.
## 4. Merge and activation
diff --git a/docs/zh-CN/spec/03-runtime/22-config-sync.md b/docs/zh-CN/spec/03-runtime/22-config-sync.md
index e4821665f..73172c49e 100644
--- a/docs/zh-CN/spec/03-runtime/22-config-sync.md
+++ b/docs/zh-CN/spec/03-runtime/22-config-sync.md
@@ -55,7 +55,7 @@ Host-core 持有 vault key、WebDAV 传输、修订状态、合并基线、待
`404 Not Found`。能力探测会在删除临时对象后记录所选 endpoint 的这一行为;后续读取只会将该
endpoint 已观测到的状态视为对象不存在,其他非成功响应仍然报错。这不会放宽严格模式的条件写要求:忽略 `If-None-Match` 或 `If-Match` 的服务器,只有在用户选择追加式兼容模式且目录列表探测成功后,才支持双向同步。
-默认要求 HTTPS。设置页可显式确认 LAN HTTP 风险,但 Host 仅接受 localhost、`.local` 或私有/链路本地 IP;公网 HTTP 仍会被拒绝。redirect、endpoint userinfo、路径穿越、不安全远端名称、过大对象、weak ETag 和无界 KDF 参数都会被拒绝。
+默认要求 HTTPS。设置页可显式确认 LAN HTTP 风险,但 Host 仅接受 localhost、`.local` 或私有/链路本地 IP;公网 HTTP 仍会被拒绝。3xx 重定向会被拒绝且不会跟随;成功响应仍可以带 Location。endpoint userinfo、路径穿越、不安全远端名称、过大对象、weak ETag 和无界 KDF 参数都会被拒绝。所选端点下缺失的集合(含嵌套远程目录)会按顺序创建。已保存的 WebDAV 应用密码只对同一端点和账户复用。再次保存同步设置会保留已有的暂停状态。Host 错误使用稳定的 `CONFIG_SYNC_*` 代码,设置页据此给出恢复说明。
## 4. 合并与激活
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 464f12acb..bf39f3bb5 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -690,6 +690,29 @@ sklm: {
connectionTitle: "WebDAV cloud sync",
connectionDescription:
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
+ errorTitle: "Sync needs attention",
+ errorDetails: "Technical details",
+ backupPasswordOptional: "Leave this blank to keep the current vault password.",
+ passwordTooShort: "The backup password must be at least 8 characters.",
+ previewPending: "Pending activation: {{count}}",
+ previewConflicts: "Conflicts: {{count}}",
+ errors: {
+ auth: "Check the WebDAV username and app password, then test the connection again.",
+ permission: "This account cannot read and write the selected WebDAV directory.",
+ notFound: "Check the WebDAV URL and directory. Use the WebDAV endpoint, not the website home page.",
+ conflict: "Another device updated this backup. Sync again to merge, then review anything waiting for approval.",
+ quota: "The remote storage is full. Free space or raise the quota, then retry.",
+ rateLimit: "The server is rate limiting requests. Retry the sync in a moment.",
+ server: "The WebDAV server is temporarily unavailable.",
+ network: "Check the network, address, and certificate, then retry.",
+ redirect: "The server redirected the request. Use the direct WebDAV URL.",
+ unsupported: "This server does not support the required WebDAV operations. Try compatibility mode.",
+ locked: "Enter the backup password to unlock sync.",
+ invalid: "Check the server URL, directory, and required passwords.",
+ password: "Use the backup password created for this vault, not the WebDAV password.",
+ limit: "The backup is larger than the supported size. Sync fewer categories and retry.",
+ unknown: "Sync did not finish. Check the connection and retry. Open the technical details if it keeps failing.",
+ },
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
remoteMode: "Server-Kompatibilität",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index dc3157348..21f620a1a 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -937,6 +937,29 @@ sklm: {
connectionTitle: "WebDAV cloud sync",
connectionDescription:
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
+ errorTitle: "Sync needs attention",
+ errorDetails: "Technical details",
+ backupPasswordOptional: "Leave this blank to keep the current vault password.",
+ passwordTooShort: "The backup password must be at least 8 characters.",
+ previewPending: "Pending activation: {{count}}",
+ previewConflicts: "Conflicts: {{count}}",
+ errors: {
+ auth: "Check the WebDAV username and app password, then test the connection again.",
+ permission: "This account cannot read and write the selected WebDAV directory.",
+ notFound: "Check the WebDAV URL and directory. Use the WebDAV endpoint, not the website home page.",
+ conflict: "Another device updated this backup. Sync again to merge, then review anything waiting for approval.",
+ quota: "The remote storage is full. Free space or raise the quota, then retry.",
+ rateLimit: "The server is rate limiting requests. Retry the sync in a moment.",
+ server: "The WebDAV server is temporarily unavailable.",
+ network: "Check the network, address, and certificate, then retry.",
+ redirect: "The server redirected the request. Use the direct WebDAV URL.",
+ unsupported: "This server does not support the required WebDAV operations. Try compatibility mode.",
+ locked: "Enter the backup password to unlock sync.",
+ invalid: "Check the server URL, directory, and required passwords.",
+ password: "Use the backup password created for this vault, not the WebDAV password.",
+ limit: "The backup is larger than the supported size. Sync fewer categories and retry.",
+ unknown: "Sync did not finish. Check the connection and retry. Open the technical details if it keeps failing.",
+ },
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
remoteMode: "Server compatibility",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 89e9488b3..49f5a1214 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -690,6 +690,29 @@ sklm: {
connectionTitle: "WebDAV cloud sync",
connectionDescription:
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
+ errorTitle: "Sync needs attention",
+ errorDetails: "Technical details",
+ backupPasswordOptional: "Leave this blank to keep the current vault password.",
+ passwordTooShort: "The backup password must be at least 8 characters.",
+ previewPending: "Pending activation: {{count}}",
+ previewConflicts: "Conflicts: {{count}}",
+ errors: {
+ auth: "Check the WebDAV username and app password, then test the connection again.",
+ permission: "This account cannot read and write the selected WebDAV directory.",
+ notFound: "Check the WebDAV URL and directory. Use the WebDAV endpoint, not the website home page.",
+ conflict: "Another device updated this backup. Sync again to merge, then review anything waiting for approval.",
+ quota: "The remote storage is full. Free space or raise the quota, then retry.",
+ rateLimit: "The server is rate limiting requests. Retry the sync in a moment.",
+ server: "The WebDAV server is temporarily unavailable.",
+ network: "Check the network, address, and certificate, then retry.",
+ redirect: "The server redirected the request. Use the direct WebDAV URL.",
+ unsupported: "This server does not support the required WebDAV operations. Try compatibility mode.",
+ locked: "Enter the backup password to unlock sync.",
+ invalid: "Check the server URL, directory, and required passwords.",
+ password: "Use the backup password created for this vault, not the WebDAV password.",
+ limit: "The backup is larger than the supported size. Sync fewer categories and retry.",
+ unknown: "Sync did not finish. Check the connection and retry. Open the technical details if it keeps failing.",
+ },
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
remoteMode: "Compatibilidad del servidor",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index d6e4a326f..c20f0092c 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -690,6 +690,29 @@ sklm: {
connectionTitle: "WebDAV cloud sync",
connectionDescription:
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
+ errorTitle: "Sync needs attention",
+ errorDetails: "Technical details",
+ backupPasswordOptional: "Leave this blank to keep the current vault password.",
+ passwordTooShort: "The backup password must be at least 8 characters.",
+ previewPending: "Pending activation: {{count}}",
+ previewConflicts: "Conflicts: {{count}}",
+ errors: {
+ auth: "Check the WebDAV username and app password, then test the connection again.",
+ permission: "This account cannot read and write the selected WebDAV directory.",
+ notFound: "Check the WebDAV URL and directory. Use the WebDAV endpoint, not the website home page.",
+ conflict: "Another device updated this backup. Sync again to merge, then review anything waiting for approval.",
+ quota: "The remote storage is full. Free space or raise the quota, then retry.",
+ rateLimit: "The server is rate limiting requests. Retry the sync in a moment.",
+ server: "The WebDAV server is temporarily unavailable.",
+ network: "Check the network, address, and certificate, then retry.",
+ redirect: "The server redirected the request. Use the direct WebDAV URL.",
+ unsupported: "This server does not support the required WebDAV operations. Try compatibility mode.",
+ locked: "Enter the backup password to unlock sync.",
+ invalid: "Check the server URL, directory, and required passwords.",
+ password: "Use the backup password created for this vault, not the WebDAV password.",
+ limit: "The backup is larger than the supported size. Sync fewer categories and retry.",
+ unknown: "Sync did not finish. Check the connection and retry. Open the technical details if it keeps failing.",
+ },
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
remoteMode: "Compatibilité du serveur",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index c650364da..560eeabdb 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -698,6 +698,29 @@ sklm: {
connectionTitle: "WebDAV cloud sync",
connectionDescription:
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
+ errorTitle: "Sync needs attention",
+ errorDetails: "Technical details",
+ backupPasswordOptional: "Leave this blank to keep the current vault password.",
+ passwordTooShort: "The backup password must be at least 8 characters.",
+ previewPending: "Pending activation: {{count}}",
+ previewConflicts: "Conflicts: {{count}}",
+ errors: {
+ auth: "Check the WebDAV username and app password, then test the connection again.",
+ permission: "This account cannot read and write the selected WebDAV directory.",
+ notFound: "Check the WebDAV URL and directory. Use the WebDAV endpoint, not the website home page.",
+ conflict: "Another device updated this backup. Sync again to merge, then review anything waiting for approval.",
+ quota: "The remote storage is full. Free space or raise the quota, then retry.",
+ rateLimit: "The server is rate limiting requests. Retry the sync in a moment.",
+ server: "The WebDAV server is temporarily unavailable.",
+ network: "Check the network, address, and certificate, then retry.",
+ redirect: "The server redirected the request. Use the direct WebDAV URL.",
+ unsupported: "This server does not support the required WebDAV operations. Try compatibility mode.",
+ locked: "Enter the backup password to unlock sync.",
+ invalid: "Check the server URL, directory, and required passwords.",
+ password: "Use the backup password created for this vault, not the WebDAV password.",
+ limit: "The backup is larger than the supported size. Sync fewer categories and retry.",
+ unknown: "Sync did not finish. Check the connection and retry. Open the technical details if it keeps failing.",
+ },
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
remoteMode: "서버 호환 모드",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index d6ca825eb..43ae59fd8 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -697,6 +697,29 @@ sklm: {
title: "Bulut senkronizasyonu",
connectionTitle: "WebDAV bulut senkronizasyonu",
connectionDescription: "Şifreli bir WebDAV kasası üzerinden taşınabilir yapılandırmayı senkronize edin.",
+ errorTitle: "Sync needs attention",
+ errorDetails: "Technical details",
+ backupPasswordOptional: "Leave this blank to keep the current vault password.",
+ passwordTooShort: "The backup password must be at least 8 characters.",
+ previewPending: "Pending activation: {{count}}",
+ previewConflicts: "Conflicts: {{count}}",
+ errors: {
+ auth: "Check the WebDAV username and app password, then test the connection again.",
+ permission: "This account cannot read and write the selected WebDAV directory.",
+ notFound: "Check the WebDAV URL and directory. Use the WebDAV endpoint, not the website home page.",
+ conflict: "Another device updated this backup. Sync again to merge, then review anything waiting for approval.",
+ quota: "The remote storage is full. Free space or raise the quota, then retry.",
+ rateLimit: "The server is rate limiting requests. Retry the sync in a moment.",
+ server: "The WebDAV server is temporarily unavailable.",
+ network: "Check the network, address, and certificate, then retry.",
+ redirect: "The server redirected the request. Use the direct WebDAV URL.",
+ unsupported: "This server does not support the required WebDAV operations. Try compatibility mode.",
+ locked: "Enter the backup password to unlock sync.",
+ invalid: "Check the server URL, directory, and required passwords.",
+ password: "Use the backup password created for this vault, not the WebDAV password.",
+ limit: "The backup is larger than the supported size. Sync fewer categories and retry.",
+ unknown: "Sync did not finish. Check the connection and retry. Open the technical details if it keeps failing.",
+ },
endpoint: "WebDAV URL'si",
endpointPlaceholder: "https://dav.example.com/",
remoteMode: "Sunucu uyumluluğu",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index 7fd15dffa..7229205fb 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -687,6 +687,29 @@ sklm: {
title: "云同步",
connectionTitle: "WebDAV 云同步",
connectionDescription: "通过加密的 WebDAV 保管库同步可移植配置。不会包含对话历史、源文件或运行时状态。",
+ errorTitle: "同步需要处理",
+ errorDetails: "技术详情",
+ backupPasswordOptional: "留空则保留当前保管库密码。",
+ passwordTooShort: "备份密码至少需要 8 个字符。",
+ previewPending: "等待启用:{{count}}",
+ previewConflicts: "冲突:{{count}}",
+ errors: {
+ auth: "请检查 WebDAV 用户名和应用密码,然后重新测试连接。",
+ permission: "请确认这个账户对所选目录有读写权限。",
+ notFound: "请检查 WebDAV 地址和目录。应填写 WebDAV 接口地址,而不是网站首页。",
+ conflict: "另一台设备更新了这份备份。请重新同步合并,并查看等待审批的项目。",
+ quota: "远程存储空间不足。请释放空间或提高配额后再试。",
+ rateLimit: "服务器限制了请求频率。请稍后再同步。",
+ server: "WebDAV 服务暂时不可用。",
+ network: "请检查网络、地址和证书,确认能访问后再试。",
+ redirect: "服务器重定向了请求。请改用直接的 WebDAV 地址。",
+ unsupported: "服务器不支持所需的 WebDAV 操作。可以试试兼容模式。",
+ locked: "请输入备份密码以解锁同步。",
+ invalid: "请检查服务器地址、目录和必填密码。",
+ password: "请使用创建这份备份时的保管库密码,而不是 WebDAV 密码。",
+ limit: "备份超过支持的大小。请减少同步类别后再试。",
+ unknown: "同步没有完成。请检查连接后再试;如果反复失败,展开技术详情排查。",
+ },
endpoint: "WebDAV 地址",
endpointPlaceholder: "https://dav.example.com/",
remoteMode: "服务器兼容模式",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index ec8833d52..6f191287b 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -687,6 +687,29 @@ sklm: {
title: "雲端同步",
connectionTitle: "WebDAV 雲端同步",
connectionDescription: "透過加密的 WebDAV 保管庫同步可攜式設定。不會包含對話記錄、原始碼或執行階段狀態。",
+ errorTitle: "同步需要處理",
+ errorDetails: "技術詳情",
+ backupPasswordOptional: "留空則保留目前的保管庫密碼。",
+ passwordTooShort: "備份密碼至少需要 8 個字元。",
+ previewPending: "等待啟用:{{count}}",
+ previewConflicts: "衝突:{{count}}",
+ errors: {
+ auth: "請檢查 WebDAV 使用者名稱和應用程式密碼,然後重新測試連線。",
+ permission: "請確認這個帳戶對所選目錄有讀寫權限。",
+ notFound: "請檢查 WebDAV 網址和目錄。應填寫 WebDAV 介面網址,而不是網站首頁。",
+ conflict: "另一台裝置更新了這份備份。請重新同步合併,並查看等待核准的項目。",
+ quota: "遠端儲存空間不足。請釋放空間或提高配額後再試。",
+ rateLimit: "伺服器限制了請求頻率。請稍後再同步。",
+ server: "WebDAV 服務暫時無法使用。",
+ network: "請檢查網路、網址和憑證,確認能連線後再試。",
+ redirect: "伺服器重新導向了請求。請改用直接的 WebDAV 網址。",
+ unsupported: "伺服器不支援所需的 WebDAV 操作。可以試試相容模式。",
+ locked: "請輸入備份密碼以解除鎖定同步。",
+ invalid: "請檢查伺服器網址、目錄和必填密碼。",
+ password: "請使用建立這份備份時的保管庫密碼,而不是 WebDAV 密碼。",
+ limit: "備份超過支援的大小。請減少同步類別後再試。",
+ unknown: "同步沒有完成。請檢查連線後再試;如果反覆失敗,展開技術詳情排查。",
+ },
endpoint: "WebDAV 網址",
endpointPlaceholder: "https://dav.example.com/",
remoteMode: "伺服器相容模式",