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
package-lock.json
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 {
name = 'AddLibraryItemCreatedAt1739650446621'
export class AddLibraryItemCreatedAt1739650446621
implements MigrationInterface
{
name = 'AddLibraryItemCreatedAt1739650446621';
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(`INSERT INTO "temporary_library_item"("id", "tmdbId", "userId", "mediaType") SELECT "id", "tmdbId", "userId", "mediaType" FROM "library_item"`);
await queryRunner.query(`DROP TABLE "library_item"`);
await queryRunner.query(`ALTER TABLE "temporary_library_item" RENAME TO "library_item"`);
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"))`);
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(`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"`);
}
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(
`INSERT INTO "temporary_library_item"("id", "tmdbId", "userId", "mediaType") SELECT "id", "tmdbId", "userId", "mediaType" FROM "library_item"`,
);
await queryRunner.query(`DROP TABLE "library_item"`);
await queryRunner.query(
`ALTER TABLE "temporary_library_item" RENAME TO "library_item"`,
);
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"))`,
);
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(
`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');
}
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);
@@ -146,7 +150,11 @@ class TorrentProvider extends SourceProvider {
.filter((f) => subtitleExtensions.some((ext) => f.name.endsWith(ext)))
.map((f) => ({
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,
lang: 'unknown',
}));
@@ -193,7 +201,11 @@ class TorrentProvider extends SourceProvider {
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);
@@ -201,7 +213,11 @@ class TorrentProvider extends SourceProvider {
.filter((f) => subtitleExtensions.some((ext) => f.name.endsWith(ext)))
.map((f) => ({
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,
lang: 'unknown',
}));
@@ -259,7 +275,9 @@ class TorrentProvider extends SourceProvider {
const name = f.name.toUpperCase();
return (
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()}`)
);

View File

@@ -91,7 +91,9 @@ export const getEpisodeTorrents = (
params: {
apikey: settings.apiKey,
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')}`
// season: season,
// episode: episode,

View File

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

View File

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

View File

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

View File

@@ -6,7 +6,10 @@ import {
PartialType,
PickType,
} 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>(
clazz: Type<T>,

View File

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

View File

@@ -59,7 +59,9 @@ export class SourceProvidersService {
plugins[plugin.name] = plugin;
} else {
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
},
query: {
language: get(settings)?.language || 'en',
language: get(settings)?.language || 'en'
}
}
})
@@ -327,7 +327,7 @@ export class TmdbApi implements Api<paths> {
series_id: tmdbId
},
query: {
language: get(settings)?.language || 'en',
language: get(settings)?.language || 'en'
}
}
})

View File

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

View File

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

View File

@@ -7,7 +7,8 @@
export let scrollLeft: number = 0;
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.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