1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-20 14:37:43 +01:00

Merge branch 'dev' into coop-fixes

This commit is contained in:
mrjvs 2023-12-13 21:44:05 +01:00 committed by GitHub
commit 88356bad26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 101 additions and 10195 deletions

View file

@ -1,4 +0,0 @@
dist
node_modules
.output
.nuxt

View file

@ -1,8 +0,0 @@
module.exports = {
root: true,
extends: '@nuxt/eslint-config',
rules: {
'vue/max-attributes-per-line': 'off',
'vue/multi-word-component-names': 'off'
}
}

12
.docs/.gitignore vendored
View file

@ -1,12 +0,0 @@
node_modules
*.iml
.idea
*.log*
.nuxt
.vscode
.DS_Store
coverage
dist
sw.*
.env
.output

View file

@ -1 +0,0 @@
shamefully-hoist=true

View file

@ -1,57 +0,0 @@
# Docus Starter
Starter template for [Docus](https://docus.dev).
## Clone
Clone the repository (using `nuxi`):
```bash
npx nuxi init -t themes/docus
```
## Setup
Install dependencies:
```bash
yarn install
```
## Development
```bash
yarn dev
```
## Edge Side Rendering
Can be deployed to Vercel Functions, Netlify Functions, AWS, and most Node-compatible environments.
Look at all the available presets [here](https://v3.nuxtjs.org/guide/deploy/presets).
```bash
yarn build
```
## Static Generation
Use the `generate` command to build your application.
The HTML files will be generated in the .output/public directory and ready to be deployed to any static compatible hosting.
```bash
yarn generate
```
## Preview build
You might want to preview the result of your build locally, to do so, run the following command:
```bash
yarn preview
```
---
For a detailed explanation of how things work, check out [Docus](https://docus.dev).

View file

@ -1,18 +0,0 @@
export default defineAppConfig({
docus: {
title: 'movie-web',
description: 'For all your media scraping needs',
socials: {
github: 'movie-web/providers',
},
image: '',
aside: {
level: 0,
exclude: [],
},
header: {
logo: false,
title: "movie-web"
},
},
});

View file

@ -1,50 +0,0 @@
---
title: "movie-web | For all your movie and TV show needs"
navigation: false
layout: page
---
::block-hero
---
cta:
- Get Started
- /introduction/getting-started
secondary:
- Open on GitHub →
- https://github.com/movie-web/movie-web
---
#title
movie-web
#description
A simple and no-BS app for watching movies and TV shows
::
::card-grid
#title
What's all the fuss?
#root
:ellipsis
#default
::card{icon="mdi:server-network"}
#title
Easy to host
#description
movie-web can be easily hosted on any static website host.
::
::card{icon="material-symbols:hangout-video-off"}
#title
No ADs
#description
movie-web will never show ADs, enjoy watching without interruptions.
::
::card{icon="ic:baseline-ondemand-video"}
#title
Custom Player
#description
Enjoy a fully custom video player including streaming integration, subtitle customisation and easy TV season navigation.
::
::

View file

@ -1,2 +0,0 @@
# Getting Started

View file

@ -1,2 +0,0 @@
icon: ph:star-duotone
navigation.redirect: /introduction/getting-started

View file

@ -1,9 +0,0 @@
# How to self host
::alert{type="info"}
We **do not** provide support on how to self-host. If you can't figure it out then tough luck. Please do not make GitHub issues or ask in our Discord server for support on how to self-host.
::
The movie-web application is made of two parts: the proxy and the client. Click the following links to find out more:
- [Setup the Proxy](2.proxy.md)
- [Setup the Client](3.client.md)

View file

@ -1,37 +0,0 @@
# Setting up the proxy
Our proxy is used to bypass CORS-protected URLs on the client side, allowing users to make requests to protected endpoints without a backend server.
The proxy is made using [Nitro by UnJS](https://nitro.unjs.io/) which supports building the proxy to work on multiple providers including Cloudflare Workers, AWS Lambda and [more...](https://nitro.unjs.io/deploy)
Our recommended provider is Cloudflare due to its [generous free plan](https://www.cloudflare.com/en-gb/plans/developer-platform/).
## Cloudflare Workers
The proxy is made as a Cloudflare worker. Cloudflare has a generous free plan, so you don't need to pay anything unless you get hundreds of users.
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/movie-web/simple-proxy)
1. Create a GitHub account at https://github.com if you don't have one.
1. Click the "Deploy with workers" button above.
1. Click the "Authorize Workers" button to authorise Cloudflare to talk to GitHub.
1. Authorize Cloudflare Workers in the GitHub page that pops up.
1. Follow the instructions to configure your Cloudflare account. Select "I have an account" if you have a Cloudflare account already, otherwise follow the link to create one.
1. Click the link to "Workers Dashboard" to find your account ID.
1. If you have used workers in the past, there will be a place on the right hand side to copy your account ID.
1. If you haven't used workers before, you can copy your account ID from the URL e.g. https://dash.cloudflare.com/ab7cb454c93987b6343350d4e84c16c7/workers-and-pages/create where `ab7cb454c93987b6343350d4e84c16c7` is the account ID.
1. Paste the account ID into the text box on the original Cloudflare workers page.
1. Click the link to "My Profile" to create an API token.
1. Click "Create Token".
1. Select "Use template" next to "Edit Cloudflare Workers".
1. Under "Account Resources", select "Include" and your account under the dropdown.
1. Under "Zone Resources", select "All zones" (You can select a more specific zone if you have the zones available).
1. At the bottom of the page, click "Continue to summary".
1. On the next screen, click "Create token".
1. Copy the API token and **save it in a safe place, it won't be shown again**.
1. Paste the API token into the Cloudflare Workers API Token text box.
1. Click "Fork the Repository" and follow the instructions to enable workflows.
1. Click "Deploy" to deploy to Cloudflare Workers.
1. Congratulations! Your worker is now deploying. Please wait for the GitHub Action to build and publish your worker.
1. You can click the "Worker dash" and "GitHub repo" buttons to see the status of the deploy.
1. When the worker has deployed, you will need to take note of the URL. This can be found on Cloudflare under Workers and Pages -> Overview -> proxy.

View file

@ -1,49 +0,0 @@
# Setting up the client
## Vercel - Recommended
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmovie-web%2Fmovie-web%2Ftree%2Fmaster&env=VITE_CORS_PROXY_URL,VITE_TMDB_READ_API_KEY)
1. Click the Deploy button.
1. Sign in using either a GitHub, GitLab, or Bitbucket.
1. Follow the instructions to create a repository for movie-web.
1. Configure the environment variables:
- `VITE_CORS_PROXY_URL`: Enter your proxy URL here. Make sure to not have a slash at the end of your URL.
Example (THIS IS AN EXAMPLE, IT WON'T WORK FOR YOU): `https://test-proxy.test.workers.dev`
- `VITE_TMDB_READ_API_KEY`: Enter your TMDB Read Access Token here. Please read [below](#tmdb-api-key) on how to get an API key.
1. Click "Deploy"
1. Congrats! You have your own version of movie-web hosted.
1. You may wish to configure a custom domain - Please consult [the Vercel docs for how to do this](https://vercel.com/docs/getting-started-with-vercel/domains).
## Any Static Web Host
1. Download the file `movie-web.zip` from the latest release: https://github.com/movie-web/movie-web/releases/latest.
2. Extract the ZIP file so you can edit the files.
3. Open `config.js` in an editor such as Notepad, Visual Studio Code or similar.
4. Put your proxy URL in-between the double quotes of `VITE_CORS_PROXY_URL: ""`. Make sure to not have a slash at the end of your URL.
Example (THIS IS AN EXAMPLE, IT WON'T WORK FOR YOU): `VITE_CORS_PROXY_URL: "https://test-proxy.test.workers.dev"`
5. Put your TMDB Read Access Token inside the quotes of `VITE_TMDB_READ_API_KEY: ""`. Please read [below](#tmdb-api-key) on how to get an API key.
6. Save the file.
7. Upload **all** of the files to a static website hosting such as:
- GitHub Pages
- Netlify
- Vercel
- Etc, there are lots - Google it if the ones above don't work for you.
1. Congrats! You have your own version of movie-web hosted.
## TMDB API Key
In order to search for movies and TV shows, we use an API called "The Movie Database" (TMDB). In order for your client to be able to search, you need to generate an API key.
::alert{type="info"}
The API key is **free**, you just need to create an account.
::
1. Create an account at https://www.themoviedb.org/signup
1. You will be required to verify your email; click the link that you get sent to verify your account.
1. Go to https://www.themoviedb.org/settings/api/request to create a developer account.
1. Read the terms and conditions and accept them.
1. Fill out your details:
- Select "Website" as type of use.
- For the other details can put any values; they are not important.
1. Copy the "API Read Access Token" - **DO NOT COPY THE API Key - IT WILL NOT WORK**

View file

@ -1 +0,0 @@
# Config Reference

View file

@ -1,2 +0,0 @@
title: 'Self-Hosting'
icon: mdi:server-network

View file

@ -1,11 +0,0 @@
export default defineNuxtConfig({
// https://github.com/nuxt-themes/docus
extends: '@nuxt-themes/docus',
devtools: { enabled: true },
modules: [
// Remove it if you don't use Plausible analytics
// https://github.com/nuxt-modules/plausible
'@nuxtjs/plausible'
]
})

View file

@ -1,21 +0,0 @@
{
"name": "docus-starter",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "nuxi dev",
"build": "nuxi build",
"generate": "nuxi generate",
"preview": "nuxi preview",
"lint": "eslint ."
},
"devDependencies": {
"@nuxt-themes/docus": "latest",
"@nuxt/devtools": "^0.8.5",
"@nuxt/eslint-config": "^0.2.0",
"@nuxtjs/plausible": "^0.2.3",
"@types/node": "^20.8.2",
"eslint": "^8.50.0",
"nuxt": "^3.7.4"
}
}

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

View file

@ -1,8 +0,0 @@
{
"extends": [
"@nuxtjs"
],
"lockFileMaintenance": {
"enabled": true
}
}

View file

@ -1,18 +0,0 @@
import { defineTheme } from 'pinceau'
export default defineTheme({
color: {
primary: {
50: "#F5E5FF",
100: "#E7CCFF",
200: "#D4A9FF",
300: "#BE85FF",
400: "#A861FF",
500: "#8E3DFF",
600: "#7F36D4",
700: "#662CA6",
800: "#552578",
900: "#441E49"
}
}
})

View file

@ -1,3 +0,0 @@
{
"extends": "./.nuxt/tsconfig.json"
}

View file

@ -85,28 +85,10 @@ Here are some tips to make sure that your pull requests are :pinched_fingers: fi
### Language Contributions
Language contributions help movie-web massively, allowing people worldwide to use our app!
Like most apps, our translations are stored in `.json` files. Each language string has a unique key (For example, `notFound.genericTitle`) that references a language string in the appropriate language file.
We use weblate for crowdsourcing our translations. [Click here to go to our translation tool.](https://weblate.movie-web.app/projects/movie-web/website/)
Each language file is called `translation.json` and is stored in the `src/setup/languages/<language code>/` folder. For example, the English language file is located at `src/setup/languages/en/translation.json`.
> **Warning**
>
> Before you start a translation, please:
> - Check there isn't an existing GitHub [issue](https://github.com/movie-web/movie-web/issues) or [pull request](https://github.com/movie-web/movie-web/pulls) open for the language.
> - Make sure we aren't in the middle of a new feature update. When releasing major versions, we only accept changes to translations once the new version is complete. Otherwise, the language files would need to be updated.
>
> Please speak to us before starting a language PR. We want to use your time effectively.
To make a translation:
- Copy the `en` folder inside the `src/setup/languages` folder
- Rename the copied folder to the 2-letter code for the country/language which is being translated.
- [Click this link to see a list of codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes). Use the codes in the `639-1` column!
- For example, Arabic is `ar`
- Edit the language strings inside the `translation.json` file
- **Do not** edit the keys. Only edit the values.
- e.g. in `"stopEditing": "Stop editing",` - only change the `Stop editing` part, not the `stopEditing` part.
- In the `src/setup/i18n.ts` file:
- Import your new translation file, e.g. `import ar from "./locales/ar/translation.json";`
- Add your translation to the `locales` object (Look at other languages for an example)
Once you have completed your translation, please open a pull request. We do not accept partial translations, so please ensure every language string is translated to the intended language.
1. First make sure you make an account. (click the link above)
2. Click the language you want to help translate, if it's not listed you can click the plus top left to add a new language.
3. In the top right of the screen, click "translate"
4. Here you will be prompted a key to translate, fill in a translation and proceed to the next item by pressing "save and continue".
5. Thats all there is to it, every translation will eventually come through and be pushed with an update. This usually doesn't take longer than a week.

View file

@ -1,52 +0,0 @@
name: Publish docs
on:
push:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install packages
working-directory: ./.docs
run: npm install
- name: Build project
working-directory: ./.docs
run: npm run generate
- name: Upload production-ready build files
uses: actions/upload-pages-artifact@v1
with:
path: ./.docs/.output/public
deploy:
name: Deploy
needs: build
permissions:
pages: write
id-token: write
environment:
name: docs
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2

View file

@ -43,6 +43,8 @@ pnpm install
pnpm run dev
```
You have to also make an `.env` file to configure your environment. Inspire it from the content of `example.env`.
To build production files, run:
```bash
pnpm build
@ -55,7 +57,7 @@ pnpm build
A simple guide has been written to assist in hosting your own instance of movie-web. Check it out below
|[Selfhosting guide](https://docs.movie-web.app/self-hosting/self-hosting)|
|[Selfhosting guide](https://docs.movie-web.app)|
|---|

View file

@ -3,6 +3,28 @@
"version": "4.0.0",
"private": true,
"homepage": "https://movie-web.app",
"scripts": {
"dev": "vite",
"build": "vite build",
"build:pwa": "cross-env VITE_PWA_ENABLED=true vite build",
"test": "vitest run",
"preview": "vite preview",
"lint": "eslint --ext .tsx,.ts src",
"lint:fix": "eslint --fix --ext .tsx,.ts src",
"lint:report": "eslint --ext .tsx,.ts --output-file eslint_report.json --format json src",
"preinstall": "npx -y only-allow pnpm"
},
"browserslist": {
"production": [
"defaults",
"chrome > 90"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"dependencies": {
"@formkit/auto-animate": "^0.7.0",
"@headlessui/react": "^1.5.0",
@ -39,28 +61,6 @@
"subsrt-ts": "^2.1.1",
"zustand": "^4.3.9"
},
"scripts": {
"dev": "vite",
"build": "vite build",
"build:pwa": "cross-env VITE_PWA_ENABLED=yes vite build",
"test": "vitest run",
"preview": "vite preview",
"lint": "eslint --ext .tsx,.ts src",
"lint:fix": "eslint --fix --ext .tsx,.ts src",
"lint:report": "eslint --ext .tsx,.ts --output-file eslint_report.json --format json src",
"preinstall": "npx -y only-allow pnpm"
},
"browserslist": {
"production": [
"defaults",
"chrome > 90"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@babel/core": "^7.21.3",
"@babel/preset-env": "^7.20.2",

View file

@ -1,5 +1,19 @@
window.__CONFIG__ = {
// url must NOT end with a slash
VITE_CORS_PROXY_URL: "",
VITE_TMDB_READ_API_KEY: ""
// The URL for the CORS proxy, the URL must NOT end with a slash!
VITE_CORS_PROXY_URL: "CHANGEME",
// The READ API key to access TMDB
VITE_TMDB_READ_API_KEY: "CHANGEME",
// The DMCA email displayed in the footer, null to hide the DMCA link
VITE_DMCA_EMAIL: null,
// Whether to disable hash-based routing, leave this as false if you don't know what this is
VITE_NORMAL_ROUTER: false,
// The backend URL to communicate with, defaults to the movie-web hosted one at backend.movie-web.app
VITE_BACKEND_URL: null,
// A comma separated list of disallowed IDs in the case of a DMCA claim - in the format "series-<id>" and "movie-<id>"
VITE_DISALLOWED_IDS: ""
};

View file

@ -260,7 +260,8 @@
"loadingUserError": {
"text": "Failed to load your profile",
"textWithReset": "Failed to load your profile from your custom server, want to reset back to the default server?",
"reset": "Reset custom server"
"reset": "Reset custom server",
"logout": "Logout"
},
"migration": {
"failed": "Failed to migrate your data.",

View file

@ -1,4 +1,9 @@
{
"auth": {
"deviceNameLabel": "Toestel naam",
"deviceNamePlaceholder": "Huistelefoon",
"hasAccount": "Heb je al een account? <0>Log hier in.</0>"
},
"global": {
"name": "movie-web"
},

View file

@ -15,6 +15,7 @@ import { useAsync } from "react-use";
import { Button } from "@/components/buttons/Button";
import { Icon, Icons } from "@/components/Icon";
import { Loading } from "@/components/layout/Loading";
import { useAuth } from "@/hooks/auth/useAuth";
import { useAuthRestore } from "@/hooks/auth/useAuthRestore";
import { useBackendUrl } from "@/hooks/auth/useBackendUrl";
import { ErrorBoundary } from "@/pages/errors/ErrorBoundary";
@ -57,14 +58,22 @@ function LoadingScreen(props: { type: "user" | "lazy" }) {
function ErrorScreen(props: {
children: ReactNode;
showResetButton?: boolean;
showLogoutButton?: boolean;
}) {
const { t } = useTranslation();
const { logout } = useAuth();
const setBackendUrl = useAuthStore((s) => s.setBackendUrl);
const resetBackend = useCallback(() => {
setBackendUrl(null);
// eslint-disable-next-line no-restricted-globals
location.reload();
}, [setBackendUrl]);
const logoutFromBackend = useCallback(() => {
logout().then(() => {
// eslint-disable-next-line no-restricted-globals
location.reload();
});
}, [logout]);
return (
<LargeTextPart
@ -80,6 +89,13 @@ function ErrorScreen(props: {
</Button>
</div>
) : null}
{props.showLogoutButton ? (
<div className="mt-6">
<Button theme="secondary" onClick={logoutFromBackend}>
{t("screens.loadingUserError.logout")}
</Button>
</div>
) : null}
</LargeTextPart>
);
}
@ -90,12 +106,17 @@ function AuthWrapper() {
const userBackendUrl = useBackendUrl();
const { t } = useTranslation();
const isCustomUrl = backendUrl !== userBackendUrl;
if (status.loading) return <LoadingScreen type="user" />;
if (status.error)
return (
<ErrorScreen showResetButton={backendUrl !== userBackendUrl}>
<ErrorScreen
showResetButton={isCustomUrl}
showLogoutButton={!isCustomUrl}
>
{t(
backendUrl !== userBackendUrl
isCustomUrl
? "screens.loadingUserError.textWithReset"
: "screens.loadingUserError.text"
)}

View file

@ -16,6 +16,14 @@ export interface HeroPartProps {
searchParams: ReturnType<typeof useSearchQuery>;
}
function getTimeOfDay(date: Date): "night" | "morning" | "day" {
const hour = date.getHours();
if (hour < 5) return "night";
if (hour < 12) return "morning";
if (hour < 19) return "day";
return "night";
}
export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) {
const { t: randomT } = useRandomTranslation();
const { t } = useTranslation();
@ -44,11 +52,7 @@ export function HeroPart({ setIsSticky, searchParams }: HeroPartProps) {
}
}, [windowWidth]);
let time = "night";
const hour = new Date().getHours();
if (hour < 12) time = "morning";
else if (hour < 19) time = "day";
const time = getTimeOfDay(new Date());
const title = randomT(`home.titles.${time}`);
const inputRef = useRef<HTMLInputElement>(null);

View file

@ -1,5 +1,6 @@
import {
APP_VERSION,
BACKEND_URL,
DISCORD_LINK,
DONATION_LINK,
GITHUB_LINK,
@ -47,13 +48,17 @@ const env: Record<keyof Config, undefined | string> = {
// loads from different locations, in order: environment (VITE_{KEY}), window (public/config.js)
function getKeyValue(key: keyof Config): string | undefined {
let windowValue = (window as any)?.__CONFIG__?.[`VITE_${key}`];
if (windowValue !== undefined && windowValue.length === 0)
if (
windowValue !== null &&
windowValue !== undefined &&
windowValue.length === 0
)
windowValue = undefined;
return env[key] ?? windowValue ?? undefined;
}
function getKey(key: keyof Config, defaultString?: string): string {
return getKeyValue(key) ?? defaultString ?? "";
return getKeyValue(key)?.toString() ?? defaultString ?? "";
}
export function conf(): RuntimeConfig {
@ -64,7 +69,7 @@ export function conf(): RuntimeConfig {
DONATION_LINK,
DISCORD_LINK,
DMCA_EMAIL: dmcaEmail.length > 0 ? dmcaEmail : null,
BACKEND_URL: getKey("BACKEND_URL"),
BACKEND_URL: getKey("BACKEND_URL", BACKEND_URL),
TMDB_READ_API_KEY: getKey("TMDB_READ_API_KEY"),
PROXY_URLS: getKey("CORS_PROXY_URL")
.split(",")

View file

@ -3,3 +3,4 @@ export const DISCORD_LINK = "https://discord.movie-web.app";
export const GITHUB_LINK = "https://github.com/movie-web/movie-web";
export const DONATION_LINK = "https://ko-fi.com/movieweb";
export const GA_ID = "G-44YVXRL61C";
export const BACKEND_URL = "https://backend.movie-web.app";

View file

@ -39,7 +39,7 @@ export default defineConfig(({ mode }) => {
}
}),
VitePWA({
disable: env.VITE_PWA_ENABLED !== "yes",
disable: env.VITE_PWA_ENABLED !== "true",
registerType: "autoUpdate",
workbox: {
maximumFileSizeToCacheInBytes: 4000000, // 4mb
@ -102,6 +102,10 @@ export default defineConfig(({ mode }) => {
})
],
build: {
sourcemap: true,
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),