From 16b00416d4495b2eb34b9a549cb40961801b1719 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Mon, 1 Apr 2024 13:48:14 +1300 Subject: [PATCH 1/2] Added setup instructions --- README.md | 101 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 93 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c311e6f1..f29cff6a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ![Preview of homepage](./previews/home-preview.png) -## Features +# Features - Sponsorblock built-in. - Return YouTube dislikes built-in. - Video progress tracking & resuming. @@ -27,24 +27,109 @@ - Playlists. - PWA support. -## Todo +# Todo - Localization. -## Previews +# Setup +For security reasons regarding CORS, your hosted instance of Materialious must serve as the value for the `Access-Control-Allow-Origin` header on Invidious. -### Player +Invidious doesn't provide a simple way to modify CORS, so this must be done with your reverse proxy. + +### Caddy example +```caddyfile +invidious.example.com { + @cors_preflight { + method OPTIONS + } + respond @cors_preflight 204 + + header Access-Control-Allow-Credentials true + header Access-Control-Allow-Origin "https://materialious.example.com" { + defer + } + header Access-Control-Allow-Methods "GET,POST,OPTIONS,HEAD,PATCH,PUT,DELETE" + header Access-Control-Allow-Headers "User-Agent,Authorization,Content-Type" + + reverse_proxy localhost:3000 +} + +materialious.example.com { + reverse_proxy localhost:5173 +} +``` + +### Nginx example +```nginx +server { + listen 80; + server_name invidious.example.com; + + location / { + if ($request_method = OPTIONS) { + return 204; + } + + add_header Access-Control-Allow-Credentials true; + add_header Access-Control-Allow-Origin "https://materialious.example.com" always; + add_header Access-Control-Allow-Methods "GET, POST, OPTIONS, HEAD, PATCH, PUT, DELETE" always; + add_header Access-Control-Allow-Headers "User-Agent, Authorization, Content-Type" always; + + proxy_pass http://localhost:3000; + } +} + +server { + listen 80; + server_name materialious.example.com; + + location / { + proxy_pass http://localhost:5173; + } +} +``` + +### Other +Please open a PR request or issue if your implement this in a different reverse proxy. + +### Docker compose +```yaml +version: "3" +services: + materialious: + image: wardpearce/materialious + restart: unless-stopped + ports: + - 3001:80 + environment: + # No trailing backslashes! + # URL to your proxied Invidious instance + VITE_DEFAULT_INVIDIOUS_INSTANCE: "https://invidious.materialio.us" + + # URL TO RYD + VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE: "https://returnyoutubedislikeapi.com" + + # URL to your proxied instance of Materialious + VITE_DEFAULT_FRONTEND_URL: "https://materialio.us" + + # URL to Sponsorblock + VITE_DEFAULT_SPONSERBLOCK_INSTANCE: "https://sponsor.ajay.app" +``` + +# Previews + +## Player ![Preview of player](./previews/player-preview.png) -### Settings +## Settings ![Preview of settings](./previews/setting-preview.png) -### Channel +## Channel ![Preview of channel](./previews/channel-preview.png) -### Chapters +## Chapters ![Preview of chapters](./previews/chapter-previews.png) -### Playlists +## Playlists ![Preview of playlist page](./previews/playlist-preview.png) ![Preview of playlist on video page](./previews/playlist-preview-2.png) From b38be4f9df4334c69885e7188edcfc48822e4370 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Mon, 1 Apr 2024 13:49:22 +1300 Subject: [PATCH 2/2] Minor spelling fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f29cff6a..8e3e52db 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ server { ``` ### Other -Please open a PR request or issue if your implement this in a different reverse proxy. +Please open a PR request or issue if you implement this in a different reverse proxy. ### Docker compose ```yaml