Update readme and todo

This commit is contained in:
mbaharip
2023-05-08 16:33:51 +07:00
parent 99cf117c94
commit 44aa1870fa
2 changed files with 120 additions and 112 deletions
+38 -39
View File
@@ -1,16 +1,9 @@
![next-gdrive-index](./public/og.png)
## Status
### Project halted at the moment.
Found out it's not cfworker fault, but Google Drive API is the one that slow.
It took 500ms to 1s response time to fetch files, took longer if it's inside protected folder.
It can be faster if I'm using `@upstash/redis` to cache the response, but for free tier it capped on 10k request per day. (It should've enough for most people)
I'm currently working on a workaround for this, but it's not a priority for me at the moment.
~~Currently still in development, ~~but main features are already working as intended.~~ Preview and download files are not working because of Vercel's limit for serverless function. Working on a workaround for this.~~
~~You can check the demo [here](https://drive.mbaharip.com).~~
Basic features are working now, can be used for daily use.
You can check the demo [here](https://drive.mbaharip.com).
## What is this?
`next-gdrive-index` is an indexer for Google Drive, it's a simple project that I made to index my files in Google Drive.
@@ -18,7 +11,7 @@ It's aim to simplify the process of sharing files using Google Drive, and also i
This project are **HEAVILY INSPIRED** by [onedrive-vercel-index](https://github.com/spencerwooo/onedrive-vercel-index) by SpencerWooo.
### Why?
### Why I made this?
I know there already some Google Drive indexer out there, but all of them are using **Cloudflare** worker.
I've tried to use it, but the speed isn't that great for me.
Currently I'm using SpencerWooo's onedrive index, and it's working perfectly for me from usage perspective and speed.
@@ -29,45 +22,51 @@ For free plan, Google Drive offering 15GB of storage, and Onedrive offering 5GB
I know there are a lot of people selling cheap edu account for Google Drive and Onedrive, but most of the time those account doesn't last long, especially Google Drive account. So I want to do it legit without buying cheap edu account or anything similar this time.
## Features
### Navigate through your Google Drive files and folders.
You can navigate through your Google Drive files and folders, just like you're browsing your local files.
You can also set the root folder, so you can share only specific folder in your Google Drive.
### Theme support.
Choose your side!
### Site wide password protection.
You can lock the site so only those who know the password can access it.
NOTE: This only protect the site, not the files. The files are still accessible if you know the link.
### Search for files and folders.
We implement native search for files and folders, so you can search for files and folders easily.
### File preview for some file types.
You can preview some file types directly from the browser, without downloading it first.
Most files are Images, Videos, Audio, Markdown, and PDF. (I'm still adding more file types)
### Direct download for files.
Download files directly from index site without opening Google Drive.
### Raw file link for files.
You can use the raw file link for hosting your web project assets or comments on forum.
### Embed your readme file for folder.
You can embed your readme file for folder, so you can add some description for your folder.
Simply upload `.readme.md` on your folder, and it will be displayed on the folder page.
### Override folder OpenGraph image.
You can override the folder OpenGraph image by uploading `.banner.(png/jpg/jpeg/webp/svg)` on your folder.
## Credits
- [onedrive-vercel-index](https://github.com/spencerwooo/onedrive-vercel-index) by SpencerWooo for the inspiration and also some file type helpers.
---
## Known Issues
- Fetching files from Google Drive API take too much time, it triggers 504 Error on Vercel.
- ~~Fetching files from Google Drive API take too much time, it triggers 504 Error on Vercel.~~
- ~~Can't download big files, because of Vercel's 4.5MB limit for serverless function.~~ (Implement redirect to Google Drive download link instead of using Vercel serverless function for files bigger than 4MB)
- Need to set the folder to public, so it can be downloaded directly from Google Drive.
- The way to get files are changed because of this, now it's using the file name, and 8 first character of file id for hiding the id so no one can access it via Google Drive.
- All id and webContentLink are now encrypted using AES-128-CBC.
- Protected folder cause long response time, because it need to fetch the file / folder first > fetch each of the parents till root > check if it's inside protected folder > then checking the password.
- Download might show scan warning, because it's using Google Drive's direct download link.
- Download might show scan warning, because it's using Google Drive's direct download link.
## TODO
- [ ] Aim for max 1.5s response time for every API routes
- Fetch all routes - 600~900ms (OK)
- Fetch file or folder - 700~1400ms (OK)
- Breadcrumb - 900~1400ms (OK)
- Readme - 1100~1200ms (OK)
- Banner - 500~800ms (OK)
- [x] Navigate through folders
- [ ] Use banner for OG image
- [ ] File preview
- [x] Audio
- [x] Code
- [x] Default
- [x] Image
- [x] Markdown
- [ ] 3D Model
- [ ] Office files (Word, Excel, PowerPoint)
- [x] PDF
- [x] Text
- [x] Video
- [x] Search for files
- [x] Direct view the files
- [x] Download files
- [x] Render Readme file
- [ ] Password protection
- [ ] Create token hash for sharing protected ~~files that valid for x hours~~
- [ ] Implement time limit for token
- [x] ~~Pretty path URL~~ ~~(Not possible, since Google Drive allowing multiple files with same name)~~ (Kinda pretty now, it consist of the file name, then 8 character of file id for security)
Todo list are moved to [here](./TODO.md).
+82 -73
View File
@@ -6,95 +6,104 @@ Probably also include some ideas that I want to implement in the future.
## Frontend
### General
- ~~Site wide password protection~~
- Migrate to app directory (?)
### Navbar `8/8 Completed`
- [x] Responsive
- [x] Search
- [x] Open / Close search modal
- [x] Search for files or folder
- [x] Configurable search limit
- [x] Close search modal when click outside of modal
- [x] Theme
- [x] Switch theme
- [x] Store theme preference in local storage
- [x] Navbar menu
- ~~Search for files~~
- ~~Open / Close search modal~~
- ~~Search for files or folder~~
- ~~Configurable search limit~~
- ~~Close search modal when click outside of modal~~
- ~~Theme~~
- ~~Switch theme~~
- ~~Store theme preference in local storage~~
- ~~Navbar menu~~
### View bar (Top bar) `9/10 Completed`
### Layout Container `10/10 Completed`
This part contains only breadcrumb and view selection.
- [x] Breadcrumb
- [x] Fetch breadcrumb
- [x] Navigate through breadcrumb
- [x] Limit breadcrumb
- [x] Add `...` if breadcrumb is too long
- [ ] Add ellipsis if current file name is too long
- [x] Configurable breadcrumb limit
- [x] Layout view
- [x] Grid view
- [x] List view
- [x] Store view preference in local storage
- [x] Close view selection when click outside
- ~~Breadcrumb~~
- ~~Fetch breadcrumb~~
- ~~Navigate through breadcrumb~~
- ~~Limit breadcrumb~~
- ~~Add `...` if breadcrumb is too long~~
- ~~Add ellipsis if current file name is too long~~
- ~~Configurable breadcrumb limit~~
- ~~Layout view~~
- ~~Grid view~~
- ~~List view~~
- ~~Store view preference in local storage~~
- ~~Close view selection when click outside~~
### Home `/` | `4/5 Completed`
- [x] Fetch files
- [x] Fetch readme if exist
- [x] ~~Fetch banner if exist~~ Fetch banner in server side for Opengraph Image
- [x] Pagination
- [ ] Protected root folder
- ~~Fetch files~~
- ~~Fetch readme if exist~~
- ~~Fetch banner if exist~~
- ~~Pagination~~
- Protected folder
### Folder `/folder/:id` | ``
- [ ] Server side check if folder exist, if not redirect to 404 page
- [ ] Fetch files
- [ ] Fetch readme if exist
- [ ] Fetch banner in server side for Opengraph Image
- [ ] Protected folder
### Folder `/folder/:id` | `5/6 Completed`
- ~~Check if folder exist~~
- ~~Fetch files~~
- ~~Fetch readme if exist~~
- ~~Fetch banner if exist~~
- ~~Pagination~~
- Protected folder
### File `/file/:id` | ``
## Backend
### General
Since Google Drive direct download need the file to be public, I implement the `partial file id` to keep people from directly accessing the Google Drive itself, and also encrypt the `id` and `webContentLink` from Google Drive API to ensure that no one can access the file directly from Google Drive.
- [x] Change `fileId` to `{file name}:{partial file id}`
- [x] Encrypt `id` and `webContentLink`
- [x] Making sure response time is fast enough. Aim for max 1.5s.
- [x] Fetch root folder `600~900ms`
- [x] Fetch file or folder `700~1400ms`
- [x] Fetch breadcrumb `900~1500ms`
- [x] Fetch readme `1100~1200ms`
- [ ] Fetch readme from specific folder `1200~1600ms`
- [x] Fetch banner `500-800ms`
- [x] Fetch banner from specific folder `500~800ms`
- [ ] Protect folder
### Fetch files `/api/files` | `14/17 Completed`
- [x] Fetch file
- [x] Fetch folder
- [x] Paginated
- [x] Fetch info regarding readme file
- [x] Fetch info regarding banner file
- [x] Fetch info regarding password file (Not used yet)
- [ ] Download file
- [x] Redirect to Google Drive download link instead of using Vercel serverless function for files bigger than 4MB
- [x] Only allow for files
- [ ] Files inside protected folder
- [x] Get thumbnail for files
- [ ] Get banner inside folder
- [x] Only if banner file is inside the folder
- [ ] Redirect to Google Drive download link instead of using Vercel serverless function for files bigger than 4MB
- [ ] Check if banner file is image
- [x] Generate breadcrumb
- [x] On folder
- [x] On file
- [x] Hide root folder
- [x] Limiting breadcrumb length
- ~~Change `fileId` to `{file name}:{partial file id}`~~
- ~~Encrypt `id` and `webContentLink`~~
- ~~Making sure response time is fast enough. Aim for max 1.5s.~~
- ~~Fetch root folder `600~900ms`~~
- ~~Fetch file or folder `700~1400ms`~~
- ~~Fetch breadcrumb `900~1500ms`~~
- ~~Fetch readme `1100~1200ms`~~
- ~~Fetch readme from specific folder `1200~1500ms`~~
- ~~Fetch banner `500-800ms`~~
- ~~Fetch banner from specific folder `500~800ms`~~
- Protect folder
### Get readme data `/api/readme` | `1/2 Completed`
### Fetch files `/api/files` | `16/17 Completed`
- ~~Fetch file~~
- ~~Fetch folder~~
- ~~Paginated~~
- ~~Fetch info regarding readme file~~
- ~~Fetch info regarding banner file~~
- ~~Fetch info regarding password file~~ (Not used yet)
- Download file
- ~~Redirect to Google Drive download link instead of using Vercel serverless function for files bigger than 4MB~~
- ~~Only allow for files~~
- Files inside protected folder
- ~~Get thumbnail for files~~
- ~~Get banner inside folder~~
- ~~Only if banner file is inside the folder~~
- ~~Redirect to Google Drive download link instead of using Vercel serverless function for files bigger than 4MB~~
- ~~Check if banner file is image~~
- ~~Generate breadcrumb~~
- ~~On folder~~
- ~~On file~~
- ~~Hide root folder~~
- ~~Limiting breadcrumb length~~
### Get readme data `/api/readme` | `2/2 Completed`
This API route doesn't need authorization, because it's only used for getting readme data.
- [x] Get root folder readme
- [ ] Get specific folder readme
- ~~Get root folder readme~~
- ~~Get specific folder readme~~
### Get banner file id `/api/banner` | `2/2 Completed`
This API route doesn't need authorization, because it's only used for getting banner file id for Opengraph Image.
- [x] Get root folder banner
- [x] Get specific folder banner
- ~~Get root folder banner~~
- ~~Get specific folder banner~~
### Search for files `/api/search` | `2/2 Completed`
- [x] Search for files and folder
- [x] Limit search result
- ~~Search for files and folder~~
- ~~Limit search result~~