Select Page

Install Onelist On Centos 7 – Simple Index For Onedrive
Posted on February 06, 2020
Install Onelist On Centos 7 – Simple Index For Onedrive

Jackie, also known by his nick-name KK, always strives for the best and learn from the best. Working and living as a Freelance Web Engineer/ Web Developer & Designer/ Amateur Youtuber/ Husky Lover. If you love one of these things that I love, we already have something in common.

Jackie Sung

Owner

OneList is a OneDrive files directory index application written in GoLang.

In this post, we're gonna install and configure OneList - a simple index for onedrive.

Github: https://github.com/MoeClub/OneList

Step 1 - Preparation

Install 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

Add following code at the last

export GOPATH=$HOME/work
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
source ~/.bash_profile
go version

Step 2 - Install OneList

mkdir /usr/local/bin/OneList && cd $_
wget https://raw.githubusercontent.com/MoeClub/OneList/master/Rewrite/amd64/linux/OneList
chmod +x OneList

Step 3 - Authorization

International and personal version

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=78d4dc35-7e46-42c6-9023-2d39314433a5&response_type=code&redirect_uri=http://localhost/onedrive-login&response_mode=query&scope=offline_access%20User.Read%20Files.ReadWrite.All

Chinese version

https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize?client_id=dfe36e60-6133-48cf-869f-4d15b8354769&response_type=code&redirect_uri=http://localhost/onedrive-login&response_mode=query&scope=offline_access%20User.Read%20Files.ReadWrite.All

Add config.json file

## 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

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]

Config

[
  {
    // 如果是家庭版或者个人免费版, 此项应为 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
  }
]

Step 4 - Run OneList

Download index.html file

# 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

Run OneList on port 8801

nohup /usr/local/bin/OneList/OneList -bind 0.0.0.0 -port 8801  > /dev/null 2>&1 &

Nginx reverse proxy

location ^~ /onedrive/ {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_pass http://127.0.0.1:8801;
}

Step 5 - Control Process with Supervisor

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

Copyright Statement: Original Article of JackieSung.com

Please Indicate the Source: Install Onelist On Centos 7 – Simple Index For Onedrive | Jackie Sung's Blog

Related Articles

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Pin It on Pinterest

Share This