1 下载
mkdir onelist && cd onelist
#64位系统
wget https://raw.githubusercontent.com/MoeClub/OneList/master/Rewrite/amd64/linux/OneList
#32位系统
wget https://raw.githubusercontent.com/MoeClub/OneList//master/Rewrite/i386/linux/OneList
#arm架构
wget https://raw.githubusercontent.com/MoeClub/OneList/master/Rewrite/arm/linux/OneList
chmod +x OneList
2 授权
3 添加配置文件
# 国际版
OneList -a "url" -s "/onedrive"
# 个人版(家庭版)
OneList -ms -a "url" -s "/onedrive"
# 中国版(世纪互联)
OneList -cn -a "url" -s "/onedrive"
# 在浏览器地址栏中获取以 http://loaclhost 开头的整个url内容
# 将获取的完整url内容替换命令中的 url 三个字母
# 每次产生的 url 只能用一次, 重试请重新获取 url
# 可以一个盘内的多个文件夹分别映射到多个`SubPath`上
# 此操作将会自动添加的配置文件
# 提示 Success! Add config. '/path/to/config.json' 则成功
4 修改配置文件 config.json
[
{
// 如果是家庭版或者个人免费版, 此项应为 true.
"MSAccount": false,
// 如果是中国版(世纪互联), 此项应为 true.
"MainLand": false,
// 授权令牌
"RefreshToken": "xxx",
// 单配置文件中,此项要唯一.将此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
}
]
5 运行
#下载默认的index.html主题,或者其他index.html主题([地址](https://github.com/MoeClub/OneList/tree/master/Rewrite/@Theme))与config.json同目录,即本文默认的 /root/onelist/
wget https://raw.githubusercontent.com/MoeClub/OneList/master/Rewrite/index.html -P /root/onelist/
#监听5000地址,自行修改
/root/onelist/OneList -bind 0.0.0.0 -port 5000
6 开机自启
cat > /etc/systemd/system/onelist.service <<EOF
[Unit]
Description=onelist
After=network.target
[Service]
Type=simple
ExecStart=/root/onelist/OneList -bind 0.0.0.0 -port 5000
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl start onelist
systemctl enable onelist
7 反向代理及HTTPS
- 可使用宝塔面板或自行修改网站配置文件添加反向代理及HTTPS证书,反向代理端口为自行设置的端口,如
5000
; - 打开
http://ip:5000
或https://onelist.yourdomain.com
即可使用
8 参数使用
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]
-P string
// 设置反代域名.此设置将全部流量定向到某个服务器或CDN,用于隐藏全局域名或者加速.
// 每组以";"相间隔. 源域名与目标域名以"|"间隔. 可以设置多组.
// 默认为空. (不建议新手使用此参数)
Set Proxy Domain. [x.sharepoint.com|domain.com;...]
Lasted update: May 27, 2020 at 10:50 pm