Merge branch 'development' of https://github.com/Stremio/stremio-web into chore/update-pull-user-from-api-action

This commit is contained in:
Tim 2025-10-22 13:41:11 +02:00
commit 7b2e5305e0
26 changed files with 11197 additions and 15627 deletions

View file

@ -13,8 +13,8 @@ jobs:
steps: steps:
# Auto assign PR to author # Auto assign PR to author
- name: Auto Assign PR to Author - name: Auto Assign PR to Author
if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' if: github.event.pull_request.head.repo.fork == false && github.event_name == 'pull_request' && github.actor != 'dependabot[bot]'
uses: actions/github-script@v7 uses: actions/github-script@v8
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
script: | script: |
@ -31,10 +31,10 @@ jobs:
# Dynamic labeling based on PR/Issue title # Dynamic labeling based on PR/Issue title
- name: Label PRs and Issues - name: Label PRs and Issues
if: github.actor != 'dependabot[bot]' if: github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]'
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/github-script@v7 uses: actions/github-script@v8
with: with:
github-token: ${{ secrets.GITHUB_TOKEN }} github-token: ${{ secrets.GITHUB_TOKEN }}
script: | script: |

View file

@ -5,7 +5,7 @@ on:
branches: branches:
- development - development
tags-ignore: tags-ignore:
- '**' - "**"
pull_request: pull_request:
branches: branches:
- development - development
@ -21,19 +21,25 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false
- name: Setup node - name: Setup node
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version-file: .nvmrc node-version-file: .nvmrc
cache: "pnpm"
- name: Install NPM dependencies - name: Install NPM dependencies
run: npm ci run: pnpm install
- name: Build - name: Build
run: npm run build run: pnpm build
- name: Test - name: Test
run: npm test run: pnpm test
- name: Lint - name: Lint
run: npm run lint run: pnpm lint
# Create recursivelly the destiantion dir with # Create recursively the destination dir with
# "--parrents where no error if existing, make parent directories as needed." # "--parrents where no error if existing, make parent directories as needed."
- run: mkdir -p ./build/${{ github.head_ref || github.ref_name }} - run: mkdir -p ./build/${{ github.head_ref || github.ref_name }}
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages

View file

@ -9,7 +9,7 @@ permissions:
contents: write contents: write
jobs: jobs:
build: cleanup:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -18,13 +18,30 @@ jobs:
ref: gh-pages ref: gh-pages
fetch-depth: 0 fetch-depth: 0
- name: Delete directories older than 1 year - name: Delete directories that don't have existing branch
run: | run: |
for dir in $(find . -mindepth 1 -maxdepth 2 -type d -not -path '*/\.*'); do branches=( $(git branch -r | grep origin | grep -v HEAD | sed 's|origin/||') )
if ! git log -1 --since="1 year ago" -- "$dir" | grep -q .; then declare -p branches
echo "Deleting $dir"
rm -rf "$dir" find . -mindepth 1 -maxdepth 2 -type d -not -path '*/\.*' | while read -r dir; do
fi path="${dir#./}"
if [[ " ${branches[*]} " =~ " $path " ]]; then
continue
fi
keep_parent=false
for branch in "${branches[@]}"; do
if [[ "$branch" == "$path/"* ]]; then
keep_parent=true
break
fi
done
if ! $keep_parent; then
echo "Deleting $dir"
rm -rf "$dir"
fi
done done
- name: Commit and push - name: Commit and push

View file

@ -11,11 +11,11 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
- name: Install NPM dependencies - name: Install NPM dependencies
run: npm install run: pnpm install
- name: Build - name: Build
env: env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
run: npm run build run: pnpm build
- name: Zip build artifact - name: Zip build artifact
run: zip -r stremio-web.zip ./build run: zip -r stremio-web.zip ./build
- name: Upload build artifact to GitHub release assets - name: Upload build artifact to GitHub release assets
@ -25,4 +25,4 @@ jobs:
file: stremio-web.zip file: stremio-web.zip
asset_name: stremio-web.zip asset_name: stremio-web.zip
tag: ${{ github.ref }} tag: ${{ github.ref }}
overwrite: true overwrite: true

View file

