3 WebDAV sync
ZHAO Xudong edited this page 2026-04-01 21:51:29 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

WebDAV Data Sync

English | 中文


English

Overview

WebDAV sync allows you to synchronize your electerm data (bookmarks, settings, themes, etc.) to any WebDAV-compatible server. This provides a self-hosted alternative to GitHub/Gitee sync.

Supported WebDAV Servers

  • Nextcloud - Recommended, full-featured cloud platform
  • ownCloud - Similar to Nextcloud
  • Jianguoyun (坚果云) - Free tier available, Chinese service
  • Apache with mod_dav - Simple WebDAV server
  • nginx with nginx-dav-ext-module - High-performance option
  • Any standards-compliant WebDAV server

Setup Guide

1. Set Up WebDAV Server

Option A: Using Docker (Quick Start)

cd temp/dockers
docker-compose up -d

This will start a WebDAV server on http://localhost:8080 with:

  • Username: admin
  • Password: admin

Option B: Using Nextcloud/ownCloud

  1. Install Nextcloud or ownCloud on your server
  2. Create a dedicated user for electerm sync
  3. Note the WebDAV URL (usually https://your-server.com/remote.php/dav/files/username)

Option C: Using Apache

  1. Enable mod_dav module
  2. Configure a directory for WebDAV access
  3. Set up authentication (Basic or Digest)

2. Configure electerm

  1. Open electerm Settings (Ctrl+,)
  2. Navigate to Sync tab
  3. Select webdav from the sync type dropdown
  4. Fill in the required fields:
    • Server URL: Your WebDAV server endpoint
      • Nextcloud: https://your-server.com/remote.php/dav/files/username
      • ownCloud: https://your-server.com/remote.php/dav/files/username
      • Docker test server: http://localhost:8080
    • Username: Your WebDAV username
    • Password: Your WebDAV password or app password
  5. Click Save
  6. Use Upload to sync data to server or Download to sync from server

Data Storage Structure

electerm stores sync data in the following structure on your WebDAV server:

/electerm/
├── bookmarks.json
├── bookmarkGroups.json
├── settings.json
├── terminalThemes.json
├── quickCommands.json
├── profiles.json
├── addressBookmarks.json
├── workspaces.json
├── userConfig.json
├── electerm-status.json
└── *.order.json (order files)

Security Considerations

  1. Use HTTPS: Always use HTTPS for production WebDAV servers to protect your data in transit
  2. App Passwords: For Nextcloud/ownCloud, use app-specific passwords instead of your main account password
  3. Dedicated User: Create a dedicated user account for electerm sync with limited permissions
  4. Regular Backups: Regularly backup your WebDAV data directory
  5. Access Control: Restrict WebDAV directory access to only necessary users

Troubleshooting

Connection Failed

  • Verify the server URL is correct and accessible
  • Check username and password
  • Ensure WebDAV is enabled on your server
  • Test with a WebDAV client (e.g., Cyberduck, cadaver)

Upload/Download Errors

  • Check server disk space
  • Verify write permissions on the WebDAV directory
  • Check network connectivity
  • Review server logs for errors

Data Not Syncing

  • Ensure you clicked Save after entering credentials
  • Check that the WebDAV directory is writable
  • Verify the electerm folder exists on the server
  • Try clearing sync settings and reconfiguring

API Reference

The WebDAV sync uses standard WebDAV methods:

  • PROPFIND: List directory contents and check file existence
  • GET: Download files from the server
  • PUT: Upload files to the server
  • MKCOL: Create directories

Common WebDAV URLs

Service WebDAV URL Format
Jianguoyun https://dav.jianguoyun.com/dav/
Nextcloud https://server.com/remote.php/dav/files/username
ownCloud https://server.com/remote.php/dav/files/username
Apache http://server.com/dav/
nginx http://server.com/dav/
Docker test http://localhost:8080

中文

概述

WebDAV 同步允许您将 electerm 数据(书签、设置、主题等)同步到任何兼容 WebDAV 的服务器。这为 GitHub/Gitee 同步提供了一个自托管替代方案。

支持的 WebDAV 服务器

  • 坚果云 - 免费额度,国产服务
  • Nextcloud - 推荐,功能全面的云平台
  • ownCloud - 类似 Nextcloud
  • Apache with mod_dav - 简单的 WebDAV 服务器
  • nginx with nginx-dav-ext-module - 高性能选项
  • 任何符合标准的 WebDAV 服务器

设置指南

1. 设置 WebDAV 服务器

选项 A使用 Docker快速开始

cd temp/dockers
docker-compose up -d

这将在 http://localhost:8080 启动一个 WebDAV 服务器:

  • 用户名:admin
  • 密码:admin

选项 B使用 Nextcloud/ownCloud

  1. 在服务器上安装 Nextcloud 或 ownCloud
  2. 为 electerm 同步创建专用用户
  3. 记录 WebDAV URL通常是 https://your-server.com/remote.php/dav/files/username

选项 C使用 Apache

  1. 启用 mod_dav 模块
  2. 配置 WebDAV 访问目录
  3. 设置认证Basic 或 Digest

2. 配置 electerm

  1. 打开 electerm 设置Ctrl+,
  2. 导航到 同步 选项卡
  3. 从同步类型下拉菜单中选择 webdav
  4. 填写必填字段:
    • 服务器 URL:您的 WebDAV 服务器端点
      • Nextcloudhttps://your-server.com/remote.php/dav/files/username
      • ownCloudhttps://your-server.com/remote.php/dav/files/username
      • Docker 测试服务器:http://localhost:8080
    • 用户名:您的 WebDAV 用户名
    • 密码:您的 WebDAV 密码或应用密码
  5. 点击 保存
  6. 使用 上传 将数据同步到服务器,或使用 下载 从服务器同步数据

数据存储结构

electerm 在 WebDAV 服务器上以下列结构存储同步数据:

/electerm/
├── bookmarks.json
├── bookmarkGroups.json
├── settings.json
├── terminalThemes.json
├── quickCommands.json
├── profiles.json
├── addressBookmarks.json
├── workspaces.json
├── userConfig.json
├── electerm-status.json
└── *.order.json排序文件

安全考虑

  1. 使用 HTTPS:生产环境始终使用 HTTPS 保护传输中的数据
  2. 应用密码:对于 Nextcloud/ownCloud使用应用专用密码而不是主账户密码
  3. 专用用户:为 electerm 同步创建权限有限的专用用户账户
  4. 定期备份:定期备份 WebDAV 数据目录
  5. 访问控制:限制 WebDAV 目录访问权限,仅允许必要用户

故障排除

连接失败

  • 验证服务器 URL 是否正确且可访问
  • 检查用户名和密码
  • 确保服务器上启用了 WebDAV
  • 使用 WebDAV 客户端测试(如 Cyberduck、cadaver

上传/下载错误

  • 检查服务器磁盘空间
  • 验证 WebDAV 目录的写入权限
  • 检查网络连接
  • 查看服务器错误日志

数据未同步

  • 确保输入凭据后点击了 保存
  • 检查 WebDAV 目录是否可写
  • 验证服务器上存在 electerm 文件夹
  • 尝试清除同步设置并重新配置

常见 WebDAV URL

服务 WebDAV URL 格式
坚果云 https://dav.jianguoyun.com/dav/
Nextcloud https://server.com/remote.php/dav/files/username
ownCloud https://server.com/remote.php/dav/files/username
Apache http://server.com/dav/
nginx http://server.com/dav/
Docker 测试 http://localhost:8080