Skip to main content

WebDAV server for AliyunDrive

Project description

aliyundrive-webdav

GitHub Actions PyPI Docker Image aliyundrive-webdav Crates.io

🚀 Help me to become a full-time open-source developer by sponsoring me on GitHub

阿里云盘 WebDAV 服务,主要使用场景为配合支持 WebDAV 协议的客户端 App 如 InfusenPlayer 等实现在电视上直接观看云盘视频内容, 支持客户端 App 直接从阿里云盘获取文件播放而不经过运行本应用的服务器中转, 支持上传文件,但受限于 WebDAV 协议不支持文件秒传。

请注意:V2 版本基于阿里云盘开放平台接口实现,不再支持阿里云盘 Web 和 App 版本获取的 refresh token。 由于本项目作者不再使用梅林固件,V2 版本不再免费支持 Koolshare 梅林固件系统,如有需要请考虑付费支持

如果项目对你有帮助,请考虑捐赠支持项目持续维护。 也可以考虑加入aliyundrive-webdav 知识星球获取咨询和技术支持服务。

Note

本项目作者没有上传需求, 故上传文件功能测试不全面且没有持续迭代计划.

安装

可以从 GitHub Releases 页面下载预先构建的二进制包, 也可以使用 pip 从 PyPI 下载:

pip install aliyundrive-webdav

如果系统支持 Snapcraft 比如 Ubuntu、Debian 等,也可以使用 snap 安装:

sudo snap install aliyundrive-webdav

OpenWrt 路由器

GitHub Releases 中有预编译的 ipk 文件, 目前提供了 aarch64/arm/mipsel/x86_64/i686 等架构的版本,可以下载后使用 opkg 安装,以 nanopi r4s 为例:

wget https://github.com/messense/aliyundrive-webdav/releases/download/v2.2.1/aliyundrive-webdav_2.2.1-1_aarch64_generic.ipk
wget https://github.com/messense/aliyundrive-webdav/releases/download/v2.2.1/luci-app-aliyundrive-webdav_2.2.1_all.ipk
wget https://github.com/messense/aliyundrive-webdav/releases/download/v2.2.1/luci-i18n-aliyundrive-webdav-zh-cn_2.2.1-1_all.ipk
opkg install aliyundrive-webdav_2.2.1-1_aarch64_generic.ipk
opkg install luci-app-aliyundrive-webdav_2.2.1_all.ipk
opkg install luci-i18n-aliyundrive-webdav-zh-cn_2.2.1-1_all.ipk

其它 CPU 架构的路由器可在 GitHub Releases 页面中查找对应的架构的主程序 ipk 文件下载安装, 常见 OpenWrt 路由器 CPU 架构如下表(欢迎补充):

路由器 CPU 架构
nanopi r4s aarch64_generic
小米 AX3600 aarch64_cortex-a53
斐讯 N1 盒子 aarch64_cortex-a53
Newifi D2 mipsel_24kc
Pogoplug arm_mpcore

Tips: 不清楚 CPU 架构类型可通过运行 opkg print-architecture 命令查询。

OpenWrt 配置界面

Docker 运行

docker run -d --name=aliyundrive-webdav --restart=unless-stopped -p 8080:8080 \
  -v /etc/aliyundrive-webdav/:/etc/aliyundrive-webdav/ \
  -e REFRESH_TOKEN='your refresh token' \
  -e WEBDAV_AUTH_USER=admin \
  -e WEBDAV_AUTH_PASSWORD=admin \
  messense/aliyundrive-webdav

其中,REFRESH_TOKEN 环境变量为你的阿里云盘 refresh_tokenWEBDAV_AUTH_USERWEBDAV_AUTH_PASSWORD 为连接 WebDAV 服务的用户名和密码。

QNAP 威联通 NAS

QNAP 插件

qnap-aliyunpan-webdav by @iranee.

ContainerStation (Docker)

