In my previous post ‘Using Cloudflare Workers to Deploy A Free Google Drive Directory Indexer in 5 Minutes‘, I showed a GitHub project GDINDEX. In this post, I am going to show another similar project, but it is for OneDrive – FODI (Fast OneDrive Index) at Github.
It is a serverless program using GitHub page as frontend and using Cloudflare as backend to list your OneDrive files and folders.
I did a quick testing and used it to list my own OneDrive files and folders. Here are some features I like:
1. Fast – listing files and folders is super fast.
2. You can assign it to only show a specific folder.
3. You can add a password on any assigned folder
4. It can preview txt file, photos, audios and videos. (only those popular formats)
5. No need a server (VPS). (You only need a Github account and a Cloudflare account)
Here are all steps we can follow:
Backend – Cloudflare Workers
Create a Workers
Create a workers and paste following contents from https://raw.githubusercontent.com/vcheckzen/FODI/master/back-end-cf/index.js
Only things you will need to change later are following two:
- EXPOSE_PATH= “”
- ONEDRIVE_REFRESHTOKEN = “”
* EXPOSE_PATH：One Drive folder name which you would like to list. If it is whole folder, you can keep it as is. Else, you need to put it as /music, /video , this kind of format.
* ONEDRIVE_REFRESHTOKEN: refresh_token which you will get it later. It will be used to log into your OneDrive account.
You will need to log into your OneDrive and authorize SCF to access your OneDrive. Eventually, you will be re-direct to a message page with a refresh_token in a textbox, as shown below.
Now you can copy this whole refresh_token into your Workers. Save and deploy your workers with a customized name. Write down the workers url , such as https://onedrive.51sec.workers.dev. It will be added into front_end page.
FrontEnd – Github Page
Fork FODI project into your Github repository.
Edit the front_end page , change SCF_GATEWAY to your workers address, which is https://onedrive.51sec.workers.dev
Publish this page. You are good to go. The web page url will be something like: https://51sec.github.io/FODI/front-end/