From 20c821e2ebb3ba0622059fb01baf9967bb56770d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 29 Jan 2023 20:33:10 +0000 Subject: [PATCH 01/49] chore(release): 1.4.0 --- CHANGELOG.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4245c764b..997bf1280 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,57 @@ +# [1.4.0](https://github.com/fallenbagel/jellyseerr/compare/v1.3.0...v1.4.0) (2023-01-29) + + +### Bug Fixes + +* add bg-opacity to in-progress status badges ([#3190](https://github.com/fallenbagel/jellyseerr/issues/3190)) ([68223f4](https://github.com/fallenbagel/jellyseerr/commit/68223f4b1e98b01825516dcba39cbb2d3df31a70)) +* added download status and title to request card/item error components ([#3186](https://github.com/fallenbagel/jellyseerr/issues/3186)) ([3309f77](https://github.com/fallenbagel/jellyseerr/commit/3309f77aa4be1d70b27693531c119a8e26822518)) +* arrow icons were misplaced on mobile in slider edit ([#3260](https://github.com/fallenbagel/jellyseerr/issues/3260)) ([d328485](https://github.com/fallenbagel/jellyseerr/commit/d328485161b9cae6a70ef0713b4878207bc6015e)) +* **build:** update usage of publish snap action ([#3272](https://github.com/fallenbagel/jellyseerr/issues/3272)) ([51b05cd](https://github.com/fallenbagel/jellyseerr/commit/51b05cd8fbb5d332807d8c00b2ffb7b10c3d0179)) +* changed overflow scroll to only if necessary ([#3184](https://github.com/fallenbagel/jellyseerr/issues/3184)) ([27feeea](https://github.com/fallenbagel/jellyseerr/commit/27feeea69121336557deda1f32b65a5daa146f82)) +* convert genre/studio to string in create slider ([#3201](https://github.com/fallenbagel/jellyseerr/issues/3201)) ([93afead](https://github.com/fallenbagel/jellyseerr/commit/93afead92e497f2e5bce67a34fffdaa08d20c7f2)) +* correct checkbox position (again) for slider edits ([#3227](https://github.com/fallenbagel/jellyseerr/issues/3227)) ([3ba6df1](https://github.com/fallenbagel/jellyseerr/commit/3ba6df1a41c084c4a6a90354338047623abef521)) +* correct grid sizing for webkit on streaming services ([#3248](https://github.com/fallenbagel/jellyseerr/issues/3248)) ([6fd11cf](https://github.com/fallenbagel/jellyseerr/commit/6fd11cf4254e1a19310592bec78a6de52bc073a8)) +* correct issue detail bottom padding on mobile displays ([#3268](https://github.com/fallenbagel/jellyseerr/issues/3268)) ([3db010b](https://github.com/fallenbagel/jellyseerr/commit/3db010b9eaec62aa08d973a61caf1801471bbf3e)) +* correct link to correct keyword results for series ([#3208](https://github.com/fallenbagel/jellyseerr/issues/3208)) ([4e9be7a](https://github.com/fallenbagel/jellyseerr/commit/4e9be7a3f7304ee7be5ee6fd34b1ea8f6c0cf399)) +* correct spacing between sliders ([#3225](https://github.com/fallenbagel/jellyseerr/issues/3225)) ([62e2de7](https://github.com/fallenbagel/jellyseerr/commit/62e2de70bf37b72d5f63370b662d4103a642775b)) +* correctly check mobile menu permissions ([#3271](https://github.com/fallenbagel/jellyseerr/issues/3271)) ([f4a22dc](https://github.com/fallenbagel/jellyseerr/commit/f4a22dc437404558f301ccfc195cf0a300dd1ff2)) +* correctly restore selected streaming service filters ([#3249](https://github.com/fallenbagel/jellyseerr/issues/3249)) ([154f3e7](https://github.com/fallenbagel/jellyseerr/commit/154f3e72efbf0b663358b3029156f54516f01a2f)) +* create shared class to add bottom spacing ([#3269](https://github.com/fallenbagel/jellyseerr/issues/3269)) ([5d1c6f7](https://github.com/fallenbagel/jellyseerr/commit/5d1c6f706555613d97ed9e61d8b665543c2f239b)) +* **deps:** pin dependency @headlessui/react to 1.7.7 ([#3194](https://github.com/fallenbagel/jellyseerr/issues/3194)) [skip ci] ([c4b16ab](https://github.com/fallenbagel/jellyseerr/commit/c4b16abc62647c74215155942a4230a31a238677)) +* **deps:** update dependency @heroicons/react to v2 ([#2970](https://github.com/fallenbagel/jellyseerr/issues/2970)) ([dd48d59](https://github.com/fallenbagel/jellyseerr/commit/dd48d59b20e2d1800ea30912116f4a4f1bb7928f)) +* **deps:** update dependency axios to v1 ([#3202](https://github.com/fallenbagel/jellyseerr/issues/3202)) ([421029e](https://github.com/fallenbagel/jellyseerr/commit/421029ebab66c9a6622ba47e56d7f6473524cce4)) +* **deps:** update dependency swr to v2 ([#3212](https://github.com/fallenbagel/jellyseerr/issues/3212)) ([7b6db50](https://github.com/fallenbagel/jellyseerr/commit/7b6db50ae55b1fc60d19a5cff62dd46bb989fa51)) +* **experimental:** use new RT API (sorta) ([#3179](https://github.com/fallenbagel/jellyseerr/issues/3179)) ([357cab8](https://github.com/fallenbagel/jellyseerr/commit/357cab87ac7752b8e119b51c938b343c661d83c2)) +* improve small screen layout for discover editing ([#3221](https://github.com/fallenbagel/jellyseerr/issues/3221)) ([d23b213](https://github.com/fallenbagel/jellyseerr/commit/d23b2132de05f072f7f9daad83d81421d747cf99)) +* include new package calendar css in build ([#3235](https://github.com/fallenbagel/jellyseerr/issues/3235)) ([c2a1a20](https://github.com/fallenbagel/jellyseerr/commit/c2a1a20a3bb20039a1936c7fe0ecb9e8311a0aea)) +* issues with issues ([#3267](https://github.com/fallenbagel/jellyseerr/issues/3267)) ([fd21971](https://github.com/fallenbagel/jellyseerr/commit/fd219717c01c558814d7a80de6304272b5a7944e)) +* multiple genre filtering now works ([#3282](https://github.com/fallenbagel/jellyseerr/issues/3282)) ([5076938](https://github.com/fallenbagel/jellyseerr/commit/507693881b939819413f0959df5ef6b7a357eb5c)) +* prevent double encode if we are on /search endpoint ([#3238](https://github.com/fallenbagel/jellyseerr/issues/3238)) ([a343f8a](https://github.com/fallenbagel/jellyseerr/commit/a343f8ad915491a9c81512c7e541a1dac8906025)) +* **request:** approve request when retrying request ([#3234](https://github.com/fallenbagel/jellyseerr/issues/3234)) ([b515701](https://github.com/fallenbagel/jellyseerr/commit/b5157010c46cd9083993d5ee0172007b83d631da)) +* **request:** mark request as approved if media is already available when retrying failed request ([#3244](https://github.com/fallenbagel/jellyseerr/issues/3244)) ([cb65074](https://github.com/fallenbagel/jellyseerr/commit/cb650745f6a33e69391a633e6d272831f314e098)) +* restore border to ghost button and fix discover slider visibility toggle position ([#3226](https://github.com/fallenbagel/jellyseerr/issues/3226)) ([2eebb7f](https://github.com/fallenbagel/jellyseerr/commit/2eebb7fd3941b34fe9472aaf9d28265df8cce311)) +* restore status badges on titles on actors page when hide available media enabled ([#3206](https://github.com/fallenbagel/jellyseerr/issues/3206)) ([9d3446d](https://github.com/fallenbagel/jellyseerr/commit/9d3446d370499c3251159393e5c791b01225e05c)) +* screen would zoom on mobile if date picker input was selected ([#3241](https://github.com/fallenbagel/jellyseerr/issues/3241)) ([3aefddd](https://github.com/fallenbagel/jellyseerr/commit/3aefddd48834d86150d5f5cceb2d08af3a78847b)) +* series displayed an empty season with series list/request modal ([#3147](https://github.com/fallenbagel/jellyseerr/issues/3147)) ([2179637](https://github.com/fallenbagel/jellyseerr/commit/2179637d437999290eaa4152f6f37c71fc3d8ba3)) +* tooltip shows properly if not in progress ([#3185](https://github.com/fallenbagel/jellyseerr/issues/3185)) ([6face8c](https://github.com/fallenbagel/jellyseerr/commit/6face8cc4564b978fb98af32659b326d8c5cede8)) +* **ui:** series first air date sorting ([#3283](https://github.com/fallenbagel/jellyseerr/issues/3283)) ([374c78c](https://github.com/fallenbagel/jellyseerr/commit/374c78c989cc86bb144a954a91d5d183c4b591c0)) +* update StatusBadgeMini to shrink on title cards (and remove ring) ([#3210](https://github.com/fallenbagel/jellyseerr/issues/3210)) ([042a1a9](https://github.com/fallenbagel/jellyseerr/commit/042a1a950fdd4d4a61edf4bc19657f9b7a526da8)) + + +### Features + +* add discover customization ([#3182](https://github.com/fallenbagel/jellyseerr/issues/3182)) ([cd35748](https://github.com/fallenbagel/jellyseerr/commit/cd3574851a12517cbfadc109e6412a7a9e44c114)) +* add keywords to movie/series detail pages ([#3204](https://github.com/fallenbagel/jellyseerr/issues/3204)) ([e084649](https://github.com/fallenbagel/jellyseerr/commit/e084649878a58c296786141d12dd69a69a27ee85)) +* add streaming services filter ([#3247](https://github.com/fallenbagel/jellyseerr/issues/3247)) ([1154156](https://github.com/fallenbagel/jellyseerr/commit/1154156459403494e8daf0c89a3ba356aeea1d97)) +* discover inline customization ([#3220](https://github.com/fallenbagel/jellyseerr/issues/3220)) ([8bd10b5](https://github.com/fallenbagel/jellyseerr/commit/8bd10b5bf3d1b8069872b616c7c8596caeb4937e)) +* discover overhaul (filters!) ([#3232](https://github.com/fallenbagel/jellyseerr/issues/3232)) ([dd00e48](https://github.com/fallenbagel/jellyseerr/commit/dd00e48f59054b44bef6b32a2c169e59f6175051)) +* discover slider edit arrow buttons for reordering ([#3259](https://github.com/fallenbagel/jellyseerr/issues/3259)) ([da00d45](https://github.com/fallenbagel/jellyseerr/commit/da00d454e17e8b00d04f6e26f6dd5153ed6ced81)) +* **lang:** translations update from Hosted Weblate ([#3030](https://github.com/fallenbagel/jellyseerr/issues/3030)) ([0d8b390](https://github.com/fallenbagel/jellyseerr/commit/0d8b390b678731e76bd1f0f8a0a4952c11e77f4d)) +* new mobile menu ([#3251](https://github.com/fallenbagel/jellyseerr/issues/3251)) ([fcbca17](https://github.com/fallenbagel/jellyseerr/commit/fcbca1722f31f32633a57bc5048f46c9da057d87)) +* translations update from Hosted Weblate ([#3218](https://github.com/fallenbagel/jellyseerr/issues/3218)) ([5940ff7](https://github.com/fallenbagel/jellyseerr/commit/5940ff7f5f62eed9ac5aa6f02803418aaa09813a)) +* **ui:** add episode number to front of episode name in season details ([#3086](https://github.com/fallenbagel/jellyseerr/issues/3086)) ([a672b32](https://github.com/fallenbagel/jellyseerr/commit/a672b324ec391a20f6f3a1daed82a8d276a52c2c)) +* **ui:** request card progress bar ([#3123](https://github.com/fallenbagel/jellyseerr/issues/3123)) ([03853a1](https://github.com/fallenbagel/jellyseerr/commit/03853a1b9155c8a2153c8885022a74619af1bc15)) + # [1.3.0](https://github.com/fallenbagel/jellyseerr/compare/v1.2.1...v1.3.0) (2023-01-02) ### Bug Fixes diff --git a/package.json b/package.json index f1f2de39e..b959f2963 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jellyseerr", - "version": "0.1.0", + "version": "1.4.0", "private": true, "scripts": { "dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts", From 57e7d68092b24b19e35bfa5ed3cccc5c8215bc39 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 31 Jan 2023 00:20:50 +0000 Subject: [PATCH 02/49] chore(release): 1.4.1 --- CHANGELOG.md | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 997bf1280..5c1670b3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [1.4.1](https://github.com/fallenbagel/jellyseerr/compare/v1.4.0...v1.4.1) (2023-01-31) + + +### Bug Fixes + +* pass in library type when scanning recently added items ([#3287](https://github.com/fallenbagel/jellyseerr/issues/3287)) ([8942eb8](https://github.com/fallenbagel/jellyseerr/commit/8942eb8b7c4fa1d16aa2e72e8ba7120a653c9aa2)) +* **ui:** air date will use UTC for timezone ([#3297](https://github.com/fallenbagel/jellyseerr/issues/3297)) ([3e43586](https://github.com/fallenbagel/jellyseerr/commit/3e43586acc0804c3fff524509caa890a104e132b)) +* **ui:** correct range slider styling in chrome ([#3299](https://github.com/fallenbagel/jellyseerr/issues/3299)) ([d954328](https://github.com/fallenbagel/jellyseerr/commit/d9543289111d72245564d25d300a71b0ea3954ba)) +* **ui:** show 5 icons when possible on mobile menu ([#3298](https://github.com/fallenbagel/jellyseerr/issues/3298)) ([7040da1](https://github.com/fallenbagel/jellyseerr/commit/7040da1334f6d18e19a494c73caa17f7df552dfe)) +* **ui:** style range thumbs correctly for firefox ([#3294](https://github.com/fallenbagel/jellyseerr/issues/3294)) ([9d10e6a](https://github.com/fallenbagel/jellyseerr/commit/9d10e6a88c0996671f1d9d20792e1930dbc82329)) + # [1.4.0](https://github.com/fallenbagel/jellyseerr/compare/v1.3.0...v1.4.0) (2023-01-29) diff --git a/package.json b/package.json index b959f2963..dd5fb6cf1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jellyseerr", - "version": "1.4.0", + "version": "1.4.1", "private": true, "scripts": { "dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts", From 24151d27f7e2faf24bfc10b4a41cb6b3d31a8a45 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 20 Apr 2023 02:05:25 +0000 Subject: [PATCH 03/49] chore(release): 1.5.0 --- CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c1670b3b..434888f5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,35 @@ +# [1.5.0](https://github.com/fallenbagel/jellyseerr/compare/v1.4.1...v1.5.0) (2023-04-20) + + +### Bug Fixes + +* add better checks on 4k detection of series ([bc9017f](https://github.com/fallenbagel/jellyseerr/commit/bc9017f54d84ec24c4d74d38e1b4e24219425d41)) +* added a refresh interval if download status is in progress ([#3275](https://github.com/fallenbagel/jellyseerr/issues/3275)) ([1e2c6f4](https://github.com/fallenbagel/jellyseerr/commit/1e2c6f46ab66c836f321b5d8e34f1e8124c0b542)) +* **build:** increase threshold for amount of data to be fetched when SSR'ing ([#3320](https://github.com/fallenbagel/jellyseerr/issues/3320)) ([d7b83d2](https://github.com/fallenbagel/jellyseerr/commit/d7b83d22cee3d20db564cc0564d42802b02327e3)) +* disable availability sync temporarily ([2e5cf22](https://github.com/fallenbagel/jellyseerr/commit/2e5cf226265686012329248e7f729fec324c3deb)) +* hide remove button when default service is not configured ([7d4455b](https://github.com/fallenbagel/jellyseerr/commit/7d4455ba6bfd12e2730f7085cbb87df246f01d22)) +* **jellyfin scan:** temporary workaround fix for jellyfin scan when display specials within season ([38fb66d](https://github.com/fallenbagel/jellyseerr/commit/38fb66d31e41232c01898d0d362af8338eb7b960)), closes [#215](https://github.com/fallenbagel/jellyseerr/issues/215) [#176](https://github.com/fallenbagel/jellyseerr/issues/176) [#246](https://github.com/fallenbagel/jellyseerr/issues/246) +* lint issues ([bcd2bb7](https://github.com/fallenbagel/jellyseerr/commit/bcd2bb7c96810f5a6932f42468a628d2db1bc771)) +* logger was set to info for the wrong logs ([#3354](https://github.com/fallenbagel/jellyseerr/issues/3354)) ([c36a4ba](https://github.com/fallenbagel/jellyseerr/commit/c36a4ba2b8df05873f5dfd0946a9bc3dc4ecfd1d)) +* remove unnecessary parenthesis from api key generation ([#3336](https://github.com/fallenbagel/jellyseerr/issues/3336)) ([6bd3f01](https://github.com/fallenbagel/jellyseerr/commit/6bd3f015d65507efca60279007bd2b86ee860643)) +* **snapcraft:** use the correct config folder for image cache ([#3302](https://github.com/fallenbagel/jellyseerr/issues/3302)) ([c93467b](https://github.com/fallenbagel/jellyseerr/commit/c93467b3acf2c256324297e7e8f21e9944005dd4)) +* **ui:** hide mini status badge if non-4K media status is unknown ([#3346](https://github.com/fallenbagel/jellyseerr/issues/3346)) ([50f06da](https://github.com/fallenbagel/jellyseerr/commit/50f06dabbffc693f0843584a64d1d96e77982820)) +* **ui:** hide search bar behind slideover when opened ([#3348](https://github.com/fallenbagel/jellyseerr/issues/3348)) ([b3882de](https://github.com/fallenbagel/jellyseerr/commit/b3882de8930a70adb2f93a27be6370bfa1826587)) +* **ui:** prevent title cards from flickering when quickly hovering across them ([#3349](https://github.com/fallenbagel/jellyseerr/issues/3349)) ([eb5502a](https://github.com/fallenbagel/jellyseerr/commit/eb5502a16f86e37a933f6beca0678c2d228e77d5)) +* **watchlist:** correctly load more than 20 watchlist items ([#3351](https://github.com/fallenbagel/jellyseerr/issues/3351)) ([af880a6](https://github.com/fallenbagel/jellyseerr/commit/af880a6c839794b34bddcd7e0fe56353aa48ba36)) + + +### Features + +* add a button in ManageSlideOver to remove the movie and the file from Radarr/Sonarr ([2e74584](https://github.com/fallenbagel/jellyseerr/commit/2e7458457e995dd3ec6dd96035fe997646cdd446)) +* availability sync rework ([#3219](https://github.com/fallenbagel/jellyseerr/issues/3219)) ([ae38183](https://github.com/fallenbagel/jellyseerr/commit/ae3818304b2f75222d1bd223ece94f829a3b42d0)), closes [#377](https://github.com/fallenbagel/jellyseerr/issues/377) +* full title of download item on hover with tooltip ([#3296](https://github.com/fallenbagel/jellyseerr/issues/3296)) ([33e7691](https://github.com/fallenbagel/jellyseerr/commit/33e7691b94d7d369a0a1410e434850bc51e5572e)) + + +### Performance Improvements + +* **imageproxy:** do not set cookies to image proxy so CDNs can cache images ([#3332](https://github.com/fallenbagel/jellyseerr/issues/3332)) ([966639d](https://github.com/fallenbagel/jellyseerr/commit/966639df430d32f6bfebdb16314dc4590d21caf8)) + ## [1.4.1](https://github.com/fallenbagel/jellyseerr/compare/v1.4.0...v1.4.1) (2023-01-31) diff --git a/package.json b/package.json index dd5fb6cf1..3c4da6f65 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jellyseerr", - "version": "1.4.1", + "version": "1.5.0", "private": true, "scripts": { "dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts", From 5712e1980457aa1345fc0dd3dece6734deff259d Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Fri, 4 Aug 2023 20:43:24 +0000 Subject: [PATCH 04/49] chore(release): 1.6.0 --- CHANGELOG.md | 39 +++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 434888f5d..7dfc086a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,42 @@ +# [1.6.0](https://github.com/fallenbagel/jellyseerr/compare/v1.5.0...v1.6.0) (2023-08-04) + + +### Bug Fixes + +* availability sync file detection ([#3371](https://github.com/fallenbagel/jellyseerr/issues/3371)) ([7522aa3](https://github.com/fallenbagel/jellyseerr/commit/7522aa31743b169c903ebdf9d4d698645d27514c)) +* corrected initial fallback data load on details page ([#3395](https://github.com/fallenbagel/jellyseerr/issues/3395)) ([4bd8764](https://github.com/fallenbagel/jellyseerr/commit/4bd87647d0551c20e13589a62690a6f3e5ad8ff7)) +* correctly load series fallback modal with sonarr v4 ([#3451](https://github.com/fallenbagel/jellyseerr/issues/3451)) ([e051b1d](https://github.com/fallenbagel/jellyseerr/commit/e051b1dfea9c9320cc9dd420c475ae74cff0d901)) +* **deps:** update all non-major dependencies ([#3223](https://github.com/fallenbagel/jellyseerr/issues/3223)) ([f5191ad](https://github.com/fallenbagel/jellyseerr/commit/f5191aded680357522a65bbdcc40d162b8fbf594)) +* error deleting users with over 1000 requests ([#3376](https://github.com/fallenbagel/jellyseerr/issues/3376)) ([ac77b03](https://github.com/fallenbagel/jellyseerr/commit/ac77b037d5fb0c54f5edf4b29d04adb57aef388f)) +* external url regex is now consistent with internal url ([33ec443](https://github.com/fallenbagel/jellyseerr/commit/33ec4436fb82e1eb1bc97dd650088c27785e9d94)) +* externalLinkBlock ([46cd4d0](https://github.com/fallenbagel/jellyseerr/commit/46cd4d01d9a3cf17d79350c5e678202820272299)) +* fix regex for internal url to use a more effecient one ([e848386](https://github.com/fallenbagel/jellyseerr/commit/e848386d10f05f157e7a6dde8847ecab50c169ac)) +* fixes RT ratings for tv shows ([#3492](https://github.com/fallenbagel/jellyseerr/issues/3492)) ([04fbd00](https://github.com/fallenbagel/jellyseerr/commit/04fbd00d4ac29045592588ef8b664d1916991e37)), closes [#3491](https://github.com/fallenbagel/jellyseerr/issues/3491) +* **genreselector:** fix searching in Genre filter ([#3468](https://github.com/fallenbagel/jellyseerr/issues/3468)) ([d7fa35e](https://github.com/fallenbagel/jellyseerr/commit/d7fa35e066cf371797aaa46ca464aa531ba8fb35)) +* handle search results with collections ([#3393](https://github.com/fallenbagel/jellyseerr/issues/3393)) ([70b1540](https://github.com/fallenbagel/jellyseerr/commit/70b1540ae23e83e01013856a9e06ad39e600922d)) +* lock body scroll when using webkit ([#3399](https://github.com/fallenbagel/jellyseerr/issues/3399)) ([c27f960](https://github.com/fallenbagel/jellyseerr/commit/c27f96096ac8cc6c387f9d1dde5b263576ac2132)) +* **logs:** jellyfin auth error now has the severity warn consistent with local login ([cc041b5](https://github.com/fallenbagel/jellyseerr/commit/cc041b5e0aa2b67573edba5919772b77a5111162)), closes [#224](https://github.com/fallenbagel/jellyseerr/issues/224) +* make a (shallow) copy of radarr/sonarr tags into a request before adding user tags ([#3485](https://github.com/fallenbagel/jellyseerr/issues/3485)) ([48f7666](https://github.com/fallenbagel/jellyseerr/commit/48f76662d5c08156f1da3f47e216c5f02668f64b)) +* **ui:** corrected default badge hover opacity ([#3369](https://github.com/fallenbagel/jellyseerr/issues/3369)) ([a4d07f5](https://github.com/fallenbagel/jellyseerr/commit/a4d07f5afab613317d96c9c6e9b47157a5a28986)) +* **ui:** corrected mobile menu spacing in collection details ([#3432](https://github.com/fallenbagel/jellyseerr/issues/3432)) ([77a33cb](https://github.com/fallenbagel/jellyseerr/commit/77a33cb74d744bb747b791785799b632af8c7862)) +* **ui:** Make play symbol white ([1fe4bb8](https://github.com/fallenbagel/jellyseerr/commit/1fe4bb8a0415a72791ced75a2fba1027287398d5)) +* **ui:** Resize Emby icon and add margins ([ad69d67](https://github.com/fallenbagel/jellyseerr/commit/ad69d6715e976630092bfbbb1843886523551014)) +* **watchlist:** add validation for creation request ([03316c6](https://github.com/fallenbagel/jellyseerr/commit/03316c642d1ecf89753789af08caf6e3aac80113)) +* **watchlist:** fix github code scanning ([c08897b](https://github.com/fallenbagel/jellyseerr/commit/c08897bdc1cff65862c62347572bbbd01b6c36ac)) + + +### Features + +* **add watchlist:** adding midding functionality from overserr ([5f1c10d](https://github.com/fallenbagel/jellyseerr/commit/5f1c10d50aaa430bcda96218ef2cc12a0eb926f3)) +* adds streaming services custom slider ([#3361](https://github.com/fallenbagel/jellyseerr/issues/3361)) ([2520d8f](https://github.com/fallenbagel/jellyseerr/commit/2520d8f739abfde608f3ef66a9fbe6b7b5c6647a)) +* auto tagging requested media with username ([#3338](https://github.com/fallenbagel/jellyseerr/issues/3338)) ([24f268b](https://github.com/fallenbagel/jellyseerr/commit/24f268b6cb67d9a8d8675cd6e09dd83a7f499add)) +* **discover:** support filtering by tmdb user vote count on discover page ([#3407](https://github.com/fallenbagel/jellyseerr/issues/3407)) ([aa84977](https://github.com/fallenbagel/jellyseerr/commit/aa849776809dfe891e67ff4db6861ef44df1a774)) +* **settings:** add internal url to jellyfin settings form ([0a30cd3](https://github.com/fallenbagel/jellyseerr/commit/0a30cd356d217a39546c016cc8bfa6ff6ad75e3e)), closes [#194](https://github.com/fallenbagel/jellyseerr/issues/194) +* **src/components/externallinkblock/index.tsx:** support Emby icon ([672061c](https://github.com/fallenbagel/jellyseerr/commit/672061cd646c97c9954790c8e50eac88ea2666e9)) +* **tooltip:** email tooltip now appears when hovered over info icon ([cd7930e](https://github.com/fallenbagel/jellyseerr/commit/cd7930eef98451a781e5c9dc5ec223600a379f42)) +* translations update ([47287c3](https://github.com/fallenbagel/jellyseerr/commit/47287c368885d14bd1a56e3e8318ce22dd0f6ddf)), closes [#381](https://github.com/fallenbagel/jellyseerr/issues/381) +* **watchlist:** add translation for en ([b7e3d28](https://github.com/fallenbagel/jellyseerr/commit/b7e3d285ed35b623062eceb0d99035cafbf075a6)) + # [1.5.0](https://github.com/fallenbagel/jellyseerr/compare/v1.4.1...v1.5.0) (2023-04-20) diff --git a/package.json b/package.json index 257e2994f..055192f23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jellyseerr", - "version": "1.5.0", + "version": "1.6.0", "private": true, "scripts": { "dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts", From 325e2ed6d36b3a9dfe0cb25d583749194b92886c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 14 Sep 2023 00:44:40 +0000 Subject: [PATCH 05/49] chore(release): 1.7.0 --- CHANGELOG.md | 23 +++++++++++++++++++++++ package.json | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dfc086a3..c9b87bc9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +# [1.7.0](https://github.com/fallenbagel/jellyseerr/compare/v1.6.0...v1.7.0) (2023-09-14) + + +### Bug Fixes + +* adjust the plex watchlist sync schedule to have fuzziness ([#3502](https://github.com/fallenbagel/jellyseerr/issues/3502)) ([2c3f533](https://github.com/fallenbagel/jellyseerr/commit/2c3f5330764492e1323afd2d1f25e28ad78a2f2f)) +* handle issue causing incorrect media to change to unknown ([#3516](https://github.com/fallenbagel/jellyseerr/issues/3516)) ([83b008c](https://github.com/fallenbagel/jellyseerr/commit/83b008c8391459bd02dc74bcdb0d8caf27207bdf)) +* improved handling of edge case that could cause availability sync to fail ([#3497](https://github.com/fallenbagel/jellyseerr/issues/3497)) ([d0836ce](https://github.com/fallenbagel/jellyseerr/commit/d0836ce0efd55fccf2546087a0c4f94f7cb2e82a)) +* Include all defaults in payload ([#3538](https://github.com/fallenbagel/jellyseerr/issues/3538)) ([cb63bf2](https://github.com/fallenbagel/jellyseerr/commit/cb63bf217b9e8810a5210b4bf475b2a96583cc84)) +* multiple notifications for available media ([048fa96](https://github.com/fallenbagel/jellyseerr/commit/048fa967f2e5b23831ac9917c703934c50ef75f0)) +* repeat notifications for available 4k media ([30361f2](https://github.com/fallenbagel/jellyseerr/commit/30361f2ab751d9a882a9120e0f3df28dc42cc2cd)) +* resolved issue with create slider causing incorrect form submission ([#3514](https://github.com/fallenbagel/jellyseerr/issues/3514)) ([a761b7d](https://github.com/fallenbagel/jellyseerr/commit/a761b7dd35a5bd61bb4eb0275b75d1e0977e6a2d)) +* resolved user access check issue ([#3551](https://github.com/fallenbagel/jellyseerr/issues/3551)) ([2816c66](https://github.com/fallenbagel/jellyseerr/commit/2816c66300bf870d493c0665b0e984d60f707dfd)) +* **server/api/jellyfin.ts:** use /Library/VirtualFolders Jellyfin API call to fetch Jellyfin libs ([8685f57](https://github.com/fallenbagel/jellyseerr/commit/8685f5796a99d9700146bae9892319db10508d68)), closes [#256](https://github.com/fallenbagel/jellyseerr/issues/256) +* **statusbadge:** handle missing season/episode number ([#3526](https://github.com/fallenbagel/jellyseerr/issues/3526)) ([01de972](https://github.com/fallenbagel/jellyseerr/commit/01de972a8fe2ea3c18d5b2f426d01b5b14d142d4)) +* **tautulli:** only test connection if hostname is defined ([#3573](https://github.com/fallenbagel/jellyseerr/issues/3573)) ([f7b4dfc](https://github.com/fallenbagel/jellyseerr/commit/f7b4dfcac472d08c54779a14fc1ad3c90927df26)) +* **ui:** corrected issues icon color ([#3498](https://github.com/fallenbagel/jellyseerr/issues/3498)) ([c1a47bd](https://github.com/fallenbagel/jellyseerr/commit/c1a47bd9de332cb4925974690f5a33448b5cc2e6)) + + +### Features + +* **rating:** added IMDB Radarr proxy ([#3496](https://github.com/fallenbagel/jellyseerr/issues/3496)) ([b4191f9](https://github.com/fallenbagel/jellyseerr/commit/b4191f9c65b7ff08764e61d18e7a75bc8d4b3325)) + # [1.6.0](https://github.com/fallenbagel/jellyseerr/compare/v1.5.0...v1.6.0) (2023-08-04) diff --git a/package.json b/package.json index 055192f23..6892a3bd8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jellyseerr", - "version": "1.6.0", + "version": "1.7.0", "private": true, "scripts": { "dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts", From b39a5a7d824dd269f72c5fe33cf2c2681045daec Mon Sep 17 00:00:00 2001 From: zackhow Date: Tue, 4 Jul 2023 17:30:51 -0400 Subject: [PATCH 06/49] feat: support for postgresql --- package.json | 1 + server/datasource.ts | 50 ++++++++++++++++-- server/entity/Media.ts | 5 +- server/entity/MediaRequest.ts | 16 +++++- server/routes/request.ts | 2 +- server/utils/DbColumnHelper.ts | 21 ++++++++ yarn.lock | 95 ++++++++++++++++++++++++++++++++++ 7 files changed, 183 insertions(+), 7 deletions(-) create mode 100644 server/utils/DbColumnHelper.ts diff --git a/package.json b/package.json index 6892a3bd8..16489d5ea 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "node-schedule": "2.1.1", "nodemailer": "6.9.1", "openpgp": "5.7.0", + "pg": "8.11.0", "plex-api": "5.3.2", "pug": "3.0.2", "react": "18.2.0", diff --git a/server/datasource.ts b/server/datasource.ts index d4eadaa10..14e215554 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -30,9 +30,53 @@ const prodConfig: DataSourceOptions = { subscribers: ['dist/subscriber/**/*.js'], }; -const dataSource = new DataSource( - process.env.NODE_ENV !== 'production' ? devConfig : prodConfig -); +const postgresDevConfig: DataSourceOptions = { + type: 'postgres', + name: 'pgdb', + host: process.env.DB_HOST, + port: parseInt(process.env.DB_PORT ?? '5432'), + username: process.env.DB_USER, + password: process.env.DB_PASS, + database: process.env.DB_NAME ?? 'jellyseerr', + synchronize: true, + migrationsRun: false, + logging: false, + entities: ['server/entity/**/*.ts'], + migrations: ['server/migration/**/*.ts'], + subscribers: ['server/subscriber/**/*.ts'], +}; + +const postgresProdConfig: DataSourceOptions = { + type: 'postgres', + name: 'pgdb', + host: process.env.DB_HOST, + port: parseInt(process.env.DB_PORT ?? '5432'), + username: process.env.DB_USER, + password: process.env.DB_PASS, + database: process.env.DB_NAME ?? 'jellyseerr', + synchronize: false, + migrationsRun: false, + logging: false, + entities: ['dist/entity/**/*.js'], + migrations: ['dist/migration/**/*.js'], + subscribers: ['dist/subscriber/**/*.js'], +}; + +export const isPgsql = process.env.DB_TYPE === 'postgres'; + +function getDataSource(): DataSourceOptions { + if (process.env.NODE_ENV === 'production') { + if (isPgsql) { + return postgresProdConfig; + } + return prodConfig; + } else if (isPgsql) { + return postgresDevConfig; + } + return devConfig; +} + +const dataSource = new DataSource(getDataSource()); export const getRepository = ( target: EntityTarget diff --git a/server/entity/Media.ts b/server/entity/Media.ts index 68a5622c0..8620bc32d 100644 --- a/server/entity/Media.ts +++ b/server/entity/Media.ts @@ -9,6 +9,7 @@ import type { DownloadingItem } from '@server/lib/downloadtracker'; import downloadTracker from '@server/lib/downloadtracker'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; +import { DbAwareColumn } from '@server/utils/DbColumnHelper'; import { AfterLoad, Column, @@ -121,10 +122,10 @@ class Media { @UpdateDateColumn() public updatedAt: Date; - @Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) + @DbAwareColumn({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) public lastSeasonChange: Date; - @Column({ type: 'datetime', nullable: true }) + @DbAwareColumn({ type: 'datetime', nullable: true }) public mediaAddedAt: Date; @Column({ nullable: true, type: 'int' }) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index e980860c6..303700a2b 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -12,7 +12,7 @@ import { MediaStatus, MediaType, } from '@server/constants/media'; -import { getRepository } from '@server/datasource'; +import { getRepository, isPgsql } from '@server/datasource'; import type { MediaRequestBody } from '@server/interfaces/api/requestInterfaces'; import notificationManager, { Notification } from '@server/lib/notifications'; import { Permission } from '@server/lib/permissions'; @@ -569,6 +569,13 @@ export class MediaRequest { }); return; } + // Typeorm pgsql doesn't load this relation even though the query specifically + // calls for it. The fk will get blown away from media_request when it is + // saved. Adding request back in prior to saving. + if (isPgsql) { + media.requests.push(this); + } + const seasonRequestRepository = getRepository(SeasonRequest); if ( this.status === MediaRequestStatus.APPROVED && @@ -627,6 +634,13 @@ export class MediaRequest { relations: { requests: true }, }); + // Typeorm pgsql doesn't load this relation even though the query specifically + // calls for it. The fk will get blown away from media_request when it is + // saved. Adding request back in prior to saving. + if (isPgsql) { + fullMedia.requests.push(this); + } + if ( !fullMedia.requests.some((request) => !request.is4k) && fullMedia.status !== MediaStatus.AVAILABLE diff --git a/server/routes/request.ts b/server/routes/request.ts index 83c05b485..3ab1685ba 100644 --- a/server/routes/request.ts +++ b/server/routes/request.ts @@ -109,7 +109,7 @@ requestRoutes.get, RequestResultsResponse>( requestStatus: statusFilter, }) .andWhere( - '((request.is4k = 0 AND media.status IN (:...mediaStatus)) OR (request.is4k = 1 AND media.status4k IN (:...mediaStatus)))', + '((request.is4k = false AND media.status IN (:...mediaStatus)) OR (request.is4k = true AND media.status4k IN (:...mediaStatus)))', { mediaStatus: mediaStatusFilter, } diff --git a/server/utils/DbColumnHelper.ts b/server/utils/DbColumnHelper.ts new file mode 100644 index 000000000..2f13432a7 --- /dev/null +++ b/server/utils/DbColumnHelper.ts @@ -0,0 +1,21 @@ +import { isPgsql } from '@server/datasource'; +import type { ColumnOptions, ColumnType } from 'typeorm'; +import { Column } from 'typeorm'; + +const pgTypeMapping: { [key: string]: ColumnType } = { + datetime: 'timestamp with time zone', +}; + +export function resolveDbType(pgType: ColumnType): ColumnType { + if (isPgsql && pgType.toString() in pgTypeMapping) { + return pgTypeMapping[pgType.toString()]; + } + return pgType; +} + +export function DbAwareColumn(columnOptions: ColumnOptions) { + if (columnOptions.type) { + columnOptions.type = resolveDbType(columnOptions.type); + } + return Column(columnOptions); +} diff --git a/yarn.lock b/yarn.lock index 09b5a3ca0..9ab9acd16 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4950,6 +4950,11 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer-writer@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/buffer-writer/-/buffer-writer-2.0.0.tgz#ce7eb81a38f7829db09c873f2fbb792c0c98ec04" + integrity sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw== + buffer@^5.5.0, buffer@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" @@ -10773,6 +10778,11 @@ p-wait-for@3.2.0: dependencies: p-timeout "^3.0.0" +packet-reader@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" + integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== + pacote@^13.0.3, pacote@^13.6.1, pacote@^13.6.2: version "13.6.2" resolved "https://registry.yarnpkg.com/pacote/-/pacote-13.6.2.tgz#0d444ba3618ab3e5cd330b451c22967bbd0ca48a" @@ -10957,6 +10967,64 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow== +pg-cloudflare@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pg-cloudflare/-/pg-cloudflare-1.1.1.tgz#e6d5833015b170e23ae819e8c5d7eaedb472ca98" + integrity sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q== + +pg-connection-string@^2.6.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.6.1.tgz#78c23c21a35dd116f48e12e23c0965e8d9e2cbfb" + integrity sha512-w6ZzNu6oMmIzEAYVw+RLK0+nqHPt8K3ZnknKi+g48Ak2pr3dtljJW3o+D/n2zzCG07Zoe9VOX3aiKpj+BN0pjg== + +pg-int8@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/pg-int8/-/pg-int8-1.0.1.tgz#943bd463bf5b71b4170115f80f8efc9a0c0eb78c" + integrity sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw== + +pg-pool@^3.6.0: + version "3.6.1" + resolved "https://registry.yarnpkg.com/pg-pool/-/pg-pool-3.6.1.tgz#5a902eda79a8d7e3c928b77abf776b3cb7d351f7" + integrity sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og== + +pg-protocol@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/pg-protocol/-/pg-protocol-1.6.0.tgz#4c91613c0315349363af2084608db843502f8833" + integrity sha512-M+PDm637OY5WM307051+bsDia5Xej6d9IR4GwJse1qA1DIhiKlksvrneZOYQq42OM+spubpcNYEo2FcKQrDk+Q== + +pg-types@^2.1.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/pg-types/-/pg-types-2.2.0.tgz#2d0250d636454f7cfa3b6ae0382fdfa8063254a3" + integrity sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA== + dependencies: + pg-int8 "1.0.1" + postgres-array "~2.0.0" + postgres-bytea "~1.0.0" + postgres-date "~1.0.4" + postgres-interval "^1.1.0" + +pg@8.11.0: + version "8.11.0" + resolved "https://registry.yarnpkg.com/pg/-/pg-8.11.0.tgz#a37e534e94b57a7ed811e926f23a7c56385f55d9" + integrity sha512-meLUVPn2TWgJyLmy7el3fQQVwft4gU5NGyvV0XbD41iU9Jbg8lCH4zexhIkihDzVHJStlt6r088G6/fWeNjhXA== + dependencies: + buffer-writer "2.0.0" + packet-reader "1.0.0" + pg-connection-string "^2.6.0" + pg-pool "^3.6.0" + pg-protocol "^1.6.0" + pg-types "^2.1.0" + pgpass "1.x" + optionalDependencies: + pg-cloudflare "^1.1.0" + +pgpass@1.x: + version "1.0.5" + resolved "https://registry.yarnpkg.com/pgpass/-/pgpass-1.0.5.tgz#9b873e4a564bb10fa7a7dbd55312728d422a223d" + integrity sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug== + dependencies: + split2 "^4.1.0" + picocolors@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c" @@ -11103,6 +11171,28 @@ postcss@8.4.21, postcss@^8.0.9: picocolors "^1.0.0" source-map-js "^1.0.2" +postgres-array@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/postgres-array/-/postgres-array-2.0.0.tgz#48f8fce054fbc69671999329b8834b772652d82e" + integrity sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA== + +postgres-bytea@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/postgres-bytea/-/postgres-bytea-1.0.0.tgz#027b533c0aa890e26d172d47cf9ccecc521acd35" + integrity sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w== + +postgres-date@~1.0.4: + version "1.0.7" + resolved "https://registry.yarnpkg.com/postgres-date/-/postgres-date-1.0.7.tgz#51bc086006005e5061c591cee727f2531bf641a8" + integrity sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q== + +postgres-interval@^1.1.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/postgres-interval/-/postgres-interval-1.2.0.tgz#b460c82cb1587507788819a06aa0fffdb3544695" + integrity sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ== + dependencies: + xtend "^4.0.0" + prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -12516,6 +12606,11 @@ split2@^3.0.0: dependencies: readable-stream "^3.0.0" +split2@^4.1.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" + integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== + split2@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/split2/-/split2-1.0.0.tgz#52e2e221d88c75f9a73f90556e263ff96772b314" From 573b64f9017a8a5da83eaf3ed6531cc059b08448 Mon Sep 17 00:00:00 2001 From: Ryan Algar Date: Mon, 13 Nov 2023 15:16:39 -0800 Subject: [PATCH 07/49] test(pgsql): disable root certificate verification --- server/datasource.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/datasource.ts b/server/datasource.ts index 14e215554..fbfc993b3 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -38,6 +38,12 @@ const postgresDevConfig: DataSourceOptions = { username: process.env.DB_USER, password: process.env.DB_PASS, database: process.env.DB_NAME ?? 'jellyseerr', + ssl: { + rejectUnauthorized: false, // Disable root certificate verification + //ca: fs.readFileSync('/path/to/server-certificates/root.crt').toString(), + //key: fs.readFileSync('/path/to/client-key/postgresql.key').toString(), + //cert: fs.readFileSync('/path/to/client-certificates/postgresql.crt').toString(), + }, synchronize: true, migrationsRun: false, logging: false, @@ -54,6 +60,12 @@ const postgresProdConfig: DataSourceOptions = { username: process.env.DB_USER, password: process.env.DB_PASS, database: process.env.DB_NAME ?? 'jellyseerr', + ssl: { + rejectUnauthorized: false, // Disable root certificate verification + //ca: fs.readFileSync('/path/to/server-certificates/root.crt').toString(), + //key: fs.readFileSync('/path/to/client-key/postgresql.key').toString(), + //cert: fs.readFileSync('/path/to/client-certificates/postgresql.crt').toString(), + }, synchronize: false, migrationsRun: false, logging: false, From b6592bf9f7a25fb092a309ffbb99c7719414cea1 Mon Sep 17 00:00:00 2001 From: Ryan Algar Date: Mon, 13 Nov 2023 14:58:48 -0800 Subject: [PATCH 08/49] test(ci): temporarily change CI for local repo --- .github/workflows/ci.yml | 88 -------------------------- .github/workflows/codeql.yml | 41 ------------ .github/workflows/cypress.yml | 30 --------- .github/workflows/preview.yml | 27 ++++---- .github/workflows/release.yml | 116 ---------------------------------- .github/workflows/snap.yaml | 91 -------------------------- .github/workflows/support.yml | 25 -------- 7 files changed, 15 insertions(+), 403 deletions(-) delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/codeql.yml delete mode 100644 .github/workflows/cypress.yml delete mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/snap.yaml delete mode 100644 .github/workflows/support.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 0d117c4ec..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,88 +0,0 @@ -name: Jellyseerr CI - -on: - pull_request: - branches: - - '*' - push: - branches: - - develop - -jobs: - test: - name: Lint & Test Build - if: github.event_name == 'pull_request' - runs-on: ubuntu-20.04 - container: node:16.17-alpine - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Install dependencies - env: - HUSKY: 0 - run: yarn - - name: Lint - run: yarn lint - - name: Formatting - run: yarn format:check - - name: Build - run: yarn build - - build_and_push: - name: Build & Publish Docker Images - if: github.ref == 'refs/heads/develop' && !contains(github.event.head_commit.message, '[skip ci]') - runs-on: ubuntu-20.04 - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Log in to GitHub Container Registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push - uses: docker/build-push-action@v3 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64,linux/arm/v7 - push: true - build-args: | - COMMIT_TAG=${{ github.sha }} - tags: | - fallenbagel/jellyseerr:develop - - discord: - name: Send Discord Notification - needs: build_and_push - if: always() && github.event_name != 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]') - runs-on: ubuntu-20.04 - steps: - - name: Get Build Job Status - uses: technote-space/workflow-conclusion-action@v3 - - name: Combine Job Status - id: status - run: | - failures=(neutral, skipped, timed_out, action_required) - if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then - echo "status=failure" >> $GITHUB_OUTPUT - else - echo "status=$WORKFLOW_CONCLUSION" >> $GITHUB_OUTPUT - fi - - name: Post Status to Discord - uses: sarisia/actions-status-discord@v1 - with: - webhook: ${{ secrets.DISCORD_WEBHOOK }} - status: ${{ steps.status.outputs.status }} - title: ${{ github.workflow }} - nofail: true diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 10926bbd9..000000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: 'CodeQL' - -on: - push: - branches: ['develop'] - pull_request: - branches: ['develop'] - schedule: - - cron: '50 7 * * 5' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write - - strategy: - fail-fast: false - matrix: - language: [javascript] - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - queries: +security-and-quality - - - name: Autobuild - uses: github/codeql-action/autobuild@v2 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 - with: - category: '/language:${{ matrix.language }}' diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml deleted file mode 100644 index ecd260dd5..000000000 --- a/.github/workflows/cypress.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Cypress Tests - -on: - pull_request: - branches: - - '*' - push: - branches: - - develop - -jobs: - cypress-run: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Cypress run - uses: cypress-io/github-action@v4 - with: - build: yarn cypress:build - start: yarn start - wait-on: 'http://localhost:5055' - record: true - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - WITH_MIGRATIONS: true - # Fix test titles in cypress dashboard - COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}} - COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}} diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 3797936af..2d1a29cf4 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -1,29 +1,32 @@ -name: Jellyseerr Preview +name: Jellyseerr PostgreSQL Preview on: push: - tags: - - 'preview-*' + branches: + - 'v1.7.0/postgresql' jobs: + build_and_push: - name: Build & Publish Docker Preview Images - runs-on: ubuntu-20.04 + name: Build & Publish Docker Image + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v3 - - name: Get the version - id: get_version - run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + - name: Set up QEMU uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Log in to Docker Hub + + - name: Log in to GitHub Container Registry uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push uses: docker/build-push-action@v3 with: @@ -34,4 +37,4 @@ jobs: build-args: | COMMIT_TAG=${{ github.sha }} tags: | - fallenbagel/jellyseerr:${{ steps.get_version.outputs.VERSION }} + ghcr.io/${{ github.repository_owner }}/jellyseerr-pgsql:v1.7.0-preview diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 94ba679b8..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,116 +0,0 @@ -name: Jellyseer Release - -on: workflow_dispatch - -jobs: - semantic-release: - name: Tag and release latest version - runs-on: ubuntu-20.04 - env: - HUSKY: 0 - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: 16 - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Log in to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - - name: Install dependencies - run: yarn - - name: Release - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - run: npx semantic-release - - build-snap: - name: Build Snap Package (${{ matrix.architecture }}) - needs: semantic-release - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - architecture: - - amd64 - - arm64 - - armhf - steps: - - name: Checkout Code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Switch to main branch - run: git checkout main - - name: Pull latest changes - run: git pull - - name: Prepare - id: prepare - run: | - git fetch --prune --tags - if [[ $GITHUB_REF == refs/tags/* || $GITHUB_REF == refs/heads/master ]]; then - echo "RELEASE=stable" >> $GITHUB_OUTPUT - else - echo "RELEASE=edge" >> $GITHUB_OUTPUT - fi - - name: Set Up QEMU - uses: docker/setup-qemu-action@v1 - with: - image: tonistiigi/binfmt@sha256:df15403e06a03c2f461c1f7938b171fda34a5849eb63a70e2a2109ed5a778bde - - name: Build Snap Package - uses: diddlesnaps/snapcraft-multiarch-action@v1 - id: build - with: - architecture: ${{ matrix.architecture }} - - name: Upload Snap Package - uses: actions/upload-artifact@v2 - with: - name: jellyseerr-snap-package-${{ matrix.architecture }} - path: ${{ steps.build.outputs.snap }} - - name: Review Snap Package - uses: diddlesnaps/snapcraft-review-tools-action@v1 - with: - snap: ${{ steps.build.outputs.snap }} - - name: Publish Snap Package - uses: snapcore/action-publish@v1 - env: - SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_LOGIN }} - with: - snap: ${{ steps.build.outputs.snap }} - release: ${{ steps.prepare.outputs.RELEASE }} - - discord: - name: Send Discord Notification - needs: semantic-release - if: always() - runs-on: ubuntu-20.04 - steps: - - name: Get Build Job Status - uses: technote-space/workflow-conclusion-action@v3 - - name: Combine Job Status - id: status - run: | - failures=(neutral, skipped, timed_out, action_required) - if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then - echo "status=failure" >> $GITHUB_OUTPUT - else - echo "status=$WORKFLOW_CONCLUSION" >> $GITHUB_OUTPUT - fi - - name: Post Status to Discord - uses: sarisia/actions-status-discord@v1 - with: - webhook: ${{ secrets.DISCORD_WEBHOOK }} - status: ${{ steps.status.outputs.status }} - title: ${{ github.workflow }} - nofail: true diff --git a/.github/workflows/snap.yaml b/.github/workflows/snap.yaml deleted file mode 100644 index 9c5b143b1..000000000 --- a/.github/workflows/snap.yaml +++ /dev/null @@ -1,91 +0,0 @@ -name: Publish Snap - -on: - push: - branches: - - develop - -jobs: - jobs: - name: Job Check - runs-on: ubuntu-20.04 - if: "!contains(github.event.head_commit.message, '[skip ci]')" - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.10.0 - with: - access_token: ${{ secrets.GITHUB_TOKEN }} - - build-snap: - name: Build Snap Package (${{ matrix.architecture }}) - needs: jobs - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - matrix: - architecture: - - amd64 - - arm64 - - armhf - steps: - - name: Checkout Code - uses: actions/checkout@v3 - - name: Prepare - id: prepare - run: | - git fetch --prune --unshallow --tags - if [[ $GITHUB_REF == refs/tags/* || $GITHUB_REF == refs/heads/master ]]; then - echo "RELEASE=stable" >> $GITHUB_OUTPUT - else - echo "RELEASE=edge" >> $GITHUB_OUTPUT - fi - - name: Set Up QEMU - uses: docker/setup-qemu-action@v2 - - name: Configure Git - run: git config --add safe.directory /data/parts/jellyseerr/src - - name: Build Snap Package - uses: diddlesnaps/snapcraft-multiarch-action@v1 - id: build - with: - architecture: ${{ matrix.architecture }} - - name: Upload Snap Package - uses: actions/upload-artifact@v3 - with: - name: jellyseerr-snap-package-${{ matrix.architecture }} - path: ${{ steps.build.outputs.snap }} - - name: Review Snap Package - uses: diddlesnaps/snapcraft-review-tools-action@v1 - with: - snap: ${{ steps.build.outputs.snap }} - - name: Publish Snap Package - uses: snapcore/action-publish@v1 - env: - SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_LOGIN }} - with: - snap: ${{ steps.build.outputs.snap }} - release: ${{ steps.prepare.outputs.RELEASE }} - - discord: - name: Send Discord Notification - needs: build-snap - if: always() && !contains(github.event.head_commit.message, '[skip ci]') - runs-on: ubuntu-20.04 - steps: - - name: Get Build Job Status - uses: technote-space/workflow-conclusion-action@v3 - - name: Combine Job Status - id: status - run: | - failures=(neutral, skipped, timed_out, action_required) - if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then - echo "status=failure" >> $GITHUB_OUTPUT - else - echo "status=$WORKFLOW_CONCLUSION" >> $GITHUB_OUTPUT - fi - - name: Post Status to Discord - uses: sarisia/actions-status-discord@v1 - with: - webhook: ${{ secrets.DISCORD_WEBHOOK }} - status: ${{ steps.status.outputs.status }} - title: ${{ github.workflow }} - nofail: true diff --git a/.github/workflows/support.yml b/.github/workflows/support.yml deleted file mode 100644 index 8b45dcdc5..000000000 --- a/.github/workflows/support.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: 'Support requests' - -on: - issues: - types: [labeled, unlabeled, reopened] - -jobs: - support: - runs-on: ubuntu-20.04 - steps: - - uses: dessant/support-requests@v2 - with: - github-token: ${{ github.token }} - support-label: 'support' - issue-comment: > - :wave: @{issue-author}, we use the issue tracker exclusively - for bug reports and feature requests. However, this issue appears - to be a support request. Please use our support channels - to get help with Jellyseerr. - - - [Discord](https://discord.gg/ckbvBtDJgC) - - close-issue: true - lock-issue: true - issue-lock-reason: 'off-topic' From abd80c1fa89a4bbacdaa377cbbc051f3edc9fa25 Mon Sep 17 00:00:00 2001 From: Ryan Algar Date: Tue, 14 Nov 2023 16:03:40 -0800 Subject: [PATCH 09/49] fix: don't use SQLite idiom when using PgSQL --- server/index.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/server/index.ts b/server/index.ts index 6cc3e8258..1a3096fd1 100644 --- a/server/index.ts +++ b/server/index.ts @@ -1,5 +1,5 @@ import PlexAPI from '@server/api/plexapi'; -import dataSource, { getRepository } from '@server/datasource'; +import dataSource, { getRepository, isPgsql } from '@server/datasource'; import DiscoverSlider from '@server/entity/DiscoverSlider'; import { Session } from '@server/entity/Session'; import { User } from '@server/entity/User'; @@ -50,9 +50,13 @@ app // Run migrations in production if (process.env.NODE_ENV === 'production') { - await dbConnection.query('PRAGMA foreign_keys=OFF'); - await dbConnection.runMigrations(); - await dbConnection.query('PRAGMA foreign_keys=ON'); + if (isPgsql) { + await dbConnection.runMigrations(); + } else { + await dbConnection.query('PRAGMA foreign_keys=OFF'); + await dbConnection.runMigrations(); + await dbConnection.query('PRAGMA foreign_keys=ON'); + } } // Load Settings From 44aaca0fb275ea370909e335442935c46006a6c2 Mon Sep 17 00:00:00 2001 From: Ryan Algar <59636191+ralgar@users.noreply.github.com> Date: Sat, 16 Dec 2023 10:37:45 -0800 Subject: [PATCH 10/49] feat(db): add flag to toggle TLS for Postgres --- server/datasource.ts | 45 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/server/datasource.ts b/server/datasource.ts index fbfc993b3..3a19a9af9 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -31,6 +31,22 @@ const prodConfig: DataSourceOptions = { }; const postgresDevConfig: DataSourceOptions = { + type: 'postgres', + name: 'pgdb', + host: process.env.DB_HOST, + port: parseInt(process.env.DB_PORT ?? '5432'), + username: process.env.DB_USER, + password: process.env.DB_PASS, + database: process.env.DB_NAME ?? 'jellyseerr', + synchronize: true, + migrationsRun: false, + logging: false, + entities: ['server/entity/**/*.ts'], + migrations: ['server/migration/**/*.ts'], + subscribers: ['server/subscriber/**/*.ts'], +}; + +const postgresDevConfigSSL: DataSourceOptions = { type: 'postgres', name: 'pgdb', host: process.env.DB_HOST, @@ -53,6 +69,22 @@ const postgresDevConfig: DataSourceOptions = { }; const postgresProdConfig: DataSourceOptions = { + type: 'postgres', + name: 'pgdb', + host: process.env.DB_HOST, + port: parseInt(process.env.DB_PORT ?? '5432'), + username: process.env.DB_USER, + password: process.env.DB_PASS, + database: process.env.DB_NAME ?? 'jellyseerr', + synchronize: false, + migrationsRun: false, + logging: false, + entities: ['dist/entity/**/*.js'], + migrations: ['dist/migration/**/*.js'], + subscribers: ['dist/subscriber/**/*.js'], +}; + +const postgresProdConfigSSL: DataSourceOptions = { type: 'postgres', name: 'pgdb', host: process.env.DB_HOST, @@ -75,15 +107,24 @@ const postgresProdConfig: DataSourceOptions = { }; export const isPgsql = process.env.DB_TYPE === 'postgres'; +export const pgsqlUseSSL = process.env.DB_USE_SSL === 'true'; function getDataSource(): DataSourceOptions { if (process.env.NODE_ENV === 'production') { if (isPgsql) { - return postgresProdConfig; + if (pgsqlUseSSL) { + return postgresProdConfigSSL; + } else { + return postgresProdConfig; + } } return prodConfig; } else if (isPgsql) { - return postgresDevConfig; + if (pgsqlUseSSL) { + return postgresDevConfigSSL; + } else { + return postgresDevConfig; + } } return devConfig; } From 4d85f298431219d8b78a0c4f345f4b507f7834d8 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Fri, 19 Jan 2024 16:58:46 -0500 Subject: [PATCH 11/49] feat(postgres and migrations): added migrations for postgres & imporved ssl for postgres config #186 --- server/datasource.ts | 98 +++--- .../1705599190375-InitialMigration.ts | 303 ++++++++++++++++++ .../1603944374840-InitialMigration.ts | 0 .../1605085519544-SeasonStatus.ts | 0 .../1606730060700-CascadeMigration.ts | 0 .../1607928251245-DropImdbIdConstraint.ts | 0 ...8217312474-AddUserRequestDeleteCascades.ts | 0 .../1608477467935-AddLastSeasonChangeMedia.ts | 0 ...477467936-ForceDropImdbUniqueConstraint.ts | 0 ...9236552057-RemoveTmdbIdUniqueConstraint.ts | 0 .../{ => sqlite}/1610070934506-LocalUsers.ts | 0 .../1610370640747-Add4kStatusFields.ts | 0 ...1610522845513-AddMediaAddedFieldToMedia.ts | 0 .../1611508672722-AddDisplayNameToUser.ts | 0 ...757511674-SonarrRadarrSyncServiceFields.ts | 0 .../1611801511397-AddRatingKeysToMedia.ts | 0 ...78137-AddResetPasswordGuidAndExpiryDate.ts | 0 .../1612571545781-AddLanguageProfileId.ts | 0 .../1613379909641-AddJellyfinUserParams.ts | 0 .../1613412948344-ServerTypeEnum.ts | 0 .../1613615266968-CreateUserSettings.ts | 0 .../1613670041760-AddJellyfinDeviceId.ts | 0 ...1613955393450-UpdateUserSettingsRegions.ts | 0 ...95680-AddTelegramSettingsToUserSettings.ts | 0 .../1615333940450-AddPGPToUserSettings.ts | 0 .../1616576677254-AddUserQuotaFields.ts | 0 ...624225464-CreateTagsFieldonMediaRequest.ts | 0 ...-AddUserSettingsNotificationAgentsField.ts | 0 ...18912653565-CreateUserPushSubscriptions.ts | 0 .../1619239659754-AddUserSettingsLocale.ts | 0 ...817343-AddUserSettingsNotificationTypes.ts | 0 .../{ => sqlite}/1634904083966-AddIssues.ts | 0 ...63457-AddPushbulletPushoverUserSettings.ts | 0 ...60632269368-AddWatchlistSyncUserSetting.ts | 0 ...373-AddMediaRequestIsAutoRequestedField.ts | 0 .../1672041273674-AddDiscoverSlider.ts | 0 .../1682608634546-AddWatchlists.ts | 0 37 files changed, 341 insertions(+), 60 deletions(-) create mode 100644 server/migration/postgres/1705599190375-InitialMigration.ts rename server/migration/{ => sqlite}/1603944374840-InitialMigration.ts (100%) rename server/migration/{ => sqlite}/1605085519544-SeasonStatus.ts (100%) rename server/migration/{ => sqlite}/1606730060700-CascadeMigration.ts (100%) rename server/migration/{ => sqlite}/1607928251245-DropImdbIdConstraint.ts (100%) rename server/migration/{ => sqlite}/1608217312474-AddUserRequestDeleteCascades.ts (100%) rename server/migration/{ => sqlite}/1608477467935-AddLastSeasonChangeMedia.ts (100%) rename server/migration/{ => sqlite}/1608477467936-ForceDropImdbUniqueConstraint.ts (100%) rename server/migration/{ => sqlite}/1609236552057-RemoveTmdbIdUniqueConstraint.ts (100%) rename server/migration/{ => sqlite}/1610070934506-LocalUsers.ts (100%) rename server/migration/{ => sqlite}/1610370640747-Add4kStatusFields.ts (100%) rename server/migration/{ => sqlite}/1610522845513-AddMediaAddedFieldToMedia.ts (100%) rename server/migration/{ => sqlite}/1611508672722-AddDisplayNameToUser.ts (100%) rename server/migration/{ => sqlite}/1611757511674-SonarrRadarrSyncServiceFields.ts (100%) rename server/migration/{ => sqlite}/1611801511397-AddRatingKeysToMedia.ts (100%) rename server/migration/{ => sqlite}/1612482778137-AddResetPasswordGuidAndExpiryDate.ts (100%) rename server/migration/{ => sqlite}/1612571545781-AddLanguageProfileId.ts (100%) rename server/migration/{ => sqlite}/1613379909641-AddJellyfinUserParams.ts (100%) rename server/migration/{ => sqlite}/1613412948344-ServerTypeEnum.ts (100%) rename server/migration/{ => sqlite}/1613615266968-CreateUserSettings.ts (100%) rename server/migration/{ => sqlite}/1613670041760-AddJellyfinDeviceId.ts (100%) rename server/migration/{ => sqlite}/1613955393450-UpdateUserSettingsRegions.ts (100%) rename server/migration/{ => sqlite}/1614334195680-AddTelegramSettingsToUserSettings.ts (100%) rename server/migration/{ => sqlite}/1615333940450-AddPGPToUserSettings.ts (100%) rename server/migration/{ => sqlite}/1616576677254-AddUserQuotaFields.ts (100%) rename server/migration/{ => sqlite}/1617624225464-CreateTagsFieldonMediaRequest.ts (100%) rename server/migration/{ => sqlite}/1617730837489-AddUserSettingsNotificationAgentsField.ts (100%) rename server/migration/{ => sqlite}/1618912653565-CreateUserPushSubscriptions.ts (100%) rename server/migration/{ => sqlite}/1619239659754-AddUserSettingsLocale.ts (100%) rename server/migration/{ => sqlite}/1619339817343-AddUserSettingsNotificationTypes.ts (100%) rename server/migration/{ => sqlite}/1634904083966-AddIssues.ts (100%) rename server/migration/{ => sqlite}/1635079863457-AddPushbulletPushoverUserSettings.ts (100%) rename server/migration/{ => sqlite}/1660632269368-AddWatchlistSyncUserSetting.ts (100%) rename server/migration/{ => sqlite}/1660714479373-AddMediaRequestIsAutoRequestedField.ts (100%) rename server/migration/{ => sqlite}/1672041273674-AddDiscoverSlider.ts (100%) rename server/migration/{ => sqlite}/1682608634546-AddWatchlists.ts (100%) diff --git a/server/datasource.ts b/server/datasource.ts index 3a19a9af9..e4ba67cb6 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -1,4 +1,6 @@ -import 'reflect-metadata'; +import fs from 'fs'; +import * as process from 'process'; +import type { TlsOptions } from 'tls'; import type { DataSourceOptions, EntityTarget, Repository } from 'typeorm'; import { DataSource } from 'typeorm'; @@ -12,7 +14,7 @@ const devConfig: DataSourceOptions = { logging: false, enableWAL: true, entities: ['server/entity/**/*.ts'], - migrations: ['server/migration/**/*.ts'], + migrations: ['server/migration/sqlite/**/*.ts'], subscribers: ['server/subscriber/**/*.ts'], }; @@ -26,7 +28,7 @@ const prodConfig: DataSourceOptions = { logging: false, enableWAL: true, entities: ['dist/entity/**/*.js'], - migrations: ['dist/migration/**/*.js'], + migrations: ['dist/migration/sqlite/**/*.js'], subscribers: ['dist/subscriber/**/*.js'], }; @@ -42,29 +44,7 @@ const postgresDevConfig: DataSourceOptions = { migrationsRun: false, logging: false, entities: ['server/entity/**/*.ts'], - migrations: ['server/migration/**/*.ts'], - subscribers: ['server/subscriber/**/*.ts'], -}; - -const postgresDevConfigSSL: DataSourceOptions = { - type: 'postgres', - name: 'pgdb', - host: process.env.DB_HOST, - port: parseInt(process.env.DB_PORT ?? '5432'), - username: process.env.DB_USER, - password: process.env.DB_PASS, - database: process.env.DB_NAME ?? 'jellyseerr', - ssl: { - rejectUnauthorized: false, // Disable root certificate verification - //ca: fs.readFileSync('/path/to/server-certificates/root.crt').toString(), - //key: fs.readFileSync('/path/to/client-key/postgresql.key').toString(), - //cert: fs.readFileSync('/path/to/client-certificates/postgresql.crt').toString(), - }, - synchronize: true, - migrationsRun: false, - logging: false, - entities: ['server/entity/**/*.ts'], - migrations: ['server/migration/**/*.ts'], + migrations: ['server/migration/postgres/**/*.ts'], subscribers: ['server/subscriber/**/*.ts'], }; @@ -76,55 +56,53 @@ const postgresProdConfig: DataSourceOptions = { username: process.env.DB_USER, password: process.env.DB_PASS, database: process.env.DB_NAME ?? 'jellyseerr', + ssl: buildSslConfig(), synchronize: false, migrationsRun: false, logging: false, entities: ['dist/entity/**/*.js'], - migrations: ['dist/migration/**/*.js'], - subscribers: ['dist/subscriber/**/*.js'], -}; - -const postgresProdConfigSSL: DataSourceOptions = { - type: 'postgres', - name: 'pgdb', - host: process.env.DB_HOST, - port: parseInt(process.env.DB_PORT ?? '5432'), - username: process.env.DB_USER, - password: process.env.DB_PASS, - database: process.env.DB_NAME ?? 'jellyseerr', - ssl: { - rejectUnauthorized: false, // Disable root certificate verification - //ca: fs.readFileSync('/path/to/server-certificates/root.crt').toString(), - //key: fs.readFileSync('/path/to/client-key/postgresql.key').toString(), - //cert: fs.readFileSync('/path/to/client-certificates/postgresql.crt').toString(), - }, - synchronize: false, - migrationsRun: false, - logging: false, - entities: ['dist/entity/**/*.js'], - migrations: ['dist/migration/**/*.js'], + migrations: ['dist/migration/postgres/**/*.js'], subscribers: ['dist/subscriber/**/*.js'], }; export const isPgsql = process.env.DB_TYPE === 'postgres'; -export const pgsqlUseSSL = process.env.DB_USE_SSL === 'true'; +const DB_SSL_PREFIX = 'DB_SSL_CONF_'; + +function boolFromEnv(envVar: string) { + return process.env[envVar]?.toLowerCase() === 'true'; +} + +function stringOrReadFileFromEnv(envVar: string): Buffer | string | undefined { + if (process.env[envVar]) { + return process.env[envVar]; + } + const filePath = process.env[`${envVar}_FILE`]; + if (filePath) { + return fs.readFileSync(filePath); + } + return undefined; +} + +function buildSslConfig(): TlsOptions | undefined { + if (process.env.DB_USE_SSL?.toLowerCase() !== 'true') { + return undefined; + } + return { + rejectUnauthorized: boolFromEnv(`${DB_SSL_PREFIX}REJECT_UNAUTHORIZED`), + ca: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}CA`), + key: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}KEY`), + cert: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}CERT`), + }; +} function getDataSource(): DataSourceOptions { if (process.env.NODE_ENV === 'production') { if (isPgsql) { - if (pgsqlUseSSL) { - return postgresProdConfigSSL; - } else { - return postgresProdConfig; - } + return postgresProdConfig; } return prodConfig; } else if (isPgsql) { - if (pgsqlUseSSL) { - return postgresDevConfigSSL; - } else { - return postgresDevConfig; - } + return postgresDevConfig; } return devConfig; } diff --git a/server/migration/postgres/1705599190375-InitialMigration.ts b/server/migration/postgres/1705599190375-InitialMigration.ts new file mode 100644 index 000000000..1a862cd5e --- /dev/null +++ b/server/migration/postgres/1705599190375-InitialMigration.ts @@ -0,0 +1,303 @@ +import type { MigrationInterface, QueryRunner } from 'typeorm'; + +export class InitialMigration1705599190375 implements MigrationInterface { + name = 'InitialMigration1705599190375'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `create table if not exists session + ( + "expiredAt" int, + id text, + json text + );` + ); + await queryRunner.query( + `create index if not exists "idx_194703_IDX_28c5d1d16da7908c97c9bc2f74" + on session ("expiredAt");` + ); + await queryRunner.query( + `create unique index if not exists idx_194703_sqlite_autoindex_session_1 + on session (id);` + ); + await queryRunner.query( + `create table if not exists media + ( + id serial, + "mediaType" text, + "tmdbId" int, + "tvdbId" int, + "imdbId" text, + status int default '1'::int, + status4k int default '1'::int, + "createdAt" timestamp with time zone, + "updatedAt" timestamp with time zone, + "lastSeasonChange" timestamp with time zone, + "mediaAddedAt" timestamp with time zone, + "serviceId" int, + "serviceId4k" int, + "externalServiceId" int, + "externalServiceId4k" int, + "externalServiceSlug" text, + "externalServiceSlug4k" text, + "ratingKey" text, + "ratingKey4k" text, + "jellyfinMediaId" text, + "jellyfinMediaId4k" text, + constraint idx_194722_media_pkey + primary key (id) + );` + ); + await queryRunner.query( + `create table if not exists season + ( + id serial, + "seasonNumber" int, + status int default '1'::int, + "createdAt" timestamp with time zone, + "updatedAt" timestamp with time zone, + "mediaId" int, + status4k int default '1'::int, + constraint idx_194715_season_pkey + primary key (id), + foreign key ("mediaId") references media + on delete cascade + );` + ); + await queryRunner.query( + `create index if not exists "idx_194722_IDX_7ff2d11f6a83cb52386eaebe74" + on media ("imdbId");` + ); + await queryRunner.query( + `create index if not exists "idx_194722_IDX_41a289eb1fa489c1bc6f38d9c3" + on media ("tvdbId");` + ); + await queryRunner.query( + `create index if not exists "idx_194722_IDX_7157aad07c73f6a6ae3bbd5ef5" + on media ("tmdbId");` + ); + await queryRunner.query( + `create unique index if not exists idx_194722_sqlite_autoindex_media_1 + on media ("tvdbId");` + ); + await queryRunner.query( + `create table if not exists "user" + ( + id serial, + email text, + username text, + "plexId" int, + "plexToken" text, + permissions int default '0'::int, + avatar text, + "createdAt" timestamp with time zone, + "updatedAt" timestamp with time zone, + password text, + "userType" int default '1'::int, + "plexUsername" text, + "resetPasswordGuid" text, + "recoveryLinkExpirationDate" date, + "movieQuotaLimit" int, + "movieQuotaDays" int, + "tvQuotaLimit" int, + "tvQuotaDays" int, + "jellyfinUsername" text, + "jellyfinAuthToken" text, + "jellyfinUserId" text, + "jellyfinDeviceId" text, + constraint idx_194731_user_pkey + primary key (id) + );` + ); + await queryRunner.query( + `create unique index if not exists idx_194731_sqlite_autoindex_user_1 + on "user" (email);` + ); + await queryRunner.query( + `create table if not exists user_push_subscription + ( + id serial, + endpoint text, + p256dh text, + auth text, + "userId" int, + constraint idx_194740_user_push_subscription_pkey + primary key (id), + foreign key ("userId") references "user" + on delete cascade + );` + ); + await queryRunner.query( + `create unique index if not exists idx_194740_sqlite_autoindex_user_push_subscription_1 + on user_push_subscription (auth);` + ); + await queryRunner.query( + `create table if not exists issue + ( + id serial, + "issueType" int, + status int default '1'::int, + "problemSeason" int default '0'::int, + "problemEpisode" int default '0'::int, + "createdAt" timestamp with time zone, + "updatedAt" timestamp with time zone, + "mediaId" int, + "createdById" int, + "modifiedById" int, + constraint idx_194747_issue_pkey + primary key (id), + foreign key ("modifiedById") references "user" + on delete cascade, + foreign key ("createdById") references "user" + on delete cascade, + foreign key ("mediaId") references media + on delete cascade + );` + ); + await queryRunner.query( + `create table if not exists issue_comment + ( + id serial, + message text, + "createdAt" timestamp with time zone, + "updatedAt" timestamp with time zone, + "userId" int, + "issueId" int, + constraint idx_194755_issue_comment_pkey + primary key (id), + foreign key ("issueId") references issue + on delete cascade, + foreign key ("userId") references "user" + on delete cascade + );` + ); + await queryRunner.query( + `create table if not exists user_settings + ( + id serial, + "notificationTypes" text, + "discordId" text, + "userId" int, + region text, + "originalLanguage" text, + "telegramChatId" text, + "telegramSendSilently" boolean, + "pgpKey" text, + locale text default ''::text, + "pushbulletAccessToken" text, + "pushoverApplicationToken" text, + "pushoverUserKey" text, + "watchlistSyncMovies" boolean, + "watchlistSyncTv" boolean, + constraint idx_194762_user_settings_pkey + primary key (id), + foreign key ("userId") references "user" + on delete cascade + );` + ); + await queryRunner.query( + `create unique index if not exists idx_194762_sqlite_autoindex_user_settings_1 + on user_settings ("userId");` + ); + await queryRunner.query( + `create table if not exists media_request + ( + id serial, + status int, + "createdAt" timestamp with time zone, + "updatedAt" timestamp with time zone, + type text, + "mediaId" int, + "requestedById" int, + "modifiedById" int, + is4k boolean default false, + "serverId" int, + "profileId" int, + "rootFolder" text, + "languageProfileId" int, + tags text, + "isAutoRequest" boolean default false, + constraint idx_194770_media_request_pkey + primary key (id), + foreign key ("modifiedById") references "user" + on delete set null, + foreign key ("requestedById") references "user" + on delete cascade, + foreign key ("mediaId") references media + on delete cascade + );` + ); + await queryRunner.query( + `create table if not exists season_request + ( + id serial, + "seasonNumber" int, + status int default '1'::int, + "createdAt" timestamp with time zone default now(), + "updatedAt" timestamp with time zone default now(), + "requestId" int, + constraint idx_194709_season_request_pkey + primary key (id), + foreign key ("requestId") references media_request + on delete cascade + );` + ); + await queryRunner.query( + `create table if not exists discover_slider + ( + id serial, + type integer, + "order" integer, + "isBuiltIn" boolean default false, + enabled boolean default true, + title text, + data text, + "createdAt" timestamp with time zone, + "updatedAt" timestamp with time zone, + constraint idx_194779_discover_slider_pkey + primary key (id) + );` + ); + await queryRunner.query( + `create table if not exists watchlist + ( + id serial, + "ratingKey" text, + "mediaType" text, + title text, + "tmdbId" int, + "createdAt" timestamp with time zone, + "updatedAt" timestamp with time zone, + "requestedById" int, + "mediaId" int, + constraint idx_194788_watchlist_pkey + primary key (id) + );` + ); + await queryRunner.query( + `create index if not exists "idx_194788_IDX_939f205946256cc0d2a1ac51a8" + on watchlist ("tmdbId");` + ); + await queryRunner.query( + `create unique index if not exists idx_194788_sqlite_autoindex_watchlist_1 + on watchlist ("tmdbId", "requestedById");` + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`drop table if exists session cascade`); + await queryRunner.query(`drop table if exists season_request cascade`); + await queryRunner.query(`drop table if exists season cascade`); + await queryRunner.query( + `drop table if exists user_push_subscription cascade` + ); + await queryRunner.query(`drop table if exists issue_comment cascade`); + await queryRunner.query(`drop table if exists issue cascade`); + await queryRunner.query(`drop table if exists user_settings cascade`); + await queryRunner.query(`drop table if exists media_request cascade`); + await queryRunner.query(`drop table if exists media cascade`); + await queryRunner.query(`drop table if exists "user" cascade`); + await queryRunner.query(`drop table if exists discover_slider cascade`); + await queryRunner.query(`drop table if exists watchlist cascade`); + } +} diff --git a/server/migration/1603944374840-InitialMigration.ts b/server/migration/sqlite/1603944374840-InitialMigration.ts similarity index 100% rename from server/migration/1603944374840-InitialMigration.ts rename to server/migration/sqlite/1603944374840-InitialMigration.ts diff --git a/server/migration/1605085519544-SeasonStatus.ts b/server/migration/sqlite/1605085519544-SeasonStatus.ts similarity index 100% rename from server/migration/1605085519544-SeasonStatus.ts rename to server/migration/sqlite/1605085519544-SeasonStatus.ts diff --git a/server/migration/1606730060700-CascadeMigration.ts b/server/migration/sqlite/1606730060700-CascadeMigration.ts similarity index 100% rename from server/migration/1606730060700-CascadeMigration.ts rename to server/migration/sqlite/1606730060700-CascadeMigration.ts diff --git a/server/migration/1607928251245-DropImdbIdConstraint.ts b/server/migration/sqlite/1607928251245-DropImdbIdConstraint.ts similarity index 100% rename from server/migration/1607928251245-DropImdbIdConstraint.ts rename to server/migration/sqlite/1607928251245-DropImdbIdConstraint.ts diff --git a/server/migration/1608217312474-AddUserRequestDeleteCascades.ts b/server/migration/sqlite/1608217312474-AddUserRequestDeleteCascades.ts similarity index 100% rename from server/migration/1608217312474-AddUserRequestDeleteCascades.ts rename to server/migration/sqlite/1608217312474-AddUserRequestDeleteCascades.ts diff --git a/server/migration/1608477467935-AddLastSeasonChangeMedia.ts b/server/migration/sqlite/1608477467935-AddLastSeasonChangeMedia.ts similarity index 100% rename from server/migration/1608477467935-AddLastSeasonChangeMedia.ts rename to server/migration/sqlite/1608477467935-AddLastSeasonChangeMedia.ts diff --git a/server/migration/1608477467936-ForceDropImdbUniqueConstraint.ts b/server/migration/sqlite/1608477467936-ForceDropImdbUniqueConstraint.ts similarity index 100% rename from server/migration/1608477467936-ForceDropImdbUniqueConstraint.ts rename to server/migration/sqlite/1608477467936-ForceDropImdbUniqueConstraint.ts diff --git a/server/migration/1609236552057-RemoveTmdbIdUniqueConstraint.ts b/server/migration/sqlite/1609236552057-RemoveTmdbIdUniqueConstraint.ts similarity index 100% rename from server/migration/1609236552057-RemoveTmdbIdUniqueConstraint.ts rename to server/migration/sqlite/1609236552057-RemoveTmdbIdUniqueConstraint.ts diff --git a/server/migration/1610070934506-LocalUsers.ts b/server/migration/sqlite/1610070934506-LocalUsers.ts similarity index 100% rename from server/migration/1610070934506-LocalUsers.ts rename to server/migration/sqlite/1610070934506-LocalUsers.ts diff --git a/server/migration/1610370640747-Add4kStatusFields.ts b/server/migration/sqlite/1610370640747-Add4kStatusFields.ts similarity index 100% rename from server/migration/1610370640747-Add4kStatusFields.ts rename to server/migration/sqlite/1610370640747-Add4kStatusFields.ts diff --git a/server/migration/1610522845513-AddMediaAddedFieldToMedia.ts b/server/migration/sqlite/1610522845513-AddMediaAddedFieldToMedia.ts similarity index 100% rename from server/migration/1610522845513-AddMediaAddedFieldToMedia.ts rename to server/migration/sqlite/1610522845513-AddMediaAddedFieldToMedia.ts diff --git a/server/migration/1611508672722-AddDisplayNameToUser.ts b/server/migration/sqlite/1611508672722-AddDisplayNameToUser.ts similarity index 100% rename from server/migration/1611508672722-AddDisplayNameToUser.ts rename to server/migration/sqlite/1611508672722-AddDisplayNameToUser.ts diff --git a/server/migration/1611757511674-SonarrRadarrSyncServiceFields.ts b/server/migration/sqlite/1611757511674-SonarrRadarrSyncServiceFields.ts similarity index 100% rename from server/migration/1611757511674-SonarrRadarrSyncServiceFields.ts rename to server/migration/sqlite/1611757511674-SonarrRadarrSyncServiceFields.ts diff --git a/server/migration/1611801511397-AddRatingKeysToMedia.ts b/server/migration/sqlite/1611801511397-AddRatingKeysToMedia.ts similarity index 100% rename from server/migration/1611801511397-AddRatingKeysToMedia.ts rename to server/migration/sqlite/1611801511397-AddRatingKeysToMedia.ts diff --git a/server/migration/1612482778137-AddResetPasswordGuidAndExpiryDate.ts b/server/migration/sqlite/1612482778137-AddResetPasswordGuidAndExpiryDate.ts similarity index 100% rename from server/migration/1612482778137-AddResetPasswordGuidAndExpiryDate.ts rename to server/migration/sqlite/1612482778137-AddResetPasswordGuidAndExpiryDate.ts diff --git a/server/migration/1612571545781-AddLanguageProfileId.ts b/server/migration/sqlite/1612571545781-AddLanguageProfileId.ts similarity index 100% rename from server/migration/1612571545781-AddLanguageProfileId.ts rename to server/migration/sqlite/1612571545781-AddLanguageProfileId.ts diff --git a/server/migration/1613379909641-AddJellyfinUserParams.ts b/server/migration/sqlite/1613379909641-AddJellyfinUserParams.ts similarity index 100% rename from server/migration/1613379909641-AddJellyfinUserParams.ts rename to server/migration/sqlite/1613379909641-AddJellyfinUserParams.ts diff --git a/server/migration/1613412948344-ServerTypeEnum.ts b/server/migration/sqlite/1613412948344-ServerTypeEnum.ts similarity index 100% rename from server/migration/1613412948344-ServerTypeEnum.ts rename to server/migration/sqlite/1613412948344-ServerTypeEnum.ts diff --git a/server/migration/1613615266968-CreateUserSettings.ts b/server/migration/sqlite/1613615266968-CreateUserSettings.ts similarity index 100% rename from server/migration/1613615266968-CreateUserSettings.ts rename to server/migration/sqlite/1613615266968-CreateUserSettings.ts diff --git a/server/migration/1613670041760-AddJellyfinDeviceId.ts b/server/migration/sqlite/1613670041760-AddJellyfinDeviceId.ts similarity index 100% rename from server/migration/1613670041760-AddJellyfinDeviceId.ts rename to server/migration/sqlite/1613670041760-AddJellyfinDeviceId.ts diff --git a/server/migration/1613955393450-UpdateUserSettingsRegions.ts b/server/migration/sqlite/1613955393450-UpdateUserSettingsRegions.ts similarity index 100% rename from server/migration/1613955393450-UpdateUserSettingsRegions.ts rename to server/migration/sqlite/1613955393450-UpdateUserSettingsRegions.ts diff --git a/server/migration/1614334195680-AddTelegramSettingsToUserSettings.ts b/server/migration/sqlite/1614334195680-AddTelegramSettingsToUserSettings.ts similarity index 100% rename from server/migration/1614334195680-AddTelegramSettingsToUserSettings.ts rename to server/migration/sqlite/1614334195680-AddTelegramSettingsToUserSettings.ts diff --git a/server/migration/1615333940450-AddPGPToUserSettings.ts b/server/migration/sqlite/1615333940450-AddPGPToUserSettings.ts similarity index 100% rename from server/migration/1615333940450-AddPGPToUserSettings.ts rename to server/migration/sqlite/1615333940450-AddPGPToUserSettings.ts diff --git a/server/migration/1616576677254-AddUserQuotaFields.ts b/server/migration/sqlite/1616576677254-AddUserQuotaFields.ts similarity index 100% rename from server/migration/1616576677254-AddUserQuotaFields.ts rename to server/migration/sqlite/1616576677254-AddUserQuotaFields.ts diff --git a/server/migration/1617624225464-CreateTagsFieldonMediaRequest.ts b/server/migration/sqlite/1617624225464-CreateTagsFieldonMediaRequest.ts similarity index 100% rename from server/migration/1617624225464-CreateTagsFieldonMediaRequest.ts rename to server/migration/sqlite/1617624225464-CreateTagsFieldonMediaRequest.ts diff --git a/server/migration/1617730837489-AddUserSettingsNotificationAgentsField.ts b/server/migration/sqlite/1617730837489-AddUserSettingsNotificationAgentsField.ts similarity index 100% rename from server/migration/1617730837489-AddUserSettingsNotificationAgentsField.ts rename to server/migration/sqlite/1617730837489-AddUserSettingsNotificationAgentsField.ts diff --git a/server/migration/1618912653565-CreateUserPushSubscriptions.ts b/server/migration/sqlite/1618912653565-CreateUserPushSubscriptions.ts similarity index 100% rename from server/migration/1618912653565-CreateUserPushSubscriptions.ts rename to server/migration/sqlite/1618912653565-CreateUserPushSubscriptions.ts diff --git a/server/migration/1619239659754-AddUserSettingsLocale.ts b/server/migration/sqlite/1619239659754-AddUserSettingsLocale.ts similarity index 100% rename from server/migration/1619239659754-AddUserSettingsLocale.ts rename to server/migration/sqlite/1619239659754-AddUserSettingsLocale.ts diff --git a/server/migration/1619339817343-AddUserSettingsNotificationTypes.ts b/server/migration/sqlite/1619339817343-AddUserSettingsNotificationTypes.ts similarity index 100% rename from server/migration/1619339817343-AddUserSettingsNotificationTypes.ts rename to server/migration/sqlite/1619339817343-AddUserSettingsNotificationTypes.ts diff --git a/server/migration/1634904083966-AddIssues.ts b/server/migration/sqlite/1634904083966-AddIssues.ts similarity index 100% rename from server/migration/1634904083966-AddIssues.ts rename to server/migration/sqlite/1634904083966-AddIssues.ts diff --git a/server/migration/1635079863457-AddPushbulletPushoverUserSettings.ts b/server/migration/sqlite/1635079863457-AddPushbulletPushoverUserSettings.ts similarity index 100% rename from server/migration/1635079863457-AddPushbulletPushoverUserSettings.ts rename to server/migration/sqlite/1635079863457-AddPushbulletPushoverUserSettings.ts diff --git a/server/migration/1660632269368-AddWatchlistSyncUserSetting.ts b/server/migration/sqlite/1660632269368-AddWatchlistSyncUserSetting.ts similarity index 100% rename from server/migration/1660632269368-AddWatchlistSyncUserSetting.ts rename to server/migration/sqlite/1660632269368-AddWatchlistSyncUserSetting.ts diff --git a/server/migration/1660714479373-AddMediaRequestIsAutoRequestedField.ts b/server/migration/sqlite/1660714479373-AddMediaRequestIsAutoRequestedField.ts similarity index 100% rename from server/migration/1660714479373-AddMediaRequestIsAutoRequestedField.ts rename to server/migration/sqlite/1660714479373-AddMediaRequestIsAutoRequestedField.ts diff --git a/server/migration/1672041273674-AddDiscoverSlider.ts b/server/migration/sqlite/1672041273674-AddDiscoverSlider.ts similarity index 100% rename from server/migration/1672041273674-AddDiscoverSlider.ts rename to server/migration/sqlite/1672041273674-AddDiscoverSlider.ts diff --git a/server/migration/1682608634546-AddWatchlists.ts b/server/migration/sqlite/1682608634546-AddWatchlists.ts similarity index 100% rename from server/migration/1682608634546-AddWatchlists.ts rename to server/migration/sqlite/1682608634546-AddWatchlists.ts From ed57911c7c915bafc4542ddb0920a0ae53c08acd Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Fri, 19 Jan 2024 17:22:48 -0500 Subject: [PATCH 12/49] fix: restored workflow actions --- .github/workflows/codeql.yml | 41 +++++++++++++++++++++++++++++++++++ .github/workflows/cypress.yml | 30 +++++++++++++++++++++++++ .github/workflows/support.yml | 25 +++++++++++++++++++++ 3 files changed, 96 insertions(+) create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/cypress.yml create mode 100644 .github/workflows/support.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..10926bbd9 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,41 @@ +name: 'CodeQL' + +on: + push: + branches: ['develop'] + pull_request: + branches: ['develop'] + schedule: + - cron: '50 7 * * 5' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [javascript] + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + queries: +security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 + with: + category: '/language:${{ matrix.language }}' diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml new file mode 100644 index 000000000..ecd260dd5 --- /dev/null +++ b/.github/workflows/cypress.yml @@ -0,0 +1,30 @@ +name: Cypress Tests + +on: + pull_request: + branches: + - '*' + push: + branches: + - develop + +jobs: + cypress-run: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Cypress run + uses: cypress-io/github-action@v4 + with: + build: yarn cypress:build + start: yarn start + wait-on: 'http://localhost:5055' + record: true + env: + CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + WITH_MIGRATIONS: true + # Fix test titles in cypress dashboard + COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}} + COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}} diff --git a/.github/workflows/support.yml b/.github/workflows/support.yml new file mode 100644 index 000000000..8b45dcdc5 --- /dev/null +++ b/.github/workflows/support.yml @@ -0,0 +1,25 @@ +name: 'Support requests' + +on: + issues: + types: [labeled, unlabeled, reopened] + +jobs: + support: + runs-on: ubuntu-20.04 + steps: + - uses: dessant/support-requests@v2 + with: + github-token: ${{ github.token }} + support-label: 'support' + issue-comment: > + :wave: @{issue-author}, we use the issue tracker exclusively + for bug reports and feature requests. However, this issue appears + to be a support request. Please use our support channels + to get help with Jellyseerr. + + - [Discord](https://discord.gg/ckbvBtDJgC) + + close-issue: true + lock-issue: true + issue-lock-reason: 'off-topic' From 14d3ec22b0f9f571c28bf427e67d678becc193ae Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Fri, 19 Jan 2024 18:31:31 -0500 Subject: [PATCH 13/49] fix: access order --- server/datasource.ts | 57 ++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/server/datasource.ts b/server/datasource.ts index e4ba67cb6..d89ee33e3 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -4,6 +4,35 @@ import type { TlsOptions } from 'tls'; import type { DataSourceOptions, EntityTarget, Repository } from 'typeorm'; import { DataSource } from 'typeorm'; +const DB_SSL_PREFIX = 'DB_SSL_CONF_'; + +function boolFromEnv(envVar: string) { + return process.env[envVar]?.toLowerCase() === 'true'; +} + +function stringOrReadFileFromEnv(envVar: string): Buffer | string | undefined { + if (process.env[envVar]) { + return process.env[envVar]; + } + const filePath = process.env[`${envVar}_FILE`]; + if (filePath) { + return fs.readFileSync(filePath); + } + return undefined; +} + +function buildSslConfig(): TlsOptions | undefined { + if (process.env.DB_USE_SSL?.toLowerCase() !== 'true') { + return undefined; + } + return { + rejectUnauthorized: boolFromEnv(`${DB_SSL_PREFIX}REJECT_UNAUTHORIZED`), + ca: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}CA`), + key: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}KEY`), + cert: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}CERT`), + }; +} + const devConfig: DataSourceOptions = { type: 'sqlite', database: process.env.CONFIG_DIRECTORY @@ -66,34 +95,6 @@ const postgresProdConfig: DataSourceOptions = { }; export const isPgsql = process.env.DB_TYPE === 'postgres'; -const DB_SSL_PREFIX = 'DB_SSL_CONF_'; - -function boolFromEnv(envVar: string) { - return process.env[envVar]?.toLowerCase() === 'true'; -} - -function stringOrReadFileFromEnv(envVar: string): Buffer | string | undefined { - if (process.env[envVar]) { - return process.env[envVar]; - } - const filePath = process.env[`${envVar}_FILE`]; - if (filePath) { - return fs.readFileSync(filePath); - } - return undefined; -} - -function buildSslConfig(): TlsOptions | undefined { - if (process.env.DB_USE_SSL?.toLowerCase() !== 'true') { - return undefined; - } - return { - rejectUnauthorized: boolFromEnv(`${DB_SSL_PREFIX}REJECT_UNAUTHORIZED`), - ca: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}CA`), - key: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}KEY`), - cert: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}CERT`), - }; -} function getDataSource(): DataSourceOptions { if (process.env.NODE_ENV === 'production') { From 00c811d10d9950ecca18e16ab3555cf4bc30ecb0 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Fri, 19 Jan 2024 19:17:07 -0500 Subject: [PATCH 14/49] fix: added pushover sound migration tto initial migration --- .../1705599190375-InitialMigration.ts | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/server/migration/postgres/1705599190375-InitialMigration.ts b/server/migration/postgres/1705599190375-InitialMigration.ts index 1a862cd5e..c363a2374 100644 --- a/server/migration/postgres/1705599190375-InitialMigration.ts +++ b/server/migration/postgres/1705599190375-InitialMigration.ts @@ -174,25 +174,26 @@ export class InitialMigration1705599190375 implements MigrationInterface { await queryRunner.query( `create table if not exists user_settings ( - id serial, - "notificationTypes" text, - "discordId" text, - "userId" int, - region text, - "originalLanguage" text, - "telegramChatId" text, - "telegramSendSilently" boolean, - "pgpKey" text, - locale text default ''::text, - "pushbulletAccessToken" text, - "pushoverApplicationToken" text, - "pushoverUserKey" text, - "watchlistSyncMovies" boolean, - "watchlistSyncTv" boolean, - constraint idx_194762_user_settings_pkey - primary key (id), - foreign key ("userId") references "user" - on delete cascade + id serial, + "notificationTypes" text, + "discordId" text, + "userId" int, + region text, + "originalLanguage" text, + "telegramChatId" text, + "telegramSendSilently" boolean, + "pgpKey" text, + locale text default ''::text, + "pushbulletAccessToken" text, + "pushoverApplicationToken" text, + "pushoverUserKey" text, + "watchlistSyncMovies" boolean, + "watchlistSyncTv" boolean, + "pushoverSound" varchar, + constraint idx_194762_user_settings_pkey + primary key (id), + foreign key ("userId") references "user" + on delete cascade );` ); await queryRunner.query( From 0581d7b6ad828a54fb35eb3106ca7683369614b7 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 20 Jan 2024 14:24:59 -0500 Subject: [PATCH 15/49] fix: added option to log queries --- server/datasource.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/datasource.ts b/server/datasource.ts index d89ee33e3..660c67a99 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -88,7 +88,7 @@ const postgresProdConfig: DataSourceOptions = { ssl: buildSslConfig(), synchronize: false, migrationsRun: false, - logging: false, + logging: boolFromEnv('DB_LOG_QUERIES'), entities: ['dist/entity/**/*.js'], migrations: ['dist/migration/postgres/**/*.js'], subscribers: ['dist/subscriber/**/*.js'], From e93ab065045331313e34a6ff551e4adadf9d28d9 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 20 Jan 2024 14:48:47 -0500 Subject: [PATCH 16/49] fix: issue with session migration --- server/migration/postgres/1705599190375-InitialMigration.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/migration/postgres/1705599190375-InitialMigration.ts b/server/migration/postgres/1705599190375-InitialMigration.ts index c363a2374..6f3a501c2 100644 --- a/server/migration/postgres/1705599190375-InitialMigration.ts +++ b/server/migration/postgres/1705599190375-InitialMigration.ts @@ -7,7 +7,7 @@ export class InitialMigration1705599190375 implements MigrationInterface { await queryRunner.query( `create table if not exists session ( - "expiredAt" int, + "expiredAt" bigint, id text, json text );` From b594dec992db3050e026c2cfc69cae760daf7170 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 20 Jan 2024 14:49:23 -0500 Subject: [PATCH 17/49] chore: relocate pushover sound migration --- .../migration/{ => sqlite}/1697393491630-AddUserPushoverSound.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename server/migration/{ => sqlite}/1697393491630-AddUserPushoverSound.ts (100%) diff --git a/server/migration/1697393491630-AddUserPushoverSound.ts b/server/migration/sqlite/1697393491630-AddUserPushoverSound.ts similarity index 100% rename from server/migration/1697393491630-AddUserPushoverSound.ts rename to server/migration/sqlite/1697393491630-AddUserPushoverSound.ts From 8c7004c50d09a6f2c304c52ac16411f689b05258 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 20 Jan 2024 14:50:24 -0500 Subject: [PATCH 18/49] feat: added logging option to other datasources --- server/datasource.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/server/datasource.ts b/server/datasource.ts index 660c67a99..a8137bd92 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -40,7 +40,7 @@ const devConfig: DataSourceOptions = { : 'config/db/db.sqlite3', synchronize: true, migrationsRun: false, - logging: false, + logging: boolFromEnv('DB_LOG_QUERIES'), enableWAL: true, entities: ['server/entity/**/*.ts'], migrations: ['server/migration/sqlite/**/*.ts'], @@ -54,7 +54,7 @@ const prodConfig: DataSourceOptions = { : 'config/db/db.sqlite3', synchronize: false, migrationsRun: false, - logging: false, + logging: boolFromEnv('DB_LOG_QUERIES'), enableWAL: true, entities: ['dist/entity/**/*.js'], migrations: ['dist/migration/sqlite/**/*.js'], @@ -63,7 +63,6 @@ const prodConfig: DataSourceOptions = { const postgresDevConfig: DataSourceOptions = { type: 'postgres', - name: 'pgdb', host: process.env.DB_HOST, port: parseInt(process.env.DB_PORT ?? '5432'), username: process.env.DB_USER, @@ -71,7 +70,7 @@ const postgresDevConfig: DataSourceOptions = { database: process.env.DB_NAME ?? 'jellyseerr', synchronize: true, migrationsRun: false, - logging: false, + logging: boolFromEnv('DB_LOG_QUERIES'), entities: ['server/entity/**/*.ts'], migrations: ['server/migration/postgres/**/*.ts'], subscribers: ['server/subscriber/**/*.ts'], @@ -79,7 +78,6 @@ const postgresDevConfig: DataSourceOptions = { const postgresProdConfig: DataSourceOptions = { type: 'postgres', - name: 'pgdb', host: process.env.DB_HOST, port: parseInt(process.env.DB_PORT ?? '5432'), username: process.env.DB_USER, From 501859207a28552857fe20e7fa149ebae3d09bf6 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 20 Jan 2024 17:50:04 -0500 Subject: [PATCH 19/49] chore: small tweaks for the datasource. Added docs for db setup --- README.md | 34 ++++++++++++++++++++++++++++++++++ server/datasource.ts | 19 +++++++++++++++---- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 257d14899..ae78660fc 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,40 @@ _*On Jellyfin/Emby, ensure the `settings > Home > Automatically group content fr Check out our dockerhub for instructions on how to install and run Jellyseerr: https://hub.docker.com/r/fallenbagel/jellyseerr +### Database configuration + +Jellyseerr supports sqlite and postgres. The database connection can be configured using the following options: + +#### SQLite Options + +```dotenv +DB_TYPE="sqlite" # Which DB engine to use. The default is "sqlite" +CONFIG_DIRECTORY="config" # The path to the config directory where the db file is stored +DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging +``` + +#### PostgreSQL Options + +```dotenv +DB_TYPE="postgres" # Which DB engine to use. The default is "sqlite". To use postgres, this needs to be set to "postgres" +DB_HOST= # The host (url) of the database +DB_PORT="5432" # The port to connect to +DB_USER= # Username used to connect to the database +DB_PASS= # Password of the user used to connect to the database +DB_NAME="jellyseerr" # The name of the database to connect to +DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging +DB_USE_SSL="false" # Whether to enable ssl for database connection + +# The following options can be used to further configure ssl: +DB_SSL_REJECT_UNAUTHORIZED="true" # Whether to reject ssl connections with unverifiable certificates i.e. self-signed certificates without providing the below settings +DB_SSL_CA= # The CA certificate to verify the connection, provided as a string +DB_SSL_CA_FILE= # The path to a CA certificate to verify the connection +DB_SSL_KEY= # The private key for the connection in PEM format, provided as a string +DB_SSL_KEY_FILE= # Path to the private key for the connection in PEM format +DB_SSL_CERT= # Certificate chain in pem format for the private key, provided as a string +DB_SSL_CERT_FILE= # Path to certificate chain in pem format for the private key +``` + ### Building from source (ADVANCED): #### Windows diff --git a/server/datasource.ts b/server/datasource.ts index a8137bd92..4416b1f81 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -4,13 +4,19 @@ import type { TlsOptions } from 'tls'; import type { DataSourceOptions, EntityTarget, Repository } from 'typeorm'; import { DataSource } from 'typeorm'; -const DB_SSL_PREFIX = 'DB_SSL_CONF_'; +const DB_SSL_PREFIX = 'DB_SSL_'; -function boolFromEnv(envVar: string) { - return process.env[envVar]?.toLowerCase() === 'true'; +function boolFromEnv(envVar: string, defaultVal = false) { + console.log(envVar); + console.log(process.env[envVar]); + if (process.env[envVar]) { + return process.env[envVar]?.toLowerCase() === 'true'; + } + return defaultVal; } function stringOrReadFileFromEnv(envVar: string): Buffer | string | undefined { + console.log(envVar); if (process.env[envVar]) { return process.env[envVar]; } @@ -22,11 +28,15 @@ function stringOrReadFileFromEnv(envVar: string): Buffer | string | undefined { } function buildSslConfig(): TlsOptions | undefined { + console.log(process.env.DB_USE_SSL); if (process.env.DB_USE_SSL?.toLowerCase() !== 'true') { return undefined; } return { - rejectUnauthorized: boolFromEnv(`${DB_SSL_PREFIX}REJECT_UNAUTHORIZED`), + rejectUnauthorized: boolFromEnv( + `${DB_SSL_PREFIX}REJECT_UNAUTHORIZED`, + true + ), ca: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}CA`), key: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}KEY`), cert: stringOrReadFileFromEnv(`${DB_SSL_PREFIX}CERT`), @@ -68,6 +78,7 @@ const postgresDevConfig: DataSourceOptions = { username: process.env.DB_USER, password: process.env.DB_PASS, database: process.env.DB_NAME ?? 'jellyseerr', + ssl: buildSslConfig(), synchronize: true, migrationsRun: false, logging: boolFromEnv('DB_LOG_QUERIES'), From 42ad4e0ae35026669ebd0535ce783cf0e79a48c2 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 20 Jan 2024 17:50:56 -0500 Subject: [PATCH 20/49] chore: cleanup logs --- server/datasource.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/server/datasource.ts b/server/datasource.ts index 4416b1f81..adb6f4398 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -7,8 +7,6 @@ import { DataSource } from 'typeorm'; const DB_SSL_PREFIX = 'DB_SSL_'; function boolFromEnv(envVar: string, defaultVal = false) { - console.log(envVar); - console.log(process.env[envVar]); if (process.env[envVar]) { return process.env[envVar]?.toLowerCase() === 'true'; } @@ -16,7 +14,6 @@ function boolFromEnv(envVar: string, defaultVal = false) { } function stringOrReadFileFromEnv(envVar: string): Buffer | string | undefined { - console.log(envVar); if (process.env[envVar]) { return process.env[envVar]; } @@ -28,7 +25,6 @@ function stringOrReadFileFromEnv(envVar: string): Buffer | string | undefined { } function buildSslConfig(): TlsOptions | undefined { - console.log(process.env.DB_USE_SSL); if (process.env.DB_USE_SSL?.toLowerCase() !== 'true') { return undefined; } From 106cd195d4b7028de5304d34addcfc4cfc8a9cec Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 20 Jan 2024 23:58:00 -0500 Subject: [PATCH 21/49] fix: added default dates to postgres migration --- .../1705599190375-InitialMigration.ts | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/server/migration/postgres/1705599190375-InitialMigration.ts b/server/migration/postgres/1705599190375-InitialMigration.ts index 6f3a501c2..1be192328 100644 --- a/server/migration/postgres/1705599190375-InitialMigration.ts +++ b/server/migration/postgres/1705599190375-InitialMigration.ts @@ -30,9 +30,9 @@ export class InitialMigration1705599190375 implements MigrationInterface { "imdbId" text, status int default '1'::int, status4k int default '1'::int, - "createdAt" timestamp with time zone, - "updatedAt" timestamp with time zone, - "lastSeasonChange" timestamp with time zone, + "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, + "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, + "lastSeasonChange" timestamp with time zone default CURRENT_TIMESTAMP, "mediaAddedAt" timestamp with time zone, "serviceId" int, "serviceId4k" int, @@ -54,8 +54,8 @@ export class InitialMigration1705599190375 implements MigrationInterface { id serial, "seasonNumber" int, status int default '1'::int, - "createdAt" timestamp with time zone, - "updatedAt" timestamp with time zone, + "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, + "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, "mediaId" int, status4k int default '1'::int, constraint idx_194715_season_pkey @@ -90,8 +90,8 @@ export class InitialMigration1705599190375 implements MigrationInterface { "plexToken" text, permissions int default '0'::int, avatar text, - "createdAt" timestamp with time zone, - "updatedAt" timestamp with time zone, + "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, + "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, password text, "userType" int default '1'::int, "plexUsername" text, @@ -139,8 +139,8 @@ export class InitialMigration1705599190375 implements MigrationInterface { status int default '1'::int, "problemSeason" int default '0'::int, "problemEpisode" int default '0'::int, - "createdAt" timestamp with time zone, - "updatedAt" timestamp with time zone, + "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, + "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, "mediaId" int, "createdById" int, "modifiedById" int, @@ -159,8 +159,8 @@ export class InitialMigration1705599190375 implements MigrationInterface { ( id serial, message text, - "createdAt" timestamp with time zone, - "updatedAt" timestamp with time zone, + "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, + "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, "userId" int, "issueId" int, constraint idx_194755_issue_comment_pkey @@ -205,8 +205,8 @@ export class InitialMigration1705599190375 implements MigrationInterface { ( id serial, status int, - "createdAt" timestamp with time zone, - "updatedAt" timestamp with time zone, + "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, + "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, type text, "mediaId" int, "requestedById" int, @@ -253,8 +253,8 @@ export class InitialMigration1705599190375 implements MigrationInterface { enabled boolean default true, title text, data text, - "createdAt" timestamp with time zone, - "updatedAt" timestamp with time zone, + "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, + "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, constraint idx_194779_discover_slider_pkey primary key (id) );` @@ -267,8 +267,8 @@ export class InitialMigration1705599190375 implements MigrationInterface { "mediaType" text, title text, "tmdbId" int, - "createdAt" timestamp with time zone, - "updatedAt" timestamp with time zone, + "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, + "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, "requestedById" int, "mediaId" int, constraint idx_194788_watchlist_pkey From eb111ac1db4728870522c2f49f902d3352ca8e9a Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Mon, 22 Jan 2024 17:34:02 -0500 Subject: [PATCH 22/49] fix: removed psql specific relation checks --- server/datasource.ts | 4 ++-- server/entity/MediaRequest.ts | 20 +++----------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/server/datasource.ts b/server/datasource.ts index adb6f4398..72a9794ae 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -75,8 +75,8 @@ const postgresDevConfig: DataSourceOptions = { password: process.env.DB_PASS, database: process.env.DB_NAME ?? 'jellyseerr', ssl: buildSslConfig(), - synchronize: true, - migrationsRun: false, + synchronize: false, + migrationsRun: true, logging: boolFromEnv('DB_LOG_QUERIES'), entities: ['server/entity/**/*.ts'], migrations: ['server/migration/postgres/**/*.ts'], diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index 92bff7573..85537bd51 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -12,7 +12,7 @@ import { MediaStatus, MediaType, } from '@server/constants/media'; -import { getRepository, isPgsql } from '@server/datasource'; +import { getRepository } from '@server/datasource'; import type { MediaRequestBody } from '@server/interfaces/api/requestInterfaces'; import notificationManager, { Notification } from '@server/lib/notifications'; import { Permission } from '@server/lib/permissions'; @@ -569,13 +569,6 @@ export class MediaRequest { }); return; } - // Typeorm pgsql doesn't load this relation even though the query specifically - // calls for it. The fk will get blown away from media_request when it is - // saved. Adding request back in prior to saving. - if (isPgsql) { - media.requests.push(this); - } - const seasonRequestRepository = getRepository(SeasonRequest); if ( this.status === MediaRequestStatus.APPROVED && @@ -634,13 +627,6 @@ export class MediaRequest { relations: { requests: true }, }); - // Typeorm pgsql doesn't load this relation even though the query specifically - // calls for it. The fk will get blown away from media_request when it is - // saved. Adding request back in prior to saving. - if (isPgsql) { - fullMedia.requests.push(this); - } - if ( !fullMedia.requests.some((request) => !request.is4k) && fullMedia.status !== MediaStatus.AVAILABLE @@ -862,7 +848,7 @@ export class MediaRequest { const requestRepository = getRepository(MediaRequest); this.status = MediaRequestStatus.FAILED; - requestRepository.save(this); + await requestRepository.save(this); logger.warn( 'Something went wrong sending movie request to Radarr, marking status as FAILED', @@ -1143,7 +1129,7 @@ export class MediaRequest { const requestRepository = getRepository(MediaRequest); this.status = MediaRequestStatus.FAILED; - requestRepository.save(this); + await requestRepository.save(this); logger.warn( 'Something went wrong sending series request to Sonarr, marking status as FAILED', From b1b4dd9cfc08e1001900ea6b9dec6866f9fc9e02 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 17:07:10 -0500 Subject: [PATCH 23/49] chore: added some debug sanity checks --- server/entity/MediaRequest.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index 85537bd51..6e40e9d54 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -1114,6 +1114,18 @@ export class MediaRequest { relations: { requests: true }, }); + logger.debug( + `Typeorm claims ${ + media?.requests?.length ?? 0 + } relations are loaded` + ); + const reqCheck = await getRepository(MediaRequest).find({ + where: { media: { id: this.media.id } }, + }); + logger.debug( + `The DB claims we have ${reqCheck?.length ?? 0} relations` + ); + if (!media) { throw new Error('Media data not found'); } From f08c537cbaeeba44b20bcc323cd302c674ad8ca4 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 17:13:55 -0500 Subject: [PATCH 24/49] chore: added some more debug sanity checks --- server/entity/MediaRequest.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index 6e40e9d54..58e57bf7f 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -1108,6 +1108,14 @@ export class MediaRequest { sonarr .addSeries(sonarrSeriesOptions) .then(async (sonarrSeries) => { + const reqCheck1 = await getRepository(MediaRequest).find({ + where: { media: { id: this.media.id } }, + }); + logger.debug( + `Before running the find the DB claims we have ${ + reqCheck1?.length ?? 0 + } relations` + ); // We grab media again here to make sure we have the latest version of it const media = await mediaRepository.findOne({ where: { id: this.media.id }, From 87c8444ec6a9937022f798226bab60c6321142b3 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 17:15:55 -0500 Subject: [PATCH 25/49] chore: added some more additional debug sanity checks --- server/entity/MediaRequest.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index 58e57bf7f..b48bf55af 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -1144,6 +1144,14 @@ export class MediaRequest { sonarrSeries.titleSlug; media[this.is4k ? 'serviceId4k' : 'serviceId'] = sonarrSettings?.id; await mediaRepository.save(media); + const reqCheck3 = await getRepository(MediaRequest).find({ + where: { media: { id: this.media.id } }, + }); + logger.debug( + `After save, the DB claims we have ${ + reqCheck3?.length ?? 0 + } relations` + ); }) .catch(async () => { const requestRepository = getRepository(MediaRequest); From 0d6a1f12fbab1c0408e93950a466410cf379be97 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 18:00:42 -0500 Subject: [PATCH 26/49] chore: added some more+ additional debug sanity checks --- server/entity/MediaRequest.ts | 50 +++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index b48bf55af..29d1bff99 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -12,7 +12,7 @@ import { MediaStatus, MediaType, } from '@server/constants/media'; -import { getRepository } from '@server/datasource'; +import { getRepository, isPgsql } from '@server/datasource'; import type { MediaRequestBody } from '@server/interfaces/api/requestInterfaces'; import notificationManager, { Notification } from '@server/lib/notifications'; import { Permission } from '@server/lib/permissions'; @@ -1108,41 +1108,49 @@ export class MediaRequest { sonarr .addSeries(sonarrSeriesOptions) .then(async (sonarrSeries) => { - const reqCheck1 = await getRepository(MediaRequest).find({ - where: { media: { id: this.media.id } }, - }); - logger.debug( - `Before running the find the DB claims we have ${ - reqCheck1?.length ?? 0 - } relations` - ); + // const reqCheck1 = await getRepository(MediaRequest).find({ + // where: { media: { id: this.media.id } }, + // }); + // logger.debug( + // `Before running the find the DB claims we have ${ + // reqCheck1?.length ?? 0 + // } relations` + // ); // We grab media again here to make sure we have the latest version of it const media = await mediaRepository.findOne({ where: { id: this.media.id }, relations: { requests: true }, }); - logger.debug( - `Typeorm claims ${ - media?.requests?.length ?? 0 - } relations are loaded` - ); - const reqCheck = await getRepository(MediaRequest).find({ - where: { media: { id: this.media.id } }, - }); - logger.debug( - `The DB claims we have ${reqCheck?.length ?? 0} relations` - ); + // logger.debug( + // `Typeorm claims ${ + // media?.requests?.length ?? 0 + // } relations are loaded` + // ); + // const reqCheck = await getRepository(MediaRequest).find({ + // where: { media: { id: this.media.id } }, + // }); + // logger.debug( + // `The DB claims we have ${reqCheck?.length ?? 0} relations` + // ); if (!media) { throw new Error('Media data not found'); } + if (isPgsql) { + // Force lazy loading of requests + logger.debug('Forcing lazy loading of requests'); + media.requests; + } + media[this.is4k ? 'externalServiceId4k' : 'externalServiceId'] = sonarrSeries.id; media[this.is4k ? 'externalServiceSlug4k' : 'externalServiceSlug'] = sonarrSeries.titleSlug; media[this.is4k ? 'serviceId4k' : 'serviceId'] = sonarrSettings?.id; + logger.debug('Dumping media before save:'); + logger.debug(JSON.stringify(media)); await mediaRepository.save(media); const reqCheck3 = await getRepository(MediaRequest).find({ where: { media: { id: this.media.id } }, @@ -1152,6 +1160,8 @@ export class MediaRequest { reqCheck3?.length ?? 0 } relations` ); + logger.debug('Dumping media after save:'); + logger.debug(JSON.stringify(media)); }) .catch(async () => { const requestRepository = getRepository(MediaRequest); From 0bab6887b0e07016356bfb667f6df109d074585a Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 18:18:16 -0500 Subject: [PATCH 27/49] chore: mild log cleanup --- server/entity/MediaRequest.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index 29d1bff99..947b63628 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -1120,6 +1120,7 @@ export class MediaRequest { const media = await mediaRepository.findOne({ where: { id: this.media.id }, relations: { requests: true }, + loadEagerRelations: true, }); // logger.debug( @@ -1149,8 +1150,7 @@ export class MediaRequest { media[this.is4k ? 'externalServiceSlug4k' : 'externalServiceSlug'] = sonarrSeries.titleSlug; media[this.is4k ? 'serviceId4k' : 'serviceId'] = sonarrSettings?.id; - logger.debug('Dumping media before save:'); - logger.debug(JSON.stringify(media)); + await mediaRepository.save(media); const reqCheck3 = await getRepository(MediaRequest).find({ where: { media: { id: this.media.id } }, From 7aca0be41c447fd6bf97c3deda6fec1bd166b25c Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 18:34:55 -0500 Subject: [PATCH 28/49] chore: more log cleanup --- server/entity/MediaRequest.ts | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index 947b63628..bd78ce80d 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -1108,14 +1108,6 @@ export class MediaRequest { sonarr .addSeries(sonarrSeriesOptions) .then(async (sonarrSeries) => { - // const reqCheck1 = await getRepository(MediaRequest).find({ - // where: { media: { id: this.media.id } }, - // }); - // logger.debug( - // `Before running the find the DB claims we have ${ - // reqCheck1?.length ?? 0 - // } relations` - // ); // We grab media again here to make sure we have the latest version of it const media = await mediaRepository.findOne({ where: { id: this.media.id }, @@ -1123,18 +1115,6 @@ export class MediaRequest { loadEagerRelations: true, }); - // logger.debug( - // `Typeorm claims ${ - // media?.requests?.length ?? 0 - // } relations are loaded` - // ); - // const reqCheck = await getRepository(MediaRequest).find({ - // where: { media: { id: this.media.id } }, - // }); - // logger.debug( - // `The DB claims we have ${reqCheck?.length ?? 0} relations` - // ); - if (!media) { throw new Error('Media data not found'); } @@ -1142,7 +1122,9 @@ export class MediaRequest { if (isPgsql) { // Force lazy loading of requests logger.debug('Forcing lazy loading of requests'); - media.requests; + media.requests.forEach((r) => + logger.debug(`loaded request ${r.id} with status ${r.status}`) + ); } media[this.is4k ? 'externalServiceId4k' : 'externalServiceId'] = @@ -1152,14 +1134,6 @@ export class MediaRequest { media[this.is4k ? 'serviceId4k' : 'serviceId'] = sonarrSettings?.id; await mediaRepository.save(media); - const reqCheck3 = await getRepository(MediaRequest).find({ - where: { media: { id: this.media.id } }, - }); - logger.debug( - `After save, the DB claims we have ${ - reqCheck3?.length ?? 0 - } relations` - ); logger.debug('Dumping media after save:'); logger.debug(JSON.stringify(media)); }) From 610c372498c4e54ca644b2918d23e46137c81bb2 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 19:07:57 -0500 Subject: [PATCH 29/49] chore: finish log cleanup --- server/entity/MediaRequest.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index bd78ce80d..0ef925253 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -1134,8 +1134,6 @@ export class MediaRequest { media[this.is4k ? 'serviceId4k' : 'serviceId'] = sonarrSettings?.id; await mediaRepository.save(media); - logger.debug('Dumping media after save:'); - logger.debug(JSON.stringify(media)); }) .catch(async () => { const requestRepository = getRepository(MediaRequest); From 5f7679982a64158a01cbe3f4677f67e78a2c0e80 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 19:08:47 -0500 Subject: [PATCH 30/49] fix: added not null to migration so typeorm doesn't delete ids --- .../postgres/1705599190375-InitialMigration.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/server/migration/postgres/1705599190375-InitialMigration.ts b/server/migration/postgres/1705599190375-InitialMigration.ts index 1be192328..20e349c5a 100644 --- a/server/migration/postgres/1705599190375-InitialMigration.ts +++ b/server/migration/postgres/1705599190375-InitialMigration.ts @@ -56,7 +56,7 @@ export class InitialMigration1705599190375 implements MigrationInterface { status int default '1'::int, "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, - "mediaId" int, + "mediaId" int not null, status4k int default '1'::int, constraint idx_194715_season_pkey primary key (id), @@ -141,7 +141,7 @@ export class InitialMigration1705599190375 implements MigrationInterface { "problemEpisode" int default '0'::int, "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, - "mediaId" int, + "mediaId" int not null, "createdById" int, "modifiedById" int, constraint idx_194747_issue_pkey @@ -208,7 +208,7 @@ export class InitialMigration1705599190375 implements MigrationInterface { "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, type text, - "mediaId" int, + "mediaId" int not null, "requestedById" int, "modifiedById" int, is4k boolean default false, @@ -231,7 +231,7 @@ export class InitialMigration1705599190375 implements MigrationInterface { await queryRunner.query( `create table if not exists season_request ( - id serial, + id serial NOT NULL, "seasonNumber" int, status int default '1'::int, "createdAt" timestamp with time zone default now(), @@ -270,7 +270,7 @@ export class InitialMigration1705599190375 implements MigrationInterface { "createdAt" timestamp with time zone default CURRENT_TIMESTAMP, "updatedAt" timestamp with time zone default CURRENT_TIMESTAMP, "requestedById" int, - "mediaId" int, + "mediaId" int not null, constraint idx_194788_watchlist_pkey primary key (id) );` From 86444b80b9791c7b480717b0053212216dbdd221 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 19:29:41 -0500 Subject: [PATCH 31/49] chore: cleanup extra psql code --- server/entity/MediaRequest.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index 0ef925253..c95797590 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -12,7 +12,7 @@ import { MediaStatus, MediaType, } from '@server/constants/media'; -import { getRepository, isPgsql } from '@server/datasource'; +import { getRepository } from '@server/datasource'; import type { MediaRequestBody } from '@server/interfaces/api/requestInterfaces'; import notificationManager, { Notification } from '@server/lib/notifications'; import { Permission } from '@server/lib/permissions'; @@ -1119,14 +1119,6 @@ export class MediaRequest { throw new Error('Media data not found'); } - if (isPgsql) { - // Force lazy loading of requests - logger.debug('Forcing lazy loading of requests'); - media.requests.forEach((r) => - logger.debug(`loaded request ${r.id} with status ${r.status}`) - ); - } - media[this.is4k ? 'externalServiceId4k' : 'externalServiceId'] = sonarrSeries.id; media[this.is4k ? 'externalServiceSlug4k' : 'externalServiceSlug'] = From 88b67686ff4110e64fa61c33ead81705ca7d904a Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sat, 27 Jan 2024 19:56:28 -0500 Subject: [PATCH 32/49] fix: remove eager load --- server/entity/MediaRequest.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index c95797590..31b13c696 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -1112,7 +1112,6 @@ export class MediaRequest { const media = await mediaRepository.findOne({ where: { id: this.media.id }, relations: { requests: true }, - loadEagerRelations: true, }); if (!media) { From ef78fdd5348883131ecf0f43ffe595418c5085f8 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sun, 3 Mar 2024 17:27:55 -0500 Subject: [PATCH 33/49] docs: added documentation for migration to postgres --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 1b7540c66..a3fa584ac 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,20 @@ DB_SSL_CERT= # Certificate chain in pem format for the private key, provided as DB_SSL_CERT_FILE= # Path to certificate chain in pem format for the private key ``` +#### Migrating from SQLite to PostgreSQL + +1. Set up your PostgreSQL database and configure Jellyseerr to use it +2. Run Jellyseerr to create the tables in the PostgreSQL database +3. Stop Jellyseerr +4. Run the following command to export the data from the SQLite database and import it into the PostgreSQL database: + - Edit the postgres connection string to match your setup + - WARNING: The most recent release of pgloader has an issue quoting the table columns. Use the version in the docker container to avoid this issue. + - "I don't have or don't want to use docker" - You can build the working pgloader version [in this PR](https://github.com/dimitri/pgloader/pull/1531) from source and use the same options as below. + ```bash + docker run --rm -v config/db.sqlite3:/db.sqlite3:ro -v pgloader/pgloader.load:/pgloader.load ghcr.io/ralgar/pgloader:pr-1531 pgloader --with "quote identifiers" --with "data only" /db.sqlite3 postgresql://{{DB_USER}}:{{DB_PASS}}@{{DB_HOST}}:{{DB_PORT}}/{{DB_NAME}} + ``` +5. Start Jellyseerr + ### Building from source (ADVANCED): #### Windows From ff7bb884ae9080168c568ba6b9b56d97b663bdb4 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sun, 3 Mar 2024 17:30:50 -0500 Subject: [PATCH 34/49] docs: added database option to bug template --- .github/ISSUE_TEMPLATE/bug.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index a98da7502..541aff51e 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -55,6 +55,14 @@ body: - tablet validations: required: true + - type: dropdown + id: database + attributes: + options: + - SQLite (default) + - PostgreSQL + label: Database + description: Which database backend are you using? - type: input id: device attributes: From 29452648e6a56517d0ab4871baa99ed6f3bcd21d Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Wed, 8 May 2024 17:51:15 -0400 Subject: [PATCH 35/49] feat: created docker-compose postgres file --- docker-compose.postgres.yaml | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docker-compose.postgres.yaml diff --git a/docker-compose.postgres.yaml b/docker-compose.postgres.yaml new file mode 100644 index 000000000..f3f348274 --- /dev/null +++ b/docker-compose.postgres.yaml @@ -0,0 +1,38 @@ +--- +version: '3.8' +services: + jellyseerr: + build: + context: . + dockerfile: Dockerfile.local + ports: + - "5055:5055" + environment: + DB_TYPE: "postgres" # Which DB engine to use. The default is "sqlite". To use postgres, this needs to be set to "postgres" + DB_HOST: "postgres" # The host (url) of the database + DB_PORT: "5432" # The port to connect to + DB_USER: "jellyseerr" # Username used to connect to the database + DB_PASS: "jellyseerr" # Password of the user used to connect to the database + DB_NAME: "jellyseerr" # The name of the database to connect to + DB_LOG_QUERIES: "false" # Whether to log the DB queries for debugging + DB_USE_SSL: "false" # Whether to enable ssl for database connection + volumes: + - .:/app:rw,cached + - /app/node_modules + - /app/.next + depends_on: + - postgres + links: + - postgres + postgres: + image: postgres + environment: + POSTGRES_USER: jellyseerr + POSTGRES_PASSWORD: jellyseerr + POSTGRES_DB: jellyseerr + ports: + - "5432:5432" + volumes: + - postgres:/var/lib/postgresql/data + volumes: + postgres: From caaed7c8b8f693157970d98b2be086f9601af3a9 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Wed, 8 May 2024 17:53:19 -0400 Subject: [PATCH 36/49] fix: updated ts schema to align with change to migration --- server/entity/Media.ts | 5 ++--- server/entity/MediaRequest.ts | 1 + server/entity/Season.ts | 5 ++++- server/entity/Watchlist.ts | 1 + server/utils/DbColumnHelper.ts | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/entity/Media.ts b/server/entity/Media.ts index a4edd63ef..5871e5a9e 100644 --- a/server/entity/Media.ts +++ b/server/entity/Media.ts @@ -9,7 +9,6 @@ import type { DownloadingItem } from '@server/lib/downloadtracker'; import downloadTracker from '@server/lib/downloadtracker'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; -import { DbAwareColumn } from '@server/utils/DbColumnHelper'; import { AfterLoad, Column, @@ -122,10 +121,10 @@ class Media { @UpdateDateColumn() public updatedAt: Date; - @DbAwareColumn({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) + @Column({ type: 'timestamp without time zone', default: () => 'now()' }) public lastSeasonChange: Date; - @DbAwareColumn({ type: 'datetime', nullable: true }) + @Column({ type: 'timestamp without time zone', default: () => 'now()' }) public mediaAddedAt: Date; @Column({ nullable: true, type: 'int' }) diff --git a/server/entity/MediaRequest.ts b/server/entity/MediaRequest.ts index 31b13c696..f64e6c900 100644 --- a/server/entity/MediaRequest.ts +++ b/server/entity/MediaRequest.ts @@ -376,6 +376,7 @@ export class MediaRequest { @ManyToOne(() => Media, (media) => media.requests, { eager: true, onDelete: 'CASCADE', + nullable: false, }) public media: Media; diff --git a/server/entity/Season.ts b/server/entity/Season.ts index 44a83d976..5f948d303 100644 --- a/server/entity/Season.ts +++ b/server/entity/Season.ts @@ -23,7 +23,10 @@ class Season { @Column({ type: 'int', default: MediaStatus.UNKNOWN }) public status4k: MediaStatus; - @ManyToOne(() => Media, (media) => media.seasons, { onDelete: 'CASCADE' }) + @ManyToOne(() => Media, (media) => media.seasons, { + onDelete: 'CASCADE', + nullable: false, + }) public media: Promise; @CreateDateColumn() diff --git a/server/entity/Watchlist.ts b/server/entity/Watchlist.ts index df820120e..f79be9fcf 100644 --- a/server/entity/Watchlist.ts +++ b/server/entity/Watchlist.ts @@ -53,6 +53,7 @@ export class Watchlist implements WatchlistItem { @ManyToOne(() => Media, (media) => media.watchlists, { eager: true, onDelete: 'CASCADE', + nullable: false, }) public media: Media; diff --git a/server/utils/DbColumnHelper.ts b/server/utils/DbColumnHelper.ts index 2f13432a7..14fe21e9a 100644 --- a/server/utils/DbColumnHelper.ts +++ b/server/utils/DbColumnHelper.ts @@ -1,9 +1,9 @@ import { isPgsql } from '@server/datasource'; import type { ColumnOptions, ColumnType } from 'typeorm'; import { Column } from 'typeorm'; - +// TODO cleanup this file const pgTypeMapping: { [key: string]: ColumnType } = { - datetime: 'timestamp with time zone', + datetime: 'timestamp without time zone', }; export function resolveDbType(pgType: ColumnType): ColumnType { From 94a9806089a3bb872b52ce0228de97cf99c20ef3 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Wed, 29 May 2024 18:04:35 -0400 Subject: [PATCH 37/49] fix: switch timestamp to include timezone --- server/entity/Media.ts | 5 +++-- server/utils/DbColumnHelper.ts | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/entity/Media.ts b/server/entity/Media.ts index 5871e5a9e..a4edd63ef 100644 --- a/server/entity/Media.ts +++ b/server/entity/Media.ts @@ -9,6 +9,7 @@ import type { DownloadingItem } from '@server/lib/downloadtracker'; import downloadTracker from '@server/lib/downloadtracker'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; +import { DbAwareColumn } from '@server/utils/DbColumnHelper'; import { AfterLoad, Column, @@ -121,10 +122,10 @@ class Media { @UpdateDateColumn() public updatedAt: Date; - @Column({ type: 'timestamp without time zone', default: () => 'now()' }) + @DbAwareColumn({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) public lastSeasonChange: Date; - @Column({ type: 'timestamp without time zone', default: () => 'now()' }) + @DbAwareColumn({ type: 'datetime', nullable: true }) public mediaAddedAt: Date; @Column({ nullable: true, type: 'int' }) diff --git a/server/utils/DbColumnHelper.ts b/server/utils/DbColumnHelper.ts index 14fe21e9a..1c030b92d 100644 --- a/server/utils/DbColumnHelper.ts +++ b/server/utils/DbColumnHelper.ts @@ -1,9 +1,8 @@ import { isPgsql } from '@server/datasource'; import type { ColumnOptions, ColumnType } from 'typeorm'; import { Column } from 'typeorm'; -// TODO cleanup this file const pgTypeMapping: { [key: string]: ColumnType } = { - datetime: 'timestamp without time zone', + datetime: 'timestamp with time zone', }; export function resolveDbType(pgType: ColumnType): ColumnType { From 2b0d497370f4ca1c5e35817f1c844e0b9bf0ad9d Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Wed, 29 May 2024 18:35:10 -0400 Subject: [PATCH 38/49] fix: fixed indentation in psql docker-compose --- docker-compose.postgres.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docker-compose.postgres.yaml b/docker-compose.postgres.yaml index f3f348274..f2cce1d0c 100644 --- a/docker-compose.postgres.yaml +++ b/docker-compose.postgres.yaml @@ -17,9 +17,9 @@ services: DB_LOG_QUERIES: "false" # Whether to log the DB queries for debugging DB_USE_SSL: "false" # Whether to enable ssl for database connection volumes: - - .:/app:rw,cached - - /app/node_modules - - /app/.next + - .:/app:rw,cached + - /app/node_modules + - /app/.next depends_on: - postgres links: @@ -34,5 +34,6 @@ services: - "5432:5432" volumes: - postgres:/var/lib/postgresql/data - volumes: - postgres: +volumes: + postgres: + From f8926fa86c358e9e542aef3458d09ec61242ea08 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Fri, 21 Jun 2024 13:15:18 -0400 Subject: [PATCH 39/49] fix: changed version to 0.1.0 to remove ui notification --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d65e06b3f..61550dab1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jellyseerr", - "version": "1.7.0", + "version": "0.1.0", "private": true, "scripts": { "dev": "nodemon -e ts --watch server --watch overseerr-api.yml -e .json,.ts,.yml -x ts-node -r tsconfig-paths/register --files --project server/tsconfig.json server/index.ts", From 357b927ab32167d5d00fac4b0a357096ad05bb95 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Fri, 21 Jun 2024 13:38:55 -0400 Subject: [PATCH 40/49] style: fixed prettier in docker-compose.pastgres.yaml --- docker-compose.postgres.yaml | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docker-compose.postgres.yaml b/docker-compose.postgres.yaml index f2cce1d0c..2ed270f3d 100644 --- a/docker-compose.postgres.yaml +++ b/docker-compose.postgres.yaml @@ -6,16 +6,16 @@ services: context: . dockerfile: Dockerfile.local ports: - - "5055:5055" + - '5055:5055' environment: - DB_TYPE: "postgres" # Which DB engine to use. The default is "sqlite". To use postgres, this needs to be set to "postgres" - DB_HOST: "postgres" # The host (url) of the database - DB_PORT: "5432" # The port to connect to - DB_USER: "jellyseerr" # Username used to connect to the database - DB_PASS: "jellyseerr" # Password of the user used to connect to the database - DB_NAME: "jellyseerr" # The name of the database to connect to - DB_LOG_QUERIES: "false" # Whether to log the DB queries for debugging - DB_USE_SSL: "false" # Whether to enable ssl for database connection + DB_TYPE: 'postgres' # Which DB engine to use. The default is "sqlite". To use postgres, this needs to be set to "postgres" + DB_HOST: 'postgres' # The host (url) of the database + DB_PORT: '5432' # The port to connect to + DB_USER: 'jellyseerr' # Username used to connect to the database + DB_PASS: 'jellyseerr' # Password of the user used to connect to the database + DB_NAME: 'jellyseerr' # The name of the database to connect to + DB_LOG_QUERIES: 'false' # Whether to log the DB queries for debugging + DB_USE_SSL: 'false' # Whether to enable ssl for database connection volumes: - .:/app:rw,cached - /app/node_modules @@ -31,9 +31,8 @@ services: POSTGRES_PASSWORD: jellyseerr POSTGRES_DB: jellyseerr ports: - - "5432:5432" + - '5432:5432' volumes: - postgres:/var/lib/postgresql/data volumes: postgres: - From bd7339a105e165a0a13a273c3229c12319b8575f Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Tue, 25 Jun 2024 16:43:45 -0400 Subject: [PATCH 41/49] chore: restored CHANGELOG.md --- CHANGELOG.md | 159 --------------------------------------------------- 1 file changed, 159 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9b87bc9b..4245c764b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,162 +1,3 @@ -# [1.7.0](https://github.com/fallenbagel/jellyseerr/compare/v1.6.0...v1.7.0) (2023-09-14) - - -### Bug Fixes - -* adjust the plex watchlist sync schedule to have fuzziness ([#3502](https://github.com/fallenbagel/jellyseerr/issues/3502)) ([2c3f533](https://github.com/fallenbagel/jellyseerr/commit/2c3f5330764492e1323afd2d1f25e28ad78a2f2f)) -* handle issue causing incorrect media to change to unknown ([#3516](https://github.com/fallenbagel/jellyseerr/issues/3516)) ([83b008c](https://github.com/fallenbagel/jellyseerr/commit/83b008c8391459bd02dc74bcdb0d8caf27207bdf)) -* improved handling of edge case that could cause availability sync to fail ([#3497](https://github.com/fallenbagel/jellyseerr/issues/3497)) ([d0836ce](https://github.com/fallenbagel/jellyseerr/commit/d0836ce0efd55fccf2546087a0c4f94f7cb2e82a)) -* Include all defaults in payload ([#3538](https://github.com/fallenbagel/jellyseerr/issues/3538)) ([cb63bf2](https://github.com/fallenbagel/jellyseerr/commit/cb63bf217b9e8810a5210b4bf475b2a96583cc84)) -* multiple notifications for available media ([048fa96](https://github.com/fallenbagel/jellyseerr/commit/048fa967f2e5b23831ac9917c703934c50ef75f0)) -* repeat notifications for available 4k media ([30361f2](https://github.com/fallenbagel/jellyseerr/commit/30361f2ab751d9a882a9120e0f3df28dc42cc2cd)) -* resolved issue with create slider causing incorrect form submission ([#3514](https://github.com/fallenbagel/jellyseerr/issues/3514)) ([a761b7d](https://github.com/fallenbagel/jellyseerr/commit/a761b7dd35a5bd61bb4eb0275b75d1e0977e6a2d)) -* resolved user access check issue ([#3551](https://github.com/fallenbagel/jellyseerr/issues/3551)) ([2816c66](https://github.com/fallenbagel/jellyseerr/commit/2816c66300bf870d493c0665b0e984d60f707dfd)) -* **server/api/jellyfin.ts:** use /Library/VirtualFolders Jellyfin API call to fetch Jellyfin libs ([8685f57](https://github.com/fallenbagel/jellyseerr/commit/8685f5796a99d9700146bae9892319db10508d68)), closes [#256](https://github.com/fallenbagel/jellyseerr/issues/256) -* **statusbadge:** handle missing season/episode number ([#3526](https://github.com/fallenbagel/jellyseerr/issues/3526)) ([01de972](https://github.com/fallenbagel/jellyseerr/commit/01de972a8fe2ea3c18d5b2f426d01b5b14d142d4)) -* **tautulli:** only test connection if hostname is defined ([#3573](https://github.com/fallenbagel/jellyseerr/issues/3573)) ([f7b4dfc](https://github.com/fallenbagel/jellyseerr/commit/f7b4dfcac472d08c54779a14fc1ad3c90927df26)) -* **ui:** corrected issues icon color ([#3498](https://github.com/fallenbagel/jellyseerr/issues/3498)) ([c1a47bd](https://github.com/fallenbagel/jellyseerr/commit/c1a47bd9de332cb4925974690f5a33448b5cc2e6)) - - -### Features - -* **rating:** added IMDB Radarr proxy ([#3496](https://github.com/fallenbagel/jellyseerr/issues/3496)) ([b4191f9](https://github.com/fallenbagel/jellyseerr/commit/b4191f9c65b7ff08764e61d18e7a75bc8d4b3325)) - -# [1.6.0](https://github.com/fallenbagel/jellyseerr/compare/v1.5.0...v1.6.0) (2023-08-04) - - -### Bug Fixes - -* availability sync file detection ([#3371](https://github.com/fallenbagel/jellyseerr/issues/3371)) ([7522aa3](https://github.com/fallenbagel/jellyseerr/commit/7522aa31743b169c903ebdf9d4d698645d27514c)) -* corrected initial fallback data load on details page ([#3395](https://github.com/fallenbagel/jellyseerr/issues/3395)) ([4bd8764](https://github.com/fallenbagel/jellyseerr/commit/4bd87647d0551c20e13589a62690a6f3e5ad8ff7)) -* correctly load series fallback modal with sonarr v4 ([#3451](https://github.com/fallenbagel/jellyseerr/issues/3451)) ([e051b1d](https://github.com/fallenbagel/jellyseerr/commit/e051b1dfea9c9320cc9dd420c475ae74cff0d901)) -* **deps:** update all non-major dependencies ([#3223](https://github.com/fallenbagel/jellyseerr/issues/3223)) ([f5191ad](https://github.com/fallenbagel/jellyseerr/commit/f5191aded680357522a65bbdcc40d162b8fbf594)) -* error deleting users with over 1000 requests ([#3376](https://github.com/fallenbagel/jellyseerr/issues/3376)) ([ac77b03](https://github.com/fallenbagel/jellyseerr/commit/ac77b037d5fb0c54f5edf4b29d04adb57aef388f)) -* external url regex is now consistent with internal url ([33ec443](https://github.com/fallenbagel/jellyseerr/commit/33ec4436fb82e1eb1bc97dd650088c27785e9d94)) -* externalLinkBlock ([46cd4d0](https://github.com/fallenbagel/jellyseerr/commit/46cd4d01d9a3cf17d79350c5e678202820272299)) -* fix regex for internal url to use a more effecient one ([e848386](https://github.com/fallenbagel/jellyseerr/commit/e848386d10f05f157e7a6dde8847ecab50c169ac)) -* fixes RT ratings for tv shows ([#3492](https://github.com/fallenbagel/jellyseerr/issues/3492)) ([04fbd00](https://github.com/fallenbagel/jellyseerr/commit/04fbd00d4ac29045592588ef8b664d1916991e37)), closes [#3491](https://github.com/fallenbagel/jellyseerr/issues/3491) -* **genreselector:** fix searching in Genre filter ([#3468](https://github.com/fallenbagel/jellyseerr/issues/3468)) ([d7fa35e](https://github.com/fallenbagel/jellyseerr/commit/d7fa35e066cf371797aaa46ca464aa531ba8fb35)) -* handle search results with collections ([#3393](https://github.com/fallenbagel/jellyseerr/issues/3393)) ([70b1540](https://github.com/fallenbagel/jellyseerr/commit/70b1540ae23e83e01013856a9e06ad39e600922d)) -* lock body scroll when using webkit ([#3399](https://github.com/fallenbagel/jellyseerr/issues/3399)) ([c27f960](https://github.com/fallenbagel/jellyseerr/commit/c27f96096ac8cc6c387f9d1dde5b263576ac2132)) -* **logs:** jellyfin auth error now has the severity warn consistent with local login ([cc041b5](https://github.com/fallenbagel/jellyseerr/commit/cc041b5e0aa2b67573edba5919772b77a5111162)), closes [#224](https://github.com/fallenbagel/jellyseerr/issues/224) -* make a (shallow) copy of radarr/sonarr tags into a request before adding user tags ([#3485](https://github.com/fallenbagel/jellyseerr/issues/3485)) ([48f7666](https://github.com/fallenbagel/jellyseerr/commit/48f76662d5c08156f1da3f47e216c5f02668f64b)) -* **ui:** corrected default badge hover opacity ([#3369](https://github.com/fallenbagel/jellyseerr/issues/3369)) ([a4d07f5](https://github.com/fallenbagel/jellyseerr/commit/a4d07f5afab613317d96c9c6e9b47157a5a28986)) -* **ui:** corrected mobile menu spacing in collection details ([#3432](https://github.com/fallenbagel/jellyseerr/issues/3432)) ([77a33cb](https://github.com/fallenbagel/jellyseerr/commit/77a33cb74d744bb747b791785799b632af8c7862)) -* **ui:** Make play symbol white ([1fe4bb8](https://github.com/fallenbagel/jellyseerr/commit/1fe4bb8a0415a72791ced75a2fba1027287398d5)) -* **ui:** Resize Emby icon and add margins ([ad69d67](https://github.com/fallenbagel/jellyseerr/commit/ad69d6715e976630092bfbbb1843886523551014)) -* **watchlist:** add validation for creation request ([03316c6](https://github.com/fallenbagel/jellyseerr/commit/03316c642d1ecf89753789af08caf6e3aac80113)) -* **watchlist:** fix github code scanning ([c08897b](https://github.com/fallenbagel/jellyseerr/commit/c08897bdc1cff65862c62347572bbbd01b6c36ac)) - - -### Features - -* **add watchlist:** adding midding functionality from overserr ([5f1c10d](https://github.com/fallenbagel/jellyseerr/commit/5f1c10d50aaa430bcda96218ef2cc12a0eb926f3)) -* adds streaming services custom slider ([#3361](https://github.com/fallenbagel/jellyseerr/issues/3361)) ([2520d8f](https://github.com/fallenbagel/jellyseerr/commit/2520d8f739abfde608f3ef66a9fbe6b7b5c6647a)) -* auto tagging requested media with username ([#3338](https://github.com/fallenbagel/jellyseerr/issues/3338)) ([24f268b](https://github.com/fallenbagel/jellyseerr/commit/24f268b6cb67d9a8d8675cd6e09dd83a7f499add)) -* **discover:** support filtering by tmdb user vote count on discover page ([#3407](https://github.com/fallenbagel/jellyseerr/issues/3407)) ([aa84977](https://github.com/fallenbagel/jellyseerr/commit/aa849776809dfe891e67ff4db6861ef44df1a774)) -* **settings:** add internal url to jellyfin settings form ([0a30cd3](https://github.com/fallenbagel/jellyseerr/commit/0a30cd356d217a39546c016cc8bfa6ff6ad75e3e)), closes [#194](https://github.com/fallenbagel/jellyseerr/issues/194) -* **src/components/externallinkblock/index.tsx:** support Emby icon ([672061c](https://github.com/fallenbagel/jellyseerr/commit/672061cd646c97c9954790c8e50eac88ea2666e9)) -* **tooltip:** email tooltip now appears when hovered over info icon ([cd7930e](https://github.com/fallenbagel/jellyseerr/commit/cd7930eef98451a781e5c9dc5ec223600a379f42)) -* translations update ([47287c3](https://github.com/fallenbagel/jellyseerr/commit/47287c368885d14bd1a56e3e8318ce22dd0f6ddf)), closes [#381](https://github.com/fallenbagel/jellyseerr/issues/381) -* **watchlist:** add translation for en ([b7e3d28](https://github.com/fallenbagel/jellyseerr/commit/b7e3d285ed35b623062eceb0d99035cafbf075a6)) - -# [1.5.0](https://github.com/fallenbagel/jellyseerr/compare/v1.4.1...v1.5.0) (2023-04-20) - - -### Bug Fixes - -* add better checks on 4k detection of series ([bc9017f](https://github.com/fallenbagel/jellyseerr/commit/bc9017f54d84ec24c4d74d38e1b4e24219425d41)) -* added a refresh interval if download status is in progress ([#3275](https://github.com/fallenbagel/jellyseerr/issues/3275)) ([1e2c6f4](https://github.com/fallenbagel/jellyseerr/commit/1e2c6f46ab66c836f321b5d8e34f1e8124c0b542)) -* **build:** increase threshold for amount of data to be fetched when SSR'ing ([#3320](https://github.com/fallenbagel/jellyseerr/issues/3320)) ([d7b83d2](https://github.com/fallenbagel/jellyseerr/commit/d7b83d22cee3d20db564cc0564d42802b02327e3)) -* disable availability sync temporarily ([2e5cf22](https://github.com/fallenbagel/jellyseerr/commit/2e5cf226265686012329248e7f729fec324c3deb)) -* hide remove button when default service is not configured ([7d4455b](https://github.com/fallenbagel/jellyseerr/commit/7d4455ba6bfd12e2730f7085cbb87df246f01d22)) -* **jellyfin scan:** temporary workaround fix for jellyfin scan when display specials within season ([38fb66d](https://github.com/fallenbagel/jellyseerr/commit/38fb66d31e41232c01898d0d362af8338eb7b960)), closes [#215](https://github.com/fallenbagel/jellyseerr/issues/215) [#176](https://github.com/fallenbagel/jellyseerr/issues/176) [#246](https://github.com/fallenbagel/jellyseerr/issues/246) -* lint issues ([bcd2bb7](https://github.com/fallenbagel/jellyseerr/commit/bcd2bb7c96810f5a6932f42468a628d2db1bc771)) -* logger was set to info for the wrong logs ([#3354](https://github.com/fallenbagel/jellyseerr/issues/3354)) ([c36a4ba](https://github.com/fallenbagel/jellyseerr/commit/c36a4ba2b8df05873f5dfd0946a9bc3dc4ecfd1d)) -* remove unnecessary parenthesis from api key generation ([#3336](https://github.com/fallenbagel/jellyseerr/issues/3336)) ([6bd3f01](https://github.com/fallenbagel/jellyseerr/commit/6bd3f015d65507efca60279007bd2b86ee860643)) -* **snapcraft:** use the correct config folder for image cache ([#3302](https://github.com/fallenbagel/jellyseerr/issues/3302)) ([c93467b](https://github.com/fallenbagel/jellyseerr/commit/c93467b3acf2c256324297e7e8f21e9944005dd4)) -* **ui:** hide mini status badge if non-4K media status is unknown ([#3346](https://github.com/fallenbagel/jellyseerr/issues/3346)) ([50f06da](https://github.com/fallenbagel/jellyseerr/commit/50f06dabbffc693f0843584a64d1d96e77982820)) -* **ui:** hide search bar behind slideover when opened ([#3348](https://github.com/fallenbagel/jellyseerr/issues/3348)) ([b3882de](https://github.com/fallenbagel/jellyseerr/commit/b3882de8930a70adb2f93a27be6370bfa1826587)) -* **ui:** prevent title cards from flickering when quickly hovering across them ([#3349](https://github.com/fallenbagel/jellyseerr/issues/3349)) ([eb5502a](https://github.com/fallenbagel/jellyseerr/commit/eb5502a16f86e37a933f6beca0678c2d228e77d5)) -* **watchlist:** correctly load more than 20 watchlist items ([#3351](https://github.com/fallenbagel/jellyseerr/issues/3351)) ([af880a6](https://github.com/fallenbagel/jellyseerr/commit/af880a6c839794b34bddcd7e0fe56353aa48ba36)) - - -### Features - -* add a button in ManageSlideOver to remove the movie and the file from Radarr/Sonarr ([2e74584](https://github.com/fallenbagel/jellyseerr/commit/2e7458457e995dd3ec6dd96035fe997646cdd446)) -* availability sync rework ([#3219](https://github.com/fallenbagel/jellyseerr/issues/3219)) ([ae38183](https://github.com/fallenbagel/jellyseerr/commit/ae3818304b2f75222d1bd223ece94f829a3b42d0)), closes [#377](https://github.com/fallenbagel/jellyseerr/issues/377) -* full title of download item on hover with tooltip ([#3296](https://github.com/fallenbagel/jellyseerr/issues/3296)) ([33e7691](https://github.com/fallenbagel/jellyseerr/commit/33e7691b94d7d369a0a1410e434850bc51e5572e)) - - -### Performance Improvements - -* **imageproxy:** do not set cookies to image proxy so CDNs can cache images ([#3332](https://github.com/fallenbagel/jellyseerr/issues/3332)) ([966639d](https://github.com/fallenbagel/jellyseerr/commit/966639df430d32f6bfebdb16314dc4590d21caf8)) - -## [1.4.1](https://github.com/fallenbagel/jellyseerr/compare/v1.4.0...v1.4.1) (2023-01-31) - - -### Bug Fixes - -* pass in library type when scanning recently added items ([#3287](https://github.com/fallenbagel/jellyseerr/issues/3287)) ([8942eb8](https://github.com/fallenbagel/jellyseerr/commit/8942eb8b7c4fa1d16aa2e72e8ba7120a653c9aa2)) -* **ui:** air date will use UTC for timezone ([#3297](https://github.com/fallenbagel/jellyseerr/issues/3297)) ([3e43586](https://github.com/fallenbagel/jellyseerr/commit/3e43586acc0804c3fff524509caa890a104e132b)) -* **ui:** correct range slider styling in chrome ([#3299](https://github.com/fallenbagel/jellyseerr/issues/3299)) ([d954328](https://github.com/fallenbagel/jellyseerr/commit/d9543289111d72245564d25d300a71b0ea3954ba)) -* **ui:** show 5 icons when possible on mobile menu ([#3298](https://github.com/fallenbagel/jellyseerr/issues/3298)) ([7040da1](https://github.com/fallenbagel/jellyseerr/commit/7040da1334f6d18e19a494c73caa17f7df552dfe)) -* **ui:** style range thumbs correctly for firefox ([#3294](https://github.com/fallenbagel/jellyseerr/issues/3294)) ([9d10e6a](https://github.com/fallenbagel/jellyseerr/commit/9d10e6a88c0996671f1d9d20792e1930dbc82329)) - -# [1.4.0](https://github.com/fallenbagel/jellyseerr/compare/v1.3.0...v1.4.0) (2023-01-29) - - -### Bug Fixes - -* add bg-opacity to in-progress status badges ([#3190](https://github.com/fallenbagel/jellyseerr/issues/3190)) ([68223f4](https://github.com/fallenbagel/jellyseerr/commit/68223f4b1e98b01825516dcba39cbb2d3df31a70)) -* added download status and title to request card/item error components ([#3186](https://github.com/fallenbagel/jellyseerr/issues/3186)) ([3309f77](https://github.com/fallenbagel/jellyseerr/commit/3309f77aa4be1d70b27693531c119a8e26822518)) -* arrow icons were misplaced on mobile in slider edit ([#3260](https://github.com/fallenbagel/jellyseerr/issues/3260)) ([d328485](https://github.com/fallenbagel/jellyseerr/commit/d328485161b9cae6a70ef0713b4878207bc6015e)) -* **build:** update usage of publish snap action ([#3272](https://github.com/fallenbagel/jellyseerr/issues/3272)) ([51b05cd](https://github.com/fallenbagel/jellyseerr/commit/51b05cd8fbb5d332807d8c00b2ffb7b10c3d0179)) -* changed overflow scroll to only if necessary ([#3184](https://github.com/fallenbagel/jellyseerr/issues/3184)) ([27feeea](https://github.com/fallenbagel/jellyseerr/commit/27feeea69121336557deda1f32b65a5daa146f82)) -* convert genre/studio to string in create slider ([#3201](https://github.com/fallenbagel/jellyseerr/issues/3201)) ([93afead](https://github.com/fallenbagel/jellyseerr/commit/93afead92e497f2e5bce67a34fffdaa08d20c7f2)) -* correct checkbox position (again) for slider edits ([#3227](https://github.com/fallenbagel/jellyseerr/issues/3227)) ([3ba6df1](https://github.com/fallenbagel/jellyseerr/commit/3ba6df1a41c084c4a6a90354338047623abef521)) -* correct grid sizing for webkit on streaming services ([#3248](https://github.com/fallenbagel/jellyseerr/issues/3248)) ([6fd11cf](https://github.com/fallenbagel/jellyseerr/commit/6fd11cf4254e1a19310592bec78a6de52bc073a8)) -* correct issue detail bottom padding on mobile displays ([#3268](https://github.com/fallenbagel/jellyseerr/issues/3268)) ([3db010b](https://github.com/fallenbagel/jellyseerr/commit/3db010b9eaec62aa08d973a61caf1801471bbf3e)) -* correct link to correct keyword results for series ([#3208](https://github.com/fallenbagel/jellyseerr/issues/3208)) ([4e9be7a](https://github.com/fallenbagel/jellyseerr/commit/4e9be7a3f7304ee7be5ee6fd34b1ea8f6c0cf399)) -* correct spacing between sliders ([#3225](https://github.com/fallenbagel/jellyseerr/issues/3225)) ([62e2de7](https://github.com/fallenbagel/jellyseerr/commit/62e2de70bf37b72d5f63370b662d4103a642775b)) -* correctly check mobile menu permissions ([#3271](https://github.com/fallenbagel/jellyseerr/issues/3271)) ([f4a22dc](https://github.com/fallenbagel/jellyseerr/commit/f4a22dc437404558f301ccfc195cf0a300dd1ff2)) -* correctly restore selected streaming service filters ([#3249](https://github.com/fallenbagel/jellyseerr/issues/3249)) ([154f3e7](https://github.com/fallenbagel/jellyseerr/commit/154f3e72efbf0b663358b3029156f54516f01a2f)) -* create shared class to add bottom spacing ([#3269](https://github.com/fallenbagel/jellyseerr/issues/3269)) ([5d1c6f7](https://github.com/fallenbagel/jellyseerr/commit/5d1c6f706555613d97ed9e61d8b665543c2f239b)) -* **deps:** pin dependency @headlessui/react to 1.7.7 ([#3194](https://github.com/fallenbagel/jellyseerr/issues/3194)) [skip ci] ([c4b16ab](https://github.com/fallenbagel/jellyseerr/commit/c4b16abc62647c74215155942a4230a31a238677)) -* **deps:** update dependency @heroicons/react to v2 ([#2970](https://github.com/fallenbagel/jellyseerr/issues/2970)) ([dd48d59](https://github.com/fallenbagel/jellyseerr/commit/dd48d59b20e2d1800ea30912116f4a4f1bb7928f)) -* **deps:** update dependency axios to v1 ([#3202](https://github.com/fallenbagel/jellyseerr/issues/3202)) ([421029e](https://github.com/fallenbagel/jellyseerr/commit/421029ebab66c9a6622ba47e56d7f6473524cce4)) -* **deps:** update dependency swr to v2 ([#3212](https://github.com/fallenbagel/jellyseerr/issues/3212)) ([7b6db50](https://github.com/fallenbagel/jellyseerr/commit/7b6db50ae55b1fc60d19a5cff62dd46bb989fa51)) -* **experimental:** use new RT API (sorta) ([#3179](https://github.com/fallenbagel/jellyseerr/issues/3179)) ([357cab8](https://github.com/fallenbagel/jellyseerr/commit/357cab87ac7752b8e119b51c938b343c661d83c2)) -* improve small screen layout for discover editing ([#3221](https://github.com/fallenbagel/jellyseerr/issues/3221)) ([d23b213](https://github.com/fallenbagel/jellyseerr/commit/d23b2132de05f072f7f9daad83d81421d747cf99)) -* include new package calendar css in build ([#3235](https://github.com/fallenbagel/jellyseerr/issues/3235)) ([c2a1a20](https://github.com/fallenbagel/jellyseerr/commit/c2a1a20a3bb20039a1936c7fe0ecb9e8311a0aea)) -* issues with issues ([#3267](https://github.com/fallenbagel/jellyseerr/issues/3267)) ([fd21971](https://github.com/fallenbagel/jellyseerr/commit/fd219717c01c558814d7a80de6304272b5a7944e)) -* multiple genre filtering now works ([#3282](https://github.com/fallenbagel/jellyseerr/issues/3282)) ([5076938](https://github.com/fallenbagel/jellyseerr/commit/507693881b939819413f0959df5ef6b7a357eb5c)) -* prevent double encode if we are on /search endpoint ([#3238](https://github.com/fallenbagel/jellyseerr/issues/3238)) ([a343f8a](https://github.com/fallenbagel/jellyseerr/commit/a343f8ad915491a9c81512c7e541a1dac8906025)) -* **request:** approve request when retrying request ([#3234](https://github.com/fallenbagel/jellyseerr/issues/3234)) ([b515701](https://github.com/fallenbagel/jellyseerr/commit/b5157010c46cd9083993d5ee0172007b83d631da)) -* **request:** mark request as approved if media is already available when retrying failed request ([#3244](https://github.com/fallenbagel/jellyseerr/issues/3244)) ([cb65074](https://github.com/fallenbagel/jellyseerr/commit/cb650745f6a33e69391a633e6d272831f314e098)) -* restore border to ghost button and fix discover slider visibility toggle position ([#3226](https://github.com/fallenbagel/jellyseerr/issues/3226)) ([2eebb7f](https://github.com/fallenbagel/jellyseerr/commit/2eebb7fd3941b34fe9472aaf9d28265df8cce311)) -* restore status badges on titles on actors page when hide available media enabled ([#3206](https://github.com/fallenbagel/jellyseerr/issues/3206)) ([9d3446d](https://github.com/fallenbagel/jellyseerr/commit/9d3446d370499c3251159393e5c791b01225e05c)) -* screen would zoom on mobile if date picker input was selected ([#3241](https://github.com/fallenbagel/jellyseerr/issues/3241)) ([3aefddd](https://github.com/fallenbagel/jellyseerr/commit/3aefddd48834d86150d5f5cceb2d08af3a78847b)) -* series displayed an empty season with series list/request modal ([#3147](https://github.com/fallenbagel/jellyseerr/issues/3147)) ([2179637](https://github.com/fallenbagel/jellyseerr/commit/2179637d437999290eaa4152f6f37c71fc3d8ba3)) -* tooltip shows properly if not in progress ([#3185](https://github.com/fallenbagel/jellyseerr/issues/3185)) ([6face8c](https://github.com/fallenbagel/jellyseerr/commit/6face8cc4564b978fb98af32659b326d8c5cede8)) -* **ui:** series first air date sorting ([#3283](https://github.com/fallenbagel/jellyseerr/issues/3283)) ([374c78c](https://github.com/fallenbagel/jellyseerr/commit/374c78c989cc86bb144a954a91d5d183c4b591c0)) -* update StatusBadgeMini to shrink on title cards (and remove ring) ([#3210](https://github.com/fallenbagel/jellyseerr/issues/3210)) ([042a1a9](https://github.com/fallenbagel/jellyseerr/commit/042a1a950fdd4d4a61edf4bc19657f9b7a526da8)) - - -### Features - -* add discover customization ([#3182](https://github.com/fallenbagel/jellyseerr/issues/3182)) ([cd35748](https://github.com/fallenbagel/jellyseerr/commit/cd3574851a12517cbfadc109e6412a7a9e44c114)) -* add keywords to movie/series detail pages ([#3204](https://github.com/fallenbagel/jellyseerr/issues/3204)) ([e084649](https://github.com/fallenbagel/jellyseerr/commit/e084649878a58c296786141d12dd69a69a27ee85)) -* add streaming services filter ([#3247](https://github.com/fallenbagel/jellyseerr/issues/3247)) ([1154156](https://github.com/fallenbagel/jellyseerr/commit/1154156459403494e8daf0c89a3ba356aeea1d97)) -* discover inline customization ([#3220](https://github.com/fallenbagel/jellyseerr/issues/3220)) ([8bd10b5](https://github.com/fallenbagel/jellyseerr/commit/8bd10b5bf3d1b8069872b616c7c8596caeb4937e)) -* discover overhaul (filters!) ([#3232](https://github.com/fallenbagel/jellyseerr/issues/3232)) ([dd00e48](https://github.com/fallenbagel/jellyseerr/commit/dd00e48f59054b44bef6b32a2c169e59f6175051)) -* discover slider edit arrow buttons for reordering ([#3259](https://github.com/fallenbagel/jellyseerr/issues/3259)) ([da00d45](https://github.com/fallenbagel/jellyseerr/commit/da00d454e17e8b00d04f6e26f6dd5153ed6ced81)) -* **lang:** translations update from Hosted Weblate ([#3030](https://github.com/fallenbagel/jellyseerr/issues/3030)) ([0d8b390](https://github.com/fallenbagel/jellyseerr/commit/0d8b390b678731e76bd1f0f8a0a4952c11e77f4d)) -* new mobile menu ([#3251](https://github.com/fallenbagel/jellyseerr/issues/3251)) ([fcbca17](https://github.com/fallenbagel/jellyseerr/commit/fcbca1722f31f32633a57bc5048f46c9da057d87)) -* translations update from Hosted Weblate ([#3218](https://github.com/fallenbagel/jellyseerr/issues/3218)) ([5940ff7](https://github.com/fallenbagel/jellyseerr/commit/5940ff7f5f62eed9ac5aa6f02803418aaa09813a)) -* **ui:** add episode number to front of episode name in season details ([#3086](https://github.com/fallenbagel/jellyseerr/issues/3086)) ([a672b32](https://github.com/fallenbagel/jellyseerr/commit/a672b324ec391a20f6f3a1daed82a8d276a52c2c)) -* **ui:** request card progress bar ([#3123](https://github.com/fallenbagel/jellyseerr/issues/3123)) ([03853a1](https://github.com/fallenbagel/jellyseerr/commit/03853a1b9155c8a2153c8885022a74619af1bc15)) - # [1.3.0](https://github.com/fallenbagel/jellyseerr/compare/v1.2.1...v1.3.0) (2023-01-02) ### Bug Fixes From 3b12c982427d831e4a4ced0222d7549e7ab495d0 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sun, 18 Aug 2024 20:32:54 -0400 Subject: [PATCH 42/49] chore: revverted ts commit --- server/entity/Media.ts | 5 ++--- server/utils/DbColumnHelper.ts | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/entity/Media.ts b/server/entity/Media.ts index 3b25635e5..72bbc4303 100644 --- a/server/entity/Media.ts +++ b/server/entity/Media.ts @@ -9,7 +9,6 @@ import type { DownloadingItem } from '@server/lib/downloadtracker'; import downloadTracker from '@server/lib/downloadtracker'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; -import { DbAwareColumn } from '@server/utils/DbColumnHelper'; import { getHostname } from '@server/utils/getHostname'; import { AfterLoad, @@ -123,10 +122,10 @@ class Media { @UpdateDateColumn() public updatedAt: Date; - @DbAwareColumn({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' }) + @Column({ type: 'timestamp without time zone', default: () => 'now()' }) public lastSeasonChange: Date; - @DbAwareColumn({ type: 'datetime', nullable: true }) + @Column({ type: 'timestamp without time zone', default: () => 'now()' }) public mediaAddedAt: Date; @Column({ nullable: true, type: 'int' }) diff --git a/server/utils/DbColumnHelper.ts b/server/utils/DbColumnHelper.ts index 1c030b92d..14fe21e9a 100644 --- a/server/utils/DbColumnHelper.ts +++ b/server/utils/DbColumnHelper.ts @@ -1,8 +1,9 @@ import { isPgsql } from '@server/datasource'; import type { ColumnOptions, ColumnType } from 'typeorm'; import { Column } from 'typeorm'; +// TODO cleanup this file const pgTypeMapping: { [key: string]: ColumnType } = { - datetime: 'timestamp with time zone', + datetime: 'timestamp without time zone', }; export function resolveDbType(pgType: ColumnType): ColumnType { From 5ee29823c6b575a2c06b4e29fe98f9c91f19cb97 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Sun, 18 Aug 2024 21:07:17 -0400 Subject: [PATCH 43/49] fix: update pnpm lock with pg package --- pnpm-lock.yaml | 128 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 123 insertions(+), 5 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ea593fea5..136096248 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,7 +49,7 @@ importers: version: 2.11.0 connect-typeorm: specifier: 1.1.4 - version: 1.1.4(typeorm@0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))) + version: 1.1.4(typeorm@0.3.12(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))) cookie-parser: specifier: 1.4.6 version: 1.4.6 @@ -116,6 +116,9 @@ importers: openpgp: specifier: 5.7.0 version: 5.7.0 + pg: + specifier: 8.11.0 + version: 8.11.0 plex-api: specifier: 5.3.2 version: 5.3.2 @@ -190,7 +193,7 @@ importers: version: 2.2.5(react@18.3.1) typeorm: specifier: 0.3.12 - version: 0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)) + version: 0.3.12(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)) web-push: specifier: 3.5.0 version: 3.5.0 @@ -3518,6 +3521,10 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + buffer-writer@2.0.0: + resolution: {integrity: sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==} + engines: {node: '>=4'} + buffer@5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} @@ -7047,6 +7054,9 @@ packages: resolution: {integrity: sha512-wpgERjNkLrBiFmkMEjuZJEWKKDrNfHCKA1OhyN1wg1FrLkULbviEy6py1AyJUgZ72YWFbZ38FIpnqvVqAlDUwA==} engines: {node: '>=8'} + packet-reader@1.0.0: + resolution: {integrity: sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==} + parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -7138,6 +7148,40 @@ packages: performance-now@2.1.0: resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} + pg-cloudflare@1.1.1: + resolution: {integrity: sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==} + + pg-connection-string@2.6.4: + resolution: {integrity: sha512-v+Z7W/0EO707aNMaAEfiGnGL9sxxumwLl2fJvCQtMn9Fxsg+lPpPkdcyBSv/KFgpGdYkMfn+EI1Or2EHjpgLCA==} + + pg-int8@1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + + pg-pool@3.6.2: + resolution: {integrity: sha512-Htjbg8BlwXqSBQ9V8Vjtc+vzf/6fVUuak/3/XXKA9oxZprwW3IMDQTGHP+KDmVL7rtd+R1QjbnCFPuTHm3G4hg==} + peerDependencies: + pg: '>=8.0' + + pg-protocol@1.6.1: + resolution: {integrity: sha512-jPIlvgoD63hrEuihvIg+tJhoGjUsLPn6poJY9N5CnlPd91c2T18T/9zBtLxZSb1EhYxBRoZJtzScCaWlYLtktg==} + + pg-types@2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + + pg@8.11.0: + resolution: {integrity: sha512-meLUVPn2TWgJyLmy7el3fQQVwft4gU5NGyvV0XbD41iU9Jbg8lCH4zexhIkihDzVHJStlt6r088G6/fWeNjhXA==} + engines: {node: '>= 8.0.0'} + peerDependencies: + pg-native: '>=3.0.1' + peerDependenciesMeta: + pg-native: + optional: true + + pgpass@1.0.5: + resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} + picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} @@ -7243,6 +7287,22 @@ packages: resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} engines: {node: ^10 || ^12 || >=14} + postgres-array@2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + + postgres-bytea@1.0.0: + resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==} + engines: {node: '>=0.10.0'} + + postgres-date@1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + + postgres-interval@1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -8156,6 +8216,10 @@ packages: split2@3.2.2: resolution: {integrity: sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==} + split2@4.2.0: + resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} + engines: {node: '>= 10.x'} + split@1.0.1: resolution: {integrity: sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==} @@ -13423,6 +13487,8 @@ snapshots: buffer-from@1.1.2: {} + buffer-writer@2.0.0: {} + buffer@5.7.1: dependencies: base64-js: 1.5.1 @@ -13813,13 +13879,13 @@ snapshots: ini: 1.3.8 proto-list: 1.2.4 - connect-typeorm@1.1.4(typeorm@0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))): + connect-typeorm@1.1.4(typeorm@0.3.12(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))): dependencies: '@types/debug': 0.0.31 '@types/express-session': 1.17.6 debug: 4.3.5(supports-color@8.1.1) express-session: 1.18.0 - typeorm: 0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)) + typeorm: 0.3.12(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)) transitivePeerDependencies: - supports-color @@ -17578,6 +17644,8 @@ snapshots: dependencies: p-timeout: 3.2.0 + packet-reader@1.0.0: {} + parent-module@1.0.1: dependencies: callsites: 3.1.0 @@ -17656,6 +17724,43 @@ snapshots: performance-now@2.1.0: {} + pg-cloudflare@1.1.1: + optional: true + + pg-connection-string@2.6.4: {} + + pg-int8@1.0.1: {} + + pg-pool@3.6.2(pg@8.11.0): + dependencies: + pg: 8.11.0 + + pg-protocol@1.6.1: {} + + pg-types@2.2.0: + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.0 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + + pg@8.11.0: + dependencies: + buffer-writer: 2.0.0 + packet-reader: 1.0.0 + pg-connection-string: 2.6.4 + pg-pool: 3.6.2(pg@8.11.0) + pg-protocol: 1.6.1 + pg-types: 2.2.0 + pgpass: 1.0.5 + optionalDependencies: + pg-cloudflare: 1.1.1 + + pgpass@1.0.5: + dependencies: + split2: 4.2.0 + picocolors@1.0.1: {} picomatch@2.3.1: {} @@ -17753,6 +17858,16 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.2.0 + postgres-array@2.0.0: {} + + postgres-bytea@1.0.0: {} + + postgres-date@1.0.7: {} + + postgres-interval@1.2.0: + dependencies: + xtend: 4.0.2 + prelude-ls@1.2.1: {} prettier-linter-helpers@1.0.0: @@ -18884,6 +18999,8 @@ snapshots: dependencies: readable-stream: 3.6.2 + split2@4.2.0: {} + split@1.0.1: dependencies: through: 2.3.8 @@ -19420,7 +19537,7 @@ snapshots: typedarray@0.0.6: {} - typeorm@0.3.12(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)): + typeorm@0.3.12(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)): dependencies: '@sqltools/formatter': 1.2.5 app-root-path: 3.1.0 @@ -19440,6 +19557,7 @@ snapshots: xml2js: 0.4.23 yargs: 17.7.2 optionalDependencies: + pg: 8.11.0 sqlite3: 5.1.4(encoding@0.1.13) ts-node: 10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5) transitivePeerDependencies: From 96591a9ddd0aecc2ae6e0a7dbdc13853ea14f7e1 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Mon, 4 Nov 2024 18:04:40 -0500 Subject: [PATCH 44/49] chore(pnpm-lock.yaml): updated pnpm-lock --- docs/getting-started/database-config.mdx | 5 + pnpm-lock.yaml | 128 ++++++++++++++++++++++- server/utils/DbColumnHelper.ts | 21 ---- 3 files changed, 128 insertions(+), 26 deletions(-) create mode 100644 docs/getting-started/database-config.mdx delete mode 100644 server/utils/DbColumnHelper.ts diff --git a/docs/getting-started/database-config.mdx b/docs/getting-started/database-config.mdx new file mode 100644 index 000000000..6cb3f9b7a --- /dev/null +++ b/docs/getting-started/database-config.mdx @@ -0,0 +1,5 @@ +--- +title: Using Postgres +description: Use postgres as the database for Jellyseerr instead of SQLite +sidebar_position: 5 +--- diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8b68e8b5e..016a4b2ce 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,7 +49,7 @@ importers: version: 2.11.0 connect-typeorm: specifier: 1.1.4 - version: 1.1.4(typeorm@0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))) + version: 1.1.4(typeorm@0.3.11(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))) cookie-parser: specifier: 1.4.6 version: 1.4.6 @@ -119,6 +119,9 @@ importers: openpgp: specifier: 5.7.0 version: 5.7.0 + pg: + specifier: 8.11.0 + version: 8.11.0 plex-api: specifier: 5.3.2 version: 5.3.2 @@ -193,7 +196,7 @@ importers: version: 2.2.5(react@18.3.1) typeorm: specifier: 0.3.11 - version: 0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)) + version: 0.3.11(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)) undici: specifier: ^6.20.1 version: 6.20.1 @@ -3530,6 +3533,10 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + buffer-writer@2.0.0: + resolution: {integrity: sha512-a7ZpuTZU1TRtnwyCNW3I5dc0wWNC3VR9S++Ewyk2HHZdrO3CQJqSpd+95Us590V6AL7JqUAH2IwZ/398PmNFgw==} + engines: {node: '>=4'} + buffer@5.7.1: resolution: {integrity: sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==} @@ -7050,6 +7057,9 @@ packages: resolution: {integrity: sha512-wpgERjNkLrBiFmkMEjuZJEWKKDrNfHCKA1OhyN1wg1FrLkULbviEy6py1AyJUgZ72YWFbZ38FIpnqvVqAlDUwA==} engines: {node: '>=8'} + packet-reader@1.0.0: + resolution: {integrity: sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ==} + parent-module@1.0.1: resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} engines: {node: '>=6'} @@ -7141,6 +7151,40 @@ packages: performance-now@2.1.0: resolution: {integrity: sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==} + pg-cloudflare@1.1.1: + resolution: {integrity: sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==} + + pg-connection-string@2.7.0: + resolution: {integrity: sha512-PI2W9mv53rXJQEOb8xNR8lH7Hr+EKa6oJa38zsK0S/ky2er16ios1wLKhZyxzD7jUReiWokc9WK5nxSnC7W1TA==} + + pg-int8@1.0.1: + resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} + engines: {node: '>=4.0.0'} + + pg-pool@3.7.0: + resolution: {integrity: sha512-ZOBQForurqh4zZWjrgSwwAtzJ7QiRX0ovFkZr2klsen3Nm0aoh33Ls0fzfv3imeH/nw/O27cjdz5kzYJfeGp/g==} + peerDependencies: + pg: '>=8.0' + + pg-protocol@1.7.0: + resolution: {integrity: sha512-hTK/mE36i8fDDhgDFjy6xNOG+LCorxLG3WO17tku+ij6sVHXh1jQUJ8hYAnRhNla4QVD2H8er/FOjc/+EgC6yQ==} + + pg-types@2.2.0: + resolution: {integrity: sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==} + engines: {node: '>=4'} + + pg@8.11.0: + resolution: {integrity: sha512-meLUVPn2TWgJyLmy7el3fQQVwft4gU5NGyvV0XbD41iU9Jbg8lCH4zexhIkihDzVHJStlt6r088G6/fWeNjhXA==} + engines: {node: '>= 8.0.0'} + peerDependencies: + pg-native: '>=3.0.1' + peerDependenciesMeta: + pg-native: + optional: true + + pgpass@1.0.5: + resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} + picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} @@ -7246,6 +7290,22 @@ packages: resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} engines: {node: ^10 || ^12 || >=14} + postgres-array@2.0.0: + resolution: {integrity: sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==} + engines: {node: '>=4'} + + postgres-bytea@1.0.0: + resolution: {integrity: sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==} + engines: {node: '>=0.10.0'} + + postgres-date@1.0.7: + resolution: {integrity: sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==} + engines: {node: '>=0.10.0'} + + postgres-interval@1.2.0: + resolution: {integrity: sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==} + engines: {node: '>=0.10.0'} + prelude-ls@1.2.1: resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} engines: {node: '>= 0.8.0'} @@ -8156,6 +8216,10 @@ packages: split2@3.2.2: resolution: {integrity: sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg==} + split2@4.2.0: + resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} + engines: {node: '>= 10.x'} + split@1.0.1: resolution: {integrity: sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==} @@ -13429,6 +13493,8 @@ snapshots: buffer-from@1.1.2: {} + buffer-writer@2.0.0: {} + buffer@5.7.1: dependencies: base64-js: 1.5.1 @@ -13819,13 +13885,13 @@ snapshots: ini: 1.3.8 proto-list: 1.2.4 - connect-typeorm@1.1.4(typeorm@0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))): + connect-typeorm@1.1.4(typeorm@0.3.11(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5))): dependencies: '@types/debug': 0.0.31 '@types/express-session': 1.17.6 debug: 4.3.5(supports-color@8.1.1) express-session: 1.18.0 - typeorm: 0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)) + typeorm: 0.3.11(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)) transitivePeerDependencies: - supports-color @@ -17578,6 +17644,8 @@ snapshots: dependencies: p-timeout: 3.2.0 + packet-reader@1.0.0: {} + parent-module@1.0.1: dependencies: callsites: 3.1.0 @@ -17656,6 +17724,43 @@ snapshots: performance-now@2.1.0: {} + pg-cloudflare@1.1.1: + optional: true + + pg-connection-string@2.7.0: {} + + pg-int8@1.0.1: {} + + pg-pool@3.7.0(pg@8.11.0): + dependencies: + pg: 8.11.0 + + pg-protocol@1.7.0: {} + + pg-types@2.2.0: + dependencies: + pg-int8: 1.0.1 + postgres-array: 2.0.0 + postgres-bytea: 1.0.0 + postgres-date: 1.0.7 + postgres-interval: 1.2.0 + + pg@8.11.0: + dependencies: + buffer-writer: 2.0.0 + packet-reader: 1.0.0 + pg-connection-string: 2.7.0 + pg-pool: 3.7.0(pg@8.11.0) + pg-protocol: 1.7.0 + pg-types: 2.2.0 + pgpass: 1.0.5 + optionalDependencies: + pg-cloudflare: 1.1.1 + + pgpass@1.0.5: + dependencies: + split2: 4.2.0 + picocolors@1.0.1: {} picomatch@2.3.1: {} @@ -17753,6 +17858,16 @@ snapshots: picocolors: 1.0.1 source-map-js: 1.2.0 + postgres-array@2.0.0: {} + + postgres-bytea@1.0.0: {} + + postgres-date@1.0.7: {} + + postgres-interval@1.2.0: + dependencies: + xtend: 4.0.2 + prelude-ls@1.2.1: {} prettier-linter-helpers@1.0.0: @@ -18882,6 +18997,8 @@ snapshots: dependencies: readable-stream: 3.6.2 + split2@4.2.0: {} + split@1.0.1: dependencies: through: 2.3.8 @@ -19418,7 +19535,7 @@ snapshots: typedarray@0.0.6: {} - typeorm@0.3.11(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)): + typeorm@0.3.11(pg@8.11.0)(sqlite3@5.1.4(encoding@0.1.13))(ts-node@10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5)): dependencies: '@sqltools/formatter': 1.2.5 app-root-path: 3.1.0 @@ -19438,6 +19555,7 @@ snapshots: xml2js: 0.4.23 yargs: 17.7.2 optionalDependencies: + pg: 8.11.0 sqlite3: 5.1.4(encoding@0.1.13) ts-node: 10.9.1(@swc/core@1.6.5(@swc/helpers@0.5.11))(@types/node@20.14.8)(typescript@4.9.5) transitivePeerDependencies: diff --git a/server/utils/DbColumnHelper.ts b/server/utils/DbColumnHelper.ts deleted file mode 100644 index 14fe21e9a..000000000 --- a/server/utils/DbColumnHelper.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { isPgsql } from '@server/datasource'; -import type { ColumnOptions, ColumnType } from 'typeorm'; -import { Column } from 'typeorm'; -// TODO cleanup this file -const pgTypeMapping: { [key: string]: ColumnType } = { - datetime: 'timestamp without time zone', -}; - -export function resolveDbType(pgType: ColumnType): ColumnType { - if (isPgsql && pgType.toString() in pgTypeMapping) { - return pgTypeMapping[pgType.toString()]; - } - return pgType; -} - -export function DbAwareColumn(columnOptions: ColumnOptions) { - if (columnOptions.type) { - columnOptions.type = resolveDbType(columnOptions.type); - } - return Column(columnOptions); -} From 7a5ee18e2c5497831419c79cac7d0c45391f9343 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Mon, 4 Nov 2024 18:09:39 -0500 Subject: [PATCH 45/49] docs: update docs to add psql set up info --- README.md | 173 ----------------------- docs/README.md | 1 + docs/getting-started/database-config.mdx | 51 ++++++- 3 files changed, 50 insertions(+), 175 deletions(-) diff --git a/README.md b/README.md index 472ff12e0..fb6c8790a 100644 --- a/README.md +++ b/README.md @@ -38,179 +38,6 @@ With more features on the way! Check out our [issue tracker](https://github.com/ Check out our documentation for instructions on how to install and run Jellyseerr: -[//]: # 'TODO: move this to the docs' - -### Launching Jellyseerr using Docker (Recommended) - -Check out our docker hub for instructions on how to install and run Jellyseerr: -https://hub.docker.com/r/fallenbagel/jellyseerr - -### Database configuration - -Jellyseerr supports sqlite and postgres. The database connection can be configured using the following options: - -#### SQLite Options - -```dotenv -DB_TYPE="sqlite" # Which DB engine to use. The default is "sqlite" -CONFIG_DIRECTORY="config" # The path to the config directory where the db file is stored -DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging -``` - -#### PostgreSQL Options - -```dotenv -DB_TYPE="postgres" # Which DB engine to use. The default is "sqlite". To use postgres, this needs to be set to "postgres" -DB_HOST= # The host (url) of the database -DB_PORT="5432" # The port to connect to -DB_USER= # Username used to connect to the database -DB_PASS= # Password of the user used to connect to the database -DB_NAME="jellyseerr" # The name of the database to connect to -DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging -DB_USE_SSL="false" # Whether to enable ssl for database connection - -# The following options can be used to further configure ssl: -DB_SSL_REJECT_UNAUTHORIZED="true" # Whether to reject ssl connections with unverifiable certificates i.e. self-signed certificates without providing the below settings -DB_SSL_CA= # The CA certificate to verify the connection, provided as a string -DB_SSL_CA_FILE= # The path to a CA certificate to verify the connection -DB_SSL_KEY= # The private key for the connection in PEM format, provided as a string -DB_SSL_KEY_FILE= # Path to the private key for the connection in PEM format -DB_SSL_CERT= # Certificate chain in pem format for the private key, provided as a string -DB_SSL_CERT_FILE= # Path to certificate chain in pem format for the private key -``` - -#### Migrating from SQLite to PostgreSQL - -1. Set up your PostgreSQL database and configure Jellyseerr to use it -2. Run Jellyseerr to create the tables in the PostgreSQL database -3. Stop Jellyseerr -4. Run the following command to export the data from the SQLite database and import it into the PostgreSQL database: - - Edit the postgres connection string to match your setup - - WARNING: The most recent release of pgloader has an issue quoting the table columns. Use the version in the docker container to avoid this issue. - - "I don't have or don't want to use docker" - You can build the working pgloader version [in this PR](https://github.com/dimitri/pgloader/pull/1531) from source and use the same options as below. - ```bash - docker run --rm -v config/db.sqlite3:/db.sqlite3:ro -v pgloader/pgloader.load:/pgloader.load ghcr.io/ralgar/pgloader:pr-1531 pgloader --with "quote identifiers" --with "data only" /db.sqlite3 postgresql://{{DB_USER}}:{{DB_PASS}}@{{DB_HOST}}:{{DB_PORT}}/{{DB_NAME}} - ``` -5. Start Jellyseerr - -### Building latest version from source (ADVANCED): - -#### Windows - -Pre-requisites: - -- Nodejs [v18](https://nodejs.org/download/release/v18.18.2) -- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) -- Download/git clone the source code from the github (Either develop branch or main for stable) - -```cmd -npm i -g win-node-env -set CYPRESS_INSTALL_BINARY=0 -yarn install --frozen-lockfile --network-timeout 1000000 -yarn run build -yarn start -``` - -(You can use task scheduler to run a bat script with `@echo off` and `yarn start` to run jellyseerr in the background) -(You can also use nssm to run jellyseerr as a service, see [nssm](https://nssm.cc/usage) for more information) - -_To set env variables such as `JELLYFIN_TYPE=emby` create a file called `.env` in the root directory of jellyseerr_ - -#### Linux - -**Pre-requisites:** - -- Nodejs [v18](https://nodejs.org/en/download/package-manager) -- [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) (on Debian based distros, the package manager provided `yarn` is different and is a package called cmdlet. You can remove that using `apt-remove cmdlet` then install yarn using `npm install -g yarn`) -- Git - -**Steps:** - -1. Assuming you want the root folder for the jellyseerr source code to be cloned to `/opt` - -```bash -cd /opt -``` - -2. Then execute the following commands to clone and checkout to the stable version - -```bash -git clone https://github.com/Fallenbagel/jellyseerr.git && cd jellyseerr -git checkout main -``` - -3. Then install the dependencies and build the dist - -```bash -CYPRESS_INSTALL_BINARY=0 yarn install --frozen-lockfile --network-timeout 1000000 -yarn run build -``` - -4. Now you can start jellyseerr using `yarn start` and opening http://localhost:5055 in your browser. - -5. If you want to run jellyseerr as a _Systemd-service:_ - -- assuming jellyseerr was cloned to `/opt/` -- first create the environment file at `/etc/jellyseerr/jellyseerr.conf` - -Environment file: - -``` -# Jellyseerr's default port is 5055, if you want to use both, change this. -# specify on which port to listen -PORT=5055 - -# specify on which interface to listen, by default jellyseerr listens on all interfaces -#HOST=127.0.0.1 - -# Uncomment if your media server is emby instead of jellyfin. -# JELLYFIN_TYPE=emby -``` - -- Then run the command `which node` to find your node path (assuming it's at `/usr/bin/node`) -- Then create the service file using `sudo systemctl edit jellyseerr.service` or creating and editing a file at `/etc/systemd/system/jellyseerr.service` - -Service file contents: - -``` -[Unit] -Description=Jellyseerr Service -Wants=network-online.target -After=network-online.target - -[Service] -EnvironmentFile=/etc/jellyseerr/jellyseerr.conf -Environment=NODE_ENV=production -Type=exec -Restart=on-failure -WorkingDirectory=/opt/jellyseerr -ExecStart=/usr/bin/node dist/index.js - -[Install] -WantedBy=multi-user.target -``` - -### Building develop branch from source (ADVANCED): - -#### Windows - -Pre-requisites: - -- Nodejs [v20](https://nodejs.org/en/download) -- Pnpm [v9](https://pnpm.io/installation) -- Download/git clone the source code from the github (Either develop branch or main for stable) - -```cmd -npm i -g win-node-env -set CYPRESS_INSTALL_BINARY=0 -pnpm install --frozen-lockfile -pnpm run build -pnpm start -``` - -(You can use task scheduler to run a bat script with `@echo off` and `pnpm start` to run jellyseerr in the background) -(You can also use nssm to run jellyseerr as a service, see [nssm](https://nssm.cc/usage) for more information) - https://docs.jellyseerr.dev/getting-started/ ### Packages: diff --git a/docs/README.md b/docs/README.md index a441434d3..0d0129c11 100644 --- a/docs/README.md +++ b/docs/README.md @@ -17,6 +17,7 @@ Welcome to the Jellyseerr Documentation. - **Mobile-friendly design**, for when you need to approve requests on the go. - Granular permission system. - Localization into other languages. +- Support for PostgreSQL and SQLite databases. - More features to come! ## Motivation diff --git a/docs/getting-started/database-config.mdx b/docs/getting-started/database-config.mdx index 6cb3f9b7a..0ad7389cb 100644 --- a/docs/getting-started/database-config.mdx +++ b/docs/getting-started/database-config.mdx @@ -1,5 +1,52 @@ --- -title: Using Postgres -description: Use postgres as the database for Jellyseerr instead of SQLite +title: Configuring the Database (Advanced) +description: Configure the database for Jellyseerr sidebar_position: 5 --- +# Configuring the Database + +Jellyseerr supports SQLite and PostgreSQL. The database connection can be configured using the following environment variables: + +#### SQLite Options + +```dotenv +DB_TYPE="sqlite" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite" +CONFIG_DIRECTORY="config" # The path to the config directory where the db file is stored +DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging +``` + +#### PostgreSQL Options + +```dotenv +DB_TYPE="postgres" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite". To use postgres, this needs to be set to "postgres" +DB_HOST="postgres" # The host (url) of the database +DB_PORT="5432" # The port to connect to +DB_USER="jellyseerr" # Username used to connect to the database +DB_PASS="postgres" # Password of the user used to connect to the database +DB_NAME="jellyseerr" # The name of the database to connect to +DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging +DB_USE_SSL="false" # Whether to enable ssl for database connection + +# The following options can be used to further configure ssl: +DB_SSL_REJECT_UNAUTHORIZED="true" # Whether to reject ssl connections with unverifiable certificates i.e. self-signed certificates without providing the below settings +DB_SSL_CA= # The CA certificate to verify the connection, provided as a string +DB_SSL_CA_FILE= # The path to a CA certificate to verify the connection +DB_SSL_KEY= # The private key for the connection in PEM format, provided as a string +DB_SSL_KEY_FILE= # Path to the private key for the connection in PEM format +DB_SSL_CERT= # Certificate chain in pem format for the private key, provided as a string +DB_SSL_CERT_FILE= # Path to certificate chain in pem format for the private key +``` + +#### Migrating from SQLite to PostgreSQL + +1. Set up your PostgreSQL database and configure Jellyseerr to use it +2. Run Jellyseerr to create the tables in the PostgreSQL database +3. Stop Jellyseerr +4. Run the following command to export the data from the SQLite database and import it into the PostgreSQL database: +- Edit the postgres connection string to match your setup +- WARNING: The most recent release of pgloader has an issue quoting the table columns. Use the version in the docker container to avoid this issue. +- "I don't have or don't want to use docker" - You can build the working pgloader version [in this PR](https://github.com/dimitri/pgloader/pull/1531) from source and use the same options as below. +```bash +docker run --rm -v config/db.sqlite3:/db.sqlite3:ro -v pgloader/pgloader.load:/pgloader.load ghcr.io/ralgar/pgloader:pr-1531 pgloader --with "quote identifiers" --with "data only" /db.sqlite3 postgresql://{{DB_USER}}:{{DB_PASS}}@{{DB_HOST}}:{{DB_PORT}}/{{DB_NAME}} + ``` +5. Start Jellyseerr From d3805d99e8280a7b00df9624cbaee950ded69455 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Mon, 4 Nov 2024 18:10:43 -0500 Subject: [PATCH 46/49] refactor: clean up code from cr comments --- server/datasource.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/server/datasource.ts b/server/datasource.ts index 72a9794ae..3a81cf34e 100644 --- a/server/datasource.ts +++ b/server/datasource.ts @@ -103,14 +103,10 @@ export const isPgsql = process.env.DB_TYPE === 'postgres'; function getDataSource(): DataSourceOptions { if (process.env.NODE_ENV === 'production') { - if (isPgsql) { - return postgresProdConfig; - } - return prodConfig; - } else if (isPgsql) { - return postgresDevConfig; + return isPgsql ? postgresProdConfig : prodConfig; + } else { + return isPgsql ? postgresDevConfig : devConfig; } - return devConfig; } const dataSource = new DataSource(getDataSource()); From ab5cdf5464c6c154d3a6cf20aec3df87c9175bdb Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Mon, 4 Nov 2024 18:21:49 -0500 Subject: [PATCH 47/49] feat: migrate blacklist --- .../postgres/1699901142442-AddBlacklist.ts | 30 +++++++++++++++++++ .../1699901142442-AddBlacklist.ts | 0 2 files changed, 30 insertions(+) create mode 100644 server/migration/postgres/1699901142442-AddBlacklist.ts rename server/migration/{ => sqlite}/1699901142442-AddBlacklist.ts (100%) diff --git a/server/migration/postgres/1699901142442-AddBlacklist.ts b/server/migration/postgres/1699901142442-AddBlacklist.ts new file mode 100644 index 000000000..be889258e --- /dev/null +++ b/server/migration/postgres/1699901142442-AddBlacklist.ts @@ -0,0 +1,30 @@ +import type { MigrationInterface, QueryRunner } from 'typeorm'; + +export class AddBlacklist1699901142442 implements MigrationInterface { + name = 'AddBlacklist1699901142442'; + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query( + `CREATE TABLE "blacklist" + ( + "id" SERIAL PRIMARY KEY, + "mediaType" VARCHAR NOT NULL, + "title" VARCHAR, + "tmdbId" INTEGER NOT NULL, + "createdAt" TIMESTAMP NOT NULL DEFAULT NOW(), + "userId" INTEGER, + "mediaId" INTEGER, + CONSTRAINT "UQ_6bbafa28411e6046421991ea21c" UNIQUE ("tmdbId", "userId") + )` + ); + + await queryRunner.query( + `CREATE INDEX "IDX_6bbafa28411e6046421991ea21" ON "blacklist" ("tmdbId")` + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP INDEX "IDX_6bbafa28411e6046421991ea21"`); + await queryRunner.query(`DROP TABLE "blacklist"`); + } +} diff --git a/server/migration/1699901142442-AddBlacklist.ts b/server/migration/sqlite/1699901142442-AddBlacklist.ts similarity index 100% rename from server/migration/1699901142442-AddBlacklist.ts rename to server/migration/sqlite/1699901142442-AddBlacklist.ts From 94efdf7a18e0c9acef020ec78773c100299615c7 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Mon, 4 Nov 2024 21:04:18 -0500 Subject: [PATCH 48/49] fix: fix issue with cypress tests --- .../database-config.mdx | 0 server/entity/Media.ts | 5 +++-- ...klist.ts => 1730770837441-AddBlacklist.ts} | 4 ++-- server/utils/DbColumnHelper.ts | 20 +++++++++++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) rename docs/{getting-started => extending-jellyseerr}/database-config.mdx (100%) rename server/migration/postgres/{1699901142442-AddBlacklist.ts => 1730770837441-AddBlacklist.ts} (89%) create mode 100644 server/utils/DbColumnHelper.ts diff --git a/docs/getting-started/database-config.mdx b/docs/extending-jellyseerr/database-config.mdx similarity index 100% rename from docs/getting-started/database-config.mdx rename to docs/extending-jellyseerr/database-config.mdx diff --git a/server/entity/Media.ts b/server/entity/Media.ts index a27f2482a..008b4a596 100644 --- a/server/entity/Media.ts +++ b/server/entity/Media.ts @@ -10,6 +10,7 @@ import type { DownloadingItem } from '@server/lib/downloadtracker'; import downloadTracker from '@server/lib/downloadtracker'; import { getSettings } from '@server/lib/settings'; import logger from '@server/logger'; +import { DbAwareColumn } from '@server/utils/DbColumnHelper'; import { getHostname } from '@server/utils/getHostname'; import { AfterLoad, @@ -129,10 +130,10 @@ class Media { @UpdateDateColumn() public updatedAt: Date; - @Column({ type: 'timestamp without time zone', default: () => 'now()' }) + @DbAwareColumn({ type: 'datetime', default: () => 'now()' }) public lastSeasonChange: Date; - @Column({ type: 'timestamp without time zone', default: () => 'now()' }) + @DbAwareColumn({ type: 'datetime', default: () => 'now()' }) public mediaAddedAt: Date; @Column({ nullable: true, type: 'int' }) diff --git a/server/migration/postgres/1699901142442-AddBlacklist.ts b/server/migration/postgres/1730770837441-AddBlacklist.ts similarity index 89% rename from server/migration/postgres/1699901142442-AddBlacklist.ts rename to server/migration/postgres/1730770837441-AddBlacklist.ts index be889258e..c6ea14cce 100644 --- a/server/migration/postgres/1699901142442-AddBlacklist.ts +++ b/server/migration/postgres/1730770837441-AddBlacklist.ts @@ -1,7 +1,7 @@ import type { MigrationInterface, QueryRunner } from 'typeorm'; -export class AddBlacklist1699901142442 implements MigrationInterface { - name = 'AddBlacklist1699901142442'; +export class AddBlacklist1730770837441 implements MigrationInterface { + name = 'AddBlacklist1730770837441'; public async up(queryRunner: QueryRunner): Promise { await queryRunner.query( diff --git a/server/utils/DbColumnHelper.ts b/server/utils/DbColumnHelper.ts new file mode 100644 index 000000000..4bdb00c9b --- /dev/null +++ b/server/utils/DbColumnHelper.ts @@ -0,0 +1,20 @@ +import { isPgsql } from '@server/datasource'; +import type { ColumnOptions, ColumnType } from 'typeorm'; +import { Column } from 'typeorm'; +const pgTypeMapping: { [key: string]: ColumnType } = { + datetime: 'timestamp without time zone', +}; + +export function resolveDbType(pgType: ColumnType): ColumnType { + if (isPgsql && pgType.toString() in pgTypeMapping) { + return pgTypeMapping[pgType.toString()]; + } + return pgType; +} + +export function DbAwareColumn(columnOptions: ColumnOptions) { + if (columnOptions.type) { + columnOptions.type = resolveDbType(columnOptions.type); + } + return Column(columnOptions); +} From 830f431e0149e2368d32472000b8dba3c98321e1 Mon Sep 17 00:00:00 2001 From: dr-carrot Date: Mon, 4 Nov 2024 22:09:07 -0500 Subject: [PATCH 49/49] docs: update psql docs --- docs/extending-jellyseerr/database-config.mdx | 50 ++++++++++--------- .../postgres/1730770837441-AddBlacklist.ts | 8 +-- 2 files changed, 32 insertions(+), 26 deletions(-) diff --git a/docs/extending-jellyseerr/database-config.mdx b/docs/extending-jellyseerr/database-config.mdx index 0ad7389cb..73ce1b0f1 100644 --- a/docs/extending-jellyseerr/database-config.mdx +++ b/docs/extending-jellyseerr/database-config.mdx @@ -1,43 +1,47 @@ --- title: Configuring the Database (Advanced) description: Configure the database for Jellyseerr -sidebar_position: 5 +sidebar_position: 2 --- # Configuring the Database Jellyseerr supports SQLite and PostgreSQL. The database connection can be configured using the following environment variables: -#### SQLite Options +## SQLite Options ```dotenv -DB_TYPE="sqlite" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite" -CONFIG_DIRECTORY="config" # The path to the config directory where the db file is stored -DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging +DB_TYPE="sqlite" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite". +CONFIG_DIRECTORY="config" # (optional) The path to the config directory where the db file is stored. The default is "config". +DB_LOG_QUERIES="false" # (optional) Whether to log the DB queries for debugging. The default is "false". ``` -#### PostgreSQL Options +## PostgreSQL Options ```dotenv DB_TYPE="postgres" # Which DB engine to use, either "sqlite" or "postgres". The default is "sqlite". To use postgres, this needs to be set to "postgres" -DB_HOST="postgres" # The host (url) of the database -DB_PORT="5432" # The port to connect to -DB_USER="jellyseerr" # Username used to connect to the database -DB_PASS="postgres" # Password of the user used to connect to the database -DB_NAME="jellyseerr" # The name of the database to connect to -DB_LOG_QUERIES="false" # Whether to log the DB queries for debugging -DB_USE_SSL="false" # Whether to enable ssl for database connection - -# The following options can be used to further configure ssl: -DB_SSL_REJECT_UNAUTHORIZED="true" # Whether to reject ssl connections with unverifiable certificates i.e. self-signed certificates without providing the below settings -DB_SSL_CA= # The CA certificate to verify the connection, provided as a string -DB_SSL_CA_FILE= # The path to a CA certificate to verify the connection -DB_SSL_KEY= # The private key for the connection in PEM format, provided as a string -DB_SSL_KEY_FILE= # Path to the private key for the connection in PEM format -DB_SSL_CERT= # Certificate chain in pem format for the private key, provided as a string -DB_SSL_CERT_FILE= # Path to certificate chain in pem format for the private key +DB_HOST="localhost" # (optional) The host (url) of the database. The default is "localhost". +DB_PORT="5432" # (optional) The port to connect to. The default is "5432". +DB_USER= # (required) Username used to connect to the database +DB_PASS= # (required) Password of the user used to connect to the database +DB_NAME="jellyseerr" # (optional) The name of the database to connect to. The default is "jellyseerr". +DB_LOG_QUERIES="false" # (optional) Whether to log the DB queries for debugging. The default is "false". ``` -#### Migrating from SQLite to PostgreSQL +### SSL configuration +The following options can be used to further configure ssl. Certificates can be provided as a string or a file path, with the string version taking precedence. + +```dotenv +DB_USE_SSL="false" # (optional) Whether to enable ssl for database connection. This must be "true" to use the other ssl options. The default is "false". +DB_SSL_REJECT_UNAUTHORIZED="true" # (optional) Whether to reject ssl connections with unverifiable certificates i.e. self-signed certificates without providing the below settings. The default is "true". +DB_SSL_CA= # (optional) The CA certificate to verify the connection, provided as a string. The default is "". +DB_SSL_CA_FILE= # (optional) The path to a CA certificate to verify the connection. The default is "". +DB_SSL_KEY= # (optional) The private key for the connection in PEM format, provided as a string. The default is "". +DB_SSL_KEY_FILE= # (optinal) Path to the private key for the connection in PEM format. The default is "". +DB_SSL_CERT= # (optional) Certificate chain in pem format for the private key, provided as a string. The default is "". +DB_SSL_CERT_FILE= # (optional) Path to certificate chain in pem format for the private key. The default is "". +``` + +### Migrating from SQLite to PostgreSQL 1. Set up your PostgreSQL database and configure Jellyseerr to use it 2. Run Jellyseerr to create the tables in the PostgreSQL database diff --git a/server/migration/postgres/1730770837441-AddBlacklist.ts b/server/migration/postgres/1730770837441-AddBlacklist.ts index c6ea14cce..40fcb9048 100644 --- a/server/migration/postgres/1730770837441-AddBlacklist.ts +++ b/server/migration/postgres/1730770837441-AddBlacklist.ts @@ -11,7 +11,7 @@ export class AddBlacklist1730770837441 implements MigrationInterface { "mediaType" VARCHAR NOT NULL, "title" VARCHAR, "tmdbId" INTEGER NOT NULL, - "createdAt" TIMESTAMP NOT NULL DEFAULT NOW(), + "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(), "userId" INTEGER, "mediaId" INTEGER, CONSTRAINT "UQ_6bbafa28411e6046421991ea21c" UNIQUE ("tmdbId", "userId") @@ -24,7 +24,9 @@ export class AddBlacklist1730770837441 implements MigrationInterface { } public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`DROP INDEX "IDX_6bbafa28411e6046421991ea21"`); - await queryRunner.query(`DROP TABLE "blacklist"`); + await queryRunner.query( + `DROP INDEX IF EXISTS "IDX_6bbafa28411e6046421991ea21"` + ); + await queryRunner.query(`DROP TABLE IF EXISTS "blacklist"`); } }