style: prettier everything

This commit is contained in:
Aleksi Lassila
2025-02-19 16:21:37 +02:00
parent 389b568922
commit 00cec63917
15 changed files with 133 additions and 61 deletions

View File

@@ -12,3 +12,24 @@ node_modules
pnpm-lock.yaml pnpm-lock.yaml
package-lock.json package-lock.json
yarn.lock yarn.lock
.github
.husky
**/.DS_Store
**/.env
**/.env.*
**/build/
**/coverage/
**/dist/
**/docker-compose.*
**/node_modules/
# Ignore files for PNPM, NPM and YARN
package-lock.json
package.json
pnpm-lock.yaml
yarn.lock
backend\packages\jellyfin.plugin\src\jellyfin.openapi.ts
backend\swagger-spec.json
**/*.generated.d.ts

View File

@@ -1,28 +1,53 @@
import { MigrationInterface, QueryRunner } from "typeorm"; import { MigrationInterface, QueryRunner } from 'typeorm';
export class AddLibraryItemCreatedAt1739650446621 implements MigrationInterface { export class AddLibraryItemCreatedAt1739650446621
name = 'AddLibraryItemCreatedAt1739650446621' implements MigrationInterface
{
name = 'AddLibraryItemCreatedAt1739650446621';
public async up(queryRunner: QueryRunner): Promise<void> { public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE "temporary_library_item" ("id" varchar NOT NULL, "tmdbId" varchar NOT NULL, "userId" varchar NOT NULL, "mediaType" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "createdAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId", "userId"), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId"), CONSTRAINT "FK_44e2a69f2788510e190dd3ac5ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("id", "userId"))`); await queryRunner.query(
await queryRunner.query(`INSERT INTO "temporary_library_item"("id", "tmdbId", "userId", "mediaType") SELECT "id", "tmdbId", "userId", "mediaType" FROM "library_item"`); `CREATE TABLE "temporary_library_item" ("id" varchar NOT NULL, "tmdbId" varchar NOT NULL, "userId" varchar NOT NULL, "mediaType" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "createdAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId", "userId"), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId"), CONSTRAINT "FK_44e2a69f2788510e190dd3ac5ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("id", "userId"))`,
await queryRunner.query(`DROP TABLE "library_item"`); );
await queryRunner.query(`ALTER TABLE "temporary_library_item" RENAME TO "library_item"`); await queryRunner.query(
await queryRunner.query(`CREATE TABLE "temporary_library_item" ("id" varchar NOT NULL, "tmdbId" varchar NOT NULL, "userId" varchar NOT NULL, "mediaType" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "createdAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId", "userId"), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId"), CONSTRAINT "UQ_97081ef9b13ccb55daec682da1a" UNIQUE ("tmdbId", "userId"), CONSTRAINT "FK_44e2a69f2788510e190dd3ac5ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("id", "userId"))`); `INSERT INTO "temporary_library_item"("id", "tmdbId", "userId", "mediaType") SELECT "id", "tmdbId", "userId", "mediaType" FROM "library_item"`,
await queryRunner.query(`INSERT INTO "temporary_library_item"("id", "tmdbId", "userId", "mediaType", "updatedAt", "createdAt") SELECT "id", "tmdbId", "userId", "mediaType", "updatedAt", "createdAt" FROM "library_item"`); );
await queryRunner.query(`DROP TABLE "library_item"`); await queryRunner.query(`DROP TABLE "library_item"`);
await queryRunner.query(`ALTER TABLE "temporary_library_item" RENAME TO "library_item"`); await queryRunner.query(
} `ALTER TABLE "temporary_library_item" RENAME TO "library_item"`,
);
public async down(queryRunner: QueryRunner): Promise<void> { await queryRunner.query(
await queryRunner.query(`ALTER TABLE "library_item" RENAME TO "temporary_library_item"`); `CREATE TABLE "temporary_library_item" ("id" varchar NOT NULL, "tmdbId" varchar NOT NULL, "userId" varchar NOT NULL, "mediaType" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "createdAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId", "userId"), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId"), CONSTRAINT "UQ_97081ef9b13ccb55daec682da1a" UNIQUE ("tmdbId", "userId"), CONSTRAINT "FK_44e2a69f2788510e190dd3ac5ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("id", "userId"))`,
await queryRunner.query(`CREATE TABLE "library_item" ("id" varchar NOT NULL, "tmdbId" varchar NOT NULL, "userId" varchar NOT NULL, "mediaType" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "createdAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId", "userId"), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId"), CONSTRAINT "FK_44e2a69f2788510e190dd3ac5ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("id", "userId"))`); );
await queryRunner.query(`INSERT INTO "library_item"("id", "tmdbId", "userId", "mediaType", "updatedAt", "createdAt") SELECT "id", "tmdbId", "userId", "mediaType", "updatedAt", "createdAt" FROM "temporary_library_item"`); await queryRunner.query(
await queryRunner.query(`DROP TABLE "temporary_library_item"`); `INSERT INTO "temporary_library_item"("id", "tmdbId", "userId", "mediaType", "updatedAt", "createdAt") SELECT "id", "tmdbId", "userId", "mediaType", "updatedAt", "createdAt" FROM "library_item"`,
await queryRunner.query(`ALTER TABLE "library_item" RENAME TO "temporary_library_item"`); );
await queryRunner.query(`CREATE TABLE "library_item" ("id" varchar NOT NULL, "tmdbId" varchar NOT NULL, "userId" varchar NOT NULL, "mediaType" varchar NOT NULL, CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId", "userId"), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId"), CONSTRAINT "FK_44e2a69f2788510e190dd3ac5ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("id", "userId"))`); await queryRunner.query(`DROP TABLE "library_item"`);
await queryRunner.query(`INSERT INTO "library_item"("id", "tmdbId", "userId", "mediaType") SELECT "id", "tmdbId", "userId", "mediaType" FROM "temporary_library_item"`); await queryRunner.query(
await queryRunner.query(`DROP TABLE "temporary_library_item"`); `ALTER TABLE "temporary_library_item" RENAME TO "library_item"`,
} );
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "library_item" RENAME TO "temporary_library_item"`,
);
await queryRunner.query(
`CREATE TABLE "library_item" ("id" varchar NOT NULL, "tmdbId" varchar NOT NULL, "userId" varchar NOT NULL, "mediaType" varchar NOT NULL, "updatedAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), "createdAt" datetime NOT NULL DEFAULT (CURRENT_TIMESTAMP), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId", "userId"), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId"), CONSTRAINT "FK_44e2a69f2788510e190dd3ac5ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("id", "userId"))`,
);
await queryRunner.query(
`INSERT INTO "library_item"("id", "tmdbId", "userId", "mediaType", "updatedAt", "createdAt") SELECT "id", "tmdbId", "userId", "mediaType", "updatedAt", "createdAt" FROM "temporary_library_item"`,
);
await queryRunner.query(`DROP TABLE "temporary_library_item"`);
await queryRunner.query(
`ALTER TABLE "library_item" RENAME TO "temporary_library_item"`,
);
await queryRunner.query(
`CREATE TABLE "library_item" ("id" varchar NOT NULL, "tmdbId" varchar NOT NULL, "userId" varchar NOT NULL, "mediaType" varchar NOT NULL, CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId", "userId"), CONSTRAINT "UQ_d1794fd0082c98017895ea6afa4" UNIQUE ("tmdbId"), CONSTRAINT "FK_44e2a69f2788510e190dd3ac5ec" FOREIGN KEY ("userId") REFERENCES "user" ("id") ON DELETE CASCADE ON UPDATE NO ACTION, PRIMARY KEY ("id", "userId"))`,
);
await queryRunner.query(
`INSERT INTO "library_item"("id", "tmdbId", "userId", "mediaType") SELECT "id", "tmdbId", "userId", "mediaType" FROM "temporary_library_item"`,
);
await queryRunner.query(`DROP TABLE "temporary_library_item"`);
}
} }

View File

@@ -136,7 +136,11 @@ class TorrentProvider extends SourceProvider {
throw new Error('Torrent not found'); throw new Error('Torrent not found');
} }
const src = `${this.getProxyUrl(context.sourceId)}/magnet?link=${encodeURIComponent(torrent?.link)}&reiverr_token=${context.token}`; const src = `${this.getProxyUrl(
context.sourceId,
)}/magnet?link=${encodeURIComponent(torrent?.link)}&reiverr_token=${
context.token
}`;
const files = await getFiles(context.userId, torrent.link); const files = await getFiles(context.userId, torrent.link);
@@ -146,7 +150,11 @@ class TorrentProvider extends SourceProvider {
.filter((f) => subtitleExtensions.some((ext) => f.name.endsWith(ext))) .filter((f) => subtitleExtensions.some((ext) => f.name.endsWith(ext)))
.map((f) => ({ .map((f) => ({
kind: 'subtitles', kind: 'subtitles',
src: `${this.getProxyUrl(context.sourceId)}/magnet?link=${encodeURIComponent(torrent.link)}&reiverr_token=${context.token}&file=${f.name}`, src: `${this.getProxyUrl(
context.sourceId,
)}/magnet?link=${encodeURIComponent(torrent.link)}&reiverr_token=${
context.token
}&file=${f.name}`,
label: f.name, label: f.name,
lang: 'unknown', lang: 'unknown',
})); }));
@@ -193,7 +201,11 @@ class TorrentProvider extends SourceProvider {
throw new Error('Torrent not found'); throw new Error('Torrent not found');
} }
const src = `${this.getProxyUrl(context.sourceId)}/magnet?link=${encodeURIComponent(torrent.link)}&reiverr_token=${context.token}&season=${metadata.season}&episode=${metadata.episode}`; const src = `${this.getProxyUrl(
context.sourceId,
)}/magnet?link=${encodeURIComponent(torrent.link)}&reiverr_token=${
context.token
}&season=${metadata.season}&episode=${metadata.episode}`;
const files = await getFiles(context.userId, torrent.link); const files = await getFiles(context.userId, torrent.link);
@@ -201,7 +213,11 @@ class TorrentProvider extends SourceProvider {
.filter((f) => subtitleExtensions.some((ext) => f.name.endsWith(ext))) .filter((f) => subtitleExtensions.some((ext) => f.name.endsWith(ext)))
.map((f) => ({ .map((f) => ({
kind: 'subtitles', kind: 'subtitles',
src: `${this.getProxyUrl(context.sourceId)}/magnet?link=${encodeURIComponent(torrent.link)}&reiverr_token=${context.token}&file=${f.name}`, src: `${this.getProxyUrl(
context.sourceId,
)}/magnet?link=${encodeURIComponent(torrent.link)}&reiverr_token=${
context.token
}&file=${f.name}`,
label: f.name, label: f.name,
lang: 'unknown', lang: 'unknown',
})); }));
@@ -259,7 +275,9 @@ class TorrentProvider extends SourceProvider {
const name = f.name.toUpperCase(); const name = f.name.toUpperCase();
return ( return (
name.includes( name.includes(
`S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}`, `S${season.toString().padStart(2, '0')}E${episode
.toString()
.padStart(2, '0')}`,
) || ) ||
name.includes(`S${season.toString()}E${episode.toString()}`) name.includes(`S${season.toString()}E${episode.toString()}`)
); );

View File

@@ -91,7 +91,9 @@ export const getEpisodeTorrents = (
params: { params: {
apikey: settings.apiKey, apikey: settings.apiKey,
t: 'tvsearch', t: 'tvsearch',
q: `${series} S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}`, q: `${series} S${season.toString().padStart(2, '0')}E${episode
.toString()
.padStart(2, '0')}`,
// q: `${series}`, // `${series} S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}` // q: `${series}`, // `${series} S${season.toString().padStart(2, '0')}E${episode.toString().padStart(2, '0')}`
// season: season, // season: season,
// episode: episode, // episode: episode,

View File

@@ -5,10 +5,7 @@ import * as torrentStream from 'torrent-stream';
class FileCache<T> { class FileCache<T> {
private cache: T; private cache: T;
constructor( constructor(private cacheFile: string, private defaultValue: T) {
private cacheFile: string,
private defaultValue: T,
) {
this.cache = this.readStreamCache(); this.cache = this.readStreamCache();
} }

View File

@@ -207,4 +207,4 @@ function convertSrtCue(caption: string) {
cue += s[line] + '\n\n'; cue += s[line] + '\n\n';
} }
return cue; return cue;
} }

View File

@@ -21,7 +21,7 @@ export class SignInResponse {
@Controller('auth') @Controller('auth')
export class AuthController { export class AuthController {
constructor(private authService: AuthService) {} constructor(private authService: AuthService) {}
@HttpCode(HttpStatus.OK) @HttpCode(HttpStatus.OK)
@Post() @Post()
@ApiOkResponse({ description: 'User found', type: SignInResponse }) @ApiOkResponse({ description: 'User found', type: SignInResponse })

View File

@@ -6,7 +6,10 @@ import {
PartialType, PartialType,
PickType, PickType,
} from '@nestjs/swagger'; } from '@nestjs/swagger';
import { PaginatedResponse, PaginationParams } from '@aleksilassila/reiverr-plugin'; import {
PaginatedResponse,
PaginationParams,
} from '@aleksilassila/reiverr-plugin';
export const PickAndPartial = <T, K extends keyof T>( export const PickAndPartial = <T, K extends keyof T>(
clazz: Type<T>, clazz: Type<T>,

View File

@@ -69,8 +69,9 @@ export class ServiceOwnershipValidator implements CanActivate {
if (!sourceId) return true; if (!sourceId) return true;
const mediaSource = const mediaSource = await this.mediaSourcesService.findMediaSource(
await this.mediaSourcesService.findMediaSource(sourceId); sourceId,
);
if (!mediaSource) throw new NotFoundException('Source not found'); if (!mediaSource) throw new NotFoundException('Source not found');
@@ -302,8 +303,9 @@ export class MediaSourcesController {
@GetAuthToken() token: string, @GetAuthToken() token: string,
) { ) {
const sourceId = params.sourceId; const sourceId = params.sourceId;
const mediaSource = const mediaSource = await this.mediaSourcesService.findMediaSource(
await this.mediaSourcesService.findMediaSource(sourceId); sourceId,
);
if (!mediaSource) throw new NotFoundException('Source not found'); if (!mediaSource) throw new NotFoundException('Source not found');
@@ -368,8 +370,9 @@ export class MediaSourcesController {
} }
async getConnection(sourceId: string) { async getConnection(sourceId: string) {
const mediaSource = const mediaSource = await this.mediaSourcesService.findMediaSource(
await this.mediaSourcesService.findMediaSource(sourceId); sourceId,
);
if (!mediaSource.pluginId || !mediaSource.enabled) { if (!mediaSource.pluginId || !mediaSource.enabled) {
throw new BadRequestException('Source not configured'); throw new BadRequestException('Source not configured');

View File

@@ -59,7 +59,9 @@ export class SourceProvidersService {
plugins[plugin.name] = plugin; plugins[plugin.name] = plugin;
} else { } else {
this.logger.warn( this.logger.warn(
`Plugin ${plugin.name}@${plugin._getPluginVersion()} is not compatible with Reiverr plugin API version ${supportedPluginVersion}`, `Plugin ${
plugin.name
}@${plugin._getPluginVersion()} is not compatible with Reiverr plugin API version ${supportedPluginVersion}`,
); );
} }
}); });

View File

@@ -313,7 +313,7 @@ export class TmdbApi implements Api<paths> {
movie_id: tmdbId movie_id: tmdbId
}, },
query: { query: {
language: get(settings)?.language || 'en', language: get(settings)?.language || 'en'
} }
} }
}) })
@@ -327,7 +327,7 @@ export class TmdbApi implements Api<paths> {
series_id: tmdbId series_id: tmdbId
}, },
query: { query: {
language: get(settings)?.language || 'en', language: get(settings)?.language || 'en'
} }
} }
}) })

View File

@@ -7,19 +7,19 @@
// export let focusOnClick = false; // export let focusOnClick = false;
// export let focusedChild = false; // export let focusedChild = false;
import type { SvelteHTMLElements } from "svelte/elements"; import type { SvelteHTMLElements } from 'svelte/elements';
// export let disabled = false; // export let disabled = false;
export type ContainerProps = SvelteHTMLElements['div'] & { export type ContainerProps = SvelteHTMLElements['div'] & {
name?: string; name?: string;
direction?: 'vertical' | 'horizontal' | 'grid'; direction?: 'vertical' | 'horizontal' | 'grid';
gridCols?: number; gridCols?: number;
focusOnMount?: boolean; focusOnMount?: boolean;
trapFocus?: boolean; trapFocus?: boolean;
debugOutline?: boolean; debugOutline?: boolean;
focusOnClick?: boolean; focusOnClick?: boolean;
focusedChild?: boolean; focusedChild?: boolean;
disabled?: boolean; disabled?: boolean;
tag?: string; tag?: string;
}; };

View File

@@ -7,8 +7,8 @@
export let persistent = false; export let persistent = false;
onDestroy(() => { onDestroy(() => {
notificationStack.destroy([]); notificationStack.destroy([]);
}) });
</script> </script>
<div class="fixed top-8 right-8 z-50 flex flex-col"> <div class="fixed top-8 right-8 z-50 flex flex-col">

View File

@@ -7,7 +7,8 @@
export let scrollLeft: number = 0; export let scrollLeft: number = 0;
const scrollStore = getScrollContext(); const scrollStore = getScrollContext();
if (!scrollStore.scrollLeft || !scrollStore.scrollTop) console.error('ScrollHelper requires ScrollStore'); if (!scrollStore.scrollLeft || !scrollStore.scrollTop)
console.error('ScrollHelper requires ScrollStore');
$: scrollStore.scrollTop?.set(scrollTop); $: scrollStore.scrollTop?.set(scrollTop);
$: scrollStore.scrollLeft?.set(scrollLeft); $: scrollStore.scrollLeft?.set(scrollLeft);

View File

@@ -1,4 +1,4 @@
import scrollbarHide from 'tailwind-scrollbar-hide' import scrollbarHide from 'tailwind-scrollbar-hide';
/** /**
* https://huemint.com/website-monochrome/#palette=353633-fbfdff * https://huemint.com/website-monochrome/#palette=353633-fbfdff