管理员登陆 NAS 后安装 ContainerStation 并启动服务,在 Management (管理) 标签中 Create Application (新建应用),配置如下

version: '3.3'
services:
  aliyundrive-webdav:
    container_name: aliyundrive-webdav
    restart: unless-stopped
    ports:
      - '8080:8080'
    environment:
      - 'REFRESH_TOKEN=mytoken...'
    image: messense/aliyundrive-webdav

其中 REFRESH_TOKEN 文档最下面说明;:8080 网盘访问映射端口,可以按需改为其他的。

点击 Create (创建)后启动,访问 http://nas地址:8080/ 即可看到你网盘的自动生成索引网页文件。

参考文档

rclone

为了避免重复上传文件,使用 rclone 时推荐使用 Nextcloud WebDAV 模式,可以支持 sha1 checksums. 另外需要配合 --no-update-modtime 参数,否则 rclone 为了更新文件修改时间还是会强制重新上传。

举个例子:

rclone --no-update-modtime copy abc.pdf aliyundrive-nc://docs/

获取 refresh token

扫码获取 refresh token

命令行用法

$ 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

Note

注意:TLS/HTTPS 暂不支持 MIPS 架构。

Note

注意:启用 --skip-upload-same-size 选项虽然能加速上传但可能会导致修改过的同样大小的文件不会被上传

License

This work is released under the MIT license. A copy of the license is provided in the LICENSE file.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

aliyundrive_webdav-2.2.1-py3-none-win_arm64.whl (3.3 MB view details)

Uploaded Python 3 Windows ARM64

aliyundrive_webdav-2.2.1-py3-none-win_amd64.whl (4.2 MB view details)

Uploaded Python 3 Windows x86-64

aliyundrive_webdav-2.2.1-py3-none-win32.whl (3.9 MB view details)

Uploaded Python 3 Windows x86

aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_x86_64.whl (4.1 MB view details)

Uploaded Python 3 musllinux: musl 1.1+ x86-64

aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_i686.whl (4.1 MB view details)

Uploaded Python 3 musllinux: musl 1.1+ i686

aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_armv7l.whl (3.8 MB view details)

Uploaded Python 3 musllinux: musl 1.1+ ARMv7l

aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_aarch64.whl (3.7 MB view details)

Uploaded Python 3 musllinux: musl 1.1+ ARM64

aliyundrive_webdav-2.2.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl (3.8 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARMv7l

aliyundrive_webdav-2.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.7 MB view details)

Uploaded Python 3 manylinux: glibc 2.17+ ARM64

