中文 | English
-
Creat a new APP here https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade and set
redirect_uri
ashttps://heymind.github.io/tools/microsoft-graph-api-auth
。 -
Open
Certificates & secrets
and create a newsecret
。 -
Add permissions
offline_access, Files.Read, Files.Read.All
atAPI permissions
-
Get the value of parameter
refresh_token
using microsoft-graph-api-auth -
Create a new worker on
Cloudflare Worker
and paste the codes inindex.js
and set paramters as you wish.
*6. Authentication settings (disabled by default):
const AUTH_ENABLED = true
const NAME = "admin"
const PASS = "password"
Using Cloudflare
servers as download proxies, in order to get higher speeds in mainland China.
Known issue: download progress is invisible
Enable proxyDownload
in configuration and then add ?proxied
to a typical file url to enable this feature, i.e. https://storage.idx0.workers.dev/Other/zero_file?proxied
(But speed from cloudflare servers is also unpredictable)
To cache OneDrive
files using Cloudflare CDN
. There are two caching methods:
- Full: files will be firstly transfered to
Cloudflare
servers and then to clients but large files may encoutner timeout error due toCloudflare Worker
executing constraints. - Chunk: streaming and caching but
Content-Length
can't be correctly returned
Enabling cache
feature in configuration, caching method and the path for caching can be also configured
There's a tool to directly upload tiny files(< 4MB, constrained by OneDrive API, which brings troubles to create upload sessions with lagger ones ) to OneDrive
Add upload
in configuration and set a key key
to avoid anonymous file uploading
As:
POST https://storage.idx0.workers.dev/Images/?upload=<filename>&key=<key>
Attention: this features requires Files.ReadWrite
permitted
Thumbnails of image files can be directly got, like:
https://storage.idx0.workers.dev/Images/public-md-image-20191010113652775.png?thumbnail=mediumSquare
See eligible values here:
It would be a great self-hosted image hosting service with both caching
and tiny file uploading
enabled.
Loading speed of blog images will also be improved with the help of Thumbnails
For example, https://blog.idx0.dev is using large
thumbnails in frontpage images and smallSquare
ones in sidebar lists.