前言

在闲暇时间浏览 GitHub 时,在推荐页面发现了这样一个项目,项目的简介里写着:

An index & manager of Onedrive based on serverless. Can be deployed to Heroku/Glitch/Vercel/SCF/FG/FC/CFC/PHP web hosting/VPS.

凭借我长期的白嫖经验,以及大学英语 5.8 级的水平,迅速捕捉到几个熟悉的关键词:manager of OnedriveHerokuVercel。关于 Heroku 我曾经写过一篇 Heroku 搭建 V2ray 教程Bing 的搜索权重相当之高,高到我自己都属实没想到啊!

Preface

While browsing GitHub in my spare time, I came across this project on the recommendations page. Its description read:

An index & manager of Onedrive based on serverless. Can be deployed to Heroku/Glitch/Vercel/SCF/FG/FC/CFC/PHP web hosting/VPS.

Relying on my long experience with freeloading and my college English level of 5.8, I quickly caught a few familiar keywords: manager of Onedrive, Heroku, Vercel. I once wrote a post about Heroku — Heroku 搭建 V2ray 教程 (Heroku V2ray Tutorial) — which ranks remarkably high on Bing, so high that even I didn’t expect it!

Vercel 是我部署静态网页的另一个主要阵地,由于某种原因 github.io 的连接很不稳定,时不时就打不开,gitee 又不能免费绑定自定义域名,coding 现在和腾讯云乱搞想要收点小钱,权衡之下就 Vercel 是最好的静态网站部署阵地了,连接相对稳定又可以自定义域名,于是我把本站也同时部署在了 Vercel 上作为镜像站 https://dijk.eu.org

image-20210906222356663

Vercel is another main base of mine for deploying static websites. For some reason, connections to github.io are quite unstable and sometimes it just won’t open; gitee can’t bind custom domains for free; and coding has started messing around with Tencent Cloud to squeeze out some money. Weighing everything, Vercel is the best base for static website deployment — relatively stable connections and custom domain support — so I also deployed this site on Vercel as a mirror at https://dijk.eu.org.

image-20210906222356663

关于 index of Onedrive,曾经我也玩过类似的,是一个谷歌网盘的索引程序(GDIndex),部署在 CloudFlare Workers 上,上传和下载都由 CF 代理,因此可以实现在墙内进行操作。但是由于 CF Workers 本身就有一定的限制,实际体验也就还行。

鉴于一个简介里有这么多我熟悉的内容,想必这个项目一定很有趣(可以白嫖),当然要点进去看一眼了。

Regarding index of Onedrive, I once played with something similar — a Google Drive index program (GDIndex) deployed on CloudFlare Workers, with uploads and downloads proxied by CF, so it could be operated from inside the GFW. However, since CF Workers itself has certain limitations, the actual experience was just so-so.

Given that a project description contained so much I was familiar with, the project must be quite interesting (and freeloadable), so of course I had to click in and take a look.

主角

先展示一下成品,尝试性的增加一下阅读欲望,yunp.cf 这是一个部署在 glitch 上的静态的网站。glitch 这个东西还是第一次听说,性质和 Heroku ,Vercel 应该差不多。对比一下这三个容器的特点,Heroku 的 app 地址似乎在墙外,需要 CF 反向代理才行。glitch 速度很不错,缺点是 5 分钟后无访问就进入休眠,还好在下一次访问的时候会进入 Wake up. Vercel 整体上来说最适合国内环境的静态网站部署。

om

The Main Character

Let me first show the finished product to try to whet your appetite: yunp.cf is a static website deployed on glitch. I’d never heard of glitch before — its nature should be similar to Heroku and Vercel. Comparing the characteristics of these three containers: Heroku’s app URL seems to be outside the GFW and needs CF reverse proxying; glitch’s speed is quite good, but its downside is that it goes to sleep after 5 minutes without access — luckily it wakes up on the next visit; overall, Vercel is the most suitable for static website deployment in the domestic (China) environment.

om

OneManager 部署教程 网上一搜一大把,其实项目文档已经写的挺清楚了,跟着一步一步来就行了。最后说几个部署小提示。

  1. Vercel 虽然不休眠,但是也存在一定的缺点,就是每次修改设置的时候都要等待半分钟左右,这是因为每次修改环境变量都要重新部署 Vercel ,而且 Vercel 每天只能部署 100 次,也就是只能修改设置 100 次。

  2. 添加阿里云盘需要提供 refresh token ,可以很容易搜索到获取 refresh token 的方法,但是现在网上大部分获取refresh token的教程都是从电脑端进行获取,用这个refresh token添加的网盘可以正常下载但是却没办法进行预览。在 Issues 里可以查到这种问题的解决方案,那就是获取移动端的refresh token,可以实现高速预览。获取移动端 refresh token 的方法:

    • 登录手机阿里云盘app

    • 进入文件管理,进入 Android/data/com.alicloud.databox/files/logs/trace/数字名的文件夹/yunpan/

    • 把最新的 log 文件发送到电脑,用文本编辑器打开。

      image-20210907110208495

    • 添加这个 refreshToken 即可实现阿里云盘的视频预览。

  3. 微软系的网盘大家可以 申请 E5 获得一个大容量网盘,但是他们家的产品速度始终是个问题,应该可以考虑使用 CF 反向代理,我还没有查到很好很有用的教程。

  4. 阿里云盘的视频资源在网站中引用的时候会出现 403 的现象。阿里云盘经常出现目录下的内容无法加载,上传了之后不显示(可以尝试刷新缓存)等问题。

  5. 如果博客中使用的 Dplayer 插件引用 OneManager 的视频资源,记得要关闭 Dpalyer 插件的截图功能,否则会出现跨域的问题,导致视频无法引用。

OneManager deployment tutorials are everywhere online; actually, the project documentation is already quite clear — just follow it step by step. Finally, a few deployment tips.

  1. Although Vercel never sleeps, it does have a drawback: every time you change settings you have to wait about half a minute, because every change to environment variables requires redeploying Vercel. Moreover, Vercel can only be deployed 100 times per day, which means you can only change settings 100 times.

  2. Adding Aliyun Drive requires providing a refresh token. It’s easy to find ways to obtain a refresh token, but most of the current online tutorials obtain it from the desktop client. A drive added with such a refresh token can download normally but cannot preview. The solution to this problem can be found in the Issues — obtain a mobile refresh token instead, which enables high-speed previews. How to obtain a mobile refresh token:

    • Log in to the Aliyun Drive app on your phone

    • Go to File Management, then to Android/data/com.alicloud.databox/files/logs/trace//yunpan/

    • Send the latest log file to your computer and open it with a text editor.

      image-20210907110208495

    • Add this refreshToken to enable video preview for Aliyun Drive.

  3. For Microsoft’s cloud drive, you can apply for E5 to get a large-capacity drive, but the speed of their products has always been an issue; you might consider using a CF reverse proxy, though I haven’t found a good, useful tutorial on that yet.

  4. Aliyun Drive video resources referenced on a website will show 403 errors. Aliyun Drive often has issues such as content in a directory failing to load, or uploaded files not showing up (you can try refreshing the cache).

  5. If a Dplayer plugin in your blog references video resources from OneManager, remember to disable the Dplayer plugin’s screenshot feature; otherwise cross-origin issues will occur and the videos cannot be referenced.

登场

说这么多,差点忘记贴上项目地址了 OneManager-php

这是我部署的一个实例 https://yunp.cf ,欢迎访问🤡。

Take the Stage

After saying so much, I almost forgot to paste the project address: OneManager-php

This is an instance I deployed: https://yunp.cf, welcome to visit 🤡.