diff --git a/.gitignore b/.gitignore index babbe3c..d965fea 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,8 @@ vite.config.ts.timestamp-* /dist backend/plugins/* -!backend/plugins/plugin-types +!backend/plugins/reiverr-plugin +!backend/plugins/jellyfin-plugin # Logs logs diff --git a/backend/package-lock.json b/backend/package-lock.json index 3f1f9c2..dcbab6b 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -8,7 +8,12 @@ "name": "backend", "version": "0.0.1", "license": "UNLICENSED", + "workspaces": [ + "plugins/reiverr-plugin", + "plugins/jellyfin.plugin" + ], "dependencies": { + "@aleksilassila/reiverr-plugin": "^1.0.0", "@nanogiants/nestjs-swagger-api-exception-decorator": "^1.6.11", "@nestjs/cache-manager": "^2.3.0", "@nestjs/common": "^10.0.0", @@ -51,6 +56,10 @@ "typescript": "^5.1.3" } }, + "node_modules/@aleksilassila/reiverr-plugin": { + "resolved": "plugins/reiverr-plugin", + "link": true + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -2103,6 +2112,16 @@ "devOptional": true, "license": "MIT" }, + "node_modules/@types/axios": { + "version": "0.14.4", + "resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.4.tgz", + "integrity": "sha512-9JgOaunvQdsQ/qW2OPmE5+hCeUB52lQSolecrFrthct55QekhmXEwT203s20RL+UHtCQc15y3VXpby9E7Kkh/g==", + "deprecated": "This is a stub types definition. axios provides its own type definitions, so you do not need this installed.", + "license": "MIT", + "dependencies": { + "axios": "*" + } + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -3148,9 +3167,19 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", - "dev": true, "license": "MIT" }, + "node_modules/axios": { + "version": "1.7.9", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", + "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/babel-jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", @@ -4076,7 +4105,6 @@ "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dev": true, "license": "MIT", "dependencies": { "delayed-stream": "~1.0.0" @@ -4410,7 +4438,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", - "dev": true, "license": "MIT", "engines": { "node": ">=0.4.0" @@ -5466,6 +5493,26 @@ "dev": true, "license": "ISC" }, + "node_modules/follow-redirects": { + "version": "1.15.9", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", + "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/foreground-child": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", @@ -5539,7 +5586,6 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", - "dev": true, "license": "MIT", "dependencies": { "asynckit": "^0.4.0", @@ -6531,6 +6577,10 @@ "node": "*" } }, + "node_modules/jellyfin": { + "resolved": "plugins/jellyfin.plugin", + "link": true + }, "node_modules/jest": { "version": "29.7.0", "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", @@ -8960,6 +9010,12 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "license": "MIT" + }, "node_modules/pump": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", @@ -11583,10 +11639,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "plugins/jellyfin.plugin": { + "name": "jellyfin", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "@aleksilassila/reiverr-plugin": "*", + "@types/axios": "^0.14.4", + "axios": "^1.7.8", + "express-http-proxy": "^2.1.1", + "swagger-typescript-api": "^13.0.23" + }, + "devDependencies": {} + }, "plugins/plugin-types": { "version": "1.0.0", "license": "ISC", "devDependencies": {} + }, + "plugins/reiverr-plugin": { + "name": "@aleksilassila/reiverr-plugin", + "version": "1.0.0", + "license": "ISC", + "devDependencies": {} } } } diff --git a/backend/package.json b/backend/package.json index c02f794..6768568 100644 --- a/backend/package.json +++ b/backend/package.json @@ -27,6 +27,7 @@ "typeorm:revert-migration": "npm run typeorm -- -d ./dist/data-source.js migration:revert" }, "dependencies": { + "@aleksilassila/reiverr-plugin": "^1.0.0", "@nanogiants/nestjs-swagger-api-exception-decorator": "^1.6.11", "@nestjs/cache-manager": "^2.3.0", "@nestjs/common": "^10.0.0", @@ -38,7 +39,6 @@ "@types/express-http-proxy": "^1.6.6", "cache-manager": "^5.7.6", "express-http-proxy": "^2.0.0", - "plugin-types": "file:plugins/plugin-types", "reflect-metadata": "^0.2.1", "rxjs": "^7.8.1", "sqlite3": "^5.1.7", @@ -90,5 +90,9 @@ "tabWidth": 2, "semi": true, "singleQuote": true - } -} + }, + "workspaces": [ + "plugins/reiverr-plugin", + "plugins/jellyfin.plugin" + ] +} \ No newline at end of file diff --git a/backend/plugins/jellyfin.plugin/package.json b/backend/plugins/jellyfin.plugin/package.json index acda4b6..deb2f88 100644 --- a/backend/plugins/jellyfin.plugin/package.json +++ b/backend/plugins/jellyfin.plugin/package.json @@ -1,7 +1,6 @@ { "name": "jellyfin", "version": "1.0.0", - "description": "", "main": "src/index", "scripts": { "openapi:generate": "ts-node src/generate-openapi.ts", @@ -13,7 +12,9 @@ "@types/axios": "^0.14.4", "axios": "^1.7.8", "express-http-proxy": "^2.1.1", - "plugin-types": "file:../plugin-types", + "@aleksilassila/reiverr-plugin": "^1.0.0", "swagger-typescript-api": "^13.0.23" - } -} + }, + "devDependencies": {}, + "description": "" +} \ No newline at end of file diff --git a/backend/plugins/jellyfin.plugin/src/generate-openapi.ts b/backend/plugins/jellyfin.plugin/src/generate-openapi.ts index 0a3c819..1bc149b 100644 --- a/backend/plugins/jellyfin.plugin/src/generate-openapi.ts +++ b/backend/plugins/jellyfin.plugin/src/generate-openapi.ts @@ -1,5 +1,4 @@ import { generateApi } from 'swagger-typescript-api'; -import * as path from 'path'; generateApi({ name: 'jellyfin.openapi.ts', diff --git a/backend/plugins/jellyfin.plugin/src/index.ts b/backend/plugins/jellyfin.plugin/src/index.ts index 852c2d3..11be236 100644 --- a/backend/plugins/jellyfin.plugin/src/index.ts +++ b/backend/plugins/jellyfin.plugin/src/index.ts @@ -14,7 +14,7 @@ import { StreamCandidate, Subtitles, UserContext, -} from 'plugin-types'; +} from '@aleksilassila/reiverr-plugin'; import { Readable } from 'stream'; import { JellyfinSettings, @@ -68,7 +68,7 @@ class JellyfinProvider extends SourceProvider { } getMovieCatalogue = async ( - userContext: JellyfinUserContext, + userContext: UserContext, pagination: PaginationParams, ): Promise> => { const items = ( @@ -93,7 +93,7 @@ class JellyfinProvider extends SourceProvider { getMovieStreams = async ( tmdbId: string, metadata: MovieMetadata, - context: JellyfinUserContext, + context: UserContext, config?: PlaybackConfig, ): Promise<{ candidates: StreamCandidate[] }> => { return this.getMovieStream(tmdbId, metadata, '', context, config) @@ -108,7 +108,7 @@ class JellyfinProvider extends SourceProvider { getEpisodeStreams = async ( tmdbId: string, metadata: EpisodeMetadata, - context: JellyfinUserContext, + context: UserContext, config?: PlaybackConfig, ): Promise<{ candidates: StreamCandidate[] }> => { return this.getEpisodeStream(tmdbId, metadata, '', context, config) @@ -124,7 +124,7 @@ class JellyfinProvider extends SourceProvider { tmdbId: string, metadata: MovieMetadata, key: string, - userContext: JellyfinUserContext, + userContext: UserContext, config?: PlaybackConfig, ): Promise => { const context = new PluginContext(userContext.settings, userContext.token); @@ -268,7 +268,7 @@ class JellyfinProvider extends SourceProvider { tmdbId: string, metadata: EpisodeMetadata, key: string, - userContext: JellyfinUserContext, + userContext: UserContext, config?: PlaybackConfig, ): Promise => { const context = new PluginContext(userContext.settings, userContext.token); diff --git a/backend/plugins/plugin-types/package.json b/backend/plugins/plugin-types/package.json deleted file mode 100644 index 54bfa3f..0000000 --- a/backend/plugins/plugin-types/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "plugin-types", - "version": "1.0.0", - "main": "dist/index", - "scripts": { - "build": "tsc" - }, - "author": "", - "license": "ISC", - "devDependencies": {}, - "types": "./dist/index.d.ts", - "description": "" -} diff --git a/backend/plugins/plugin-types/.gitattributes b/backend/plugins/reiverr-plugin/.gitattributes similarity index 100% rename from backend/plugins/plugin-types/.gitattributes rename to backend/plugins/reiverr-plugin/.gitattributes diff --git a/backend/plugins/plugin-types/.gitignore b/backend/plugins/reiverr-plugin/.gitignore similarity index 100% rename from backend/plugins/plugin-types/.gitignore rename to backend/plugins/reiverr-plugin/.gitignore diff --git a/backend/plugins/reiverr-plugin/package.json b/backend/plugins/reiverr-plugin/package.json new file mode 100644 index 0000000..9d0df79 --- /dev/null +++ b/backend/plugins/reiverr-plugin/package.json @@ -0,0 +1,19 @@ +{ + "name": "@aleksilassila/reiverr-plugin", + "version": "1.0.0", + "main": "dist/index", + "scripts": { + "build": "tsc", + "publish:patch": "npm version patch && npm publish", + "publish:minor": "npm version minor && npm publish", + "publish:major": "npm version major && npm publish" + }, + "author": "", + "license": "ISC", + "devDependencies": {}, + "types": "./dist/index.d.ts", + "description": "", + "publishConfig": { + "registry": "https://npm.pkg.github.com/" + } +} \ No newline at end of file diff --git a/backend/plugins/plugin-types/src/device-profile.ts b/backend/plugins/reiverr-plugin/src/device-profile.ts similarity index 100% rename from backend/plugins/plugin-types/src/device-profile.ts rename to backend/plugins/reiverr-plugin/src/device-profile.ts diff --git a/backend/plugins/plugin-types/src/index.ts b/backend/plugins/reiverr-plugin/src/index.ts similarity index 100% rename from backend/plugins/plugin-types/src/index.ts rename to backend/plugins/reiverr-plugin/src/index.ts diff --git a/backend/plugins/plugin-types/src/plugin.ts b/backend/plugins/reiverr-plugin/src/plugin.ts similarity index 100% rename from backend/plugins/plugin-types/src/plugin.ts rename to backend/plugins/reiverr-plugin/src/plugin.ts diff --git a/backend/plugins/plugin-types/src/types.ts b/backend/plugins/reiverr-plugin/src/types.ts similarity index 100% rename from backend/plugins/plugin-types/src/types.ts rename to backend/plugins/reiverr-plugin/src/types.ts diff --git a/backend/plugins/plugin-types/tsconfig.json b/backend/plugins/reiverr-plugin/tsconfig.json similarity index 100% rename from backend/plugins/plugin-types/tsconfig.json rename to backend/plugins/reiverr-plugin/tsconfig.json diff --git a/backend/src/source-plugins/source-plugins.controller.ts b/backend/src/source-plugins/source-plugins.controller.ts index d466c2f..c315473 100644 --- a/backend/src/source-plugins/source-plugins.controller.ts +++ b/backend/src/source-plugins/source-plugins.controller.ts @@ -24,7 +24,7 @@ import { MovieMetadata, SourceProvider, SourceProviderError, -} from 'plugin-types'; +} from '@aleksilassila/reiverr-plugin'; import { GetAuthToken, GetAuthUser, diff --git a/backend/src/source-plugins/source-plugins.dto.ts b/backend/src/source-plugins/source-plugins.dto.ts index 11e641b..d8bcacf 100644 --- a/backend/src/source-plugins/source-plugins.dto.ts +++ b/backend/src/source-plugins/source-plugins.dto.ts @@ -18,7 +18,7 @@ import { StreamCandidate, StreamProperty, Stream, -} from 'plugin-types'; +} from '@aleksilassila/reiverr-plugin'; export class IndexItemDto implements IndexItem { @ApiProperty() diff --git a/backend/src/source-plugins/source-plugins.service.ts b/backend/src/source-plugins/source-plugins.service.ts index f651709..6183573 100644 --- a/backend/src/source-plugins/source-plugins.service.ts +++ b/backend/src/source-plugins/source-plugins.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import * as fs from 'fs'; import * as path from 'path'; -import { PluginProvider, SourceProvider } from 'plugin-types'; +import { PluginProvider, SourceProvider } from '@aleksilassila/reiverr-plugin'; @Injectable() export class SourcePluginsService {