feat: Backend implementation for source plugin usage and configuration

This commit is contained in:
Aleksi Lassila
2024-12-05 19:33:18 +02:00
parent ffc4197832
commit 9b6ff3379e
39 changed files with 2244 additions and 1006 deletions

45
backend/plugins/plugin-types.d.ts vendored Normal file
View File

@@ -0,0 +1,45 @@
export type PluginSettingsTemplate = Record<
string,
'string' | 'number' | 'boolean' | 'password' | { type: 'link'; url: string }
>;
export type PluginSettings = Record<string, any>;
export interface SourcePlugin {
name: string;
getIsIndexable: () => boolean;
getIndex: () => Promise<
Record<
number,
any
// | { tmdbId: number; quality: number }
// | {
// tmdbId: number;
// seasons: Record<number, Record<number, { quality: number }>>;
// }
>
>;
getSettingsTemplate: () => PluginSettingsTemplate;
validateSettings: (settings: Record<string, any>) => Promise<{
isValid: boolean;
errors: Record<string, string>;
}>;
getMovieStream: (tmdbId: string, settings: PluginSettings) => Promise<any>;
getEpisodeStream: (
tmdbId: string,
season: number,
episode: number,
settings: PluginSettings,
) => Promise<any>;
handleProxy(request: { uri: string; headers: any }, settings: PluginSettings): {
url: string;
headers: any;
};
}