* Explain why we need custom CORS headers. * Translated using Weblate (German) Currently translated at 100.0% (170 of 170 strings) Translation: Materialious/Materialious Translate-URL: https://toolate.othing.xyz/projects/materialious/materialious/de/ * Translated using Weblate (Alemannic) Currently translated at 100.0% (170 of 170 strings) Translation: Materialious/Materialious Translate-URL: https://toolate.othing.xyz/projects/materialious/materialious/gsw/ * Bump svelte from 5.43.5 to 5.45.2 in /materialious Bumps [svelte](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte) from 5.43.5 to 5.45.2. - [Release notes](https://github.com/sveltejs/svelte/releases) - [Changelog](https://github.com/sveltejs/svelte/blob/main/packages/svelte/CHANGELOG.md) - [Commits](https://github.com/sveltejs/svelte/commits/svelte@5.45.2/packages/svelte) --- updated-dependencies: - dependency-name: svelte dependency-version: 5.45.2 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Bump vite from 7.2.4 to 7.2.6 in /materialious Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 7.2.4 to 7.2.6. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v7.2.6/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-version: 7.2.6 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump @capacitor/core from 7.4.3 to 7.4.4 in /materialious Bumps [@capacitor/core](https://github.com/ionic-team/capacitor) from 7.4.3 to 7.4.4. - [Release notes](https://github.com/ionic-team/capacitor/releases) - [Changelog](https://github.com/ionic-team/capacitor/blob/7.4.4/CHANGELOG.md) - [Commits](https://github.com/ionic-team/capacitor/compare/7.4.3...7.4.4) --- updated-dependencies: - dependency-name: "@capacitor/core" dependency-version: 7.4.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump shaka-player from 4.16.10 to 4.16.11 in /materialious Bumps [shaka-player](https://github.com/shaka-project/shaka-player) from 4.16.10 to 4.16.11. - [Release notes](https://github.com/shaka-project/shaka-player/releases) - [Changelog](https://github.com/shaka-project/shaka-player/blob/v4.16.11/CHANGELOG.md) - [Commits](https://github.com/shaka-project/shaka-player/compare/v4.16.10...v4.16.11) --- updated-dependencies: - dependency-name: shaka-player dependency-version: 4.16.11 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump human-number from 2.0.7 to 2.0.8 in /materialious Bumps [human-number](https://github.com/Kikobeats/human-number) from 2.0.7 to 2.0.8. - [Release notes](https://github.com/Kikobeats/human-number/releases) - [Changelog](https://github.com/Kikobeats/human-number/blob/master/CHANGELOG.md) - [Commits](https://github.com/Kikobeats/human-number/compare/v2.0.7...v2.0.8) --- updated-dependencies: - dependency-name: human-number dependency-version: 2.0.8 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Bump chokidar from 4.0.3 to 5.0.0 in /materialious/electron Bumps [chokidar](https://github.com/paulmillr/chokidar) from 4.0.3 to 5.0.0. - [Release notes](https://github.com/paulmillr/chokidar/releases) - [Commits](https://github.com/paulmillr/chokidar/compare/4.0.3...5.0.0) --- updated-dependencies: - dependency-name: chokidar dependency-version: 5.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump electron from 39.2.3 to 39.2.4 in /materialious/electron Bumps [electron](https://github.com/electron/electron) from 39.2.3 to 39.2.4. - [Release notes](https://github.com/electron/electron/releases) - [Commits](https://github.com/electron/electron/compare/v39.2.3...v39.2.4) --- updated-dependencies: - dependency-name: electron dependency-version: 39.2.4 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Translated using Weblate (German) Currently translated at 100.0% (172 of 172 strings) Translation: Materialious/Materialious Translate-URL: https://toolate.othing.xyz/projects/materialious/materialious/de/ * Translated using Weblate (Alemannic) Currently translated at 100.0% (172 of 172 strings) Translation: Materialious/Materialious Translate-URL: https://toolate.othing.xyz/projects/materialious/materialious/gsw/ * Translated using Weblate (Hungarian) Currently translated at 100.0% (172 of 172 strings) Translation: Materialious/Materialious Translate-URL: https://toolate.othing.xyz/projects/materialious/materialious/hu/ * Add link to official RYD website * Translated using Weblate (Latvian) Currently translated at 73.2% (126 of 172 strings) Translation: Materialious/Materialious Translate-URL: https://toolate.othing.xyz/projects/materialious/materialious/lv/ * Bump version to 1.12.0 * Fix menu dropdown on theatre mode * Fixe linting * Update package-lock.json * Update package-lock.json * Update package-lock.json --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: mk-pmb <mk-pmb@users.noreply.github.com> Co-authored-by: Lenny Angst <lenny@familie-angst.ch> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ghost of Sparta <makesocialfoss32@keemail.me> Co-authored-by: ℂ𝕠𝕠𝕠𝕝 (𝕘𝕚𝕥𝕙𝕦𝕓.𝕔𝕠𝕞/ℂ𝕠𝕠𝕠𝕝) <toolate.othing.xyz.coool@privatepasta.com>
9.2 KiB
Setup
CORS
To assure browsers they are allowed to access your Materialious instance
despite their default same-origin policy, the instance's webserver
needs to send cross-origin resource sharing (CORS) headers in its
response to the browser's OPTIONS request. The Access-Control-Allow-Origin
header of that response must be set to the public origin URI of your instance.
Invidious doesn't provide a simple way to modify CORS, so this must be done with your reverse proxy.
Step 1: Reverse proxy
Caddy example
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:3001
}
Nginx example
server {
listen 80;
server_name invidious.example.com;
location / {
if ($request_method = OPTIONS) {
return 204;
}
proxy_hide_header Access-Control-Allow-Origin;
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:3001;
}
}
Nginx Proxy Manager example
- Tab: Details - Create a new proxy host with SSL on (Let's Encrypt or your own certificate).
- Tab: Custom locations, fill in IP and port. Click gear icon to add some security headers.
Add:
if ($request_method = OPTIONS) {
return 204;
}
proxy_hide_header Access-Control-Allow-Origin;
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;
Click Save.
Traefik example
Add this middleware to your Invidious instance:
http:
middlewares:
materialious:
headers:
accessControlAllowCredentials: true
accessControlAllowOriginList: "https://materialious.example.com"
accessControlAllowMethods:
- GET
- POST
- OPTIONS
- HEAD
- PATCH
- PUT
- DELETE
accessControlAllowHeaders:
- User-Agent
- Authorization
- Content-Type
Invidious Companion support
The VITE_DEFAULT_COMPANION_INSTANCE environment variable allows you to specify a custom Invidious Companion instance.
public_url MUST be set in Invidious under invidious_companion for companion to work with Materialious.
e.g.
invidious_companion:
- private_url: "http://companion:8282/companion"
public_url: "http://companion.example.com/companion"
To use this with Materialious, your Invidious Companion instance must be accessible with proper CORS headers. Fortunately, you can reuse the same reverse proxy configuration (with CORS modifications) that you applied to your Invidious instance—just apply it to your companion domain as well.
For example, if you're using Caddy, you can configure your companion domain like this:
companion.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
}
Other
Please open a PR request or issue if you implement this in a different reverse proxy.
Step 2: Invidious config
The following Invidious values must be set in your config.
domain:- The reverse proxied domain of your Invidious instance.https_only: true- Must be set if you are using HTTPS.external_port: 443- Must be set if you are using HTTPS.
Step 3: Docker
Please ensure you have followed the previous steps before doing this!
Docker Compose
---
services:
materialious:
image: wardpearce/materialious:latest
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 your proxied Companion instance
VITE_DEFAULT_COMPANION_INSTANCE: "https://companion.materialio.us"
# URL TO RYD (Return YouTube Dislike / https://github.com/Anarios/return-youtube-dislike)
# Leave blank to disable completely.
VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE: "https://returnyoutubedislikeapi.com"
# URL to Sponsorblock
# Leave blank to completely disable sponsorblock.
VITE_DEFAULT_SPONSERBLOCK_INSTANCE: "https://sponsor.ajay.app"
# URL to DeArrow
VITE_DEFAULT_DEARROW_INSTANCE: "https://sponsor.ajay.app"
# URL to DeArrow thumbnail instance
VITE_DEFAULT_DEARROW_THUMBNAIL_INSTANCE: "https://dearrow-thumb.ajay.app"
# Look at "Overwriting Materialious defaults" for all the accepted values.
VITE_DEFAULT_SETTINGS: '{"themeColor": "#2596be","region": "US"}'
Overwriting Materialious defaults
Materialious allows you to overwrite the default values using VITE_DEFAULT_SETTINGS, see SETTINGS for more details.
Please note: These overwrites only apply on 1st load & won't replace existing configuration stored in browser local storage.
Step 4 (Optional, but recommended): Self-host RYD-Proxy
Step 1: Docker compose
Add the following to your docker compose file.
With TOR (Recommended)
tor-proxy:
image: 1337kavin/alpine-tor:latest
restart: unless-stopped
environment:
- tors=15
ryd-proxy:
image: 1337kavin/ryd-proxy:latest
restart: unless-stopped
depends_on:
- tor-proxy
environment:
- PROXY=socks5://tor-proxy:5566
ports:
- 3003:3000
Without TOR
ryd-proxy:
image: 1337kavin/ryd-proxy:latest
restart: unless-stopped
ports:
- 3003:3000
Step 2:
Reverse proxy RYD-Proxy.
Caddy example
ryd-proxy.example.com {
header Access-Control-Allow-Origin "https://materialious.example.com" {
defer
}
header Access-Control-Allow-Methods "GET,OPTIONS"
reverse_proxy localhost:3003
}
Nginx example
server {
listen 80;
server_name ryd-proxy.example.com;
location / {
add_header Access-Control-Allow-Origin "https://materialious.example.com" always;
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
proxy_pass http://localhost:3003;
}
}
Traefik example
Add this middleware to your RYD-Proxy instance:
http:
middlewares:
ryd-proxy:
headers:
accessControlAllowOriginList: "https://materialious.example.com"
accessControlAllowMethods:
- GET
- OPTIONS
Step 3:
Modify/add VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE for Materialious to be the reverse proxied URL of RYD-Proxy.
Step 5 (Optional, but recommended): Self-host Invidious API extended
Step 1: Docker compose
Add the following to your docker compose
services:
api_extended:
image: wardpearce/invidious_api_extended:latest
restart: unless-stopped
ports:
- 3004:80
environment:
api_extended_postgre: '{"host": "invidious-db", "port": 5432, "database": "invidious", "user": "kemal", "password": "kemal"}'
api_extended_allowed_origins: '["https://materialious.example.com"]'
api_extended_debug: false
# No trailing backslashes!
api_extended_invidious_instance: "https://invidious.example.com"
api_extended_production_instance: "https://syncious.example.com"
Add these additional environment variables to Materialious.
VITE_DEFAULT_API_EXTENDED_INSTANCE: "https://syncious.example.com"
Step 6 (Optional): Self-host PeerJS
Add these additional environment variables to Materialious.
# Will differ depending on how you self-host peerjs.
VITE_DEFAULT_PEERJS_HOST: "peerjs.example.com"
VITE_DEFAULT_PEERJS_PATH: "/"
VITE_DEFAULT_PEERJS_PORT: 443