挂载阿里云盘webdav到本地

桌面发行版可以使用有WebUI的 AList
下载 aliyundrive-webdav 最新版

Win10操作

1、修改注册表使得WIN同时支持http和https:定位到 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WebClient\Parameters
2、把BasicAuthLevel 值改成2,即同时支持http和https,默认只支持https
3、服务里打开WebClient,改为自动启动,然后重启服务,然后映射网络驱动器即可

webdav.cmd

@title webdav
@echo off
set /p token=<refresh_token
aliyundrive-webdav -p 8086 -U "admin" -W "passwd" -w "." -r %token% -I 

Ubuntu操作

webdav.sh

#!/usr/bin/env bash

root_dir=$(pwd)/
cd ${root_dir}
status=$(ps -ef | grep "aliyundrive-webdav" | grep -vc "grep")
refresh_token=$(cat ./refresh_token)
port=8086
password="zhang123."
log_flie=./log/aliyundrive_$(date +%m%d%H%M%S).log
#log_flie=/dev/null 2>&1
#未运行,后台启动进程。
if [ ${status} -eq 0 ]
then
    echo "not run, starting.";
    echo "./aliyundrive-webdav -p ${port} -U admin -W ${password} -w ${root_dir} -r ${refresh_token} -I" >> ${log_flie}
    ./aliyundrive-webdav -p ${port} -U admin -W ${password} -w ${root_dir} -r ${refresh_token} -I >> ${log_flie} &
    exit;
fi

#已运行,打开文件管理器。
if [ $# -eq 0 ]
then
    echo "had run, open nautilus.";
    nautilus "dav://localhost:${port}/";
    exit;
#已运行,且有参数,终止进程
else
    echo "had run, killing.";
    pid=$(ps -ef | grep "aliyundrive-webdav" | grep -v "grep" | awk '{print $2}');
    kill ${pid};
    exit;
fi


#   JSON.parse(localStorage.getItem('token')).refresh_token
#sudo apt install davfs2
#mkdir ~/alipan
#sudo mount -t davfs https://localhost:8086 ~/alipan

webdav.desktop

[Desktop Entry]
Type=Application
Name=webdav
Path=/home/ubuntu/soft/webdav/
Exec=/home/ubuntu/soft/webdav/webdav.sh %f
Terminal=false
StartupNotify=true
posted @ 2021-08-22 01:45  一年`  阅读(1781)  评论(0编辑  收藏  举报