通过OneList展示OneDrive目录
本文最后更新于 1782 天前,其中的信息可能已经有所发展或是发生改变。

[successbox title=”什么是OneList”]

基于Python3的简约OneDrive目录列表,同时换了一种api来防止因使用人过多导致抽风等问题,稳定性大大的增加,而且使用Redis动态缓存策略,打开目录的速度是相当的快,不过该程序初衷只想安静的做个目录程序,所以是不会增加看视频的功能。
github地址:https://github.com/0oVicero0/OneList

[/successbox]
安装步骤:
1.安装依赖

[sourcecode language=”html” title=”CenOS 6系统”]
#安装EPEL
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
#安装Python3和Redis
yum install python34 redis git -y
#安装pip3
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
#启动Redis
service redis start
#设置Redis开机自启
chkconfig redis on
[/sourcecode]

[sourcecode language=”html” title=”CenOS 7系统”]
#安装EPEL
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
#安装Python3和Redis
yum install python36 redis git -y
#配置Python3软链接
ln -s /usr/bin/python3.6 /usr/bin/python3
#安装pip3
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
#启动Redis
systemctl start redis
#设置Redis开机自启
systemctl enable redis
[/sourcecode]

[sourcecode language=”html” title=”Debian/Ubuntu系统”]
#安装pip3和Redis
apt update
apt install python3-pip redis-server git -y
[/sourcecode]

2.安装OneList

[sourcecode language=”html” title=””]
#拉取源码
git clone https://github.com/0oVicero0/OneList.git
#安装依赖
cd OneList && pip3 install -r requirements.txt
[/sourcecode]

3.获取auth_token:
使用浏览器访问该地址:单击,登录你的OneDrive账号,复制地址栏code=和&session之间的参数。

4.获取refresh_token,在SSH客户端使用命令:
[sourcecode language=”html” title=””]
#将下面auth_token替换成你获取到的参数,再使用命令
code="auth_token"
wget –no-check-certificate –post-data="client_id=ea2b36f6-b8ad-40be-bc0f-e5e4a4a7d4fa&client_secret=h27zG8pr8BNsLU0JbBh5AOznNS5Of5Y540l/koc7048=&grant_type=authorization_code&resource=https://api.office.com/discovery/&redirect_uri=http://localhost/onedrive-login&code=$code" ‘https://login.microsoftonline.com/common/oauth2/token’ -qO-
[/sourcecode]
然后复制refresh_token参数后面的字段。

5.接下来在OneList目录新建config.json配置文件。
[sourcecode language=”html” title=””]
nano config.json
[/sourcecode]
将以下内容复制进去:
注意(start_directory是选择要分享的目录)。
[sourcecode language=”html” title=””]
#将下面refresh_token替换成你获取到的字段 注意不要带<>
{
"token": "<refresh_token>",
"location_path": "/",
"start_directory": "/",
"threads": 3,
"diff_seconds": 480,
"refresh_seconds": 720,
"metadata_cached_seconds": 768,
"structure_cached_seconds": 840
}
[/sourcecode]
再使用ctrl+x、y保存退出。

6.开始运行
gunicorn app:app -b 127.0.0.1:8888 -D
注意端口可以任意选择。此时访问地址为127.0.0.1:8888,还需要使用域名反代才能访问,如果你要使用ip访问,将运行命令改成0.0.0.0:8888即可。

7.如果需要推荐用宝塔面板做一下反代就行。
把目标URL改成http://127.0.0.1:8888就行。

8.当长时间运行服务器出现错误的时候,通过下面的方式进行重启。
1)输入通过执行如下命令,可以获取Gunicorn进程树。
[sourcecode language=”html” title=””]
pstree -ap|grep gunicorn
[/sourcecode]


2)重启Gunicorn任务。
[sourcecode language=”html” title=””]
//如上图所示是重启2883
kill -HUP 2883
[/sourcecode]
3)当然了也可以关闭再启动。
[sourcecode language=”html” title=””]
//关闭命令
kill -9 2883
[/sourcecode]

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