G-Index [DarkMode + MultiAuth + English] + TD Maker + Custom Domain[.ga] Tutorial
Alpha FolkerWhat is G-Index?
G-Index stands for Google Drive Directory Index. It is a serverless Google Drive directory indexing program that can be deployed on Cloudflare Workers. It can list Google Drive files in the form of a directory and can be downloaded through a straight chain. Since traffic is transferred through Cloudflare, it can be used freely even in a restricted network environment. This tutorial explains the deployment process of G-Index using a custom API, which is theoretically safer and faster to download.
How it is different from other Indexes?
First of all available indexes are in chinese and you have to fork them to make changes
But I took the code and changed all chinese to english, other Features are:
- Video Player - | mp4 | webm | avi | mpg | mpeg | mkv | rm | rmvb | mov | wmv | asf | ts | flv
- Music Player - | mp3 | flac | wav | ogg | m4a
- Document Viewer - | html | php | css | go | java | js | json | txt | sh | md | pdf
- Image Viewer - | bmp | jpg | jpeg | png | gif
- Multi drive encryption + Multi Level Authentication
- Mobile Friendly
- Multi-level Search within the team drive
- DarkTheme Main Color:
red | pink | purple | deep-purple | indigo | blue | light-blue | cyan | teal | green | light-green | lime yellow | amber orange | deep-orange | brown | greyblue-grey
- Accent Color:
red | pink | purple | deep-purple | indigo | blue | light-blue | cyan | teal | green | light-green | lime | yellow | amber | orange | deep-orange
- darkmode: true/false
- protect_file_link: true/false
Ready to Deploy:
Open index.js and you can see some parameters that can be modified freely
It is advised to use your own client id, and client secret which we will discuss later
You can set multiple drive indexes and enable/disable file sharing link in v2.0
"enable_password_file_verify": false //Found below the roots
Get client_id and client_secret
NOTICE: Some education mailboxes may not be able to open the API. This is because the administrator does not have open permissions. You can use your own account to create the API.
- Create an OAuth client ID . The first creation will allow you to configure the consent screen, fill in the application name and save it directly.
- Then you can see the client ID (client_id) and client secret (client_secret), copy and save it.
Get refresh_token
- Install Rclone
- Enter the
rclone config
command, the following message will appear, please follow as shown.
rclone config
...
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> n # Select n to create
name> gd
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / 1Fichier
\ "fichier"
2 / Alias for an existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Citrix Sharefile
\ "sharefile"
9 / Dropbox
\ "dropbox"
10 / Encrypt/Decrypt a remote
\ "crypt"
11 / FTP Connection
\ "ftp"
12 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
13 / Google Drive
\ "drive"
14 / Google Photos
\ "google photos"
15 / Hubic
\ "hubic"
16 / JottaCloud
\ "jottacloud"
17 / Koofr
\ "koofr"
18 / Local Disk
\ "local"
19 / Mail.ru Cloud
\ "mailru"
20 / Mega
\ "mega"
21 / Microsoft Azure Blob Storage
\ "azureblob"
22 / Microsoft OneDrive
\ "onedrive"
23 / OpenDrive
\ "opendrive"
24 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
25 / Pcloud
\ "pcloud"
26 / Put.io
\ "putio"
27 / QingCloud Object Storage
\ "qingstor"
28 / SSH/SFTP Connection
\ "sftp"
29 / Transparently chunk/split large files
\ "chunker"
30 / Union merges the contents of several remotes
\ "union"
31 / Webdav
\ "webdav"
32 / Yandex Disk
\ "yandex"
33 / http Connection
\ "http"
34 / premiumize.me
\ "premiumizeme"
Storage> 13 # Choose 13 / Google Drive
** See help for drive backend at: https://rclone.org/drive/ **
Google Application Client Id
Setting your own is recommended.
See https://rclone.org/drive/#making-your-own-client-id for how to create your own.
If you leave this blank, it will use an internal key which is low performance.
Enter a string value. Press Enter for the default ("").
client_id> # Enter the client ID
Google Application Client Secret
Setting your own is recommended.
Enter a string value. Press Enter for the default ("").
client_secret> # Enter the client key
Scope that rclone should use when requesting access from drive.
Enter a string value. Press Enter for the default ("").
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 # Full permission access
ID of the root folder
Leave blank normally.
Fill in to access "Computers" folders (see docs), or for rclone to use
a non root folder as its starting point.
Note that if this is blank, the first time rclone runs it will fill it
in with the ID of the root folder.
Enter a string value. Press Enter for the default ("").
root_folder_id> # Leave blank and press enter
Service Account Credentials JSON file path
Leave blank normally.
Needed only if you want use SA instead of interactive login.
Enter a string value. Press Enter for the default ("").
service_account_file> # Leave blank and press enter
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n # Enter n
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/XXXXXXX
Log in and authorize rclone for access # Copy the link above to open it in your browser for authorization
You can follow images
In the browser, you may encounter the prompt in the figure below, this is because the API was created by us and has not been verified by Google.
Get root directory ID (root)
The root directory here refers to the root directory displayed by G-Index, which can be any directory in your network disk. Open the network disk to locate a directory or shared directory, the code at the end of the URL in the address bar is the directory ID. If the personal network disk parameter is left blank, it is the root directory of the network disk.
Example: https://drive.google.com/drive/u/1/folders/###########PVA
Create Workers
- Log in to Cloudflare and click Workers on the right.
- Create a new Workers subdomain.
TIPS: It cannot be changed in the future, so don't fill in randomly.
- Click to
Create a Worker
create a new worker
- Clear the content in the input box, paste the modified G-Index code, and then you can double-click the domain name to modify in the upper left corner, and then click
Save and Deploy
.
- The last
****.workers.dev
thing you get is your G-Index address, example https://g-d.rive.workers.dev
Custom domain name
- Get a free .ga domain (http://www.my.ga/en/index.html?lang=en) by following on screeen instructions
- Add a CNAME record to the address previously obtained.
- Then go to Workers and click
ADD route
- Enter the custom domain name, you need to pay attention to add it later
/*
, for example, example *.mechabot.ga/*
, the following workers select the project created before.
- If you want http to automatically jump to https, you need to enable it
Always Use HTTPS
:
- Create a record in DNS MANAGEMENT for .ga domain
- Enjoy your Google Drive Index with custom domain!
Team Drive Maker
Get Required Data from
Note: You must have permissions to create shared drive in your account. This doesn't work with GMAIL Accounts, Required Gsuite Business+ Accounts. To check Open Google Drive and try to create Shared Drive first.
- Open Google Cloud Console
- After creating project or if you already have one.
- Enable Drive API from Here
- Click create credentials.
- Select OAuth client ID.
- Select Web application.
- Give it a name. (anything for your own reference)
- In Authorized JavaScript origins add
https://developers.google.com
- In Authorized redirect URIs add
https://developers.google.com/oauthplayground
- Save and note down your Client ID and Secret
- Open Developers Playground
- On Right Top Side click on Setting Icon
- Click on Use your own OAuth credentials.
- Enter OAuth Client ID: and OAuth Client secret:
- Now back to same page Developers Playground left side Step 1 i.e. Select & authorize APIs
- Find Drive API v3
- Select First Option i.e. https://www.googleapis.com/auth/drive (Required)
- Click on Authorize API. and give permissions using your google account.
- It will turn to Step 2 Exchange authorization code for tokens at the end of authentication.
- Click on Exchange authorization code for tokens, if it goes to step 3, click on Step 2 yourself.
- Select the option Auto-refresh the token before it expires.
- Copy the refresh token and paste in maker.js along with your own Client ID and Secret, your own logo, icons etc as per your taste
- Copy the Code and paste it into https://workers.cloudflare.com Site.
- Change code accordingly and modify your background, icons, logo as per your taste!
CREDITS
G-index initial code: https://github.com/yanzai/goindex
TD Maker: https://github.com/ParveenBhadooOfficial/Create-Google-Shared-Drive