Skip to content
Open
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 next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";
import "./.next/dev/types/routes.d.ts";

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -218,5 +218,8 @@
},
"scarfSettings": {
"enabled": false
},
"volta": {
"node": "22.19.0"
}
}
17 changes: 17 additions & 0 deletions server/entity/MediaRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import { getRepository } from '@server/datasource';
import OverrideRule from '@server/entity/OverrideRule';
import type { MediaRequestBody } from '@server/interfaces/api/requestInterfaces';
import notificationManager, { Notification } from '@server/lib/notifications';
import {
ParentalControlRestrictedError,
isMediaAllowedByParentalControls,
} from '@server/lib/parentalControls';
import { Permission } from '@server/lib/permissions';
import { getSettings } from '@server/lib/settings';
import logger from '@server/logger';
Expand Down Expand Up @@ -124,6 +128,19 @@ export class MediaRequest {
? await tmdb.getMovie({ movieId: requestBody.mediaId })
: await tmdb.getTvShow({ tvId: requestBody.mediaId });

if (
!(await isMediaAllowedByParentalControls({
user: requestUser,
mediaType: requestBody.mediaType,
media: tmdbMedia,
tmdb,
}))
) {
throw new ParentalControlRestrictedError(
'This media is restricted by parental controls.'
);
}

let media = await mediaRepository.findOne({
where: {
tmdbId: requestBody.mediaId,
Expand Down
15 changes: 15 additions & 0 deletions server/entity/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,21 @@ export class UserSettings {
@Column({ nullable: true })
public watchlistSyncTv?: boolean;

@Column({ default: false })
public parentalControlsEnabled?: boolean;

@Column({ nullable: true })
public maxMovieCertification?: string;

@Column({ nullable: true })
public maxTvCertification?: string;

@Column({ default: 'US' })
public parentalControlsRegion?: string;

@Column({ default: false })
public blockUnrated?: boolean;

@Column({
type: 'text',
nullable: true,
Expand Down
5 changes: 5 additions & 0 deletions server/interfaces/api/userSettingsInterfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ export interface UserSettingsGeneralResponse {
globalTvQuotaDays?: number;
watchlistSyncMovies?: boolean;
watchlistSyncTv?: boolean;
parentalControlsEnabled?: boolean;
parentalControlsRegion?: string;
maxMovieCertification?: string;
maxTvCertification?: string;
blockUnrated?: boolean;
}

export type NotificationAgentTypes = Record<NotificationAgentKey, number>;
Expand Down
Loading
Loading