diff --git a/pages/guide/drivers/google_drive.md b/pages/guide/drivers/google_drive.md index 15905bfb2..263a576e0 100644 --- a/pages/guide/drivers/google_drive.md +++ b/pages/guide/drivers/google_drive.md @@ -11,11 +11,35 @@ categories: - drivers --- +::: en + +Official website: https://drive.google.com/ + +- Supports Team Drive (Fill in the Team Drive directory ID for the Root Folder ID) + +::: +::: zh-CN + 官网:https://drive.google.com/ - 支持团队盘(根目录ID填写团队盘的目录ID) -## 1. 必要条件 +::: + +## 1. Prerequisites { lang="en" } + +## 1. 必要条件 { lang="zh-CN" } + +::: en + +1. The machine hosting OpenList must be able to connect to Google Drive. + +2. You must enable the Google Drive API service. For details, please refer to [Enable Google Drive API](#21-enable-google-drive-api). + + > Detailed steps can be found in [Google Workspace > Google Drive > Quickstart](https://developers.google.com/workspace/drive/api/quickstart/js) + +::: +::: zh-CN 1. 搭建 OpenList 服务的机器必须能够连接到 Google 网盘。 @@ -23,9 +47,26 @@ categories: > 详细步骤可参考 [Google Workspace > Google Drive > 快速入门指南](https://developers.google.com/workspace/drive/api/quickstart/js) -## 2. 准备接入 +::: + +## 2. Preparation { lang="en" } + +## 2. 准备接入 { lang="zh-CN" } + +### 2.1. Enable Google Drive API { lang="en" } + +### 2.1. 启用 Google Drive API 的 API { lang="zh-CN" } + +::: en + +1. Find the `Enable the API` button on the [Guide Page](https://developers.google.com/workspace/drive/api/quickstart/js), click to enter the quick enable interface, click Next and Confirm to complete the activation. -### 2.1. 启用 Google Drive API 的 API +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 to wait for the enablement to complete. + +3. `Quotas and System Limits Management` (Optional): Switch to the `Quotas` tab and set appropriate quotas and limits according to your usage and needs. + +::: +::: zh-CN 1. 在[指南页面](https://developers.google.com/workspace/drive/api/quickstart/js)中找到`启用API`按钮,点击进入快捷开启界面,点击下一步以及确认后,即可完成开启。 @@ -33,7 +74,38 @@ categories: 3. `配额和系统限制管理`(可选):切换到`配额和系统限制`选项卡,根据你的使用情况和需求,设置合适的配额和限制。 -### 2.2. 创建 OAuth 客户端(可选,如果使用OpenList/公益服务器/自建服务器,则不用创建) +::: + +### 2.2. Create OAuth Client (Optional) { lang="en" } + +### 2.2. 创建 OAuth 客户端(可选,如果使用OpenList/公益服务器/自建服务器,则不用创建) { lang="zh-CN" } + +::: en + +**If you are using OpenList, a public server, or a self-hosted server with built-in keys, you do not need to create this.** + +1. In the [Credentials Interface](https://console.cloud.google.com/apis/credentials?hl=en), click the `Create Credentials` drop-down menu, select and click `OAuth client ID`. + + ![google-ouath-00](/img/drivers/google/google-ouath-00-en.png) + +2. In the pop-up window, select `Web application` and fill in the application name. + +3. In `Authorized redirect URIs`, fill in `https://api.oplist.org/googleui/callback`. If it is a self-built or public service, please fill in the corresponding domain name, such as `https://your-domain.com/googleui/callback`. + +4. Click the `Create` button to complete the creation of the OAuth client. Note: Please copy and save the `Client ID` and `Client Secret`, which will be needed later. + + ![google-ouath-00](/img/drivers/google/google-ouath-01-en.png) + +5. Add yourself to the test users. Find the `OAuth consent screen` menu on the left, enter it, find the `+ Add Users` button under `Test users`, click it, enter your Google account email address, and click Add. + + ![google-ouath-02](/img/drivers/google/google-ouath-02-en.png) + +6. After testing, you can publish the application. Find the `OAuth consent screen` menu on the left, enter it, find the `Publish App` button under `Publishing status`, click it, and confirm the publication to complete the application publication. + + ![google-ouath-03](/img/drivers/google/google-ouath-03-en.png) + +::: +::: zh-CN 1. 在[凭据界面](https://console.cloud.google.com/apis/credentials?hl=zh-cn)中,点击`创建凭据`下拉菜单,选择和点击`OAuth 客户端 ID` @@ -55,7 +127,50 @@ categories: ![google-ouath-03](/img/drivers/google/google-ouath-03.png) -### 2.3. 获取`访问密钥`和`刷新密钥` +::: + +### 2.3. Get `Access Token` and `Refresh Token` { lang="en" } + +### 2.3. 获取`访问密钥`和`刷新密钥` { lang="zh-CN" } + +::: en + +1. Open [OpenList Google Auth Page](https://api.oplist.org/) **⚠️ If using a public server/self-hosted server, please visit the public server/self-hosted server address.** + +2. Select `GoogleDrive Login` in the drop-down box on the page. + + ![google-00-l](/img/drivers/google/google-00-l.png#light) + ![google-00-d](/img/drivers/google/google-00-d.png#dark) + +3. If you created an OAuth Client ID in the previous steps, please enter the `Client ID` and `Client Secret` you just created in the input box below. + + ![google-01-01-l](/img/drivers/google/google-01-01-l.png#light) + ![google-01-01-d](/img/drivers/google/google-01-01-d.png#dark) + + Otherwise, check ☑️ Use the API provided by OpenList. **⚠️ If using a public server/self-hosted server, this uses the built-in Client ID and Client Secret of the public/self-hosted server.** + + ![google-01-02-l](/img/drivers/google/google-01-02-l.png#light) + ![google-01-02-d](/img/drivers/google/google-01-02-d.png#dark) + +4. Click the `Get Authorization` button. The system will jump to the Google authorization page. Log in to your Google account and authorize OpenList to access your Google Drive. + + ![google-02](/img/drivers/google/google-02.png) + +5. If the prompt `This app is not verified by Google` appears, please click `Advanced` and then click `Go to oplist.org (unsafe)` to continue. (If it is a public server/self-hosted server, the domain name here is subject to the actual public service domain name, please identify it carefully). + + ![google-03](/img/drivers/google/google-03.png) + +6. Please pay attention to the permission information on the authorization page (in the red box below), and ensure that it **only** accesses your **Google Drive files**. If you find that the permission is not just to access **Google Drive** in the public service, please raise an issue at [openlistteam/docs/issues](https://github.com/openlistteam/docs/issues). + + ![google-04](/img/drivers/google/google-04.png) + +7. After successful authorization, the system will return a `Refresh Token` and `Access Token`. Please copy and save the token for use in subsequent configurations. + + ![google-05-l](/img/drivers/google/google-05-l.png#light) + ![google-05-d](/img/drivers/google/google-05-d.png#dark) + +::: +::: zh-CN 1. 打开[OpenList Google 授权页面](https://api.oplist.org/) **⚠️如果使用公益服务器/自建服务器,请访问公益服务器/自建服务器** @@ -91,17 +206,78 @@ categories: ![google-05-l](/img/drivers/google/google-05-l.png#light) ![google-05-d](/img/drivers/google/google-05-d.png#dark) -## 3. 在 OpenList 中添加谷歌云盘 +::: + +## 3. Add Google Drive in OpenList { lang="en" } + +## 3. 在 OpenList 中添加谷歌云盘 { lang="zh-CN" } + +### 3.1. Configuration { lang="en" } + +### 3.1. 配置说明 { lang="zh-CN" } -### 3.1. 配置说明 +#### 3.1.1. Root Folder ID { lang="en" } -#### 3.1.1. **根文件夹 ID** +#### 3.1.1. **根文件夹 ID** { lang="zh-CN" } + +::: en + +Similar to Aliyun Drive, it is the last string of the official website URL, such as: + +![google](/img/drivers/google/googledrive-dir.png) + +::: +::: zh-CN 与阿里云盘类似,官网 URL 的最后一个字符串,如: ![google](/img/drivers/google/googledrive-dir.png) -### 3.2. 开始添加 +::: + +### 3.2. Start Adding { lang="en" } + +### 3.2. 开始添加 { lang="zh-CN" } + +::: en + +1. Open the OpenList management interface and click `Storage` in the left menu. + +2. On the storage list page, click the `Add Storage` button in the upper right corner. + +3. Select the driver as `Google Drive`. + + ![google-06-l](/img/drivers/google/google-06-l-en.png#light) + ![google-06-d](/img/drivers/google/google-06-d-en.png#dark) + +4. Enter the mount path, such as: `google-drive`. + +5. Fill in the `Root folder ID` obtained above. If you use the root directory, please fill in `root`. + +6. Fill in the `Refresh Token` obtained above (if not obtained, please refer to [Preparation](#_2-preparation)). + +7. If you use the OAuth Client ID and Secret provided by `OpenList (or Public Server/Self-hosted Server)`, please configure according to `7.1` and `7.2`. + + 7.1. Check `Use online api`, indicating to use the online API provided by OpenList. + + 7.2. Fill in the API URL address as `https://api.oplist.org/googleui/renewapi`. If it is `Public Server/Self-hosted Server`, please fill in the corresponding server address. + + ![google-07-d](/img/drivers/google/google-07-d.png#dark) + ![google-07-l](/img/drivers/google/google-07-l.png#light) + +8. If you use the OAuth Client ID and Secret created by yourself, please configure according to `8.1` and `8.2`. + + 8.1. Uncheck `Use online api`, indicating to use the self-built OAuth Client ID and Secret. + + 8.2. Fill in your `OAuth Client ID` in `Client ID` and your `OAuth Client Secret` in `Client Secret`. + + ![google-08-l](/img/drivers/google/google-08-l-en.png#light) + ![google-08-d](/img/drivers/google/google-08-d-en.png#dark) + +9. Click the `Add` button to complete the addition of Google Drive. + +::: +::: zh-CN 1. 打开 OpenList 的管理界面,点击左侧菜单中的`存储`。 @@ -138,9 +314,28 @@ categories: 9. 点击`添加`按钮,完成谷歌云盘的添加。 -## 4. 关于`Use online api`选项的说明 +::: + +## 4. About `Use online api` option { lang="en" } + +## 4. 关于`Use online api`选项的说明 { lang="zh-CN" } + +### 4.1. AccessToken refresh method with own keys { lang="en" } + +### 4.1. 自身有密钥的情况下,AccessToken刷新的方式 { lang="zh-CN" } + +::: en + +```mermaid +sequenceDiagram + participant OpenList + participant GoogleDrive + OpenList->>GoogleDrive: Provide refresh token + built-in client ID and secret + GoogleDrive->>OpenList: Return new access token + refresh token +``` -### 4.1. 自身有密钥的情况下,AccessToken刷新的方式 +::: +::: zh-CN ```mermaid sequenceDiagram @@ -151,7 +346,30 @@ sequenceDiagram ``` -### 4.2.自身没有密钥的情况下,AccessToken刷新的方式 +::: + +### 4.2. AccessToken refresh method without own keys { lang="en" } + +### 4.2.自身没有密钥的情况下,AccessToken刷新的方式 { lang="zh-CN" } + +::: en + +```mermaid +--- +title: How to refresh AccessToken via OnlineAPI? +--- +sequenceDiagram + participant OpenList + participant OnlineAPI + participant GoogleDrive + OpenList->>OnlineAPI: Provide refresh token + OnlineAPI->>GoogleDrive: Provide refresh token + built-in client ID and secret + GoogleDrive->>OnlineAPI: Return new access token + refresh token + OnlineAPI->>OpenList: Return new access token + refresh token +``` + +::: +::: zh-CN ```mermaid --- @@ -167,7 +385,33 @@ sequenceDiagram OnlineAPI->>OpenList: 返回新的访问令牌+刷新令牌 ``` -## 5. 默认使用的哪种下载方式? +::: + +## 5. The default download method used { lang="en" } + +## 5. 默认使用的哪种下载方式? { lang="zh-CN" } + +::: en + +```mermaid +--- +title: Which download method is used by default? +--- +flowchart TB + style c1 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff + style a2 fill:#ff7575,stroke:#333,stroke-width:4px + subgraph ide1 [ ] + c1 + end + c1[Local Proxy]:::someclass==Default===>a2[User Device] + classDef someclass fill:#f96 + b1[Proxy URL]-.Alternative.->a2[User Device] + click b1 "../drivers/common.html#webdav-policy" + click c1 "../drivers/common.html#webdav-policy" +``` + +::: +::: zh-CN ```mermaid --- @@ -185,3 +429,5 @@ flowchart TB click b1 "../drivers/common.html#webdav-策略" click c1 "../drivers/common.html#webdav-策略" ``` + +::: diff --git a/public/img/drivers/google/google-06-d-en.png b/public/img/drivers/google/google-06-d-en.png new file mode 100644 index 000000000..7adf84ab3 Binary files /dev/null and b/public/img/drivers/google/google-06-d-en.png differ diff --git a/public/img/drivers/google/google-06-l-en.png b/public/img/drivers/google/google-06-l-en.png new file mode 100644 index 000000000..838965c3d Binary files /dev/null and b/public/img/drivers/google/google-06-l-en.png differ diff --git a/public/img/drivers/google/google-08-d-en.png b/public/img/drivers/google/google-08-d-en.png new file mode 100644 index 000000000..009f7930a Binary files /dev/null and b/public/img/drivers/google/google-08-d-en.png differ diff --git a/public/img/drivers/google/google-08-l-en.png b/public/img/drivers/google/google-08-l-en.png new file mode 100644 index 000000000..b87abcb6e Binary files /dev/null and b/public/img/drivers/google/google-08-l-en.png differ diff --git a/public/img/drivers/google/google-ouath-00-en.png b/public/img/drivers/google/google-ouath-00-en.png new file mode 100644 index 000000000..36aee0527 Binary files /dev/null and b/public/img/drivers/google/google-ouath-00-en.png differ diff --git a/public/img/drivers/google/google-ouath-01-en.png b/public/img/drivers/google/google-ouath-01-en.png new file mode 100644 index 000000000..433b68ea5 Binary files /dev/null and b/public/img/drivers/google/google-ouath-01-en.png differ diff --git a/public/img/drivers/google/google-ouath-02-en.png b/public/img/drivers/google/google-ouath-02-en.png new file mode 100644 index 000000000..63869dfb7 Binary files /dev/null and b/public/img/drivers/google/google-ouath-02-en.png differ diff --git a/public/img/drivers/google/google-ouath-03-en.png b/public/img/drivers/google/google-ouath-03-en.png new file mode 100644 index 000000000..30e5d4c42 Binary files /dev/null and b/public/img/drivers/google/google-ouath-03-en.png differ