Skip to content

Latest commit

 

History

History
100 lines (79 loc) · 3.2 KB

README.md

File metadata and controls

100 lines (79 loc) · 3.2 KB

Rain

An extremely minimalist video delivery platform made with React and Rust.

I made this project in order to improve my Rust skills, but the code is too messy and inefficient. Possibly at some time I'll do a rewrite with Warp and Solid (or Leptos), with a better base and using Libav rather than spawning FFmpeg commands. Anyway, I'm proud of it and the server can handle any kind of request without crashing.

Technologies

Frontend

Backend

Getting started

To start using Rain you need to install certain programs and build it.

Configuration

Before build Rain, you need to configure server.toml

  • In server.toml set the port and the file limit (in bytes)
ip = [0, 0, 0, 0]
port = 3000
file_limit = 10_000_000_000 # In bytes

Docker

To use docker, run the following commands.

# Clone the repo
git clone https://github.com/gatomod/rain && cd rain

# Build Dockerfile
docker build -t gatomo/rain:latest .

# Run the container
# - Choose a port. 80 is the default one
# - Volumes are used to preserve data. Choose a path
docker run --name rain -p 80:80 -v /route/to/store/cdn:/server/cdn gatomo/rain

Manual build

Prerequisites

  • FFmpeg
  • FFmpeg Thumbnailer
  • Rust and Cargo
  • Node.js and Yarn

If you have all installed, update all to latest versions (not required but recommended).

Building

Run the following command to build server and client

# build client
cd client && yarn build

# build server
cd server && cargo build --release

Run

Run the server

cd server && cargo run --release

API Endpoints

  • / - GET Web
  • /assets/:asset - GET Web assets
  • /api - API endpoints
    • /cdn - Video delivery (HLS)
      • / - POST upload multipart
      • /:uuid/video.m3u8 - GET M3U8 file
      • /:uuid/video#.ts - GET Video segments
    • /data - Video data (JSON)
      • / - GET All UUID videos
      • /:uuid - GET Video data
    • /thumbnail - Get thumbnails (PNG)
      • /lg/:uuid - GET Large
      • /sm/:uuid - GET Small

License

Rain is licensed under the GPL-3 license.

Usage

There are some security and performance issues, so is recommended to personal use at home or testing.

Contribute

🥳 Any PR is welcome! Is a small project, so the guideline is to follow the code style and not make insane purposes.

Links

Gátomo - AGPL-3 License