mirror of
https://github.com/p-stream/p-stream.git
synced 2026-01-11 20:10:32 +00:00
Revert "Inject popup ad for xprime sources"
This reverts commit b6be227ab3.
This commit is contained in:
parent
b6be227ab3
commit
03d74e4ecd
11 changed files with 2 additions and 200 deletions
|
|
@ -1126,9 +1126,6 @@
|
|||
"doubleClickToSeek": "Double tap to seek",
|
||||
"doubleClickToSeekDescription": "Double tap on the left or right side of the player to seek 10 seconds forward or backward.",
|
||||
"doubleClickToSeekLabel": "Enable double tap to seek",
|
||||
"disableXPrimeAds": "XPrime ads",
|
||||
"disableXPrimeAdsDescription": "Disable popup ads and notifications when watching content from XPrime sources. XPrime uses ads to support their service and keep it free for you and us to use.",
|
||||
"disableXPrimeAdsLabel": "Disable XPrime ads",
|
||||
"sourceOrder": "Reordering sources",
|
||||
"sourceOrderDescription": "Drag and drop to reorder sources. This will determine the order in which sources are checked for the media you are trying to watch. If a source is greyed out, it means the <bold>extension</bold> is required for that source. <br><br> <strong>(The default order is best for most users)</strong>",
|
||||
"sourceOrderEnableLabel": "Custom source order",
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ export interface SettingsInput {
|
|||
homeSectionOrder?: string[] | null;
|
||||
manualSourceSelection?: boolean;
|
||||
enableDoubleClickToSeek?: boolean;
|
||||
disableXPrimeAds?: boolean;
|
||||
}
|
||||
|
||||
export interface SettingsResponse {
|
||||
|
|
@ -70,7 +69,6 @@ export interface SettingsResponse {
|
|||
homeSectionOrder?: string[] | null;
|
||||
manualSourceSelection?: boolean;
|
||||
enableDoubleClickToSeek?: boolean;
|
||||
disableXPrimeAds?: boolean;
|
||||
}
|
||||
|
||||
export function updateSettings(
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
import { useEffect, useState } from "react";
|
||||
|
||||
import { Icon, Icons } from "@/components/Icon";
|
||||
import { Flare } from "@/components/utils/Flare";
|
||||
import { Transition } from "@/components/utils/Transition";
|
||||
import { usePlayerStore } from "@/stores/player/store";
|
||||
import { usePreferencesStore } from "@/stores/preferences";
|
||||
|
||||
export function XPrimeAdOverlay() {
|
||||
const { sourceId, status } = usePlayerStore((s) => ({
|
||||
sourceId: s.sourceId,
|
||||
status: s.status,
|
||||
}));
|
||||
const disableXPrimeAds = usePreferencesStore((s) => s.disableXPrimeAds);
|
||||
const [show, setShow] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// Only show overlay when all conditions are met
|
||||
const scriptExists = !!document.querySelector(
|
||||
'script[data-cfasync="false"][src*="jg.prisagedibbuk.com"]',
|
||||
);
|
||||
const shouldShow =
|
||||
sourceId === "xprimetv" &&
|
||||
status === "playing" &&
|
||||
!disableXPrimeAds &&
|
||||
scriptExists;
|
||||
if (shouldShow && !show) {
|
||||
setShow(true);
|
||||
const timer = setTimeout(() => {
|
||||
setShow(false);
|
||||
}, 5000); // Hide after 5 seconds
|
||||
|
||||
return () => clearTimeout(timer);
|
||||
}
|
||||
if (!shouldShow && show) {
|
||||
setShow(false);
|
||||
}
|
||||
}, [sourceId, status, disableXPrimeAds]); // eslint-disable-line react-hooks/exhaustive-deps
|
||||
|
||||
if (!show) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Transition
|
||||
animation="slide-down"
|
||||
show
|
||||
className="absolute inset-x-0 top-4 flex justify-center pointer-events-none"
|
||||
>
|
||||
<Flare.Base className="hover:flare-enabled pointer-events-auto bg-video-context-background pl-4 pr-6 py-3 group w-96 h-full rounded-lg transition-colors text-video-context-type-main">
|
||||
<Flare.Light
|
||||
enabled
|
||||
flareSize={200}
|
||||
cssColorVar="--colors-video-context-light"
|
||||
backgroundClass="bg-video-context-background duration-100"
|
||||
className="rounded-lg"
|
||||
/>
|
||||
<Flare.Child className="grid grid-cols-[auto,1fr] gap-3 pointer-events-auto relative transition-transform">
|
||||
<Icon className="text-xl" icon={Icons.CIRCLE_EXCLAMATION} />
|
||||
<div className="w-full flex items-center">
|
||||
<span className="text-sm text-center">
|
||||
XPrime uses ads, but they can be disabled from settings!
|
||||
</span>
|
||||
</div>
|
||||
</Flare.Child>
|
||||
</Flare.Base>
|
||||
</Transition>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable no-console */
|
||||
import fscreen from "fscreen";
|
||||
import Hls, { Level } from "hls.js";
|
||||
|
||||
|
|
@ -19,13 +18,11 @@ import {
|
|||
isUrlAlreadyProxied,
|
||||
} from "@/components/player/utils/proxy";
|
||||
import { useLanguageStore } from "@/stores/language";
|
||||
import { usePlayerStore } from "@/stores/player/store";
|
||||
import {
|
||||
LoadableSource,
|
||||
SourceQuality,
|
||||
getPreferredQuality,
|
||||
} from "@/stores/player/utils/qualities";
|
||||
import { usePreferencesStore } from "@/stores/preferences";
|
||||
import { processCdnLink } from "@/utils/cdn";
|
||||
import {
|
||||
canChangeVolume,
|
||||
|
|
@ -106,44 +103,6 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
|||
(value: void | PromiseLike<void>) => void
|
||||
>();
|
||||
|
||||
function removeXPrimeAd() {
|
||||
const script = document.querySelector(
|
||||
'script[data-cfasync="false"][src*="jg.prisagedibbuk.com"]',
|
||||
);
|
||||
if (script) {
|
||||
console.log("removing XPrime ad script");
|
||||
script.remove();
|
||||
}
|
||||
}
|
||||
|
||||
function injectXPrimeAd(sourceId?: string | null) {
|
||||
const currentSourceId = sourceId ?? usePlayerStore.getState().sourceId;
|
||||
console.log("currentSourceId", currentSourceId);
|
||||
const disableXPrimeAds = usePreferencesStore.getState().disableXPrimeAds;
|
||||
|
||||
// Remove script if not playing XPrime content
|
||||
if (currentSourceId !== "xprimetv") {
|
||||
removeXPrimeAd();
|
||||
return;
|
||||
}
|
||||
|
||||
// Inject script if playing XPrime content and ads are enabled
|
||||
if (
|
||||
!disableXPrimeAds &&
|
||||
!document.querySelector(
|
||||
'script[data-cfasync="false"][src*="jg.prisagedibbuk.com"]',
|
||||
)
|
||||
) {
|
||||
console.log("injecting XPrime ad");
|
||||
const script = document.createElement("script");
|
||||
script.setAttribute("data-cfasync", "false");
|
||||
script.async = true;
|
||||
script.type = "text/javascript";
|
||||
script.src = "//jg.prisagedibbuk.com/r47OViiCQMeGnyQ/131974";
|
||||
document.head.appendChild(script);
|
||||
}
|
||||
}
|
||||
|
||||
function reportLevels() {
|
||||
if (!hls) return;
|
||||
const levels = hls.levels;
|
||||
|
|
@ -395,7 +354,6 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
|||
videoElement.addEventListener("play", () => {
|
||||
emit("play", undefined);
|
||||
emit("loading", false);
|
||||
injectXPrimeAd();
|
||||
});
|
||||
videoElement.addEventListener("error", () => {
|
||||
const err = videoElement?.error ?? null;
|
||||
|
|
@ -589,8 +547,6 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
|||
"leavepictureinpicture",
|
||||
pictureInPictureChange,
|
||||
);
|
||||
// Clean up XPrime ad script when destroying the display
|
||||
removeXPrimeAd();
|
||||
},
|
||||
load(ops) {
|
||||
if (!ops.source) unloadSource();
|
||||
|
|
@ -602,10 +558,6 @@ export function makeVideoElementDisplayInterface(): DisplayInterface {
|
|||
// Set autoplay flag if starting from beginning (indicates autoplay transition)
|
||||
shouldAutoplayAfterLoad = ops.startAt === 0;
|
||||
setSource();
|
||||
// Inject ads after source change if conditions are met
|
||||
if (ops.source) {
|
||||
injectXPrimeAd();
|
||||
}
|
||||
},
|
||||
changeQuality(newAutomaticQuality, newPreferredQuality) {
|
||||
if (source?.type !== "hls") return;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,6 @@ export function useSettingsState(
|
|||
homeSectionOrder: string[],
|
||||
manualSourceSelection: boolean,
|
||||
enableDoubleClickToSeek: boolean,
|
||||
disableXPrimeAds: boolean,
|
||||
) {
|
||||
const [proxyUrlsState, setProxyUrls, resetProxyUrls, proxyUrlsChanged] =
|
||||
useDerived(proxyUrls);
|
||||
|
|
@ -263,12 +262,6 @@ export function useSettingsState(
|
|||
resetEnableDoubleClickToSeek,
|
||||
enableDoubleClickToSeekChanged,
|
||||
] = useDerived(enableDoubleClickToSeek);
|
||||
const [
|
||||
disableXPrimeAdsState,
|
||||
setDisableXPrimeAdsState,
|
||||
resetDisableXPrimeAds,
|
||||
disableXPrimeAdsChanged,
|
||||
] = useDerived(disableXPrimeAds);
|
||||
|
||||
function reset() {
|
||||
resetTheme();
|
||||
|
|
@ -306,7 +299,6 @@ export function useSettingsState(
|
|||
resetHomeSectionOrder();
|
||||
resetManualSourceSelection();
|
||||
resetEnableDoubleClickToSeek();
|
||||
resetDisableXPrimeAds();
|
||||
}
|
||||
|
||||
const changed =
|
||||
|
|
@ -344,8 +336,7 @@ export function useSettingsState(
|
|||
enableHoldToBoostChanged ||
|
||||
homeSectionOrderChanged ||
|
||||
manualSourceSelectionChanged ||
|
||||
enableDoubleClickToSeekChanged ||
|
||||
disableXPrimeAdsChanged;
|
||||
enableDoubleClickToSeekChanged;
|
||||
|
||||
return {
|
||||
reset,
|
||||
|
|
@ -525,10 +516,5 @@ export function useSettingsState(
|
|||
set: setEnableDoubleClickToSeekState,
|
||||
changed: enableDoubleClickToSeekChanged,
|
||||
},
|
||||
disableXPrimeAds: {
|
||||
state: disableXPrimeAdsState,
|
||||
set: setDisableXPrimeAdsState,
|
||||
changed: disableXPrimeAdsChanged,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -486,9 +486,6 @@ export function SettingsPage() {
|
|||
(s) => s.setEnableDoubleClickToSeek,
|
||||
);
|
||||
|
||||
const disableXPrimeAds = usePreferencesStore((s) => s.disableXPrimeAds);
|
||||
const setDisableXPrimeAds = usePreferencesStore((s) => s.setDisableXPrimeAds);
|
||||
|
||||
const account = useAuthStore((s) => s.account);
|
||||
const updateProfile = useAuthStore((s) => s.setAccountProfile);
|
||||
const updateDeviceName = useAuthStore((s) => s.updateDeviceName);
|
||||
|
|
@ -560,7 +557,6 @@ export function SettingsPage() {
|
|||
homeSectionOrder,
|
||||
manualSourceSelection,
|
||||
enableDoubleClickToSeek,
|
||||
disableXPrimeAds,
|
||||
);
|
||||
|
||||
const availableSources = useMemo(() => {
|
||||
|
|
@ -626,8 +622,7 @@ export function SettingsPage() {
|
|||
state.enableHoldToBoost.changed ||
|
||||
state.homeSectionOrder.changed ||
|
||||
state.manualSourceSelection.changed ||
|
||||
state.enableDoubleClickToSeek ||
|
||||
state.disableXPrimeAds.changed
|
||||
state.enableDoubleClickToSeek
|
||||
) {
|
||||
await updateSettings(backendUrl, account, {
|
||||
applicationLanguage: state.appLanguage.state,
|
||||
|
|
@ -656,7 +651,6 @@ export function SettingsPage() {
|
|||
homeSectionOrder: state.homeSectionOrder.state,
|
||||
manualSourceSelection: state.manualSourceSelection.state,
|
||||
enableDoubleClickToSeek: state.enableDoubleClickToSeek.state,
|
||||
disableXPrimeAds: state.disableXPrimeAds.state,
|
||||
});
|
||||
}
|
||||
if (state.deviceName.changed) {
|
||||
|
|
@ -711,7 +705,6 @@ export function SettingsPage() {
|
|||
setHomeSectionOrder(state.homeSectionOrder.state);
|
||||
setManualSourceSelection(state.manualSourceSelection.state);
|
||||
setEnableDoubleClickToSeek(state.enableDoubleClickToSeek.state);
|
||||
setDisableXPrimeAds(state.disableXPrimeAds.state);
|
||||
|
||||
if (state.profile.state) {
|
||||
updateProfile(state.profile.state);
|
||||
|
|
@ -764,7 +757,6 @@ export function SettingsPage() {
|
|||
setHomeSectionOrder,
|
||||
setManualSourceSelection,
|
||||
setEnableDoubleClickToSeek,
|
||||
setDisableXPrimeAds,
|
||||
]);
|
||||
return (
|
||||
<SubPageLayout>
|
||||
|
|
@ -846,8 +838,6 @@ export function SettingsPage() {
|
|||
setManualSourceSelection={state.manualSourceSelection.set}
|
||||
enableDoubleClickToSeek={state.enableDoubleClickToSeek.state}
|
||||
setEnableDoubleClickToSeek={state.enableDoubleClickToSeek.set}
|
||||
disableXPrimeAds={state.disableXPrimeAds.state}
|
||||
setDisableXPrimeAds={state.disableXPrimeAds.set}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import { Player } from "@/components/player";
|
|||
import { SkipIntroButton } from "@/components/player/atoms/SkipIntroButton";
|
||||
import { UnreleasedEpisodeOverlay } from "@/components/player/atoms/UnreleasedEpisodeOverlay";
|
||||
import { WatchPartyStatus } from "@/components/player/atoms/WatchPartyStatus";
|
||||
import { XPrimeAdOverlay } from "@/components/player/atoms/XPrimeAdOverlay";
|
||||
import { useShouldShowControls } from "@/components/player/hooks/useShouldShowControls";
|
||||
import { useSkipTime } from "@/components/player/hooks/useSkipTime";
|
||||
import { useIsMobile } from "@/hooks/useIsMobile";
|
||||
|
|
@ -228,7 +227,6 @@ export function PlayerPart(props: PlayerPartProps) {
|
|||
<Player.SubtitleDelayPopout />
|
||||
<Player.SpeedChangedPopout />
|
||||
<UnreleasedEpisodeOverlay />
|
||||
<XPrimeAdOverlay />
|
||||
|
||||
<Player.NextEpisodeButton
|
||||
controlsShowing={showTargets}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import { FlagIcon } from "@/components/FlagIcon";
|
|||
import { Dropdown } from "@/components/form/Dropdown";
|
||||
import { SortableListWithToggles } from "@/components/form/SortableListWithToggles";
|
||||
import { Heading1 } from "@/components/utils/Text";
|
||||
import { conf } from "@/setup/config";
|
||||
import { appLanguageOptions } from "@/setup/i18n";
|
||||
import { isAutoplayAllowed } from "@/utils/autoplay";
|
||||
import { getLocaleInfo, sortLangCodes } from "@/utils/language";
|
||||
|
|
@ -40,8 +39,6 @@ export function PreferencesPart(props: {
|
|||
setManualSourceSelection: (v: boolean) => void;
|
||||
enableDoubleClickToSeek: boolean;
|
||||
setEnableDoubleClickToSeek: (v: boolean) => void;
|
||||
disableXPrimeAds: boolean;
|
||||
setDisableXPrimeAds: (v: boolean) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const sorted = sortLangCodes(appLanguageOptions.map((item) => item.code));
|
||||
|
|
@ -187,7 +184,6 @@ export function PreferencesPart(props: {
|
|||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Low Performance Mode */}
|
||||
<div>
|
||||
<p className="text-white font-bold mb-3">
|
||||
|
|
@ -248,29 +244,6 @@ export function PreferencesPart(props: {
|
|||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Disable XPrime Ads */}
|
||||
{conf().XPRIME_ADS && (
|
||||
<div>
|
||||
<p className="text-white font-bold mb-3">
|
||||
{t("settings.preferences.disableXPrimeAds")}
|
||||
</p>
|
||||
<p className="max-w-[25rem] font-medium">
|
||||
{t("settings.preferences.disableXPrimeAdsDescription")}
|
||||
</p>
|
||||
<div
|
||||
onClick={() =>
|
||||
props.setDisableXPrimeAds(!props.disableXPrimeAds)
|
||||
}
|
||||
className="bg-dropdown-background hover:bg-dropdown-hoverBackground select-none my-4 cursor-pointer space-x-3 flex items-center max-w-[25rem] py-3 px-4 rounded-lg"
|
||||
>
|
||||
<Toggle enabled={props.disableXPrimeAds} />
|
||||
<p className="flex-1 text-white font-bold">
|
||||
{t("settings.preferences.disableXPrimeAdsLabel")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Column */}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ interface Config {
|
|||
BANNER_MESSAGE: string;
|
||||
BANNER_ID: string;
|
||||
USE_TRAKT: boolean;
|
||||
XPRIME_ADS: boolean;
|
||||
}
|
||||
|
||||
export interface RuntimeConfig {
|
||||
|
|
@ -63,7 +62,6 @@ export interface RuntimeConfig {
|
|||
BANNER_MESSAGE: string | null;
|
||||
BANNER_ID: string | null;
|
||||
USE_TRAKT: boolean;
|
||||
XPRIME_ADS: boolean;
|
||||
}
|
||||
|
||||
const env: Record<keyof Config, undefined | string> = {
|
||||
|
|
@ -96,7 +94,6 @@ const env: Record<keyof Config, undefined | string> = {
|
|||
BANNER_MESSAGE: import.meta.env.VITE_BANNER_MESSAGE,
|
||||
BANNER_ID: import.meta.env.VITE_BANNER_ID,
|
||||
USE_TRAKT: import.meta.env.VITE_USE_TRAKT,
|
||||
XPRIME_ADS: import.meta.env.VITE_XPRIME_ADS,
|
||||
};
|
||||
|
||||
function coerceUndefined(value: string | null | undefined): string | undefined {
|
||||
|
|
@ -172,6 +169,5 @@ export function conf(): RuntimeConfig {
|
|||
BANNER_MESSAGE: getKey("BANNER_MESSAGE"),
|
||||
BANNER_ID: getKey("BANNER_ID"),
|
||||
USE_TRAKT: getKey("USE_TRAKT", "false") === "true",
|
||||
XPRIME_ADS: getKey("XPRIME_ADS", "false") === "true",
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,17 +150,6 @@ export const createSourceSlice: MakeSlice<SourceSlice> = (set, get) => ({
|
|||
s.status = playerStatus.PLAYING;
|
||||
s.sourceId = id;
|
||||
});
|
||||
|
||||
// Remove XPrime ad script if not playing XPrime content
|
||||
if (id !== "xprimetv") {
|
||||
const script = document.querySelector(
|
||||
'script[data-cfasync="false"][src*="jg.prisagedibbuk.com"]',
|
||||
);
|
||||
if (script) {
|
||||
console.log("removing XPrime ad script due to source change");
|
||||
script.remove();
|
||||
}
|
||||
}
|
||||
},
|
||||
setEmbedId(id) {
|
||||
set((s) => {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ export interface PreferencesStore {
|
|||
homeSectionOrder: string[];
|
||||
manualSourceSelection: boolean;
|
||||
enableDoubleClickToSeek: boolean;
|
||||
disableXPrimeAds: boolean;
|
||||
|
||||
setEnableThumbnails(v: boolean): void;
|
||||
setEnableAutoplay(v: boolean): void;
|
||||
|
|
@ -59,7 +58,6 @@ export interface PreferencesStore {
|
|||
setHomeSectionOrder(v: string[]): void;
|
||||
setManualSourceSelection(v: boolean): void;
|
||||
setEnableDoubleClickToSeek(v: boolean): void;
|
||||
setDisableXPrimeAds(v: boolean): void;
|
||||
}
|
||||
|
||||
export const usePreferencesStore = create(
|
||||
|
|
@ -92,7 +90,6 @@ export const usePreferencesStore = create(
|
|||
homeSectionOrder: ["watching", "bookmarks"],
|
||||
manualSourceSelection: false,
|
||||
enableDoubleClickToSeek: false,
|
||||
disableXPrimeAds: false,
|
||||
setEnableThumbnails(v) {
|
||||
set((s) => {
|
||||
s.enableThumbnails = v;
|
||||
|
|
@ -233,11 +230,6 @@ export const usePreferencesStore = create(
|
|||
s.enableDoubleClickToSeek = v;
|
||||
});
|
||||
},
|
||||
setDisableXPrimeAds(v) {
|
||||
set((s) => {
|
||||
s.disableXPrimeAds = v;
|
||||
});
|
||||
},
|
||||
})),
|
||||
{
|
||||
name: "__MW::preferences",
|
||||
|
|
|
|||
Loading…
Reference in a new issue