{"slug":"onedrive-index","title":"来！让我们用Vercel来分享你的OneDrive！","description":"利用onedrive-index这个项目可以将你的OneDrive映射到公网，轻松分发资源！","coverImage":"https://b.acofork.com/img/onedrive-index-onedrive-index.webp","coverWidth":868,"coverHeight":700,"date":"2025-11-14","tags":["服务器"],"pinned":false,"wordCount":422,"html":"<h2 id=\"正式开始\">正式开始</h2><p>你可以根据<a href=\"/posts/ms-e3/\">前文</a>免费拿E3，得到至高免费5T的OneDrive存储空间，也可以用你个人永久免费的5G空间，都可以！</p>\n<p>前往 <a href=\"https://ovi.swo.moe/zh/docs/advanced#%E4%BD%BF%E7%94%A8%E4%BD%A0%E8%87%AA%E5%B7%B1%E7%9A%84-client-id-%E4%B8%8E-secret\" target=\"_blank\" rel=\"noopener noreferrer\">高级 - OneDrive Vercel Index</a> 拿到 clientid 和 secret</p>\n<p>前往该页面，点击快速部署 <a href=\"https://github.com/iRedScarf/onedrive-index/blob/main/README.zh-CN.md#%E9%83%A8%E7%BD%B2%E5%88%B0vercel\" target=\"_blank\" rel=\"noopener noreferrer\">onedrive-index/README.zh-CN.md at main · iRedScarf/onedrive-index</a> </p>\n<p><img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-1.webp\" alt=\"\" width=\"2560\" height=\"1392\" loading=\"eager\" decoding=\"async\" /></p>\n<p>填写必须的5个环境变量\n<img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-2.webp\" alt=\"\" width=\"1069\" height=\"463\" loading=\"lazy\" decoding=\"async\" /></p>\n<p>其中，USER_PRINCIPAL_NAME为类似 <a href=\"mailto:huding@Smartree233.onmicrosoft.com\">huding@Smartree233.onmicrosoft.com</a> 的电子邮箱，也就是你登陆OneDrive的用户名</p>\n<p>Vercel部署完毕后，会报错连不上Redis，因为我们还没创建和绑定，现在我们开始做\n<img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-3.webp\" alt=\"\" width=\"790\" height=\"555\" loading=\"lazy\" decoding=\"async\" /></p>\n<p>前往 <a href=\"https://vercel.com/integrations/upstash\" target=\"_blank\" rel=\"noopener noreferrer\">https://vercel.com/integrations/upstash</a> 点击 Install\n<img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-4.webp\" alt=\"\" width=\"2560\" height=\"1392\" loading=\"lazy\" decoding=\"async\" /></p>\n<p>选择你要绑定的Vercel项目，并且设置Redis实例名称\n<img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-5.webp\" alt=\"\" width=\"802\" height=\"665\" loading=\"lazy\" decoding=\"async\" /></p>\n<p>来到Vercel的环境变量页面，这就是绑定成功了\n<img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-6.webp\" alt=\"\" width=\"2560\" height=\"1392\" loading=\"lazy\" decoding=\"async\" /></p>\n<p>随便打开一个部署，点击 Redeploy 重新部署，就能成功连接数据库了</p>\n<p>接下来访问你的项目域名，进入OneDrive-Index的引导，需要打开微软的一个链接授权</p>\n<p>授权后会重定向到一个localhost的域名，复制该URI，粘贴回OneDrive-Index即可（仅需一次）</p>\n<p>成功部署！\n<img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-7.webp\" alt=\"\" width=\"2560\" height=\"1392\" loading=\"lazy\" decoding=\"async\" /></p>\n<h2 id=\"同项目更改onedrive账号\">同项目更改OneDrive账号</h2><p>首先在Vercel上更改这三个环境变量\n<img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-8.webp\" alt=\"\" width=\"944\" height=\"690\" loading=\"lazy\" decoding=\"async\" /></p>\n<p>然后打开 Upstash 找到对应的Redis，删除里面存储的所有Token\n<img src=\"https://b.acofork.com/img/onedrive-index-onedrive-index-9.webp\" alt=\"\" width=\"1023\" height=\"1058\" loading=\"lazy\" decoding=\"async\" /></p>\n","toc":[{"id":"正式开始","text":"正式开始","depth":2},{"id":"同项目更改onedrive账号","text":"同项目更改OneDrive账号","depth":2}]}