-
Notifications
You must be signed in to change notification settings - Fork 375
Getting Started
- a GitHub account
- a Cloudflare account (free plan is enough for this usage)
- 15 minutes of time
- [Optional] a domain if you want to use custom domain (via CNAME)
-
Fork this repo to your own account. (Maybe btw give it a star before forking? :3)
You can leave all the options as default, change the repo name if you want.
-
Edit
config/site.config.js
and modify the options to your need.Basically if you're Onedrive international user with admin privilege, All you need to change is
userPrincipalName
andbaseDirectory
for this to work.But you may go through
config/site.config.js
to see if you want to customize your page.If you're using 世纪互联 or not having admin privilege on your organization, please refer to docs for more info.
More docs: https://github.com/lyc8503/onedrive-cf-index-ng/wiki/Configurations
-
Login into your cloudflare, navigate to
Workers & Pages - Overview
and create a new application.Choose
Pages
and click onConnect to Git
button.Connect your GitHub account to Cloudflare via OAuth and grant permissions on your forked repo. Choose your forked repo to continue.
Choose
Next.js
framework preset and leave other options as default, click onSave and Deploy
.Wait for the building process to finish, should finish in ~2min. Then click on
Continue to project
.Now visiting the domain provided by Cloudflare (
xxx.pages.dev
) should return something likeError: Could not access built-in Node.js modules. Please make sure that your Cloudflare Pages project has the 'nodejs_compat' compatibility flag set.
So let's continue to do that.
-
Change settings and bind KV storage
Navigate to
Settings - Functions - Compatibility flags
, setnodejs_compat
forProduction compatibility flags
At last, you also need to bind a KV storage.
Navigate to
Workers & Pages - KV
, create a KV storage and choose whatever name you like.Get back to your pages config (
Workers & Pages - Overview - <YOUR_PROJ_NAME> - Settings - Functions
)Bind the created KV storage with
Variable name
set toONEDRIVE_CF_INDEX_KV
.Now all config is done! Trigger a redeployment manually via Cloudflare dashboard as below or via modifying a random file in your GitHub repo to pick up the new config.
-
Now visit the
<YOUR_PROJ_NAME>-xxx.pages.dev
domain and you will see the guide to setup your account.If you have finished the setup wizard but again get redirected to
Step 1
, it may be caused by cache or Cloudflare KV's latency, please try manually revisitinghttps://<YOUR_PROJ_NAME>-xxx.pages.dev
1~2 minutes later.