webdav協議有很好的通用性,兼容多平臺多設備,並且使用簡單易上手,想用的舒坦還是要費點心思
服務端不多說,alist對webdav有較好的支持,沒有難度
客戶端:
- Windows
- Potplayer,kmplayer,RaiDrive,kodi,OneCommander,Mountain Duck,netdrive ❌,rclone,AIMP
- Android
- Nplayer,kmplayer,ES文件管理器,kodi,nova魔改,reex,cx 文件管理器,Solid Explorer,X-plore File Manager,MiXplorer
- IOS
- VidHub,Nplayer,kmplayer,infuse,zFuse, Fileball文件管理器
- 電視TV
- VidHub,Nplayer,kodi,nova魔改
- 若只看阿里可以使用阿里官方合作的
- 歡視商店-阿里雲盤TV版,網盤播放器-阿里雲盤TV版
- Mac
- VidHub,IINA,Mountain Duck,infuse,netdrive,rclone
- Linux
- davfs2,rclone
- 筆記軟件
- Joplin ,思源
複製代碼 著重談在Windows平臺的掛載使用
掛載為網絡驅動器只是看起來美好
準備(注意備份註冊表):
解除50m限制
新建註冊表FileSizeLimitInBytes.reg,並將以下內容粘貼保存,覆蓋到當前註冊表。
win平臺最大支持4g
- Windows Registry Editor Version 5.00
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters]
- "AcceptOfficeAndTahoeServers"=dword:00000001
- "BasicAuthLevel"=dword:00000002
- "ClientDebug"=dword:00000000
- "FileAttributesLimitInBytes"=dword:000f4240
- "FileSizeLimitInBytes"=dword:ffffffff
- "InternetServerTimeoutInSec"=dword:0000001e
- "LocalServerTimeoutInSec"=dword:0000000f
- "SendReceiveTimeoutInSec"=dword:0000003c
- "ServerNotFoundCacheLifeTimeInSec"=dword:0000003c
- "ServiceDebug"=dword:00000000
- "ServiceDll"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,\
- 00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,\
- 77,00,65,00,62,00,63,00,6c,00,6e,00,74,00,2e,00,64,00,6c,00,6c,00,00,00
- "ServiceDllUnloadOnStop"=dword:00000001
- "SupportLocking"=dword:00000001
複製代碼 修改基礎驗證等級(可選)
如果你的服務端未使用https,需要修改系統默認的驗證等級以滿足條件。
新建註冊表BasicAuthLevel.reg,並將以下內容粘貼保存,覆蓋到當前註冊表。
- Windows Registry Editor Version 5.00
- [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters]
- "AcceptOfficeAndTahoeServers"=dword:00000001
- "BasicAuthLevel"=dword:00000002
- "ClientDebug"=dword:00000000
- "FileAttributesLimitInBytes"=dword:000f4240
- "FileSizeLimitInBytes"=dword:02faf080
- "InternetServerTimeoutInSec"=dword:0000001e
- "LocalServerTimeoutInSec"=dword:0000000f
- "SendReceiveTimeoutInSec"=dword:0000003c
- "ServerNotFoundCacheLifeTimeInSec"=dword:0000003c
- "ServiceDebug"=dword:00000000
- "ServiceDll"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,\
- 00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,\
- 77,00,65,00,62,00,63,00,6c,00,6e,00,74,00,2e,00,64,00,6c,00,6c,00,00,00
- "ServiceDllUnloadOnStop"=dword:00000001
- "SupportLocking"=dword:00000001
複製代碼 編寫掛載腳本
雖然Windows支持直接掛載webdav,但由於系統原因,每次登錄後都會失效,需要重新掛載,故編寫腳本
新建webdav.bat,複製以下內容並保存
- [url=home.php?mod=space&uid=20206]@echo[/url] off
- :: webdav鏈接以實際為主
- set WEBDAV_URL=https://webdav.com/dav
- :: 用戶名
- set USERNAME=用戶名
- :: 密碼
- set PASSWORD=密碼
- :: 掛載盤符到Z
- set DRIVE_LETTER=Z:
- :: 先卸載之前掛載的盤符(如果有)
- net use %DRIVE_LETTER% /delete >nul 2>&1
- :: 映射網絡驅動器
- net use %DRIVE_LETTER% %WEBDAV_URL% /user:%USERNAME% %PASSWORD%
- if %errorlevel% neq 0 (
- echo Failed to connect to WebDAV.
- ) else (
- echo Successfully connected to WebDAV.
- )
複製代碼
雙擊即可直接掛載
如不希望出現明文密碼,可使用Windows自帶的憑據管理,手動添加用戶名密碼
刪除代碼中用戶名密碼,添加以下內容(效果自測)
- for /f "tokens=1-3 delims= " %%a in ('cmdkey /webdav:%TARGET_NAME% ^| findstr /C:"用戶名"') do set USERNAME=%%b
- for /f "tokens=1-8 delims= " %%a in ('cmdkey /webdav:%TARGET_NAME% ^| findstr /C:"密碼"') do set PASSWORD=%%b
複製代碼 編寫自啟動腳本
新建一個vbs,如webdav.vbs,複製以下內容粘貼保存,注意改為腳本實際路徑。
- set ws=WScript.CreateObject("WScript.Shell")
- ws.Run "C:\webdav.bat /start",0
複製代碼 將自啟動腳本放置於
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
重啟計算機試試,應該可以成功掛載。
Linux應該更簡單[debian]
先安裝fuse3和rclone
- apt update
- apt install fuse3 -y
- 安裝rclone
- rclone config
- 按要求添加webdav信息
複製代碼 複製以下內容運行
新建文件夾 /home/webdav /home/temp
- mkdir -p /home/webdav /home/temp && chmod 777 /home/webdav /home/temp
複製代碼 複製以下內容運行
不著急,檢查命令是否有問題
- rclone mount webdav:/ /home/webdav --cache-dir=/home/temp/ --vfs-cache-mode full --vfs-cache-max-size 1G --vfs-read-ahead 64M --buffer-size 128M
複製代碼 沒問題再複製以下內容運行
添加守護進程
- cat > /lib/systemd/system/webdav-mount.service <<EOF
- [Unit]
- Description=webdav
- [Service]
- Environment='REMOTE_PATH=webdav:/'
- Environment='LOCAL_PATH=/home/webdav'
- Type=simple
- User=root
- ExecStart=/usr/bin/rclone mount webdav:/ /home/webdav --cache-dir=/home/temp/ --vfs-cache-mode full --vfs-cache-max-size 1G --vfs-read-ahead 64M --buffer-size 128M
- ExecStop=fusermount -qzu /home/webdav
- Restart=on-failure
- [Install]
- WantedBy=multi-user.target
- EOF
複製代碼 systemctl start webdav-mount
systemctl status webdav-mount
systemctl enable webdav-mount
df -h
應該就能看到掛載在本地的webdav儲存了
蘋果搭webdav 可以Mountain Duck infuse 如果搭建服務可以用自帶的阿帕奇
|