aliyundrive_webdav-2.2.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (4.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.5+ x86-64

aliyundrive_webdav-2.2.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl (4.1 MB view details)

Uploaded Python 3 manylinux: glibc 2.5+ i686

aliyundrive_webdav-2.2.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (7.6 MB view details)

Uploaded Python 3 macOS 10.9+ universal2 (ARM64, x86-64) macOS 10.9+ x86-64 macOS 11.0+ ARM64

aliyundrive_webdav-2.2.1-py3-none-macosx_10_7_x86_64.whl (4.0 MB view details)

Uploaded Python 3 macOS 10.7+ x86-64

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-win_arm64.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 ff4562ea2fa0e26d4876ea4ab4d11e8def5dc839a435a6d4557d1dfe349d032b
MD5 bcbb6da085c285aba1db261cb5e417e7
BLAKE2b-256 9cedeaee8405f4448a44336d6c1a01f332fe254e992a372944548d9c043cceb1

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f31770e7b958a9c13bddde4dcf42f7a040f3e7abf35e42dd657e035ca16c9151
MD5 70f2e8ab72f12a95ef7edaff0c88b6a5
BLAKE2b-256 af01811e22856f67d895afc107167ebccfba378495c434fa1543dfa5415ff9bc

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-win32.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-win32.whl
Algorithm Hash digest
SHA256 9d1253dcf28e1c6ccb74a2cd892e8e74cfa0ae717a948bd9d99d5cddba7fac95
MD5 2eda38f88aed36f16bb649cb5828691d
BLAKE2b-256 288d7e84e9ad37b4d8b4b980ead23c86122bf7f167668d600de71300809613ec

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_x86_64.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_x86_64.whl
Algorithm Hash digest
SHA256 34a88cf8aae17a6a390f5c62c27b076d9eaea4966db18b2e7fb12cde6426ba1b
MD5 de20a5b4acc926f1203412872c157a5c
BLAKE2b-256 1b0cd37da0e13c41a3b57550b6ba23a67e5be74628c84fb853512c5eae099bc0

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_i686.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_i686.whl
Algorithm Hash digest
SHA256 1e7f6e623504da2ba4c78cab8424b922ac11f789eb9c284fed62f59f6bd70d6e
MD5 7ba41ba94305319e865cda8f0b27da82
BLAKE2b-256 aa0c2cf7475e84b7b31e1bd97e5a9b9092303c65b1afe1f5df7bde4f426d4961

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_armv7l.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_armv7l.whl
Algorithm Hash digest
SHA256 2b86e400fbb21ce47e008dc75445693d1c73ff1d9ac2d0fd10dd64ff71637c7c
MD5 31debc34ae50e633e4cd20376610ffa5
BLAKE2b-256 bf4ff2edac00c106ac1cca01953745541636de817350769ec853beb572413eb7

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_aarch64.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-musllinux_1_1_aarch64.whl
Algorithm Hash digest
SHA256 1d7a315507f790e8599bf849f37f6ff46f5467b17ba5e1d5cd282be0c3fbbba6
MD5 da9d7283e6e576c754afeb453d123fa6
BLAKE2b-256 2c6364439406165fe0601fe9edef6e69e539ddccbd9f774020d1895b4e66f279

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Algorithm Hash digest
SHA256 c774ae1dd5f57f06b5d8fce9288b384780a806f01fb0e7491ff39789b89b8c35
MD5 d3afc6decec519d0586182d220df8f43
BLAKE2b-256 b6ad0eca205efbaad5d0dfc66e554789784a05116b5aea8cf85536c89262b3cd

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6018b8335e28078808221d7770a057525e2ea4af7edec9707a84b5a2bdf6ddaa
MD5 1940a9e952fe96f8a10f01241b7dacd9
BLAKE2b-256 3150bc25ec0b83caa9f4acd978155fe07dd138c0a4f015659d11652bde029e72

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 097804590f77f34e34d474d1e939bdc5648aeed4c3139e24e634f0ecb37f76bf
MD5 a404a5c916934a9ae2a5b4924abab5ae
BLAKE2b-256 34be83923c2e52a8f4333a9afd5f08a21e6a081adb2c1edcc28a02219323d202

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-manylinux_2_5_i686.manylinux1_i686.whl
Algorithm Hash digest
SHA256 1072b7412626a1c9b2fbb2b830cc5c91b2bbca9dc32939265c974d658bd038c2
MD5 3178d692efce5de6715c7bb5a659b150
BLAKE2b-256 3d280127ef25752220d725263494dacf076c3e58a2af8dffc1fdc92012753827

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 39306fe0343bcbb04e9e0b67c30f5d31dca32e830ea8f3fb7bd39d3d083f3a63
MD5 baecb3bf83a6807cadb4b51b550668c9
BLAKE2b-256 fa8c88d7d76a40d6a768ce5fd7865ec32955b71856d05c71b1295afbc55c18f4

See more details on using hashes here.

File details

Details for the file aliyundrive_webdav-2.2.1-py3-none-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for aliyundrive_webdav-2.2.1-py3-none-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 eaedd96d60254df9c3a85ffad68c518dd598e8978034491441b27296f28bc9e3
MD5 ae09df4ac14e7a44cbaf686d02cb54d2
BLAKE2b-256 b0dfa16910137e2cdeaa65376ea916ec123ec2d8b61b6a3c7f6558292e466678

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page