Webdav
使用 aliyundrive-webdav 这个项目实现阿里网盘 Webdav 挂载。rust 项目。提供各平台原生可执行文件。
# 微信扫码(不是用阿里网盘app扫),登录(该项目自制的小程序?)授权获取 refresh_token
aliyundrive-webdav qr login
# 启动 webdav server
# token 也可通过 REFRESH_TOKEN env 设置
aliyundrive-webdav -p 5006 -r <refresh_token>
说明
- 阿里 API 服务器域名(包含子域名)。需要直连:
- aliyundrive.net
- 只支持 Webdav, 不支持 http。所以地址用浏览器打开无法显示内容
- 如果配合 rclone 使用:
为了避免重复上传文件,使用 rclone 时推荐使用 Nextcloud WebDAV 模式,可以支持 sha1 checksums. 另外需要配合 --no-update-modtime 参数,否则 rclone 为了更新文件修改时间还是会强制重新上传。配置文件示例:
[alidrive]
type = webdav
url = http://192.168.1.250:8080
vendor = nextcloud
使用:
rclone --no-update-modtime copy abc.pdf alidrive:/docs/
# 挂载
rclone --read-only mount alidrive:/ Y:
CLI
$ aliyundrive-webdav --help
WebDAV server for AliyunDrive
Usage: aliyundrive-webdav [OPTIONS]
aliyundrive-webdav <COMMAND>
Commands:
qr Scan QRCode
help Print this message or the help of the given subcommand(s)
Options:
--host <HOST> Listen host [env: HOST=] [default: 0.0.0.0]
-p, --port <PORT> Listen port [env: PORT=] [default: 8080]
--client-id <CLIENT_ID> Aliyun drive client_id [env: CLIENT_ID=]
--client-secret <CLIENT_SECRET> Aliyun drive client_secret [env: CLIENT_SECRET=]
-r, --refresh-token <REFRESH_TOKEN> Aliyun drive refresh token [env: REFRESH_TOKEN=]
-U, --auth-user <AUTH_USER> WebDAV authentication username [env: WEBDAV_AUTH_USER=]
-W, --auth-password <AUTH_PASSWORD> WebDAV authentication password [env: WEBDAV_AUTH_PASSWORD=]
-I, --auto-index Automatically generate index.html
-S, --read-buffer-size <READ_BUFFER_SIZE> Read/download buffer size in bytes, defaults to 10MB [default: 10485760]
--upload-buffer-size <UPLOAD_BUFFER_SIZE> Upload buffer size in bytes, defaults to 16MB [default: 16777216]
--cache-size <CACHE_SIZE> Directory entries cache size [default: 1000]
--cache-ttl <CACHE_TTL> Directory entries cache expiration time in seconds [default: 600]
--root <ROOT> Root directory path [default: /]
-w, --workdir <WORKDIR> Working directory, refresh_token will be stored in there if specified
--no-trash Delete file permanently instead of trashing it
--read-only Enable read only mode
--tls-cert <TLS_CERT> TLS certificate file path [env: TLS_CERT=]
--tls-key <TLS_KEY> TLS private key file path [env: TLS_KEY=]
--strip-prefix <STRIP_PREFIX> Prefix to be stripped off when handling request [env: WEBDAV_STRIP_PREFIX=]
--debug Enable debug log
--no-self-upgrade Disable self auto upgrade
--skip-upload-same-size Skip uploading same size file
--prefer-http-download Prefer downloading using HTTP protocol
--redirect Enable 302 redirect when possible
-h, --help Print help
-V, --version Print version