From e60e6497d04cf64aa4e93fa32068e3476f22886e Mon Sep 17 00:00:00 2001 From: Ayush Sehrawat <69469790+AyushSehrawat@users.noreply.github.com> Date: Sun, 14 Jul 2024 08:29:28 +0000 Subject: [PATCH 1/2] feat!: add `BACKEND_URL` environment variable to support for custom backend url Currently frontend assumes backend url to be 127.0.0.1 (i.e in same network interface / container). This PR solves that issue. --- docker-compose-dev.yml | 1 + docker-compose.yml | 1 + entrypoint.sh | 3 ++- frontend/src/hooks.server.ts | 3 ++- frontend/src/lib/forms/helpers.ts | 7 ++++--- frontend/src/routes/+page.server.ts | 17 +++++++++-------- frontend/src/routes/library/+page.server.ts | 3 ++- .../src/routes/onboarding/1/+page.server.ts | 4 +++- .../src/routes/onboarding/2/+page.server.ts | 4 +++- .../src/routes/onboarding/3/+page.server.ts | 3 ++- .../src/routes/onboarding/4/+page.server.ts | 4 +++- .../src/routes/settings/about/+page.server.ts | 4 +++- .../src/routes/settings/content/+page.server.ts | 3 ++- .../src/routes/settings/general/+page.server.ts | 4 +++- .../routes/settings/mediaserver/+page.server.ts | 4 +++- .../routes/settings/scrapers/+page.server.ts | 4 +++- frontend/src/routes/summary/+page.server.ts | 7 ++++--- 17 files changed, 50 insertions(+), 26 deletions(-) diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 9964b581..5ddc1ade 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -13,6 +13,7 @@ services: - PUID=1000 - PGID=1000 - ORIGIN=${RIVEN_ORIGIN:-http://localhost:8080} + - BACKEND_URL=${RIVEN_BACKEND_URL:-http:// - TZ=UTC volumes: - ./data:/riven/data diff --git a/docker-compose.yml b/docker-compose.yml index 04fddcfa..59e7f8fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: - PUID=1000 - PGID=1000 - ORIGIN=http://localhost:3000 + - BACKEND_URL=http://127.0.0.1:8080 - TZ=America/New_York volumes: - ./data:/riven/data diff --git a/entrypoint.sh b/entrypoint.sh index c6da7db8..503df733 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -68,6 +68,7 @@ set -x PATH $PATH /app/.venv/bin su -m $USERNAME -c "poetry config virtualenvs.create false" set -q ORIGIN; or set ORIGIN "http://localhost:3000" +set -q BACKEND_URL; or set BACKEND_URL "http://127.0.0.1:8080" echo "Container Initialization complete." @@ -83,4 +84,4 @@ set backend_pid (jobs -p %1) # Start the frontend echo "Starting frontend..." -exec su -m $USERNAME -c "fish -c 'ORIGIN=$ORIGIN node /riven/frontend/build'" +exec su -m $USERNAME -c "fish -c 'ORIGIN=$ORIGIN BACKEND_URL=$BACKEND_URL node /riven/frontend/build'" diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts index 49b758c3..d86b93c2 100644 --- a/frontend/src/hooks.server.ts +++ b/frontend/src/hooks.server.ts @@ -1,10 +1,11 @@ import type { Handle } from '@sveltejs/kit'; import { redirect, error } from '@sveltejs/kit'; import { sequence } from '@sveltejs/kit/hooks'; +import { BACKEND_URL } from '$env/static/private'; const onboarding: Handle = async ({ event, resolve }) => { if (!event.url.pathname.startsWith('/onboarding') && event.request.method === 'GET') { - const res = await event.fetch('http://127.0.0.1:8080/services'); + const res = await event.fetch(`${BACKEND_URL}/services`); const data = await res.json(); if (!data.success || !data.data) { error(500, 'API Error'); diff --git a/frontend/src/lib/forms/helpers.ts b/frontend/src/lib/forms/helpers.ts index bf9f3358..d4a4d95c 100644 --- a/frontend/src/lib/forms/helpers.ts +++ b/frontend/src/lib/forms/helpers.ts @@ -1,10 +1,11 @@ import { type SuperValidated, type Infer } from 'sveltekit-superforms'; +import { BACKEND_URL } from '$env/static/private'; import { z } from 'zod'; // TODO: Add toCheck export async function setSettings(fetch: any, toSet: any) { - const settings = await fetch('http://127.0.0.1:8080/settings/set', { + const settings = await fetch(`${BACKEND_URL}/settings/set`, { method: 'POST', headers: { 'Content-Type': 'application/json' @@ -19,7 +20,7 @@ export async function setSettings(fetch: any, toSet: any) { } export async function saveSettings(fetch: any) { - const data = await fetch('http://127.0.0.1:8080/settings/save', { + const data = await fetch(`${BACKEND_URL}/settings/save`, { method: 'POST' }); const response = await data.json(); @@ -30,7 +31,7 @@ export async function saveSettings(fetch: any) { } export async function loadSettings(fetch: any) { - const data = await fetch('http://127.0.0.1:8080/settings/load', { + const data = await fetch(`${BACKEND_URL}/settings/load`, { method: 'GET' }); const response = await data.json(); diff --git a/frontend/src/routes/+page.server.ts b/frontend/src/routes/+page.server.ts index 168b8021..17865206 100644 --- a/frontend/src/routes/+page.server.ts +++ b/frontend/src/routes/+page.server.ts @@ -1,10 +1,11 @@ import type { PageServerLoad } from './$types'; import { error } from '@sveltejs/kit'; +import { BACKEND_URL } from '$env/static/private'; export const load: PageServerLoad = async ({ fetch }) => { async function getNowPlaying() { try { - const res = await fetch('http://127.0.0.1:8080/tmdb/movie/now_playing'); + const res = await fetch(`${BACKEND_URL}/tmdb/movie/now_playing`); if (res.ok) { return await res.json(); } @@ -17,7 +18,7 @@ export const load: PageServerLoad = async ({ fetch }) => { async function getTrendingAll() { try { - const res = await fetch('http://127.0.0.1:8080/tmdb/trending/all/day'); + const res = await fetch(`${BACKEND_URL}/tmdb/trending/all/day`); if (res.ok) { return await res.json(); } @@ -30,7 +31,7 @@ export const load: PageServerLoad = async ({ fetch }) => { async function getTrendingMoviesWeek() { try { - const res = await fetch('http://127.0.0.1:8080/tmdb/trending/movie/week'); + const res = await fetch(`${BACKEND_URL}/tmdb/trending/movie/week`); if (res.ok) { return await res.json(); } @@ -43,7 +44,7 @@ export const load: PageServerLoad = async ({ fetch }) => { async function getTrendingShowsWeek() { try { - const res = await fetch('http://127.0.0.1:8080/tmdb/trending/tv/week'); + const res = await fetch(`${BACKEND_URL}/tmdb/trending/tv/week`); if (res.ok) { return await res.json(); } @@ -56,7 +57,7 @@ export const load: PageServerLoad = async ({ fetch }) => { async function getMoviesPopular() { try { - const res = await fetch('http://127.0.0.1:8080/tmdb/movie/popular'); + const res = await fetch(`${BACKEND_URL}/tmdb/movie/popular`); if (res.ok) { return await res.json(); } @@ -69,7 +70,7 @@ export const load: PageServerLoad = async ({ fetch }) => { async function getMoviesTopRated() { try { - const res = await fetch('http://127.0.0.1:8080/tmdb/movie/top_rated'); + const res = await fetch(`${BACKEND_URL}/tmdb/movie/top_rated`); if (res.ok) { return await res.json(); } @@ -82,7 +83,7 @@ export const load: PageServerLoad = async ({ fetch }) => { async function getShowsPopular() { try { - const res = await fetch('http://127.0.0.1:8080/tmdb/tv/popular'); + const res = await fetch(`${BACKEND_URL}/tmdb/tv/popular`); if (res.ok) { return await res.json(); } @@ -95,7 +96,7 @@ export const load: PageServerLoad = async ({ fetch }) => { async function getShowsTopRated() { try { - const res = await fetch('http://127.0.0.1:8080/tmdb/tv/top_rated'); + const res = await fetch(`${BACKEND_URL}/tmdb/tv/top_rated`); if (res.ok) { return await res.json(); } diff --git a/frontend/src/routes/library/+page.server.ts b/frontend/src/routes/library/+page.server.ts index ba4877d6..c7e9026d 100644 --- a/frontend/src/routes/library/+page.server.ts +++ b/frontend/src/routes/library/+page.server.ts @@ -1,6 +1,7 @@ import type { PageServerLoad } from './$types'; import { error } from '@sveltejs/kit'; import { createQueryString } from '$lib/helpers'; +import { BACKEND_URL } from '$env/static/private'; export const load = (async ({ fetch, url }) => { const params = { @@ -15,7 +16,7 @@ export const load = (async ({ fetch, url }) => { async function getItems() { try { - const res = await fetch(`http://127.0.0.1:8080/items${queryString}`); + const res = await fetch(`${BACKEND_URL}/items${queryString}`); if (res.ok) { return await res.json(); } diff --git a/frontend/src/routes/onboarding/1/+page.server.ts b/frontend/src/routes/onboarding/1/+page.server.ts index aa07dcd0..2e47aabd 100644 --- a/frontend/src/routes/onboarding/1/+page.server.ts +++ b/frontend/src/routes/onboarding/1/+page.server.ts @@ -7,12 +7,14 @@ import { generalSettingsToGet, generalSettingsToPass } from '$lib/forms/helpers'; +import { BACKEND_URL } from '$env/static/private'; + export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { const results = await fetch( - `http://127.0.0.1:8080/settings/get/${generalSettingsToGet.join(',')}` + `${BACKEND_URL}/settings/get/${generalSettingsToGet.join(',')}` ); return await results.json(); } catch (e) { diff --git a/frontend/src/routes/onboarding/2/+page.server.ts b/frontend/src/routes/onboarding/2/+page.server.ts index a0cc3bf1..26b2267b 100644 --- a/frontend/src/routes/onboarding/2/+page.server.ts +++ b/frontend/src/routes/onboarding/2/+page.server.ts @@ -7,12 +7,14 @@ import { mediaServerSettingsToGet, mediaServerSettingsToPass } from '$lib/forms/helpers'; +import { BACKEND_URL } from '$env/static/private'; + export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { const results = await fetch( - `http://127.0.0.1:8080/settings/get/${mediaServerSettingsToGet.join(',')}` + `${BACKEND_URL}/settings/get/${mediaServerSettingsToGet.join(',')}` ); return await results.json(); } catch (e) { diff --git a/frontend/src/routes/onboarding/3/+page.server.ts b/frontend/src/routes/onboarding/3/+page.server.ts index 85c99d7d..e8200abf 100644 --- a/frontend/src/routes/onboarding/3/+page.server.ts +++ b/frontend/src/routes/onboarding/3/+page.server.ts @@ -7,12 +7,13 @@ import { contentSettingsToGet, contentSettingsToPass } from '$lib/forms/helpers'; +import { BACKEND_URL } from '$env/static/private'; export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { const results = await fetch( - `http://127.0.0.1:8080/settings/get/${contentSettingsToGet.join(',')}` + `${BACKEND_URL}/settings/get/${contentSettingsToGet.join(',')}` ); return await results.json(); } catch (e) { diff --git a/frontend/src/routes/onboarding/4/+page.server.ts b/frontend/src/routes/onboarding/4/+page.server.ts index dc59f5bf..af180318 100644 --- a/frontend/src/routes/onboarding/4/+page.server.ts +++ b/frontend/src/routes/onboarding/4/+page.server.ts @@ -7,12 +7,14 @@ import { scrapersSettingsToGet, scrapersSettingsToPass } from '$lib/forms/helpers'; +import { BACKEND_URL } from '$env/static/private'; + export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { const results = await fetch( - `http://127.0.0.1:8080/settings/get/${scrapersSettingsToGet.join(',')}` + `${BACKEND_URL}/settings/get/${scrapersSettingsToGet.join(',')}` ); return await results.json(); } catch (e) { diff --git a/frontend/src/routes/settings/about/+page.server.ts b/frontend/src/routes/settings/about/+page.server.ts index 0c48b718..dfd8dfaf 100644 --- a/frontend/src/routes/settings/about/+page.server.ts +++ b/frontend/src/routes/settings/about/+page.server.ts @@ -1,11 +1,13 @@ import type { PageServerLoad } from './$types'; import { error } from '@sveltejs/kit'; +import { BACKEND_URL } from '$env/static/private'; + export const load: PageServerLoad = async ({ fetch }) => { async function getAboutInfo() { try { const toGet = ['version', 'symlink']; - const results = await fetch(`http://127.0.0.1:8080/settings/get/${toGet.join(',')}`); + const results = await fetch(`${BACKEND_URL}/settings/get/${toGet.join(',')}`); return await results.json(); } catch (e) { console.error(e); diff --git a/frontend/src/routes/settings/content/+page.server.ts b/frontend/src/routes/settings/content/+page.server.ts index d90b0fb3..1c2d6753 100644 --- a/frontend/src/routes/settings/content/+page.server.ts +++ b/frontend/src/routes/settings/content/+page.server.ts @@ -11,12 +11,13 @@ import { contentSettingsToPass, contentSettingsToSet } from '$lib/forms/helpers'; +import { BACKEND_URL } from '$env/static/private'; export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { const results = await fetch( - `http://127.0.0.1:8080/settings/get/${contentSettingsToGet.join(',')}` + `${BACKEND_URL}/settings/get/${contentSettingsToGet.join(',')}` ); return await results.json(); } catch (e) { diff --git a/frontend/src/routes/settings/general/+page.server.ts b/frontend/src/routes/settings/general/+page.server.ts index 1a339b16..1df4c39b 100644 --- a/frontend/src/routes/settings/general/+page.server.ts +++ b/frontend/src/routes/settings/general/+page.server.ts @@ -11,12 +11,14 @@ import { generalSettingsToPass, generalSettingsToSet } from '$lib/forms/helpers'; +import { BACKEND_URL } from '$env/static/private'; + export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { const results = await fetch( - `http://127.0.0.1:8080/settings/get/${generalSettingsToGet.join(',')}` + `${BACKEND_URL}/settings/get/${generalSettingsToGet.join(',')}` ); return await results.json(); } catch (e) { diff --git a/frontend/src/routes/settings/mediaserver/+page.server.ts b/frontend/src/routes/settings/mediaserver/+page.server.ts index 1deb0560..d13b8456 100644 --- a/frontend/src/routes/settings/mediaserver/+page.server.ts +++ b/frontend/src/routes/settings/mediaserver/+page.server.ts @@ -11,12 +11,14 @@ import { mediaServerSettingsToPass, mediaServerSettingsToSet } from '$lib/forms/helpers'; +import { BACKEND_URL } from '$env/static/private'; + export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { const results = await fetch( - `http://127.0.0.1:8080/settings/get/${mediaServerSettingsToGet.join(',')}` + `${BACKEND_URL}/settings/get/${mediaServerSettingsToGet.join(',')}` ); return await results.json(); } catch (e) { diff --git a/frontend/src/routes/settings/scrapers/+page.server.ts b/frontend/src/routes/settings/scrapers/+page.server.ts index fdbe7d5b..6ae1cd08 100644 --- a/frontend/src/routes/settings/scrapers/+page.server.ts +++ b/frontend/src/routes/settings/scrapers/+page.server.ts @@ -11,12 +11,14 @@ import { scrapersSettingsToPass, scrapersSettingsToSet } from '$lib/forms/helpers'; +import { BACKEND_URL } from '$env/static/private'; + export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { const results = await fetch( - `http://127.0.0.1:8080/settings/get/${scrapersSettingsToGet.join(',')}` + `${BACKEND_URL}/settings/get/${scrapersSettingsToGet.join(',')}` ); return await results.json(); } catch (e) { diff --git a/frontend/src/routes/summary/+page.server.ts b/frontend/src/routes/summary/+page.server.ts index 361630b6..8b83f0f4 100644 --- a/frontend/src/routes/summary/+page.server.ts +++ b/frontend/src/routes/summary/+page.server.ts @@ -1,10 +1,11 @@ import type { PageServerLoad } from './$types'; import { error } from '@sveltejs/kit'; +import { BACKEND_URL } from '$env/static/private'; export const load = (async () => { async function getStats() { try { - const res = await fetch('http://127.0.0.1:8080/stats'); + const res = await fetch(`${BACKEND_URL}/stats`); if (res.ok) { return await res.json(); } @@ -17,7 +18,7 @@ export const load = (async () => { async function getIncompleteItems() { try { - const res = await fetch('http://127.0.0.1:8080/items/incomplete'); + const res = await fetch(`${BACKEND_URL}/items/incomplete`); if (res.ok) { return await res.json(); } @@ -30,7 +31,7 @@ export const load = (async () => { async function getServices() { try { - const res = await fetch('http://127.0.0.1:8080/services'); + const res = await fetch(`${BACKEND_URL}/services`); if (res.ok) { return await res.json(); } From a2ff7f4a700e5f4b2e3fde1c317353a02dcf9578 Mon Sep 17 00:00:00 2001 From: Ayush Sehrawat <69469790+AyushSehrawat@users.noreply.github.com> Date: Sun, 14 Jul 2024 08:42:12 +0000 Subject: [PATCH 2/2] docs: update readme.md to reflect latest changes --- README.md | 205 +++++++++--------- frontend/src/lib/components/header.svelte | 2 +- frontend/src/routes/+page.svelte | 10 +- .../src/routes/onboarding/1/+page.server.ts | 5 +- .../src/routes/onboarding/2/+page.server.ts | 1 - .../src/routes/onboarding/3/+page.server.ts | 4 +- .../src/routes/onboarding/4/+page.server.ts | 5 +- .../src/routes/settings/about/+page.server.ts | 1 - .../routes/settings/content/+page.server.ts | 4 +- .../routes/settings/general/+page.server.ts | 5 +- .../settings/mediaserver/+page.server.ts | 1 - .../routes/settings/scrapers/+page.server.ts | 5 +- 12 files changed, 118 insertions(+), 130 deletions(-) diff --git a/README.md b/README.md index fd409cab..999c1652 100644 --- a/README.md +++ b/README.md @@ -21,19 +21,20 @@ Services currently supported: -| Service | Supported | -|----------------------|-----------| -| Real Debrid | ✅ | -| Plex | ✅ | -| Overseerr | ✅ | -| Mdblist | ✅ | -| Trakt | ✅ | -| Jackett | ✅ | -| Plex Watchlist RSS | ✅ | -| Torrentio | ✅ | -| Orionoid | ✅ | -| Jackett | ✅ | -| Listrr | ✅ | +| Service | Supported | +| ------------------ | --------- | +| Real Debrid | ✅ | +| Plex | ✅ | +| Overseerr | ✅ | +| Mdblist | ✅ | +| Trakt | ✅ | +| Jackett | ✅ | +| Plex Watchlist RSS | ✅ | +| Torrentio | ✅ | +| Orionoid | ✅ | +| Jackett | ✅ | +| Listrr | ✅ | + | and more to come! Check out out [Project Board](/~https://github.com/users/dreulavelle/projects/2) to stay informed! @@ -46,34 +47,34 @@ We are constantly adding features and improvements as we go along and squashing ## Table of Contents -- [Table of Contents](#table-of-contents) -- [ElfHosted](#elfhosted) -- [Self Hosted](#self-hosted) - - [Docker Compose](#docker-compose) - - [What is ORIGIN ?](#what-is-origin-) - - [Running outside of Docker](#running-outside-of-docker) - - [First terminal:](#first-terminal) - - [Second terminal:](#second-terminal) - - [Symlinking settings](#symlinking-settings) - - [Example:](#example) -- [Development](#development) - - [Development without `make`](#development-without-make) -- [Contributing](#contributing) -- [License](#license) +- [Table of Contents](#table-of-contents) +- [ElfHosted](#elfhosted) +- [Self Hosted](#self-hosted) + - [Docker Compose](#docker-compose) + - [What is ORIGIN ?](#what-is-origin-) + - [Running outside of Docker](#running-outside-of-docker) + - [First terminal:](#first-terminal) + - [Second terminal:](#second-terminal) + - [Symlinking settings](#symlinking-settings) + - [Example:](#example) +- [Development](#development) + - [Development without `make`](#development-without-make) +- [Contributing](#contributing) +- [License](#license) --- ## ElfHosted -[ElfHosted](https://elfhosted.com) is a geeky [open-source](https://elfhosted.com/open/) PaaS which provides all the "plumbing" (*hosting, security, updates, etc*) for your self-hosted apps. +[ElfHosted](https://elfhosted.com) is a geeky [open-source](https://elfhosted.com/open/) PaaS which provides all the "plumbing" (_hosting, security, updates, etc_) for your self-hosted apps. > [!IMPORTANT] > Riven is a top-tier app in the [ElfHosted app catalogue](https://elfhosted.com/apps/). 30% of your subscription goes to Riven developers, and the remainder offsets [infrastructure costs](https://elfhosted.com/open/pricing/). -> [!TIP] +> [!TIP] > New accounts get $10 free credit, enough for a week's free trial of the [Riven / Plex Infinite Streaming](https://store.elfhosted.com/product/infinite-plex-riven-streaming-bundle) bundle! -(*[ElfHosted Discord](https://discord.elfhosted.com)*) +(_[ElfHosted Discord](https://discord.elfhosted.com)_) ## Self Hosted @@ -90,13 +91,8 @@ services: environment: PUID: "1000" PGID: "1000" - ORIGIN: "http://localhost:3000" # read below for more info - RIVEN_PLEX_URL: "http://plex:32400" - RIVEN_PLEX_TOKEN: "your_plex_token" - RIVEN_PLEX_RCLONE_PATH: "/mnt/zurg/__all__" - RIVEN_PLEX_LIBRARY_PATH: "/mnt/library" - RIVEN_DOWNLOADERS_REAL_DEBRID_ENABLED: "true" - RIVEN_DOWNLOADERS_REAL_DEBRID_API_KEY: "your_real_debrid_api_key" + ORIGIN: "http://localhost:3000" # IMP: read below to avoid CORS issues + BACKEND_URL: http://127.0.0.1:8080 # optional ports: - "3000:3000" volumes: @@ -106,6 +102,9 @@ services: Then run `docker compose up -d` to start the container in the background. You can then access the web interface at `http://localhost:3000` or whatever port and origin you set in the `docker-compose.yml` file. +> [!TIP] +> On first run, Riven creates a `settings.json` file in the `data` directory. You can edit the settings from frontend, or manually edit the file and restart the container or use `.env` or docker-compose environment variables to set the settings (see `.env.example` for reference). + #### What is ORIGIN ? `ORIGIN` is the URL of the frontend on which you will access it from anywhere. If you are hosting Riven on a vps with IP address `123.45.67.890` then you will need to set the `ORIGIN` to `http://123.45.67.890:3000` (no trailing slash). Similarly, if using a domain name, you will need to set the `ORIGIN` to `http://riven.example.com:3000` (no trailing slash). If you change the port in the `docker-compose.yml` file, you will need to change it in the `ORIGIN` as well. @@ -126,7 +125,7 @@ and open two terminals in the root of the project and run the following commands cd frontend npm install npm run build -ORIGIN=http://localhost:3000 node build +ORIGIN=http://localhost:3000 BACKEND_URL=http://127.0.0.1 node build ``` Read above for more info on `ORIGIN`. @@ -154,10 +153,10 @@ poetry run python backend/main.py } ``` -Plex libraries that are currently required to have sections: +Plex libraries that are currently required to have sections: -| Type | Categories | -|--------|------------------| +| Type | Categories | +| ------ | ------------------------ | | Movies | `movies`, `anime_movies` | | Shows | `shows`, `anime_shows` | @@ -173,86 +172,94 @@ Welcome to the development section! Here, you'll find all the necessary steps to ### Prerequisites Ensure you have the following installed on your system: -- **Node.js** (v18.13+) -- **Python** (3.10+) -- **Poetry** (for Python dependency management) -- **Docker** (optional, for containerized development) + +- **Node.js** (v18.13+) +- **Python** (3.10+) +- **Poetry** (for Python dependency management) +- **Docker** (optional, for containerized development) ### Initial Setup 1. **Clone the Repository:** - ```sh - git clone /~https://github.com/rivenmedia/riven.git && cd riven - ``` + + ```sh + git clone /~https://github.com/rivenmedia/riven.git && cd riven + ``` 2. **Install Backend Dependencies:** - ```sh - pip install poetry - poetry install - ``` + + ```sh + pip install poetry + poetry install + ``` 3. **Install Frontend Dependencies:** - ```sh - cd frontend - npm install - cd .. - ``` + ```sh + cd frontend + npm install + cd .. + ``` ### Using `make` for Development We provide a `Makefile` to simplify common development tasks. Here are some useful commands: -- **Initialize the Project:** - ```sh - make - ``` +- **Initialize the Project:** -- **Start the Development Environment:** - This command stops any previous containers, removes old images, and rebuilds the image using cached layers. Any changes in the code will trigger a rebuild. - ```sh - make start - ``` + ```sh + make + ``` -- **Restart the Container:** - ```sh - make restart - ``` +- **Start the Development Environment:** + This command stops any previous containers, removes old images, and rebuilds the image using cached layers. Any changes in the code will trigger a rebuild. -- **View Logs:** - ```sh - make logs - ``` + ```sh + make start + ``` + +- **Restart the Container:** + + ```sh + make restart + ``` + +- **View Logs:** + ```sh + make logs + ``` ### Development without `make` If you prefer not to use `make` and Docker, you can manually set up the development environment with the following steps: 1. **Start the Backend:** - ```sh - poetry run python backend/main.py - ``` + + ```sh + poetry run python backend/main.py + ``` 2. **Start the Frontend:** - ```sh - cd frontend - npm run dev - ``` + ```sh + cd frontend + npm run dev + ``` ### Additional Tips -- **Environment Variables:** - Ensure you set the `ORIGIN` environment variable to the URL where the frontend will be accessible. For example: - ```sh - export ORIGIN=http://localhost:3000 - ``` +- **Environment Variables:** + Ensure you set the `ORIGIN` environment variable to the URL where the frontend will be accessible. For example: + + ```sh + export ORIGIN=http://localhost:3000 + ``` -- **Code Formatting:** - We use `Black` for Python and `Prettier` for JavaScript. Make sure to format your code before submitting any changes. +- **Code Formatting:** + We use `Black` for Python and `Prettier` for JavaScript. Make sure to format your code before submitting any changes. -- **Running Tests:** - ```sh - poetry run pytest - ``` +- **Running Tests:** + ```sh + poetry run pytest + ``` By following these guidelines, you'll be able to set up your development environment smoothly and start contributing to the project. Happy coding! @@ -269,9 +276,9 @@ We welcome contributions from the community! To ensure a smooth collaboration, p ### Code Formatting -- **Backend**: We use [Black](https://black.readthedocs.io/en/stable/) for code formatting. Run `black` on your code before submitting. -- **Frontend**: We use [Prettier](https://prettier.io/) for code formatting. Run `prettier` on your code before submitting. -- **Line Endings**: Use CRLF line endings unless the file is a shell script or another format that requires LF line endings. +- **Backend**: We use [Black](https://black.readthedocs.io/en/stable/) for code formatting. Run `black` on your code before submitting. +- **Frontend**: We use [Prettier](https://prettier.io/) for code formatting. Run `prettier` on your code before submitting. +- **Line Endings**: Use CRLF line endings unless the file is a shell script or another format that requires LF line endings. ### Dependency Management @@ -285,15 +292,15 @@ We use [Poetry](https://python-poetry.org/) for managing dependencies. Poetry si #### Adding or Updating Dependencies -- **Add a Dependency**: Use `poetry add ` to add a new dependency. -- **Update a Dependency**: Use `poetry update ` to update an existing dependency. +- **Add a Dependency**: Use `poetry add ` to add a new dependency. +- **Update a Dependency**: Use `poetry update ` to update an existing dependency. ### Running Tests and Linters Before submitting a pull request, ensure your changes are compatible with the project's dependencies and coding standards. Use the following commands to run tests and linters: -- **Run Tests**: `poetry run pytest` -- **Run Linters**: `poetry run ruff check backend` and `poetry run isort --check-only backend` +- **Run Tests**: `poetry run pytest` +- **Run Linters**: `poetry run ruff check backend` and `poetry run isort --check-only backend` By following these guidelines, you help us maintain a high-quality codebase and streamline the review process. Thank you for contributing! diff --git a/frontend/src/lib/components/header.svelte b/frontend/src/lib/components/header.svelte index d9077e50..aed4dae3 100644 --- a/frontend/src/lib/components/header.svelte +++ b/frontend/src/lib/components/header.svelte @@ -36,7 +36,7 @@ function toggleNavbar() { showMenu.update((v) => !v); } - + let applyBackdropBlur = () => {}; onMount(async () => { diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 507c6f0a..c532af6e 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -107,7 +107,7 @@
-
+

What's Trending Today

@@ -129,7 +129,7 @@ {@const mediaType = trendingAll.media_type} -
+

{roundOff(trendingAll.vote_average)}

@@ -184,7 +184,7 @@
-
+

Top Rated

@@ -254,7 +254,7 @@
{showsTopRated.overview}
diff --git a/frontend/src/routes/onboarding/1/+page.server.ts b/frontend/src/routes/onboarding/1/+page.server.ts index 2e47aabd..bf743e58 100644 --- a/frontend/src/routes/onboarding/1/+page.server.ts +++ b/frontend/src/routes/onboarding/1/+page.server.ts @@ -9,13 +9,10 @@ import { } from '$lib/forms/helpers'; import { BACKEND_URL } from '$env/static/private'; - export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { - const results = await fetch( - `${BACKEND_URL}/settings/get/${generalSettingsToGet.join(',')}` - ); + const results = await fetch(`${BACKEND_URL}/settings/get/${generalSettingsToGet.join(',')}`); return await results.json(); } catch (e) { console.error(e); diff --git a/frontend/src/routes/onboarding/2/+page.server.ts b/frontend/src/routes/onboarding/2/+page.server.ts index 26b2267b..b5c03466 100644 --- a/frontend/src/routes/onboarding/2/+page.server.ts +++ b/frontend/src/routes/onboarding/2/+page.server.ts @@ -9,7 +9,6 @@ import { } from '$lib/forms/helpers'; import { BACKEND_URL } from '$env/static/private'; - export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { diff --git a/frontend/src/routes/onboarding/3/+page.server.ts b/frontend/src/routes/onboarding/3/+page.server.ts index e8200abf..66038c40 100644 --- a/frontend/src/routes/onboarding/3/+page.server.ts +++ b/frontend/src/routes/onboarding/3/+page.server.ts @@ -12,9 +12,7 @@ import { BACKEND_URL } from '$env/static/private'; export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { - const results = await fetch( - `${BACKEND_URL}/settings/get/${contentSettingsToGet.join(',')}` - ); + const results = await fetch(`${BACKEND_URL}/settings/get/${contentSettingsToGet.join(',')}`); return await results.json(); } catch (e) { console.error(e); diff --git a/frontend/src/routes/onboarding/4/+page.server.ts b/frontend/src/routes/onboarding/4/+page.server.ts index af180318..ef32d9a7 100644 --- a/frontend/src/routes/onboarding/4/+page.server.ts +++ b/frontend/src/routes/onboarding/4/+page.server.ts @@ -9,13 +9,10 @@ import { } from '$lib/forms/helpers'; import { BACKEND_URL } from '$env/static/private'; - export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { - const results = await fetch( - `${BACKEND_URL}/settings/get/${scrapersSettingsToGet.join(',')}` - ); + const results = await fetch(`${BACKEND_URL}/settings/get/${scrapersSettingsToGet.join(',')}`); return await results.json(); } catch (e) { console.error(e); diff --git a/frontend/src/routes/settings/about/+page.server.ts b/frontend/src/routes/settings/about/+page.server.ts index dfd8dfaf..82aa61c2 100644 --- a/frontend/src/routes/settings/about/+page.server.ts +++ b/frontend/src/routes/settings/about/+page.server.ts @@ -2,7 +2,6 @@ import type { PageServerLoad } from './$types'; import { error } from '@sveltejs/kit'; import { BACKEND_URL } from '$env/static/private'; - export const load: PageServerLoad = async ({ fetch }) => { async function getAboutInfo() { try { diff --git a/frontend/src/routes/settings/content/+page.server.ts b/frontend/src/routes/settings/content/+page.server.ts index 1c2d6753..191fdb49 100644 --- a/frontend/src/routes/settings/content/+page.server.ts +++ b/frontend/src/routes/settings/content/+page.server.ts @@ -16,9 +16,7 @@ import { BACKEND_URL } from '$env/static/private'; export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { - const results = await fetch( - `${BACKEND_URL}/settings/get/${contentSettingsToGet.join(',')}` - ); + const results = await fetch(`${BACKEND_URL}/settings/get/${contentSettingsToGet.join(',')}`); return await results.json(); } catch (e) { console.error(e); diff --git a/frontend/src/routes/settings/general/+page.server.ts b/frontend/src/routes/settings/general/+page.server.ts index 1df4c39b..e38d469c 100644 --- a/frontend/src/routes/settings/general/+page.server.ts +++ b/frontend/src/routes/settings/general/+page.server.ts @@ -13,13 +13,10 @@ import { } from '$lib/forms/helpers'; import { BACKEND_URL } from '$env/static/private'; - export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { - const results = await fetch( - `${BACKEND_URL}/settings/get/${generalSettingsToGet.join(',')}` - ); + const results = await fetch(`${BACKEND_URL}/settings/get/${generalSettingsToGet.join(',')}`); return await results.json(); } catch (e) { console.error(e); diff --git a/frontend/src/routes/settings/mediaserver/+page.server.ts b/frontend/src/routes/settings/mediaserver/+page.server.ts index d13b8456..ed168612 100644 --- a/frontend/src/routes/settings/mediaserver/+page.server.ts +++ b/frontend/src/routes/settings/mediaserver/+page.server.ts @@ -13,7 +13,6 @@ import { } from '$lib/forms/helpers'; import { BACKEND_URL } from '$env/static/private'; - export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { diff --git a/frontend/src/routes/settings/scrapers/+page.server.ts b/frontend/src/routes/settings/scrapers/+page.server.ts index 6ae1cd08..6a835160 100644 --- a/frontend/src/routes/settings/scrapers/+page.server.ts +++ b/frontend/src/routes/settings/scrapers/+page.server.ts @@ -13,13 +13,10 @@ import { } from '$lib/forms/helpers'; import { BACKEND_URL } from '$env/static/private'; - export const load: PageServerLoad = async ({ fetch }) => { async function getPartialSettings() { try { - const results = await fetch( - `${BACKEND_URL}/settings/get/${scrapersSettingsToGet.join(',')}` - ); + const results = await fetch(`${BACKEND_URL}/settings/get/${scrapersSettingsToGet.join(',')}`); return await results.json(); } catch (e) { console.error(e);