YukiDrive介绍
YukiDrive是一个 Onedrive & SharePoint 文件浏览程序,支持国际版和世纪互联版。后端采用 .net core 3.1,前端使用 Vue ,前后端分离,无刷新加载。无需搭建运行环境,下载并配置完成后直接运行。
特点
- .Net Core 多线程高并发
- 前后端分离,无刷新加载
- 可挂载 OneDrive 和任意多个 SharePoint 站点
- 提供文件上传 CLI
- 上传文件
- 无大小限制
- 由 浏览器&CLI 直接对微软服务器上传,不消耗流量
搭建教程:
#升级下yum,centos7 yum update #安装wget yum -y install wget
安装解压程序,如果有请跳过
yum install -y unzip zip
下载程序
#创建个目录,也可以不创建,直接用根目录开搞,不利于系统搬移 mkdir /home/yuki && cd /home/yuki
下载主程序
#linux64 wget https://drive.yukino.co/api/files/onedrive/YukiDrive/WebApi/1.1.1/YukiDrive-1.1.1-linux-x64.zip && unzip YukiDrive-1.1.1-linux-x64.zip && cd /home/yuki/YukiDrive-1.1.1-linux-x64 #linux32 wget https://drive.yukino.co/api/files/onedrive/YukiDrive/WebApi/1.1.1/YukiDrive-1.1.1-linux-arm.zip && unzip YukiDrive-1.1.1-linux-arm.zip && cd /home/yuki/YukiDrive-1.1.1-linux-arm #winx64&x86 https://drive.yukino.co/api/files/onedrive/YukiDrive/WebApi/1.1.1/YukiDrive-1.1.1-win.zip #macos https://drive.yukino.co/api/files/onedrive/YukiDrive/WebApi/1.1.1/YukiDrive-1.1.1-macOS.zip
获取APPID和秘钥,编辑并配置文件
#获取 ClientId 与 ClientSecret 登录Azure:https://portal.azure.com/(国际版)或 https://portal.azure.cn/ (世纪互联) 点击 Azure Active Directory / 应用注册 / 新注册 名字任意取,账户类型为 任何组织目录(任何 Azure AD 目录 - 多租户)中的帐户,重定向URL为 https://你的域名/api/admin/bind/new 点击 概述,记录应用程序(客户端)ID,即为 ClientId 点击 API 权限 / 添加权限 / Microsoft Graph / 委托的权限 勾选 Files.ReadWrite.All 和 Sites.ReadWrite.All 点击 证书和密码 / 新客户端密码,创建密码并记录为 ClientSecret
编辑配置文件
vi appsettings.json
填写如ClientId 与 ClientSecret
{ "Logging": { "LogLevel": { "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } }, "AllowedHosts": "*", "ConnectionString": "Data Source=YukiDrive.db;", "ClientId": "", "ClientSecret": "", "ListeningUrls": "https://*:1272;http://*:1273", "Certificate" : { "Enable" : true, "FilePath" : "", "Password" : "" }, "BaseUri":"https://localhost:1272", "Proxy":"", "Type":"", "AccountName": "", "DominName": "", "AdminName" : "", "AdminPassword": "" }
说明
ClientId
与 ClientSecret
填写在上一步所得值
ListeningUrls
和 Certificate
与 https 证书有关,下一步再讲
BaseUri
修改为你的域名,有端口必须带上端口号,必须使用 https
Type
为你的 Office 账户地区,可选择为
China
世纪互联Global
国际版
AccountName
为你的 Office账户名,如:[email protected]
DominName
为你的 SharePoint 域名,登录 SharePoint 就能在浏览器地址栏看到,如:yukistudio.sharepoint.com
AdminName
和 AdminPassword
为网站后台的账户和密码
打开端口,阿里云、腾讯云、谷歌云可能需要在后台放开1273和1272端口
#CentOS 6 iptables -I INPUT -p tcp --dport 5189 -j ACCEPT iptables -I INPUT -p tcp --dport 80 -j ACCEPT service iptables save service iptables restart #CentOS 7 firewall-cmd --zone=public --add-port=5189/tcp --permanent firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --reload
域名反代-可以使用nginx 等反带,也可以直接用程序自带的程序
使用程序自带服务器,但你要手动配置 https 将你的域名证书转换为 pfx 格式,会得到 pfx文件 和 密码,放置于任意目录 修改 appsettings.json 的 Certificate 项 FilePath 填写为证书路径,Password 即为证书的密码,Enable 保持为 true 此时 Https://你的域名:1272 为你的网盘程序访问路径
启动程序
./YukiDrive
如果不在本目录内,请务必将命令输全
/home/yuki/YukiDrive-1.1.1-linux-x64/YukiDrive
在浏览器中打开http://你的域名:1273/,并登录后台绑定账户,未绑定之前直接访问域名会显示 出现错误:undefined 不必理会,配置完成后,跳转到程序目录执行 ./YukiDrive 就开始运行了。Windows 用户直接打开 YukiDrive.exe 开始运行。在浏览器中打开http://你的IP:1273/ ,正常显示即代表程序调试正常,enjoy。
进程守护
先添加个service
vi /usr/lib/systemd/system/YukiDrive.service
填入代码,保存退出
[Unit] Description=YukiDrive [Service] WorkingDirectory=/home/yuki/YukiDrive-1.1.1-linux-x64/YukiDrive ExecStart=/home/yuki/YukiDrive-1.1.1-linux-x64/YukiDrive Restart=always RestartSec=10 KillSignal=SIGINT SyslogIdentifier=dotnet-YukiDrive User=root Environment=ASPNETCORE_ENVIRONMENT=Production Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false [Install] WantedBy=multi-user.target
后台启动、开机等
#重载配置 systemctl daemon-reload #开机启动 systemctl enable YukiDrive #启动服务 systemctl start YukiDrive #查看服务状态 systemctl status YukiDrive #重启服务 systemctl restart YukiDrive #关闭进程 systemctl stop YukiDrive
配套资源:
演示Demo:https://drive.yukino.co/
评论前必须登录!
注册