mirror of
https://github.com/aleksilassila/reiverr.git
synced 2026-04-23 01:05:13 +02:00
refactor: pretty much the whole backend module hierarchy
This commit is contained in:
@@ -39,8 +39,8 @@ export default class JellyfinPluginProvider extends PluginProvider {
|
||||
class JellyfinProvider extends SourceProvider {
|
||||
name: string = 'jellyfin';
|
||||
|
||||
private get proxyUrl() {
|
||||
return `/api/sources/${this.name}/proxy`;
|
||||
private getProxyUrl(sourceId: string) {
|
||||
return `/api/sources/${sourceId}/proxy`;
|
||||
}
|
||||
|
||||
settingsManager: SettingsManager = new JellyfinSettingsManager();
|
||||
@@ -177,7 +177,7 @@ class JellyfinProvider extends SourceProvider {
|
||||
const mediasSource = playbackInfo.data?.MediaSources?.[0];
|
||||
|
||||
const playbackUri =
|
||||
this.proxyUrl +
|
||||
this.getProxyUrl(userContext.sourceId) +
|
||||
(mediasSource?.TranscodingUrl ||
|
||||
`/Videos/${mediasSource?.Id}/stream.mp4?Static=true&mediaSourceId=${mediasSource?.Id}&deviceId=${JELLYFIN_DEVICE_ID}&api_key=${context.settings.apiKey}&Tag=${mediasSource?.ETag}`) +
|
||||
`&reiverr_token=${userContext.token}`;
|
||||
@@ -209,7 +209,8 @@ class JellyfinProvider extends SourceProvider {
|
||||
(s) => s.Type === 'Subtitle' && s.DeliveryUrl,
|
||||
).map((s, i) => ({
|
||||
src:
|
||||
this.proxyUrl + `${s.DeliveryUrl}&reiverr_token=${userContext.token}`,
|
||||
this.getProxyUrl(userContext.sourceId) +
|
||||
`${s.DeliveryUrl}&reiverr_token=${userContext.token}`,
|
||||
lang: s.Language,
|
||||
kind: 'subtitles',
|
||||
label: s.DisplayTitle,
|
||||
@@ -335,7 +336,7 @@ class JellyfinProvider extends SourceProvider {
|
||||
const mediasSource = playbackInfo.data?.MediaSources?.[0];
|
||||
|
||||
const playbackUri =
|
||||
this.proxyUrl +
|
||||
this.getProxyUrl(userContext.sourceId) +
|
||||
(mediasSource?.TranscodingUrl ||
|
||||
`/Videos/${mediasSource?.Id}/stream.mp4?Static=true&mediaSourceId=${mediasSource?.Id}&deviceId=${JELLYFIN_DEVICE_ID}&api_key=${context.settings.apiKey}&Tag=${mediasSource?.ETag}`) +
|
||||
`&reiverr_token=${userContext.token}`;
|
||||
@@ -367,7 +368,8 @@ class JellyfinProvider extends SourceProvider {
|
||||
(s) => s.Type === 'Subtitle' && s.DeliveryUrl,
|
||||
).map((s, i) => ({
|
||||
src:
|
||||
this.proxyUrl + `${s.DeliveryUrl}&reiverr_token=${userContext.token}`,
|
||||
this.getProxyUrl(userContext.sourceId) +
|
||||
`${s.DeliveryUrl}&reiverr_token=${userContext.token}`,
|
||||
lang: s.Language,
|
||||
kind: 'subtitles',
|
||||
label: s.DisplayTitle,
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
} from '@aleksilassila/reiverr-plugin';
|
||||
import { Api as JellyfinApi } from './jellyfin.openapi';
|
||||
import { JELLYFIN_DEVICE_ID } from './utils';
|
||||
import { PluginSettings } from 'plugins/plugin-types';
|
||||
|
||||
export interface JellyfinSettings extends SourceProviderSettings {
|
||||
apiKey: string;
|
||||
@@ -21,7 +20,7 @@ export class PluginContext {
|
||||
settings: JellyfinSettings;
|
||||
token: string;
|
||||
|
||||
constructor(settings: PluginSettings, token = '') {
|
||||
constructor(settings: SourceProviderSettings, token = '') {
|
||||
this.token = token;
|
||||
this.settings = settings as JellyfinSettings;
|
||||
this.api = new JellyfinApi({
|
||||
|
||||
Reference in New Issue
Block a user