@ -2,35 +2,42 @@
## Our Pledge ## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and community a harassment-free experience for everyone, regardless of age, level of experience, education, nationality or race. We as contributors and maintainers want to make contributing to our project and community a nice experience for everyone.
## Our Standards ## Our Standards
Examples of behavior that contributes to creating a positive environment include: Examples of positive behavior:
- Using welcoming and inclusive language. - Using welcoming language.
- Being respectful of differing viewpoints and experiences. - Being respectful.
- Accepting constructive criticism. - Accepting constructive criticism.
- Focusing on what is best for the community.
- Showing empathy towards other community members.
Examples of unacceptable behavior by participants include: Examples of bad behavior:
- The use of sexualized language or imagery and unwelcome sexual attention or advances. - Use of sexualized language.
- Trolling, insulting/derogatory comments, and personal or political attacks. - Trolling, insulting comments, and personal or political attacks.
- Public or private harassment. - Public or private harassment.
- Publishing others private information, such as a physical or electronic address, without explicit permission. - Publishing others private information, such as a physical or electronic address, without explicit permission.
- Other conduct which could reasonably be considered inappropriate in a professional setting. - Submitting entirely generated by AI PRs with agents such as Devin, Claude Code, Cursor Agent etc.
- Submitting PRs which in majority contain only AI generated code (including docs & comments) and do not solve an actual issue.
- Spamming issues because of no ETAs on issues.
## Our Responsibilities ## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers are responsible for enforcing this code of conduct. They can remove or edit comments, code, and other contributions that don't follow these rules. They can also ban users who behave inappropriately.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, pull requests, and other contributions that do not align with this Code of Conduct, as well as to temporarily or permanently ban any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Suggestions for newbies
- Contributors are welcomed to use AI models as "help" in solving issues, but you must always double check the code that you're submitting.
- Refrain from excesive comments generated by AI.
- Refrain from docs generated entirely by AI.
- Always check what files you are committing and submitting to the PR when you are using any agent for help or an AI model.
- If you don't know how to tackle a problem and AI can't help you, please just ask or look in Stack Overlflow, Google, Medium etc.
- Learning how to code is fun and easier when using AI, but sometimes it might be just too much ... what are you going to learn, if AI does everything for you and you don't know what the code you are submitting actually does?!
## Scope ## Scope
This Code of Conduct applies within all `stremio-web` spaces, and also applies when an individual is officially representing the project or its community in public spaces. This Code of Conduct applies everywhere in `stremio-web` repository, and also applies when an individual is officially representing the project or its community in other spaces.
## Enforcement ## Enforcement

View file

