Onedrive-Vercel-Index

最近在网上发现了一个挺有意思的项目onedrive-vercel-index,它可以在Vercel上部署一个属于你自己的网盘。那么相比于百度网盘,你对他有着很高的控制权,并不需要担心你的资源会被河蟹。那么至于网速,Onedrive给的带宽不太稳定,有时可以跑到满速,有时只有3MB/s,但怎么说也比某度网盘良心多了。

但这个网盘最大的缺点就在于空间上。现在注册Onedrive默认是5GB的空间,这显然不够用。但是也并非没有办法,我们在某宝上花个大概三块钱就可以把一个账号的空间永久提升至15GB。当然,如果你是购买了office365的话,那你就可以拿到1T的容量,就不需要担心什么容量的问题。网上还有一种教育版的,容量为1-5T,但是我不建议大家使用,因为这个账号的管理员可以看到你的文件,大家应该都知道数据的重要性,所以不要贪便宜使用这种。

最后一个问题,Vercel给你提供默认的域名大概率由于某些原因无法访问,所以你还需要拥有一个自己的域名,并把它解析到Vercel上。购买一个域名其实并不贵,如果是新用户就会更便宜了。例如.space .top .asia这类,新用户只需要个位数就能拿下一年,甚至在搞活动的时候一块钱就能拿下一个.cn域名。一个域名可以解析到很多服务器,对于已经有域名的同学来说,这个成本直接忽略不计。

因此,与我个人而言,搭建这个基本上是不需要成本的,只是需要花费那么一丢丢的时间。但是对于刚上手的同学们来说,需要那么一点点的开销,但相对于某度会员或者是他们卖的那种“24小时高速下载券”来说并不多。

搭建网盘

准备工作

  • 一台能上网的电脑
  • 一个GitHub账号
  • 一个Vercel账号
  • 一个Onedrive账号

打开 onedrive-vercel-index 的项目地址Fork 到自己的账号中。

打开项目中的/config/site.config.js,这个就是你的网盘的配置文件了,按照提示进行修改。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/**
* This file contains the configuration used for customising the website, such as the folder to share,
* the title, used Google fonts, site icons, contact info, etc.
*/
module.exports = {
// This is what we use to identify who you are when you are initialising the website for the first time.
// Make sure this is exactly the same as the email address you use to sign into your Microsoft account.
// You can also put this in your Vercel's environment variable 'NEXT_PUBLIC_USER_PRINCIPLE_NAME' if you worry about
// your email being exposed in public.
userPrincipalName: process.env.NEXT_PUBLIC_USER_PRINCIPLE_NAME || '此处填写你的Onedrive账号',

// [OPTIONAL] This is the website icon to the left of the title inside the navigation bar. It should be placed under the
// /public directory of your GitHub project (not your OneDrive folder!), and referenced here by its relative path to /public.
icon: '/icons/aninegtubiao.png(你的网站图标路径)',

// Prefix for KV Storage
kvPrefix: process.env.KV_PREFIX || '',

// The name of your website. Present alongside your icon.
title: "此处填写你的网站名字",

// The folder that you are to share publicly with onedrive-vercel-index. Use '/' if you want to share your root folder.
baseDirectory: '/Public(你要在网页上展示的文件夹)',

// [OPTIONAL] This represents the maximum number of items that one directory lists, pagination supported.
// Do note that this is limited up to 200 items by the upstream OneDrive API.
maxItems: 100,

// [OPTIONAL] We use Google Fonts natively for font customisations.
// You can check and generate the required links and names at https://fonts.google.com.
// googleFontSans - the sans serif font used in onedrive-vercel-index.
googleFontSans: 'Inter',
// googleFontMono - the monospace font used in onedrive-vercel-index.
googleFontMono: 'Fira Mono',
// googleFontLinks - an array of links for referencing the google font assets.
googleFontLinks: ['https://fonts.googleapis.com/css2?family=Fira+Mono&family=Inter:wght@400;500;700&display=swap'],

// [OPTIONAL] The footer component of your website. You can write HTML here, but you need to escape double
// quotes - changing " to \". You can write anything here, and if you like badges, generate some with https://shields.io
footer:
'Copyright © 2022 <a href="https://anineg.space/" target="_blank">ANINEG</a> &nbsp&nbsp|&nbsp&nbsp 网盘资源仅供学习交流,严禁用于商业用途,请于24小时内删除(这里是页脚的内容)',

// [OPTIONAL] This is where you specify the folders that are password protected. It is an array of paths pointing to all
// the directories in which you have .password set. Check the documentation for details.
protectedRoutes: ['/个人', '/(这里几个地方填你要加密的文件夹的路径,将密码存成.password文件放在文件夹下)'],

// [OPTIONAL] Use "" here if you want to remove this email address from the nav bar.
email: 'mailto:email@anineg.space(别人联系你的邮箱地址,不要删掉就行)',

// [OPTIONAL] This is an array of names and links for setting your social information and links.
// In the latest update, all brand icons inside font awesome is supported and the icon to render is based on the name
// you provide. See the documentation for details.
links: [
{
name: '主页',
link: 'https://anineg.space/',
},
],//这里填导航栏上你想要显示的链接

// This is a day.js-style datetime format string to format datetimes in the app. Ref to
// https://day.js.org/docs/en/display/format for detailed specification. The default value is ISO 8601 full datetime
// without timezone and replacing T with space.
datetimeFormat: 'YYYY-MM-DD HH:mm:ss',
}

然后打开 Vercel 官网注册登录,然后点 New Project,然后 Import 你刚刚 Fork 的仓库。然后点击 Deploy,仓库就会自动开始部署,一两分钟以后就好了。接下来,打开 Marketplace 中的 Upstash,点击 Add Integration,然后选中你的账户,再选中你部署的仓库。如果这时出现了一些选项,最好都填上勾上。等待 Upstash 创建 Redis 数据库。完成创建后,在项目的 Deployments 中将项目 Redeploy。重新部署完成后,在Settings-Domains中填写你的域名并将其解析至Vercel后,即可访问部署好的网站。

打开网站,根据网站的引导进行操作即可。到这里,你就拥有了一个自己的网盘了!

当然,拿它来当图床,我想也是很不错的。

ANINEGの网盘

最后,放上我的网盘来给大家参考一下:

image-20221120120327292

网盘链接: