Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ NEXT_PUBLIC_DEFAULT_BACKDROP_SIZE=w1280
# autoplay) — swap this to move to a custom domain without a code change.
# next.config.mjs derives the CSP frame-src from this value at build time, so
# changing it requires a rebuild for the player iframe to be allowed.
NEXT_PUBLIC_VIDSRC_BASE_URL=https://vidsrcme.ru
NEXT_PUBLIC_VIDSRC_BASE_URL=https://vidsrc.sh
NEXT_PUBLIC_DEFAULT_PLAYER=vidsrc
NEXT_PUBLIC_AUTO_PLAY=true

Expand Down
2 changes: 1 addition & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ NEXT_PUBLIC_DEFAULT_BACKDROP_SIZE=w1280

# Video player (VidSrc) — swap this to a CNAME'd custom domain for fewer
# ads and no-click autoplay; that's a config change here, not a code change.
NEXT_PUBLIC_VIDSRC_BASE_URL=https://vidsrcme.ru
NEXT_PUBLIC_VIDSRC_BASE_URL=https://vidsrc.sh
NEXT_PUBLIC_DEFAULT_PLAYER=vidsrc
NEXT_PUBLIC_AUTO_PLAY=true

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ COPY . .
# mirror .env.production so an image built without them still works.
ARG NEXT_PUBLIC_TMDB_API_KEY=""
ARG NEXT_PUBLIC_TMDB_BASE_URL="https://api.themoviedb.org/3"
ARG NEXT_PUBLIC_VIDSRC_BASE_URL="https://vidsrcme.ru"
ARG NEXT_PUBLIC_VIDSRC_BASE_URL="https://vidsrc.sh"
ARG NEXT_PUBLIC_GA_TRACKING_ID="G-CR3ZVV9BE1"
ARG NEXT_PUBLIC_APP_VERSION="2.0.0"
ENV NEXT_PUBLIC_TMDB_API_KEY=${NEXT_PUBLIC_TMDB_API_KEY} \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ argument; on Coolify set the TMDB key as a **build-time** variable.
MIT — see [LICENSE](LICENSE).

Powered by [TMDB](https://www.themoviedb.org/) and
[VidSrc](https://vidsrcme.ru/).
[VidSrc](https://vidsrc.sh/).
2 changes: 1 addition & 1 deletion src/api/streaming/StreamingServices.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Streaming Services API
* Handles embed URL generation for the VidSrc player
* Docs: https://vidsrcme.ru/vidsrc/docs/
* Docs: https://vidsrc.sh/
*/

import { PLAYER_DEFAULTS } from '@/shared';
Expand Down
58 changes: 58 additions & 0 deletions src/shared/__tests__/playerConfig.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { execFileSync } from 'node:child_process';

describe('VidSrc provider configuration', () => {
const originalBaseUrl = process.env.NEXT_PUBLIC_VIDSRC_BASE_URL;

afterEach(() => {
if (originalBaseUrl === undefined) {
delete process.env.NEXT_PUBLIC_VIDSRC_BASE_URL;
} else {
process.env.NEXT_PUBLIC_VIDSRC_BASE_URL = originalBaseUrl;
}
jest.resetModules();
});

it.each([
['unset', undefined, 'https://vidsrc.sh'],
['empty', '', 'https://vidsrc.sh'],
['custom', 'https://player.example:8443', 'https://player.example:8443'],
])('keeps %s configuration consistent across URLs and CSP', (_, override, expectedBaseUrl) => {
if (override === undefined) {
delete process.env.NEXT_PUBLIC_VIDSRC_BASE_URL;
} else {
process.env.NEXT_PUBLIC_VIDSRC_BASE_URL = override;
}

jest.isolateModules(() => {
const { PLAYER_DEFAULTS } = require('../config/index.js');
const streamingServices = require('@/api/streaming/StreamingServices.js').default;
const { PLAYER_CONFIG, utils } = require('@/utils/config.js');

expect(PLAYER_DEFAULTS.vidsrcBaseUrl).toBe(expectedBaseUrl);
expect(PLAYER_CONFIG.vidsrc.baseUrl).toBe(expectedBaseUrl);
expect(streamingServices.getMovieUrl(9928)).toBe(
`${expectedBaseUrl}/embed/movie/9928?autoplay=1`
);
expect(utils.generatePlayerUrl('vidsrc', 9928, 'movie')).toBe(
`${expectedBaseUrl}/embed/movie/9928?autoplay=1`
);
});

const headers = JSON.parse(
execFileSync(
process.execPath,
[
'--input-type=module',
'-e',
"import config from './next.config.mjs'; console.log(JSON.stringify(await config.headers()));",
],
{ cwd: process.cwd(), env: process.env, encoding: 'utf8' }
)
);
const csp = headers
.find(route => route.source === '/(.*)')
.headers.find(header => header.key === 'Content-Security-Policy').value;

expect(csp.split('; ')).toContain(`frame-src 'self' ${new URL(expectedBaseUrl).origin}`);
});
});
2 changes: 1 addition & 1 deletion src/shared/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const PLAYER_DEFAULTS = {
// swapping to it must be an env change here, not a code change.
vidsrcBaseUrl:
(typeof process !== 'undefined' && process.env && process.env.NEXT_PUBLIC_VIDSRC_BASE_URL) ||
'https://vidsrcme.ru',
'https://vidsrc.sh',
defaultPlayer: 'vidsrc',
autoPlay: true,
language: 'en',
Expand Down
Loading