前期准备
AriaNg
项目地址:https://github.com/mayswind/AriaNg/releases
oneindex
项目地址:https://github.com/donwa/oneindex
自动上传脚本
项目地址:https://github.com/weiyidu/OneDrive
Aria2一键安装脚本(逗比制作)
wget –N —no–check–certificate https://softs.loan/Bash/aria2.sh && chmod +x aria2.sh && bash aria2.sh# 如果上面这个脚本无法下载,尝试使用备用下载:wget –N —no–check–certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/aria2.sh && chmod +x aria2.sh && bash aria2.sh
使用教程https://doub.io/shell-jc4/(网站已挂)
安装
网站运行环境:推荐“宝塔面板”,安装教程
1、创建AriaNg网站
如果连接不上宝塔面板安全放行6800端口
2、创建oneindex网站
需求
1、PHP空间,PHP 5.6+ 打开curl支持
2、onedrive 账号 (个人、企业版或教育版/工作或学校帐户)
3、oneindex 程序
特殊文件实现功能
在文件夹底部添加说明:在onedrive的文件夹中添加README.md文件,使用markdown语法。
在文件夹头部添加说明:在onedrive的文件夹中添加HEAD.md 文件,使用markdown语法。
加密文件夹:在onedrive的文件夹中添加.password文件,填入密码,密码不能为空。
直接输出网页:在onedrive的文件夹中添加index.html 文件,程序会直接输出网页而不列目录。
配合 文件展示设置-直接输出 效果更佳
修改Aria2配置
1、修改下载目录,如下图,选择7 修改配置文件,选择3
2、选择5 手动 打开配置文件修改,在最后一行on-download-complete=/root/autoupload.sh
autoupload.sh脚本内容,需要配合《OneDrive for Business in Linux》使用
赋予运行权限 chmod +x autoupload.sh
wget —no–check–certificate –q –O /root/autoupload.sh “https://raw.githubusercontent.com/weiyidu/OneDrive/master/autoupload_new.sh” && chmod +x /root/autoupload.sh
|
修改LocalDIR目录与第1步的目录地址一样
#!/bin/bashGID=“$1”;FileNum=“$2”;File=“$3”;MaxSize=“15728640”RemoteDIR=“”; #上传到Onedrive的路径,默认为根目录。LocalDIR=“/home/”; #Aria2下载目录,记得最后面加上/if [[ –z $(echo “$FileNum” |grep –o ‘[0-9]*’ |head –n1) ]]; then FileNum=‘0’; fiif [[ “$FileNum” –le ‘0’ ]]; then exit 0; fiif [[ “$#” != ‘3’ ]]; then exit 0; fifunction LoadFile(){IFS_BAK=$IFSIFS=$‘\n’if [[ ! –d “$LocalDIR” ]]; then return; fiif [[ –e “$File” ]]; thenif [[ $(dirname “$File”) == $(readlink –f $LocalDIR) ]]; thenONEDRIVE=“onedrive”;elseONEDRIVE=“onedrive-d”;fiFileLoad=“${File/#$LocalDIR}”while truedoif [[ “$FileLoad” == ‘/’ ]]; then return; fiecho “$FileLoad” |grep –q ‘/’;if [[ “$?” == “0” ]]; thenFileLoad=$(dirname “$FileLoad”);elsebreak;fi;done;if [[ “$FileLoad” == “$LocalDIR” ]]; then return; fiif [[ –n “$RemoteDIR” ]]; thenOption=” -f $RemoteDIR”;elseOption=“”;fiEXEC=“$(command -v $ONEDRIVE)”;if [[ –z “$EXEC” ]]; then return; ficd “$LocalDIR”;if [[ –e “$FileLoad” ]]; thenItemSize=$(du –s “$FileLoad” |cut –f1 |grep –o ‘[0-9]*’ |head –n1)if [[ –z “$ItemSize” ]]; then return; fiif [[ “$ItemSize” –ge “$MaxSize” ]]; thenecho –ne “\033[33m$File \033[0mtoo large to spik.\n”;return;fieval “${EXEC}${Option}” \‘“${FileLoad}”\‘;if [[ $? == ‘0’ ]]; thenrm –rf “$FileLoad”;fififiIFS=$IFS_BAK}LoadFile;