Skip to content

Commit

Permalink
add 21vianet,Google Drive
Browse files Browse the repository at this point in the history
  • Loading branch information
gaowanliang committed Apr 29, 2021
1 parent 73e4e4c commit 219abc2
Show file tree
Hide file tree
Showing 907 changed files with 203,198 additions and 71,036 deletions.
58 changes: 29 additions & 29 deletions Readme-zh-CN.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# OneDriveUploader
# LightUploader

萌咖大佬写了一个 [非常好的版本](https://github.com/MoeClub/OneList/tree/master/OneDriveUploader) ,可惜并没有开源,而且已经好久都没有更新了。这个项目作为从 [DownloadBot](https://github.com/gaowanliang/DownloadBot) 中独立出来的一个简易上传工具,使得上传到OneDrive更加方便
萌咖大佬写了一个 [非常好的版本](https://github.com/MoeClub/OneList/tree/master/OneDriveUploader) ,可惜并没有开源,而且已经好久都没有更新了。这个项目作为从 [DownloadBot](https://github.com/gaowanliang/DownloadBot) 中独立出来的一个简易上传工具,旨在用更轻量化的方式让在各种平台都能快速的向各个网络硬盘上传数据


- 支持 国际版, 个人版(家庭版).
- 支持 OneDrive 国际版, 个人版(家庭版),世纪互联,Google Drive(测试版,下面的命令并未完全支持).
- 支持上传文件和文件夹到指定目录,并保持上传前的目录结构.
- 支持命令参数使用, 方便外部程序调用.
- 支持自定义上传分块大小.
Expand All @@ -13,31 +12,32 @@
- 支持通过Telegram Bot实时监控上传进度,方便使用全自动下载脚本时对上传的实时监控

## 授权
### 通过下面URL登录 (右键新标签打开)
#### 国际版, 个人版(家庭版)
[https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=ad5e65fd-856d-4356-aefc-537a9700c137&response_type=code&redirect_uri=http://localhost/onedrive-login&response_mode=query&scope=offline_access%20User.Read%20Files.ReadWrite.All](https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=ad5e65fd-856d-4356-aefc-537a9700c137&response_type=code&redirect_uri=http://localhost/onedrive-login&response_mode=query&scope=offline_access%20User.Read%20Files.ReadWrite.All)
详见[wiki](https://github.com/gaowanliang/LightUploader/wiki)


### 初始化配置文件
```bash
# 国际版
OneDriveUploader -a "url"
# 国际版,并使用中文语言包
OneDriveUploader -a "url" -l zh-CN
# 个人版(家庭版)
OneDriveUploader -a "url" -v 1
# 中国版(世纪互联) 目前设计中,暂不可用
OneDriveUploader -a "url" -v 2
# OneDrive 国际版
LightUploader -a "url"
# OneDrive 国际版,并使用中文语言包
LightUploader -a "url" -l zh-CN
# OneDrive 个人版(家庭版)
LightUploader -a "url" -v 1
# OneDrive 中国版(世纪互联),并使用中文语言包
LightUploader -a "url" -v 2

# 在浏览器地址栏中获取以 http://loaclhost 开头的整个url内容
# 将获取的完整url内容替换命令中的 url 三个字母
# 每次产生的 url 只能用一次, 重试请重新获取 url
# 此操作将会自动初始化的配置文件

# Google Drive
LightUploader -a "url" -v 3
```

## 使用
```c
Usage of OneDriveUploader:
Usage of LightUploader:
-a string
// 初始化授权
Setup and Init auth.json.
Expand All @@ -61,22 +61,22 @@ Usage of OneDriveUploader:
-uid string
// 使用Telegram机器人实时监控上传,此处需填写接收人的userID,形如123456789
-m int
// 选择模式,0为替换OneDrive中同名文件,1为跳过,默认为0
// 选择模式,0为替换网盘中同名文件,1为跳过,默认为0
-v int
// 选择版本,其中0为国际版,1为个人版(家庭版),默认为0
// 选择版本,其中0为 OneDrive 国际版,1为 OneDrive 个人版(家庭版),2为 OneDrive 世纪互联,3为Google Drive,默认为0
```

## 配置
```jsonc
{
// 网盘类型
"Drive":"OneDrive",
// 授权令牌
"RefreshToken": "1234564567890ABCDEF",
// 最大线程数.(同时上传文件的数量)
"ThreadNum": 2,
// 最大上传分块大小.(每次上传文件的最大分块大小,网络不好建议调低. 单位:MB)
"BlockSize": 10,
// 最大单文件大小.(目前: 个人版(家庭版)单文件限制为100GB; 其他版本单文件限制为15GB,微软将逐步更新为100GB. 单位:GB)
"SigleFile": 100,
// 如果是中国版(世纪互联), 此项应为 true.
"MainLand": false,
//软件语言
Expand All @@ -96,31 +96,31 @@ Usage of OneDriveUploader:
# 一些示例:

# 将同目录下的 mm00.jpg 文件上传到 OneDrive 网盘根目录
OneDriveUploader -c xxx.json -f "mm00.jpg"
LightUploader -c xxx.json -f "mm00.jpg"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录
OneDriveUploader -c xxx.json -f "Download"
LightUploader -c xxx.json -f "Download"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘Test目录中
OneDriveUploader -c xxx.json -f "Download" -r "Test"
LightUploader -c xxx.json -f "Download" -r "Test"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程
OneDriveUploader -c xxx.json -t 10 -f "Download"
LightUploader -c xxx.json -t 10 -f "Download"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程,并跳过同名文件
OneDriveUploader -c xxx.json -t 10 -f "Download" -m 1
LightUploader -c xxx.json -t 10 -f "Download" -m 1

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程,同时设置超时时间为30秒
OneDriveUploader -c xxx.json -t 10 -f "Download" -to 30
LightUploader -c xxx.json -t 10 -f "Download" -to 30

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程,同时使用 Telegram Bot 实时监控上传进度
OneDriveUploader -c xxx.json -t 10 -f "Download" -tgbot "123456:xxxxxxxx" -uid 123456789
LightUploader -c xxx.json -t 10 -f "Download" -tgbot "123456:xxxxxxxx" -uid 123456789

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 10 线程,同时使用配置文件中的 Telegram Bot 参数载入程序实时监控上传进度(前提是配置文件中含有Telegram Bot 的参数)
OneDriveUploader -c xxx.json -t 10 -f "Download" -tgbot "1"
LightUploader -c xxx.json -t 10 -f "Download" -tgbot "1"

# 将同目录下的 Download 文件夹上传到 OneDrive 网盘根目录中, 使用 15 线程, 并设置分块大小为 20M
OneDriveUploader -c xxx.json -t 15 -b 20 -f "Download"
LightUploader -c xxx.json -t 15 -b 20 -f "Download"

```

Expand Down
55 changes: 29 additions & 26 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[简体中文](Readme-zh-CN.md)
# OneDriveUploader
# LightUploader

MoeClub wrote a [very good version](https://github.com/MoeClub/OneList/tree/master/OneDriveUploader), but unfortunately it's not open source and hasn't been updated in a while. This project is a simple upload tool separate from [DownloadBot](https://github.com/gaowanliang/DownloadBot), making it easier to upload.
MoeClub wrote a [very good version](https://github.com/MoeClub/OneList/tree/master/OneDriveUploader), but unfortunately it's not open source and hasn't been updated in a while. This project is a simple upload tool separate from [DownloadBot](https://github.com/gaowanliang/DownloadBot), designed to be a lightweight way to quickly upload data to various network drives on all platforms.

## Features

- Supports Business, Personal (Home) versions.
- Supports OneDrive Business, Personal (Home) versions, 21vianet (CN) version, Google Drive (Beta).
- Support for uploading files and folders to specified directories, keeping the directory structure as it was before the upload.
- Supports the use of command parameters for external applications.
- Support for customising the upload chunk size.
Expand All @@ -16,35 +16,37 @@ MoeClub wrote a [very good version](https://github.com/MoeClub/OneList/tree/mast


## Authorize
### Login via the following URL (right click to open a new tab)
#### Business, Personal (Home) versions
[https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=ad5e65fd-856d-4356-aefc-537a9700c137&response_type=code&redirect_uri=http://localhost/onedrive-login&response_mode=query&scope=offline_access%20User.Read%20Files.ReadWrite.All](https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=ad5e65fd-856d-4356-aefc-537a9700c137&response_type=code&redirect_uri=http://localhost/onedrive-login&response_mode=query&scope=offline_access%20User.Read%20Files.ReadWrite.All)
See [wiki](https://github.com/gaowanliang/LightUploader/wiki) for details



### Initialization profile
```bash
# Business
OneDriveUploader -a "url"
# OneDrive Business
LightUploader -a "url"

# Business, and use Chinese language pack
OneDriveUploader -a "url" -l zh-CN
# OneDrive Business, and use Chinese language pack
LightUploader -a "url" -l zh-CN

# Personal (Home)
OneDriveUploader -a "url" -v 1
# OneDrive Personal (Home)
LightUploader -a "url" -v 1

# The China Version (Century Internet) is currently in design and is not available
OneDriveUploader -a "url" -v 2
# OneDrive 21vianet (CN) version, and use Chinese language pack
LightUploader -a "url" -v 2 -l zh-CN

# Get the entire url in the browser address bar starting with http://loaclhost
# Replace the full url with the three letters of the "url" in the command
# Each url generated can only be used once, try again to retrieve the url
# This action will automatically initialise the configuration file

# Google Drive
LightUploader -a "url" -v 3

```

## Use
```c
Usage of OneDriveUploader:
Usage of LightUploader:
-a string
//Setup and Init auth.json.
-b string
Expand All @@ -67,14 +69,15 @@ Usage of OneDriveUploader:
-uid string
// Use the Telegram bot to monitor uploads in real time, here you need to fill in the recipient's userID, shaped like 123456789
-m int
// Select the mode, 0 is to replace the file with the same name in onedrive, 1 is to skip, the default is 0
// Select the mode, 0 is to replace the file with the same name in cloud drive, 1 is to skip, the default is 0
-v int
// Select the version, where 0 is the Business version and 1 is the personal (home) version, the default is 0
// Select the version, where 0 is the OneDrive Business version and 1 is the OneDrive Personal (Home) version, 2 is OneDrive 21vianet (CN) version, 3 is Google Drive, the default is 0
```

## Config
```jsonc
{
"Drive":"OneDrive",
// Authorisation tokens
"RefreshToken": "1234564567890ABCDEF",
// Maximum number of threads. (Number of simultaneous file uploads)
Expand Down Expand Up @@ -102,32 +105,32 @@ Note that when a configuration file is used at the same time and the parameters
# Some examples:

# Upload the mm00.jpg file from the same directory to the root of the OneDrive
OneDriveUploader -c xxx.json -f "mm00.jpg"
LightUploader -c xxx.json -f "mm00.jpg"

# Upload the Download folder from the same directory to the root of the OneDrive
OneDriveUploader -c xxx.json -f "Download"
LightUploader -c xxx.json -f "Download"

# Upload the Download folder from the same directory to the Test directory of the OneDrive
OneDriveUploader -c xxx.json -f "Download" -r "Test"
LightUploader -c xxx.json -f "Download" -r "Test"

# Upload the Download folder from the same directory to the root of the OneDrive, using 10 threads
OneDriveUploader -c xxx.json -t 10 -f "Download"
LightUploader -c xxx.json -t 10 -f "Download"

# Upload the download folder in the same directory to the root directory of onedrive, use 10 threads, and skip the file with the same name
OneDriveUploader -c xxx.json -t 10 -f "Download" -m 1
LightUploader -c xxx.json -t 10 -f "Download" -m 1

# Upload the download folder in the same directory to the root directory of onedrive, use 10 threads, and set the timeout to 30 seconds
OneDriveUploader -c xxx.json -t 10 -f "Download" -to 30
LightUploader -c xxx.json -t 10 -f "Download" -to 30

# Upload the Download folder from the same directory to the root of the OneDrive, using 10 threads, while using Telegram Bot to monitor the progress of the upload in real time
OneDriveUploader -c xxx.json -t 10 -f "Download" -tgbot "123456:xxxxxxxx" -uid 123456789
LightUploader -c xxx.json -t 10 -f "Download" -tgbot "123456:xxxxxxxx" -uid 123456789

# Upload the download folder in the same directory to the root directory of onedrive network disk, use 10 threads, and use the telegram BOT parameter loader in the configuration file to monitor the upload progress in real time (provided that the configuration file contains the parameters of telegram BOT)
OneDriveUploader -c xxx.json -t 10 -f "Download" -tgbot "1"
LightUploader -c xxx.json -t 10 -f "Download" -tgbot "1"


# Upload the Download folder from the same directory to the root of the OneDrive, using 15 threads, and setting the chunk size to 20M
OneDriveUploader -c xxx.json -t 15 -b 20 -f "Download"
LightUploader -c xxx.json -t 15 -b 20 -f "Download"
```

## Note
Expand Down
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/buger/jsonparser v1.0.0
github.com/gosuri/uilive v0.0.4
github.com/hedzr/cmdr v1.7.43
github.com/hedzr/cmdr v1.7.43 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/nicksnyder/go-i18n/v2 v2.1.2
golang.org/x/sys v0.0.0-20210324051608-47abb6519492 // indirect
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4
golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78
golang.org/x/text v0.3.6
google.golang.org/api v0.45.0
)

0 comments on commit 219abc2

Please sign in to comment.