Before we start | 开始之前
Before we get into today’s tutorial, you will need four things:
在开始今天的教程之前,你需要准备好四样东西:
Which are all free to get, so upon finish this guide, you will have a UNLIMITED storage drive for FREE.
前两个账户都是免费注册,后面2个软件也都是免费的,所以可以真正做到零成本搭建无线空间网盘。
Get an Unlimited Team Drive | 找一个无线空间的团队网盘
你需要一个edu或者商业账户,才能够拥有无限的谷歌云盘空间。获取地址:https://edu.google.com/
Setup google drive with rclone | 使用rclone设置Google Drive
Download rclone here (https://rclone.org/downloads/) | 下载rclone软件
Extract the rclone or rclone.exe binary from the archive | 解压到你想放的目录
Run rclone config
to start setup | 运行rclone config
命令开始配置
Setup Process | 配置过程
Run CMD on the rclone directory, the type rclone config
to start setup process.
首选我们需要在rclone所在的文件夹启动CMD程序,并且输入rclone config
开始配置
No remotes found - make a new one n) New remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config n/r/c/s/q> n name> remote Type of storage to configure. Choose a number from below, or type in your own value
We choose n to create a New remote then type any name you like, when rclone ask us to choose a type of storage, here, we will type 13 to choose Google Drive, as demonstrated in the picture below:
首选我们选择n去创建一个新的配置,并且随便输入一个想要定义的名字,之后rclone会问你需要链接哪个储存,我们输入13去选择Google Drive,如下图所示:
Google Application Client Id - leave blank normally. client_id> Google Application Client Secret - leave blank normally. client_secret>
Then rclone will ask for your google application client id and secret, you CAN leave it blank to use the default one comes with rclone. But it is highly recommended to set up your own since the default one is shared between all the rclone users and can be low performance. (If you want to leave it blank, just press ENTER)
之后rclone会问你要你的谷歌应用的client id 和 secret,在这里你可以留空,如果留空的话,rclone会默认使用它内置的client id和secret。但是在这里我强烈建议大家用自己的,因为如rclone官网所说,默认的是和所有rclone用户共享的,所以可能表现效果上不会特别好。(如果你想留空,直接按回车键即可)
How to get your own client_id and secret | 如果获取你自己的client id和secret
If you are using default client_id and secret, you can pass this section.
如果你使用的是默认的client id和secret,你可以跳过这一小节
- Log into the Google API Console with your Google account. It doesn’t matter what Google account you use. (It need not be the same account as the Google Drive you want to access) | 用你的谷歌账户登录Google API Console
- Select a project or create a new project. | 选择一个项目或新建一个项目
- Under “ENABLE APIS AND SERVICES” search for “Drive”, and enable the “Google Drive API”. | 在启用API和服务选项下搜索Drive,找到Google Drive并选择开启
- Click “Credentials” in the left-side panel (not “Create credentials”, which opens the wizard), then “Create credentials”, then “OAuth client ID”. It will prompt you to set the OAuth consent screen product name, if you haven’t set one already. | 我们选择左侧的”凭据” 并选择创建凭据,之后选择OAuth客户端ID。如果你是第一次使用,它会带你到OAuth同意屏幕,你需要设置一个应用名称并且保存即可
- Choose an application type of “other”, and click “Create”. (the default name is fine) | 我们选择应用类型为其它并且选择创建(默认名称是OK的)
- It will show you a client ID and client secret. Use these values in rclone config to add a new remote or edit an existing remote. | 之后它会显示你的client id和secret,这两个就是我们需要在rclone里使用的
Create new project
Create OAuth client ID
Continue Setup rclone | 继续配置rclone
After you get your client_id and secret, paste it in rclone. The choose scope 1 as requested.
当你得到你自己的client id和secret之后,粘贴到rclone对应的位置内,之后在scope选项,我们输入1回车,给与rclone所有操作文件的权限。
Scope that rclone should use when requesting access from drive. Choose a number from below, or type in your own value 1 / Full access all files, excluding Application Data Folder. \ "drive" 2 / Read-only access to file metadata and file contents. \ "drive.readonly" / Access to files created by rclone only. 3 | These are visible in the drive website. | File authorization is revoked when the user deauthorizes the app. \ "drive.file" / Allows read and write access to the Application Data folder. 4 | This is not visible in the drive website. \ "drive.appfolder" / Allows read-only access to file metadata but 5 | does not allow any access to read or download file content. \ "drive.metadata.readonly" scope> 1
Get Root folder ID | 获取根目录ID
ID of the root folder - leave blank normally. Fill in to access "Computers" folders. (see docs). root_folder_id>
Since we will not using the default root folder, so we will need to set a root folder ID, you can find your desired root folder id by openning the relevant folder in the drive web interface.
因为我们在这里使用的是团队盘,不是默认的根目录,所以我们需要在rclone里设定好自己需要的根目录,我们可以通过在Google drive网页端打开我们相应的团队盘去获取我们的根目录ID
This will be the last segment of the URL when you open the relevant folder in the drive web interface.
我们的根目录ID即是我们最后一段的URL网址
So if the folder you want rclone to use has a URL which looks like https://drive.google.com/drive/folders/1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh in the browser, then you use 1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh as the root_folder_id in the config.
比如说我们的团队盘在Google drive网页端的网址是 https://drive.google.com/drive/folders/1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh,那么我们的根目录ID就是最后这一段代码1XyfxxxxxxxxxxxxxxxxxxxxxxxxxKHCh
After you set up your root folder ID, use the default setting for the next two questions. Then choose Yes for the team drive and select your desired team drive to be indexed. After that, you are all set.
当我们设置好我们的根目录ID之后,接下来的两个问题我们保持默认直接回车即可。之后当rclone询问我们是否将这个配置成团队盘时,我们选择Y确认
Now copy the client_id, client_secret, root_folder_id and refresh_token for the next section.
到这里,我们复制保存好rclone显示的client id,client secret,root folder id和refresh token 这四样东西备用
Change Goindex Config | 更改Goindex设置
First, download index.js file HERE
首选我们在上面的网址中下载好我们的index.js文件
Use any editor you like to open index.js file, and change the client_id, client_secret, root_folder_id and refresh_token with one you just got from rclone.
用任意我们喜欢的编辑器打开我们的index.js文件,之后将client_id, client_secret, root_folder_id, refresh_token四样东西换成我们rclone里复制好的四样
You can also change the site name and root password if you want. (This will be your website name and the password)
你同样也可以更换你的网站名称和根目录密码,如果你需要的话
Deploy to Cloudflare | 部署到Cloudflare
Open Cloudflare, Login and choose Workers (You need to set up your own subdomain if you use it for the first time, it can’t be changed once setted)
打开Cloudflare,登录并且选择右边的Workers (如果你是第一次使用,你需要设置一个自己想要的子域名,一旦设定不可更改)
After you have set up your subdomain, then select create a worker, copy and paste all the content in the index.js file to the workers and change the name if you want.
当你设置好你自己的子域名后,我们选择创建一个Worker,复制并且粘贴所有已经替换好内容的index.js文件内的内容,并且更改好部署名称
Once you finished, hit save and deploy and go check out your new unlimited storage drive index from the url you just defined.
当你完成后,点击保存并且部署,之后你就可以访问你自己设定好的网址去查看你新建的无线空间网盘了。
Video Tutorial | 视频教程
Youtube
Bilibili
https://www.bilibili.com/video/av92894985/