Files
songs2vid/lib/entitlements.ts
T
Songs2YTandCursor d951ecb489 Sync layouts, typography, and watermark studio for self-hosted OSS.
Unlock features without credits/Stripe, point docs to docs.songs2vid.com, and drop leftover billing admin surfaces.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 03:50:06 +02:00

42 lines
1.0 KiB
TypeScript

import { Plan } from "@prisma/client";
import type { LayoutSettings } from "./layout";
import {
PREMIUM_REQUIRED_CODE,
type WatermarkSettings,
} from "./watermark";
export class PremiumRequiredError extends Error {
readonly code = PREMIUM_REQUIRED_CODE;
readonly status = 403;
constructor(message: string) {
super(message);
this.name = "PremiumRequiredError";
}
}
/** OSS: all watermark / typography features unlocked. */
export function assertCustomWatermarkAllowed(_plan: Plan, _settings: WatermarkSettings) {
return;
}
/** OSS: all art-track layout features unlocked. */
export function assertArtTrackLayoutAllowed(_plan: Plan, _settings: LayoutSettings) {
return;
}
/** OSS: per-track cover images always allowed. */
export function assertPerItemImagesAllowed(
_plan: Plan,
_sharedImagePath: string,
_itemImagePaths: Array<string | null | undefined>,
) {
return;
}
export function premiumRequiredResponse(message: string) {
return {
error: message,
code: PREMIUM_REQUIRED_CODE,
};
}