Build A Personal Video Platform with AList
2023-09-13
Video Hosting Platform Built with AList
I’ve been working on a personal project these past few days since the pressure of exams isn’t too high. I thought it would be nice to have a platform for hosting gaming videos. Current platforms in China either have slow upload speeds or are not friendly to overseas resources, so I decided to give it a try.
Introduction to AList
The platform I chose is AList. From its external UI, it looks like a web-based file manager that can help you manage your files. However, its core functionality is to help you integrate all your data across various cloud storage services, even those on servers you’ve set up yourself. With high-speed internet, you can achieve an experience similar to NAS. As far as I know, whatever traditional NAS can do, AList can do better.
Resources Used
- Frontend and Backend: AList, an open-source online multi-source file management system on GitHub.
- Built on Gin (the fastest full-featured web framework in Go language) and Solidjs (a JavaScript library for building user interfaces that is simple, efficient, and performs excellently).
- Server Provider: Amazon EC2, free for the first year and quite affordable afterwards, especially since the traffic isn’t high.
- File Storage: Baidu Cloud Drive, Cloudflare R2
Relying on Baidu
AList supports most of the cloud drives on the market, including Baidu Cloud Drive. Other supported cloud drives can be found in its official documentation. The main issue here is configuring Baidu Cloud Drive. Since the default port for AList is reserved on Windows 10, you’ll need to change it. I used port 80 for easy access since I’m using an EC2 server.
You can follow the settings in the image below. Tokens can be found in AList’s official documentation. Be careful when configuring Baidu Cloud Drive. I suggest setting a password for the entire directory in “Metas” to prevent your files from being searchable and to avoid token leaks.
Using Baidu Cloud for hosting may violate user agreements to some extent, which could lead to account suspension. Although the risk is almost zero with limited sharing, I also explored using object storage (similar to setting up your own server for data storage, upload, and download).
Using Cloudflare R2 Object Storage
The next day, I implemented R2’s object storage service to help me build my own online cloud drive, which I can fully control. I can also give others permission to upload and download, perfectly meeting my expectations.
The specific steps are to first create a “bucket,” then create a token to grant yourself or users upload and download permissions. You can set the token’s expiration time when creating it. I suggest not sharing or using tokens with admin permissions unless necessary.
To import R2 resources into AList’s default storage, simply select “Object Storage.” For resource uploads, I recommend using rclone, which is incredibly convenient. Just download and enter:
rclone config
Follow the prompts to enter the required parameters. These include:
- Name: You can fill in any name, such as
r2name
- S3 provider: Choose the service provider you’re using; I chose Cloudflare.
- AWS credentials: Choose false by default.
- AWS Access Key ID: Paste your access key ID here.
- AWS Secret Access Key: Paste your secret access key here.
- Region: Choose the server region you selected on R2; the default ‘auto’ works fine in my tests.
Endpoint for S3 API: Paste a URL that includes your account ID. Specifically, (if you don’t know where to find your account ID, please refer to the official tutorial)
https://<ACCOUNT_ID>.r2.cloudflarestorage.com
After configuring, you can use rclone for uploads, which is very convenient. For specific operations, please refer to the rclone official website.
rclone copy file_name.mp4 r2name:bucket_name/folder_1
This command helps you upload file_name.mp4
from your local directory to the folder_1
folder under the bucket_name
bucket in the cloud using the r2name
configuration.
Special thanks to Anwen, one of the contributors to AList, for pointing me in the right direction.
Now you can access the site using the account and password “cnapex”.