Skip to content

Commit 45b4d04

Browse files
authored
docs(drivers/google_drive): add English version (#279)
1 parent ae6c950 commit 45b4d04

File tree

9 files changed

+262
-18
lines changed

9 files changed

+262
-18
lines changed

pages/guide/drivers/google_drive.md

Lines changed: 262 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,51 +11,164 @@ categories:
1111
- drivers
1212
---
1313

14+
::: en
15+
16+
Official website: https://drive.google.com/
17+
18+
- Supports Team Drive (Enter the Team Drive directory ID for the Root Folder ID)
19+
20+
:::
21+
22+
::: zh-CN
23+
1424
官网:https://drive.google.com/
1525

1626
- 支持团队盘(根目录ID填写团队盘的目录ID)
1727

18-
## 1. 必要条件
28+
:::
29+
30+
## 1. Prerequisites { lang="en" }
31+
32+
## 1. 必要条件 { lang="zh-CN" }
33+
34+
::: en
35+
36+
1. The machine on which the OpenList service is deployed must be able to connect to Google Drive.
37+
38+
2. The Google Drive API service must be enabled. For details on how to enable it, please refer to [Enabling the Google Drive API](#_2-1-enable-google-drive-api).
39+
40+
> For detailed steps, see [Google Workspace > Google Drive > Quick Start Guide](https://developers.google.com/workspace/drive/api/quickstart/js).
41+
42+
:::
43+
::: zh-CN
1944

2045
1. 搭建 OpenList 服务的机器必须能够连接到 Google 网盘。
2146

2247
2. 必须启用 Google 云盘 API 服务,具体启用方式请参考 [启用 Google Drive API](#21-启用-google-drive-api-的-api)
2348

2449
> 详细步骤可参考 [Google Workspace > Google Drive > 快速入门指南](https://developers.google.com/workspace/drive/api/quickstart/js)
2550
26-
## 2. 准备接入
51+
:::
52+
53+
## 2. Preparation { lang="en" }
54+
55+
## 2. 准备接入 { lang="zh-CN" }
56+
57+
### 2.1. Enable Google Drive API { lang="en" }
58+
59+
### 2.1. 启用 Google Drive API 的 API { lang="zh-CN" }
60+
61+
::: en
62+
63+
1. On the [Guide Page](https://developers.google.com/workspace/drive/api/quickstart/js), locate the `Enable the API` button and click to proceed to the quick activation interface. Follow the instructions and confirm the settings to complete the activation process.
2764

28-
### 2.1. 启用 Google Drive API 的 API
65+
2. You can also visit the [Google Drive API Management Interface](https://console.cloud.google.com/apis/library/drive.googleapis.com). Find the `Enable` button at the top and click it; wait for the activation to complete.
66+
67+
3. `Quotas and System Limits Management`(optional): Switch to the `Quotas and System Limits` tab and set appropriate quotas and limits based on your usage and requirements.
68+
69+
:::
70+
::: zh-CN
2971

3072
1.[指南页面](https://developers.google.com/workspace/drive/api/quickstart/js)中找到`启用API`按钮,点击进入快捷开启界面,点击下一步以及确认后,即可完成开启。
3173

3274
2. 也可以访问[谷歌云盘API功能管理界面](https://console.cloud.google.com/apis/library/drive.googleapis.com),在上方找到`启用`按钮,点击后等待启用完成。
3375

3476
3. `配额和系统限制管理`(可选):切换到`配额和系统限制`选项卡,根据你的使用情况和需求,设置合适的配额和限制。
3577

36-
### 2.2. 创建 OAuth 客户端(可选,如果使用OpenList/公益服务器/自建服务器,则不用创建)
78+
:::
79+
80+
### 2.2. Creating an OAuth Client (Optional; not required if using OpenList, a public welfare server, or a self-built server) { lang="en" }
81+
82+
### 2.2. 创建 OAuth 客户端(可选,如果使用OpenList/公益服务器/自建服务器,则不用创建) { lang="zh-CN" }
83+
84+
::: en
85+
86+
1. On the [Credentials Page](https://console.cloud.google.com/apis/credentials?hl=en), click the `Create Credentials` dropdown menu and select and click `OAuth client ID`.
87+
> If prompted with `To create an OAuth client ID, you must first configure the consent screen`, click the `Configure consent screen` button, and complete the creation of the `Brand Information` on the subsequent page, selecting `External` for the `Audience`. After completion, return to the Credentials page to continue creating the OAuth client ID.
88+
> ![google-oauth-00](/img/drivers/google/google-oauth-eng-00.png)
89+
2. In the pop-up window, select `Web Application` and enter the name of your application type.
90+
3. For the `Authorized redirect URIs`, enter `https://api.oplist.org/googleui/callback`. If you are using a self-built service or a non-profit organization, please enter the corresponding domain name, for example, `https://your-domain.com/googleui/callback`.
91+
4. Click the `Create` button to complete the creation of the OAuth client. Note: Make sure to copy and save the `Client ID` and `Client Secret`; you will need them later on.
92+
93+
![google-oauth-01](/img/drivers/google/google-oauth-eng-01.png)
94+
95+
5. Add yourself as a test user: On the left side, find the `Audience` menu and click to enter it. Then, locate `Test Users` and click the `+ Add users` button. Enter your Google account email address and click `Save`.
96+
97+
![google-oauth-02](/img/drivers/google/google-oauth-eng-02.png)
98+
99+
6. After completing the testing, you can publish your application: On the left side, find the `Audience` menu and click to enter it. Then, locate `Publication Status` and click the `Publish app` button. Confirm the publication to complete the application release process.
100+
101+
![google-oauth-03](/img/drivers/google/google-oauth-eng-03.png)
102+
103+
:::
104+
::: zh-CN
37105

38106
1.[凭据界面](https://console.cloud.google.com/apis/credentials?hl=zh-cn)中,点击`创建凭据`下拉菜单,选择和点击`OAuth 客户端 ID`
39107

40-
![google-ouath-00](/img/drivers/google/google-ouath-00.png)
108+
> 如果提示`如需创建 OAuth 客户端 ID,您必须先配置权限请求页面`,请点击`配置同意屏幕`按钮,在后续页面中完成`品牌信息`的创建,其中`受众群体`请选择`外部用户`,完成后返回凭据页面继续创建 OAuth 客户端 ID。
109+
110+
![google-oauth-00](/img/drivers/google/google-oauth-00.png)
41111

42112
2. 在弹出的窗口中,选择`Web 应用`,填写应用名称
43113

44114
3.`授权的重定向 URI`中,填写 `https://api.oplist.org/googleui/callback`,如果是自建或者公益服务,请填写对应的域名,如 `https://your-domain.com/googleui/callback`
45115

46116
4. 点击`创建`按钮,完成 OAuth 客户端的创建。注:请复制和保存`客户端 ID``客户端密钥`,后续需要使用。
47117

48-
![google-ouath-00](/img/drivers/google/google-ouath-01.png)
118+
![google-oauth-00](/img/drivers/google/google-oauth-01.png)
49119

50120
5. 将自己添加到测试用户中,在左侧找到`目标对象`菜单,点击进入后,找到`测试用户`下方的`+ Add User`按钮,点击后输入你的 Google 账号邮箱地址,点击添加即可。
51121

52-
![google-ouath-02](/img/drivers/google/google-ouath-02.png)
122+
![google-oauth-02](/img/drivers/google/google-oauth-02.png)
53123

54124
6. 测试完毕后可以发布应用,在左侧找到`目标对象`菜单,点击进入后,找到`发布状态`下方的`发布应用`按钮,点击后确认发布即可完成应用发布。
55125

56-
![google-ouath-03](/img/drivers/google/google-ouath-03.png)
126+
![google-oauth-03](/img/drivers/google/google-oauth-03.png)
127+
128+
:::
129+
130+
### 2.3. Get `Access Token` and `Refresh Token` { lang="en" }
131+
132+
### 2.3. 获取`访问密钥``刷新密钥` { lang="zh-CN" }
133+
134+
::: en
57135

58-
### 2.3. 获取`访问密钥``刷新密钥`
136+
1. Open the [OpenList Google Authorization Page](https://api.oplist.org/). **⚠️ If you are using a public or self-hosted server, please proceed with that server.**
137+
138+
2. In the dropdown menu on the page, select `GoogleDrive Login`.
139+
140+
![google-00-l](/img/drivers/google/google-00-l.png#light)
141+
![google-00-d](/img/drivers/google/google-00-d.png#dark)
142+
143+
3. If you created an OAuth Client ID in the previous steps, please enter the Client ID and Client Secrets in the input fields below.
144+
145+
![google-01-01-l](/img/drivers/google/google-01-01-l.png#light)
146+
![google-01-01-d](/img/drivers/google/google-01-01-d.png#dark)
147+
148+
Otherwise, check the box ☑️ to use the API provided by OpenList. **⚠️ If you are using a public or self-hosted server, the built-in Client ID and Client Secrets of that server will be used.**
149+
150+
![google-01-02-l](/img/drivers/google/google-01-02-l.png#light)
151+
![google-01-02-d](/img/drivers/google/google-01-02-d.png#dark)
152+
153+
4. Click the `Get Authorization` button. The system will redirect you to the Google Authorization page. Log in to your Google account and authorize OpenList to access your Google Drive.
154+
155+
![google-02](/img/drivers/google/google-02.png)
156+
157+
5. If a message appears stating `This app has not been verified by Google`, click `Advanced` and then click `Go to oplist.org (insecure)` to continue. (If you are using a public or self-hosted server, the domain name here should match the actual domain name of the service; please verify this carefully.)
158+
159+
![google-03](/img/drivers/google/google-03.png)
160+
161+
6. Pay attention to the permission information on the authorization page (within the red box in the image below). Make sure that the permission granted is only for accessing your Google Drive files. If you find that the permission includes access to something other than just your Google Drive files in the public service, please report an issue at [OpenListTeam/OpenList-Docs/issues](https://github.com/OpenListTeam/OpenList-Docs/issues).
162+
163+
![google-04](/img/drivers/google/google-04.png)
164+
165+
7. After authorization is successful, the system will provide you with a `Refresh Token` and an `Access Token`. Please copy and save these tokens, as they will be used in subsequent configurations.
166+
167+
![google-05-l](/img/drivers/google/google-05-l.png#light)
168+
![google-05-d](/img/drivers/google/google-05-d.png#dark)
169+
170+
:::
171+
::: zh-CN
59172

60173
1. 打开[OpenList Google 授权页面](https://api.oplist.org/) **⚠️如果使用公益服务器/自建服务器,请访问公益服务器/自建服务器**
61174

@@ -82,7 +195,7 @@ categories:
82195

83196
![google-03](/img/drivers/google/google-03.png)
84197

85-
6. 请注意授权页面上(下图红色框内)的权限信息,确保**只是**访问你的 **谷歌云端硬盘文件**,如果在公益服务中发现该权限不仅仅是访问**谷歌云端硬盘**,请在[openlistteam/docs/issues](https://github.com/openlistteam/docs/issues)提起issues。
198+
6. 请注意授权页面上(下图红色框内)的权限信息,确保**只是**访问你的 **谷歌云端硬盘文件**,如果在公益服务中发现该权限不仅仅是访问**谷歌云端硬盘**,请在[OpenListTeam/OpenList-Docs/issues](https://github.com/OpenListTeam/OpenList-Docs/issues)提起issues。
86199

87200
![google-04](/img/drivers/google/google-04.png)
88201

@@ -91,17 +204,78 @@ categories:
91204
![google-05-l](/img/drivers/google/google-05-l.png#light)
92205
![google-05-d](/img/drivers/google/google-05-d.png#dark)
93206

94-
## 3. 在 OpenList 中添加谷歌云盘
207+
:::
95208

96-
### 3.1. 配置说明
209+
## 3. Add Google Drive in OpenList { lang="en" }
97210

98-
#### 3.1.1. **根文件夹 ID**
211+
## 3. 在 OpenList 中添加谷歌云盘 { lang="zh-CN" }
212+
213+
### 3.1. Configuration { lang="en" }
214+
215+
### 3.1. 配置说明 { lang="zh-CN" }
216+
217+
#### 3.1.1. Root Folder ID { lang="en" }
218+
219+
#### 3.1.1. **根文件夹 ID** { lang="zh-CN" }
220+
221+
::: en
222+
223+
Similar to Aliyun Drive, it is the last string of the official website URL, such as:
224+
225+
![google](/img/drivers/google/googledrive-dir.png)
226+
227+
:::
228+
::: zh-CN
99229

100230
与阿里云盘类似,官网 URL 的最后一个字符串,如:
101231

102232
![google](/img/drivers/google/googledrive-dir.png)
103233

104-
### 3.2. 开始添加
234+
:::
235+
236+
### 3.2. Start Adding { lang="en" }
237+
238+
### 3.2. 开始添加 { lang="zh-CN" }
239+
240+
::: en
241+
242+
1. Open the management interface of OpenList and click on `Storage` in the left menu.
243+
244+
2. On the Storage List page, click the `Add Storage` button in the top right corner.
245+
246+
3. Select `Google Drive` as the drive.
247+
248+
![google-06-l](/img/drivers/google/google-06-l.png#light)
249+
![google-06-d](/img/drivers/google/google-06-d.png#dark)
250+
251+
4. Enter the mount path, for example: `google-drive`.
252+
253+
5. In the `Root Folder ID` field, enter the root folder ID obtained earlier; if you are using the root directory, enter `root`.
254+
255+
6. In the `Refresh Token` field, enter the refresh token obtained earlier (if not available, refer to [Preparing for Integration](#_2-preparation).
256+
257+
7. If you are using the OAuth client ID and key provided by OpenList (or a public welfare server/self-built server), follow steps 7.1 and 7.2:
258+
259+
7.1. Check the `Use online API` option to indicate that you want to use the online API provided by OpenList.
260+
261+
7.2. Enter `https://api.oplist.org/googleui/renewapi` as the API URL; if it’s a public welfare server/self-built server, enter the corresponding server address.
262+
263+
![google-07-d](/img/drivers/google/google-07-d.png#dark)
264+
![google-07-l](/img/drivers/google/google-07-l.png#light)
265+
266+
8. If you are using your own OAuth client ID and key, follow steps 8.1 and 8.2:
267+
268+
8.1. Uncheck the `Use online API` option to indicate that you are using your own OAuth client ID and key.
269+
270+
8.2. Enter your OAuth client ID in the `Client id` field and your OAuth Client secrets in the `Client secret` field.
271+
272+
![google-08-l](/img/drivers/google/google-08-l.png#light)
273+
![google-08-d](/img/drivers/google/google-08-d.png#dark)
274+
275+
9. Click the `Add` button to complete the addition of Google Drive.
276+
277+
:::
278+
::: zh-CN
105279

106280
1. 打开 OpenList 的管理界面,点击左侧菜单中的`存储`
107281

@@ -138,9 +312,28 @@ categories:
138312

139313
9. 点击`添加`按钮,完成谷歌云盘的添加。
140314

141-
## 4. 关于`Use online api`选项的说明
315+
:::
316+
317+
## 4. About `Use online api` option { lang="en" }
318+
319+
## 4. 关于`Use online api`选项的说明 { lang="zh-CN" }
320+
321+
### 4.1. AccessToken refresh method with own keys { lang="en" }
322+
323+
### 4.1. 自身有密钥的情况下,AccessToken刷新的方式 { lang="zh-CN" }
324+
325+
::: en
326+
327+
```mermaid
328+
sequenceDiagram
329+
participant OpenList
330+
participant GoogleDrive
331+
OpenList->>GoogleDrive: Provide refresh token + built-in client ID and secret
332+
GoogleDrive->>OpenList: Return new access token + refresh token
333+
```
142334

143-
### 4.1. 自身有密钥的情况下,AccessToken刷新的方式
335+
:::
336+
::: zh-CN
144337

145338
```mermaid
146339
sequenceDiagram
@@ -151,7 +344,30 @@ sequenceDiagram
151344
152345
```
153346

154-
### 4.2.自身没有密钥的情况下,AccessToken刷新的方式
347+
:::
348+
349+
### 4.2. AccessToken refresh method without own keys { lang="en" }
350+
351+
### 4.2.自身没有密钥的情况下,AccessToken刷新的方式 { lang="zh-CN" }
352+
353+
::: en
354+
355+
```mermaid
356+
---
357+
title: How to refresh AccessToken via OnlineAPI?
358+
---
359+
sequenceDiagram
360+
participant OpenList
361+
participant OnlineAPI
362+
participant GoogleDrive
363+
OpenList->>OnlineAPI: Provide refresh token
364+
OnlineAPI->>GoogleDrive: Provide refresh token + built-in client ID and secret
365+
GoogleDrive->>OnlineAPI: Return new access token + refresh token
366+
OnlineAPI->>OpenList: Return new access token + refresh token
367+
```
368+
369+
:::
370+
::: zh-CN
155371

156372
```mermaid
157373
---
@@ -167,7 +383,33 @@ sequenceDiagram
167383
OnlineAPI->>OpenList: 返回新的访问令牌+刷新令牌
168384
```
169385

170-
## 5. 默认使用的哪种下载方式?
386+
:::
387+
388+
## 5. The default download method used { lang="en" }
389+
390+
## 5. 默认使用的哪种下载方式? { lang="zh-CN" }
391+
392+
::: en
393+
394+
```mermaid
395+
---
396+
title: Which download method is used by default?
397+
---
398+
flowchart TB
399+
style c1 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff
400+
style a2 fill:#ff7575,stroke:#333,stroke-width:4px
401+
subgraph ide1 [ ]
402+
c1
403+
end
404+
c1[Local Proxy]:::someclass==Default===>a2[User Device]
405+
classDef someclass fill:#f96
406+
b1[Proxy URL]-.Alternative.->a2[User Device]
407+
click b1 "../drivers/common.html#webdav-policy"
408+
click c1 "../drivers/common.html#webdav-policy"
409+
```
410+
411+
:::
412+
::: zh-CN
171413

172414
```mermaid
173415
---
@@ -185,3 +427,5 @@ flowchart TB
185427
click b1 "../drivers/common.html#webdav-策略"
186428
click c1 "../drivers/common.html#webdav-策略"
187429
```
430+
431+
:::
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39.3 KB
Loading
52.2 KB
Loading
71.3 KB
Loading
32.6 KB
Loading

0 commit comments

Comments
 (0)