OneList是用GoLang编写的OneDrive文件目录索引应用程序。
在本文中,我们将安装并配置OneList-onedrive的简单索引。
GitHub:https : //github.com/MoeClub/OneList
步骤1-准备
安装Golang
cd ~ && curl -O https://dl.google.com/go/go1.13.linux-amd64.tar.gz tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz vim ~/.bash_profile
最后添加以下代码
export GOPATH=$HOME/work export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
source ~/.bash_profile go version
第2步-安装OneList
mkdir /usr/local/bin/OneList && cd $_ wget https://raw.githubusercontent.com/MoeClub/OneList/master/Rewrite/amd64/linux/OneList chmod +x OneList
步骤3-授权
国际和个人版本
中文版
添加config.json文件
## Replace url with full contents you get above starting with http://loaclhost # International OneList -a "url" -s "/onedrive" # Personal OneList -ms -a "url" -s "/onedrive" # Chinese OneList -cn -a "url" -s "/onedrive" # Success! Add config. '/path/to/config.json' means config successfully created
用法
Usage of OneList: -a string // 初始化配置文件,添加新配置 Setup and Init auth.json. -bind string // 绑定IP地址(公网: 0.0.0.0) Bind Address (default "127.0.0.1") -port string // 绑定端口(HTTP:80) Port (default "5288") -s string // 设置 SubPath 项, 需要与 -a 一起使用. Set SubPath. [unique per account] (default "/") -c string // 配置文件 Config file. (default "config.json") -t string // Index.html 目录样式文件 Index file. (default "index.html") -json // 开关 // 数据以 json 形式输出当前目录数据 Output json. -cn // 开关 // 授权中国版(世纪互联), 需要此参数. OneDrive by 21Vianet. -ms // 开关 // 授权个人版(家庭版), 需要此参数. OneDrive by Microsoft. -C string // 覆写所有预置的 Client ID. (不建议新手使用此参数) Set Client ID. [Overwrite all clientId] -S string // 覆写所有预置的 Secret Key. (不建议新手使用此参数) Set Secret Key. [Overwrite all secretKey]
设定档
[ { // 如果是家庭版或者个人免费版, 此项应为 true. "MSAccount": false, // 如果是中国版(世纪互联), 此项应为 true. "MainLand": false, // 授权令牌 "RefreshToken": "1234564567890ABCDEF", // 单配置文件中,此项要唯一.将此OneDrive中设置为`RootPath`目录映射在`http://127.0.0.1:5288/onedrive` 下. // (只推荐一个盘位的时候使用根目录"/".) "SubPath": "/onedrive", // 读取OneDrive的某个目录作为根目录. (支持根目录"/") "RootPath": "/Test", // 隐藏OneDrive目录中的文件夹和文件, 条目间使用 "|" 分割. (跳过缓存设置的条目.) "HidePath": "/Test/Obj01|/Test/Obj02", // 使用用户名和密码加密OneDrive目录. 目录和用户名密码间使用 "?" 分割, 用户名密码使用 ":" 分割, 条目间使用 "|" 分割. 无效条目将跳过. "AuthPath": "/Test/Auth01?user01:pwd01|/Test/Auth02?user02:pwd02", // 缓存刷新间隔.(所有项目中的刷新时间取最小值为有效刷新间隔) "RefreshInterval": 900 } ]
第4步-运行OneList
下载index.html文件
# Origin https://raw.githubusercontent.com/MoeClub/OneList/master/Rewrite/index.html # With online video playing feature https://raw.githubusercontent.com/jackjieYYY/yyy/master/index.html https://raw.githubusercontent.com/MoeClub/OneList/master/Rewrite/%40Theme/HaorWu/index.html
在端口8801上运行OneList
nohup /usr/local/bin/OneList/OneList -bind 0.0.0.0 -port 8801 > /dev/null 2>&1 &
Nginx反向代理
location ^~ /onedrive/ { proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:8801; }
第5步-使用主管进行控制过程
yum -y install supervisor useradd onelist vim /etc/supervisord.d/onelist.ini
[program:onelist] command=nohup /usr/local/bin/OneList/OneList -bind 0.0.0.0 -port 8801 > /dev/null 2>&1 & autorestart=true stdout_logfile=none stderr_logfile=none user=onelist
chkconfig supervisord on service supervisord start supervisorctl reload supervisorctl restart all
原创文章,作者:cheshirex,如若转载,请注明出处:https://www.homedt.net/20434.html