Strip Songs2VID to a payment-free self-hosted OSS core.
Remove Stripe/billing/pricing/marketing, simplify schema and entitlements for unlimited self-host use, and keep auth, encode, and YouTube upload. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
935abfb22e
commit
925aadae75
+10
-18
@@ -1,6 +1,3 @@
|
||||
import { Plan } from "@prisma/client";
|
||||
import { hasProFeatures } from "./edition";
|
||||
|
||||
export type TitleFields = {
|
||||
/** YouTube video title */
|
||||
title?: string | null;
|
||||
@@ -9,18 +6,16 @@ export type TitleFields = {
|
||||
artist?: string | null;
|
||||
};
|
||||
|
||||
/** Resolve the title sent to YouTube. Pro may omit video title → `${artist} - ${songTitle}`. */
|
||||
export function resolveYouTubeTitle(meta: TitleFields, plan: Plan): string {
|
||||
/** Resolve the title sent to YouTube, falling back to artist and song metadata. */
|
||||
export function resolveYouTubeTitle(meta: TitleFields): string {
|
||||
const videoTitle = meta.title?.trim();
|
||||
if (videoTitle) return videoTitle;
|
||||
|
||||
if (hasProFeatures(plan)) {
|
||||
const artist = meta.artist?.trim();
|
||||
const song = meta.songTitle?.trim();
|
||||
if (artist && song) return `${artist} - ${song}`;
|
||||
if (song) return song;
|
||||
if (artist) return artist;
|
||||
}
|
||||
const artist = meta.artist?.trim();
|
||||
const song = meta.songTitle?.trim();
|
||||
if (artist && song) return `${artist} - ${song}`;
|
||||
if (song) return song;
|
||||
if (artist) return artist;
|
||||
|
||||
return "";
|
||||
}
|
||||
@@ -33,13 +28,10 @@ export function resolveBurnedSongTitle(
|
||||
return meta.songTitle?.trim() || fallback;
|
||||
}
|
||||
|
||||
export function validateYouTubeTitle(meta: TitleFields, plan: Plan): string | null {
|
||||
const resolved = resolveYouTubeTitle(meta, plan);
|
||||
export function validateYouTubeTitle(meta: TitleFields): string | null {
|
||||
const resolved = resolveYouTubeTitle(meta);
|
||||
if (!resolved) {
|
||||
if (hasProFeatures(plan)) {
|
||||
return "Enter a video title, or both artist and song title for the YouTube fallback";
|
||||
}
|
||||
return "Each video must have a video title";
|
||||
return "Enter a video title, song title, or artist";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user