@ -1,6 +1,6 @@
# Stremio - Freedom to Stream # Stremio - Freedom to Stream
![Build](https://github.com/stremio/stremio-web/workflows/Build/badge.svg?branch=development) [![Build](https://github.com/Stremio/stremio-web/actions/workflows/build.yml/badge.svg)](https://github.com/Stremio/stremio-web/actions/workflows/build.yml)
[![Github Page](https://img.shields.io/website?label=Page&logo=github&up_message=online&down_message=offline&url=https%3A%2F%2Fstremio.github.io%2Fstremio-web%2F)](https://stremio.github.io/stremio-web/development) [![Github Page](https://img.shields.io/website?label=Page&logo=github&up_message=online&down_message=offline&url=https%3A%2F%2Fstremio.github.io%2Fstremio-web%2F)](https://stremio.github.io/stremio-web/development)
Stremio is a modern media center that's a one-stop solution for your video entertainment. You discover, watch and organize video content from easy to install addons. Stremio is a modern media center that's a one-stop solution for your video entertainment. You discover, watch and organize video content from easy to install addons.
@ -10,24 +10,31 @@ Stremio is a modern media center that's a one-stop solution for your video enter
### Prerequisites ### Prerequisites
* Node.js 12 or higher * Node.js 12 or higher
* npm 6 or higher * [pnpm](https://pnpm.io/installation) 10 or higher
### Install dependencies ### Install dependencies
```bash ```bash
npm install pnpm install
``` ```
### Start development server ### Start development server
```bash ```bash
npm start pnpm start
``` ```
### Production build ### Production build
```bash ```bash
npm run build pnpm run build
```
### Run with Docker
```bash
docker build -t stremio-web .
docker run -p 8080:8080 stremio-web
``` ```
## Screenshots ## Screenshots

View file

@ -82,7 +82,7 @@ export default [
'@stylistic/semi-spacing': 'error', '@stylistic/semi-spacing': 'error',
'@stylistic/space-before-blocks': 'error', '@stylistic/space-before-blocks': 'error',
'@stylistic/no-trailing-spaces': 'error', '@stylistic/no-trailing-spaces': 'error',
'@stylistic/func-call-spacing': 'error', '@stylistic/function-call-spacing': 'error',
'@stylistic/semi': 'error', '@stylistic/semi': 'error',
'@stylistic/no-extra-semi': 'error', '@stylistic/no-extra-semi': 'error',
'@stylistic/eol-last': 'error', '@stylistic/eol-last': 'error',

15562
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
{ {
"name": "stremio", "name": "stremio",
"displayName": "Stremio", "displayName": "Stremio",
"version": "5.0.0-beta.26", "version": "5.0.0-beta.27",
"author": "Smart Code OOD", "author": "Smart Code OOD",
"private": true, "private": true,
"license": "gpl-2.0", "license": "gpl-2.0",
@ -11,7 +11,7 @@
"build": "webpack --mode production", "build": "webpack --mode production",
"test": "jest", "test": "jest",
"lint": "eslint src", "lint": "eslint src",
"scan-translations": "npx jest ./tests/i18nScan.test.js" "scan-translations": "pnpx jest ./tests/i18nScan.test.js"
}, },
"dependencies": { "dependencies": {
"@babel/runtime": "7.26.0", "@babel/runtime": "7.26.0",
@ -19,7 +19,7 @@
"@stremio/stremio-colors": "5.2.0", "@stremio/stremio-colors": "5.2.0",
"@stremio/stremio-core-web": "0.49.4", "@stremio/stremio-core-web": "0.49.4",
"@stremio/stremio-icons": "5.7.1", "@stremio/stremio-icons": "5.7.1",
"@stremio/stremio-video": "0.0.61", "@stremio/stremio-video": "0.0.62",
"a-color-picker": "1.2.1", "a-color-picker": "1.2.1",
"bowser": "2.11.0", "bowser": "2.11.0",
"buffer": "6.0.3", "buffer": "6.0.3",
@ -50,8 +50,8 @@
"@babel/preset-env": "7.26.0", "@babel/preset-env": "7.26.0",
"@babel/preset-react": "7.26.3", "@babel/preset-react": "7.26.3",
"@eslint/js": "^9.16.0", "@eslint/js": "^9.16.0",
"@stylistic/eslint-plugin": "^2.11.0", "@stylistic/eslint-plugin": "^5.4.0",
"@stylistic/eslint-plugin-jsx": "^2.11.0", "@stylistic/eslint-plugin-jsx": "^4.4.1",
"@types/hat": "^0.0.4", "@types/hat": "^0.0.4",
"@types/lodash.isequal": "^4.5.8", "@types/lodash.isequal": "^4.5.8",
"@types/lodash.throttle": "^4.1.9", "@types/lodash.throttle": "^4.1.9",

11030
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.6 MiB

View file

@ -36,7 +36,13 @@ const SearchParamsHandler = () => {
}, },
}, },
}); });
core.transport.dispatch({
action: 'Ctx',
args: {
action: 'AddServerUrl',
args: streamingServerUrl,
},
});
toast.show({ toast.show({
type: 'success', type: 'success',
title: `Using streaming server at ${streamingServerUrl}`, title: `Using streaming server at ${streamingServerUrl}`,

View file

@ -10,11 +10,15 @@ const useFullscreen = () => {
const [fullscreen, setFullscreen] = useState(false); const [fullscreen, setFullscreen] = useState(false);
const requestFullscreen = useCallback(() => { const requestFullscreen = useCallback(async () => {
if (shell.active) { if (shell.active) {
shell.send('win-set-visibility', { fullscreen: true }); shell.send('win-set-visibility', { fullscreen: true });
} else { } else {
document.documentElement.requestFullscreen(); try {
await document.documentElement.requestFullscreen();
} catch (err) {
console.error('Error enabling fullscreen', err);
}
} }
}, []); }, []);

View file

@ -66,6 +66,15 @@
.icon-container { .icon-container {
width: 2rem; width: 2rem;
.icon {
width: 2rem;
height: 2rem;
}
}
.label-container {
display: none;
} }
} }
} }

View file

@ -36,7 +36,7 @@ i18n
const root = ReactDOM.createRoot(document.getElementById('app')); const root = ReactDOM.createRoot(document.getElementById('app'));
root.render(<App />); root.render(<App />);
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { if (process.env.NODE_ENV === 'production' && process.env.SERVICE_WORKER_DISABLED !== 'true' && process.env.SERVICE_WORKER_DISABLED !== true && 'serviceWorker' in navigator) {
window.addEventListener('load', () => { window.addEventListener('load', () => {
navigator.serviceWorker.register('service-worker.js') navigator.serviceWorker.register('service-worker.js')
.catch((registrationError) => { .catch((registrationError) => {

View file

@ -138,11 +138,11 @@ const Intro = ({ queryParams }) => {
}, []); }, []);
const loginWithEmail = React.useCallback(() => { const loginWithEmail = React.useCallback(() => {
if (typeof state.email !== 'string' || state.email.length === 0 || !emailRef.current.validity.valid) { if (typeof state.email !== 'string' || state.email.length === 0 || !emailRef.current.validity.valid) {
dispatch({ type: 'error', error: 'Invalid email' }); dispatch({ type: 'error', error: t('INVALID_EMAIL') });
return; return;
} }
if (typeof state.password !== 'string' || state.password.length === 0) { if (typeof state.password !== 'string' || state.password.length === 0) {
dispatch({ type: 'error', error: 'Invalid password' }); dispatch({ type: 'error', error: t('INVALID_PASSWORD') });
return; return;
} }
openLoaderModal(); openLoaderModal();
@ -160,26 +160,26 @@ const Intro = ({ queryParams }) => {
}, [state.email, state.password]); }, [state.email, state.password]);
const loginAsGuest = React.useCallback(() => { const loginAsGuest = React.useCallback(() => {
if (!state.termsAccepted) { if (!state.termsAccepted) {
dispatch({ type: 'error', error: 'You must accept the Terms of Service' }); dispatch({ type: 'error', error: t('MUST_ACCEPT_TERMS') });
return; return;
} }
window.location = '#/'; window.location = '#/';
}, [state.termsAccepted]); }, [state.termsAccepted]);
const signup = React.useCallback(() => { const signup = React.useCallback(() => {
if (typeof state.email !== 'string' || state.email.length === 0 || !emailRef.current.validity.valid) { if (typeof state.email !== 'string' || state.email.length === 0 || !emailRef.current.validity.valid) {
dispatch({ type: 'error', error: 'Invalid email' }); dispatch({ type: 'error', error: t('INVALID_EMAIL') });
return; return;
} }
if (typeof state.password !== 'string' || state.password.length === 0) { if (typeof state.password !== 'string' || state.password.length === 0) {
dispatch({ type: 'error', error: 'Invalid password' }); dispatch({ type: 'error', error: t('INVALID_PASSWORD') });
return; return;
} }
if (state.password !== state.confirmPassword) { if (state.password !== state.confirmPassword) {
dispatch({ type: 'error', error: 'Passwords do not match' }); dispatch({ type: 'error', error: t('PASSWORDS_NOMATCH') });
return; return;
} }
if (!state.termsAccepted) { if (!state.termsAccepted) {
dispatch({ type: 'error', error: 'You must accept the Terms of Service' }); dispatch({ type: 'error', error: t('MUST_ACCEPT_TERMS') });
return; return;
} }
if (!state.privacyPolicyAccepted) { if (!state.privacyPolicyAccepted) {

View file

@ -49,7 +49,7 @@ const useAppleLogin = (): [() => Promise<AppleLoginResponse>, () => void] => {
timeout.current && clearTimeout(timeout.current); timeout.current && clearTimeout(timeout.current);
timeout.current = setTimeout(() => { timeout.current = setTimeout(() => {
if (tries >= MAX_TRIES) if (tries >= MAX_TRIES)
return reject(new Error('Failed to authenticate with Apple')); return reject(new Error('Failed to authenticate with Apple', { cause: 'Number of allowed tries exceeded!' }));
tries++; tries++;

View file

@ -39,7 +39,7 @@ const useFacebookLogin = () => {
timeout.current && clearTimeout(timeout.current); timeout.current && clearTimeout(timeout.current);
timeout.current = setTimeout(() => { timeout.current = setTimeout(() => {
if (tries >= MAX_TRIES) if (tries >= MAX_TRIES)
return reject(new Error('Failed to authenticate with facebook')); return reject(new Error('Failed to authenticate with facebook', { cause: 'Number of allowed tries exceeded!' }));
tries++; tries++;

View file

@ -532,6 +532,53 @@ const Player = ({ urlParams, queryParams }) => {
} }
}, [settings.pauseOnMinimize, shell.windowClosed, shell.windowHidden]); }, [settings.pauseOnMinimize, shell.windowClosed, shell.windowHidden]);
// Media Session PlaybackState
React.useEffect(() => {
if (!navigator.mediaSession) return;
const playbackState = !video.state.paused ? 'playing' : 'paused';
navigator.mediaSession.playbackState = playbackState;
return () => navigator.mediaSession.playbackState = 'none';
}, [video.state.paused]);
// Media Session Metadata
React.useEffect(() => {
if (!navigator.mediaSession) return;
const metaItem = player.metaItem && player.metaItem.type === 'Ready' ? player.metaItem.content : null;
const videoId = player.selected ? player.selected.streamRequest.path.id : null;
const video = metaItem ? metaItem.videos.find(({ id }) => id === videoId) : null;
const videoInfo = video && video.season && video.episode ? ` (${video.season}x${video.episode})`: null;
const videoTitle = video ? `${video.title}${videoInfo}` : null;
const metaTitle = metaItem ? metaItem.name : null;
const imageUrl = metaItem ? metaItem.logo : null;
const title = videoTitle ?? metaTitle;
const artist = videoTitle ? metaTitle : undefined;
const artwork = imageUrl ? [{ src: imageUrl }] : undefined;
if (title) {
navigator.mediaSession.metadata = new MediaMetadata({
title,
artist,
artwork,
});
}
}, [player.metaItem, player.selected]);
// Media Session Actions
React.useEffect(() => {
if (!navigator.mediaSession) return;
navigator.mediaSession.setActionHandler('play', onPlayRequested);
navigator.mediaSession.setActionHandler('pause', onPauseRequested);
const nexVideoCallback = player.nextVideo ? onNextVideoRequested : null;
navigator.mediaSession.setActionHandler('nexttrack', nexVideoCallback);
}, [player.nextVideo, onPlayRequested, onPauseRequested, onNextVideoRequested]);
React.useLayoutEffect(() => { React.useLayoutEffect(() => {
const onKeyDown = (event) => { const onKeyDown = (event) => {
switch (event.code) { switch (event.code) {

View file

@ -21,7 +21,7 @@ const initialize = () => {
if (castAPIAvailable) { if (castAPIAvailable) {
resolve(); resolve();
} else { } else {
reject(new Error('window.cast api not available')); reject(new Error('window.cast api not available', { cause: 'castAPIAvailable is null.' }));
} }
} }
if (castAPIAvailable !== null) { if (castAPIAvailable !== null) {
@ -167,7 +167,7 @@ function ChromecastTransport() {
}); });
})); }));
} else { } else {
return Promise.reject(new Error('Session not started')); return Promise.reject(new Error('Session not started', { cause: 'castSession is null.' }));
} }
}; };
} }

View file

@ -63,7 +63,7 @@ function Shell() {
} catch (e) { } catch (e) {
console.error(e); console.error(e);
active = false; active = false;
error = new Error(e); error = new Error('Failed to initialize shell transport', { cause: e });
starting = false; starting = false;
onStateChanged(); onStateChanged();
transport = null; transport = null;

View file

@ -1,5 +1,3 @@
/* eslint-disable no-var */
type QtTransportMessage = { type QtTransportMessage = {
data: string; data: string;
}; };
@ -28,4 +26,4 @@ declare global {
var chrome: Chrome | undefined; var chrome: Chrome | undefined;
} }
export {}; export { };

View file

@ -1,6 +1,6 @@
{ {
"compilerOptions": { "compilerOptions": {
"lib": ["DOM", "DOM.Iterable"], "lib": [ "ES2016", "DOM", "DOM.Iterable"],
"jsx": "react", "jsx": "react",
"baseUrl": "./src", "baseUrl": "./src",
"outDir": "./dist", "outDir": "./dist",

View file

@ -213,6 +213,7 @@ module.exports = (env, argv) => ({
new webpack.EnvironmentPlugin({ new webpack.EnvironmentPlugin({
SENTRY_DSN: null, SENTRY_DSN: null,
...env, ...env,
SERVICE_WORKER_DISABLED: false,
DEBUG: argv.mode !== 'production', DEBUG: argv.mode !== 'production',
VERSION: pachageJson.version, VERSION: pachageJson.version,
COMMIT_HASH COMMIT_HASH