mirror of
https://github.com/sct/overseerr.git
synced 2025-12-26 00:16:16 +01:00
fix: dont show play on plex buttons when plex is disabled
This commit is contained in:
@@ -45,7 +45,7 @@ class AvailabilitySync {
|
||||
if (admin?.plexToken) {
|
||||
this.plexClient = new PlexAPI({ plexToken: admin.plexToken });
|
||||
} else {
|
||||
logger.error('An admin is not configured.');
|
||||
logger.warn('Plex is not configured. Skipping availability sync.');
|
||||
}
|
||||
|
||||
for await (const media of this.loadAvailableMediaPaginated(pageSize)) {
|
||||
|
||||
@@ -17,6 +17,18 @@ class WatchlistSync {
|
||||
public async syncWatchlist() {
|
||||
const userRepository = getRepository(User);
|
||||
|
||||
const admin = await userRepository.findOne({
|
||||
select: { id: true, plexToken: true },
|
||||
where: { id: 1 },
|
||||
});
|
||||
|
||||
if (!admin?.plexToken) {
|
||||
logger.warn('Skipping watchlist sync for admin without plex token', {
|
||||
label: 'Plex Watchlist Sync',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// Get users who actually have plex tokens
|
||||
const users = await userRepository
|
||||
.createQueryBuilder('user')
|
||||
|
||||
@@ -8,6 +8,7 @@ import IssueComment from '@app/components/IssueDetails/IssueComment';
|
||||
import IssueDescription from '@app/components/IssueDetails/IssueDescription';
|
||||
import { issueOptions } from '@app/components/IssueModal/constants';
|
||||
import useDeepLinks from '@app/hooks/useDeepLinks';
|
||||
import useSettings from '@app/hooks/useSettings';
|
||||
import { Permission, useUser } from '@app/hooks/useUser';
|
||||
import globalMessages from '@app/i18n/globalMessages';
|
||||
import Error from '@app/pages/_error';
|
||||
@@ -76,6 +77,7 @@ const isMovie = (movie: MovieDetails | TvDetails): movie is MovieDetails => {
|
||||
|
||||
const IssueDetails = () => {
|
||||
const { addToast } = useToasts();
|
||||
const { currentSettings } = useSettings();
|
||||
const router = useRouter();
|
||||
const intl = useIntl();
|
||||
const [showDeleteModal, setShowDeleteModal] = useState(false);
|
||||
@@ -361,7 +363,7 @@ const IssueDetails = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4 mb-6 flex flex-col space-y-2">
|
||||
{issueData?.media.plexUrl && (
|
||||
{currentSettings.plexLoginEnabled && issueData?.media.plexUrl && (
|
||||
<Button
|
||||
as="a"
|
||||
href={plexUrl}
|
||||
@@ -599,7 +601,7 @@ const IssueDetails = () => {
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4 mb-6 flex flex-col space-y-2">
|
||||
{issueData?.media.plexUrl && (
|
||||
{currentSettings.plexLoginEnabled && issueData?.media.plexUrl && (
|
||||
<Button
|
||||
as="a"
|
||||
href={plexUrl}
|
||||
|
||||
@@ -154,6 +154,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
|
||||
const mediaLinks: PlayButtonLink[] = [];
|
||||
|
||||
if (
|
||||
settings.currentSettings.plexLoginEnabled &&
|
||||
plexUrl &&
|
||||
hasPermission([Permission.REQUEST, Permission.REQUEST_MOVIE], {
|
||||
type: 'or',
|
||||
@@ -167,6 +168,7 @@ const MovieDetails = ({ movie }: MovieDetailsProps) => {
|
||||
}
|
||||
|
||||
if (
|
||||
settings.currentSettings.plexLoginEnabled &&
|
||||
settings.currentSettings.movie4kEnabled &&
|
||||
plexUrl4k &&
|
||||
hasPermission([Permission.REQUEST_4K, Permission.REQUEST_4K_MOVIE], {
|
||||
|
||||
@@ -149,7 +149,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
||||
|
||||
const mediaLinks: PlayButtonLink[] = [];
|
||||
|
||||
if (plexUrl) {
|
||||
if (settings.currentSettings.plexLoginEnabled && plexUrl) {
|
||||
mediaLinks.push({
|
||||
text: intl.formatMessage(messages.playonplex),
|
||||
url: plexUrl,
|
||||
@@ -158,6 +158,7 @@ const TvDetails = ({ tv }: TvDetailsProps) => {
|
||||
}
|
||||
|
||||
if (
|
||||
settings.currentSettings.plexLoginEnabled &&
|
||||
settings.currentSettings.series4kEnabled &&
|
||||
plexUrl4k &&
|
||||
hasPermission([Permission.REQUEST_4K, Permission.REQUEST_4K_TV], {
|
||||
|
||||
Reference in New Issue
Block a user