diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | docs/customservices.md | 18 | ||||
-rw-r--r-- | src/App.vue | 1 | ||||
-rw-r--r-- | src/components/services/Prowlarr.vue | 94 | ||||
-rw-r--r-- | src/components/services/Radarr.vue | 27 | ||||
-rw-r--r-- | src/components/services/Sonarr.vue | 26 | ||||
-rw-r--r-- | yarn.lock | 26 |
7 files changed, 166 insertions, 28 deletions
@@ -56,7 +56,7 @@ | |||
56 | - Search | 56 | - Search |
57 | - Grouping | 57 | - Grouping |
58 | - Theme customization | 58 | - Theme customization |
59 | - Offline heath check | 59 | - Offline health check |
60 | - keyboard shortcuts: | 60 | - keyboard shortcuts: |
61 | - `/` Start searching. | 61 | - `/` Start searching. |
62 | - `Escape` Stop searching. | 62 | - `Escape` Stop searching. |
diff --git a/docs/customservices.md b/docs/customservices.md index 77109b7..7e3e6b3 100644 --- a/docs/customservices.md +++ b/docs/customservices.md | |||
@@ -67,18 +67,28 @@ Two lines are needed in the config.yml : | |||
67 | The url must be the root url of Medusa application. | 67 | The url must be the root url of Medusa application. |
68 | The Medusa API key can be found in General configuration > Interface. It is needed to access Medusa API. | 68 | The Medusa API key can be found in General configuration > Interface. It is needed to access Medusa API. |
69 | 69 | ||
70 | ## Lidarr, Sonarr and Radarr | 70 | ## Lidarr, Prowlarr, Sonarr and Radarr |
71 | 71 | ||
72 | This service displays Activity (blue), Warning (orange) or Error (red) notifications bubbles from the Lidarr, Radarr or Sonarr application. | 72 | This service displays Activity (blue), Warning (orange) or Error (red) notifications bubbles from the Lidarr, Radarr or Sonarr application. |
73 | Two lines are needed in the config.yml : | 73 | Two lines are needed in the config.yml : |
74 | 74 | ||
75 | ```yaml | 75 | ```yaml |
76 | type: "Lidarr", "Radarr" or "Sonarr" | 76 | type: "Lidarr", "Prowlarr", "Radarr" or "Sonarr" |
77 | apikey: "01234deb70424befb1f4ef6a23456789" | 77 | apikey: "01234deb70424befb1f4ef6a23456789" |
78 | ``` | 78 | ``` |
79 | 79 | ||
80 | The url must be the root url of Lidarr, Radarr or Sonarr application. | 80 | The url must be the root url of Lidarr, Prowlarr, Radarr or Sonarr application. |
81 | The Lidarr, Radarr or Sonarr API key can be found in Settings > General. It is needed to access the API. | 81 | The Lidarr, Prowlarr, Radarr or Sonarr API key can be found in Settings > General. It is needed to access the API. |
82 | If you are using an older version of Radarr or Sonarr which don't support the new V3 api endpoints, add the following line to your service config "legacyApi: true", example: | ||
83 | |||
84 | ```yaml | ||
85 | - name: "Radarr" | ||
86 | type: "Radarr" | ||
87 | url: "http://localhost:7878/" | ||
88 | apikey: "MY-SUPER-SECRET-API-KEY" | ||
89 | target: "_blank" | ||
90 | legacyApi: true | ||
91 | ``` | ||
82 | 92 | ||
83 | ## PaperlessNG | 93 | ## PaperlessNG |
84 | 94 | ||
diff --git a/src/App.vue b/src/App.vue index 4eb112d..9a67a33 100644 --- a/src/App.vue +++ b/src/App.vue | |||
@@ -211,6 +211,7 @@ export default { | |||
211 | window.location.href = response.url; | 211 | window.location.href = response.url; |
212 | return; | 212 | return; |
213 | } | 213 | } |
214 | |||
214 | if (!response.ok) { | 215 | if (!response.ok) { |
215 | throw Error(`${response.statusText}: ${response.body}`); | 216 | throw Error(`${response.statusText}: ${response.body}`); |
216 | } | 217 | } |
diff --git a/src/components/services/Prowlarr.vue b/src/components/services/Prowlarr.vue new file mode 100644 index 0000000..abaa0f0 --- /dev/null +++ b/src/components/services/Prowlarr.vue | |||
@@ -0,0 +1,94 @@ | |||
1 | <template> | ||
2 | <Generic :item="item"> | ||
3 | <template #indicator> | ||
4 | <div class="notifs"> | ||
5 | <strong v-if="warnings > 0" class="notif warnings" title="Warning"> | ||
6 | {{ warnings }} | ||
7 | </strong> | ||
8 | <strong v-if="errors > 0" class="notif errors" title="Error"> | ||
9 | {{ errors }} | ||
10 | </strong> | ||
11 | <strong | ||
12 | v-if="serverError" | ||
13 | class="notif errors" | ||
14 | title="Connection error to Prowlarr API, check url and apikey in config.yml" | ||
15 | > | ||
16 | ? | ||
17 | </strong> | ||
18 | </div> | ||
19 | </template> | ||
20 | </Generic> | ||
21 | </template> | ||
22 | |||
23 | <script> | ||
24 | import service from "@/mixins/service.js"; | ||
25 | import Generic from "./Generic.vue"; | ||
26 | |||
27 | export default { | ||
28 | name: "Prowlarr", | ||
29 | mixins: [service], | ||
30 | props: { | ||
31 | item: Object, | ||
32 | }, | ||
33 | components: { | ||
34 | Generic, | ||
35 | }, | ||
36 | data: () => { | ||
37 | return { | ||
38 | warnings: null, | ||
39 | errors: null, | ||
40 | serverError: false, | ||
41 | }; | ||
42 | }, | ||
43 | created: function () { | ||
44 | this.fetchConfig(); | ||
45 | }, | ||
46 | methods: { | ||
47 | fetchConfig: function () { | ||
48 | this.fetch(`/api/v1/health?apikey=${this.item.apikey}`) | ||
49 | .then((health) => { | ||
50 | this.warnings = 0; | ||
51 | this.errors = 0; | ||
52 | for (var i = 0; i < health.length; i++) { | ||
53 | if (health[i].type == "warning") { | ||
54 | this.warnings++; | ||
55 | } else if (health[i].type == "error") { | ||
56 | this.errors++; | ||
57 | } | ||
58 | } | ||
59 | }) | ||
60 | .catch((e) => { | ||
61 | console.error(e); | ||
62 | this.serverError = true; | ||
63 | }); | ||
64 | }, | ||
65 | }, | ||
66 | }; | ||
67 | </script> | ||
68 | |||
69 | <style scoped lang="scss"> | ||
70 | .notifs { | ||
71 | position: absolute; | ||
72 | color: white; | ||
73 | font-family: sans-serif; | ||
74 | top: 0.3em; | ||
75 | right: 0.5em; | ||
76 | |||
77 | .notif { | ||
78 | display: inline-block; | ||
79 | padding: 0.2em 0.35em; | ||
80 | border-radius: 0.25em; | ||
81 | position: relative; | ||
82 | margin-left: 0.3em; | ||
83 | font-size: 0.8em; | ||
84 | |||
85 | &.warnings { | ||
86 | background-color: #d08d2e; | ||
87 | } | ||
88 | |||
89 | &.errors { | ||
90 | background-color: #e51111; | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | </style> | ||
diff --git a/src/components/services/Radarr.vue b/src/components/services/Radarr.vue index a57c895..7573667 100644 --- a/src/components/services/Radarr.vue +++ b/src/components/services/Radarr.vue | |||
@@ -26,6 +26,9 @@ | |||
26 | import service from "@/mixins/service.js"; | 26 | import service from "@/mixins/service.js"; |
27 | import Generic from "./Generic.vue"; | 27 | import Generic from "./Generic.vue"; |
28 | 28 | ||
29 | const V3_API = "/api/v3"; | ||
30 | const LEGACY_API = "/api"; | ||
31 | |||
29 | export default { | 32 | export default { |
30 | name: "Radarr", | 33 | name: "Radarr", |
31 | mixins: [service], | 34 | mixins: [service], |
@@ -46,9 +49,14 @@ export default { | |||
46 | created: function () { | 49 | created: function () { |
47 | this.fetchConfig(); | 50 | this.fetchConfig(); |
48 | }, | 51 | }, |
52 | computed: { | ||
53 | apiPath() { | ||
54 | return this.item.legacyApi ? LEGACY_API : V3_API; | ||
55 | }, | ||
56 | }, | ||
49 | methods: { | 57 | methods: { |
50 | fetchConfig: function () { | 58 | fetchConfig: function () { |
51 | this.fetch(`/api/health?apikey=${this.item.apikey}`) | 59 | this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`) |
52 | .then((health) => { | 60 | .then((health) => { |
53 | this.warnings = 0; | 61 | this.warnings = 0; |
54 | this.errors = 0; | 62 | this.errors = 0; |
@@ -64,12 +72,21 @@ export default { | |||
64 | console.error(e); | 72 | console.error(e); |
65 | this.serverError = true; | 73 | this.serverError = true; |
66 | }); | 74 | }); |
67 | this.fetch(`/api/queue?apikey=${this.item.apikey}`) | 75 | this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`) |
68 | .then((queue) => { | 76 | .then((queue) => { |
69 | this.activity = 0; | 77 | this.activity = 0; |
70 | for (var i = 0; i < queue.length; i++) { | 78 | |
71 | if (queue[i].movie) { | 79 | if (this.item.legacyApi) { |
72 | this.activity++; | 80 | for (var i = 0; i < queue.length; i++) { |
81 | if (queue[i].movie) { | ||
82 | this.activity++; | ||
83 | } | ||
84 | } | ||
85 | } else { | ||
86 | for (const record of queue.records) { | ||
87 | if (record.movieId) { | ||
88 | this.activity++; | ||
89 | } | ||
73 | } | 90 | } |
74 | } | 91 | } |
75 | }) | 92 | }) |
diff --git a/src/components/services/Sonarr.vue b/src/components/services/Sonarr.vue index f8dd0d1..55df437 100644 --- a/src/components/services/Sonarr.vue +++ b/src/components/services/Sonarr.vue | |||
@@ -27,6 +27,9 @@ | |||
27 | import service from "@/mixins/service.js"; | 27 | import service from "@/mixins/service.js"; |
28 | import Generic from "./Generic.vue"; | 28 | import Generic from "./Generic.vue"; |
29 | 29 | ||
30 | const V3_API = "/api/v3"; | ||
31 | const LEGACY_API = "/api"; | ||
32 | |||
30 | export default { | 33 | export default { |
31 | name: "Sonarr", | 34 | name: "Sonarr", |
32 | mixins: [service], | 35 | mixins: [service], |
@@ -36,6 +39,11 @@ export default { | |||
36 | components: { | 39 | components: { |
37 | Generic, | 40 | Generic, |
38 | }, | 41 | }, |
42 | computed: { | ||
43 | apiPath() { | ||
44 | return this.item.legacyApi ? LEGACY_API : V3_API; | ||
45 | }, | ||
46 | }, | ||
39 | data: () => { | 47 | data: () => { |
40 | return { | 48 | return { |
41 | activity: null, | 49 | activity: null, |
@@ -49,7 +57,7 @@ export default { | |||
49 | }, | 57 | }, |
50 | methods: { | 58 | methods: { |
51 | fetchConfig: function () { | 59 | fetchConfig: function () { |
52 | this.fetch(`/api/health?apikey=${this.item.apikey}`) | 60 | this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`) |
53 | .then((health) => { | 61 | .then((health) => { |
54 | this.warnings = 0; | 62 | this.warnings = 0; |
55 | this.errors = 0; | 63 | this.errors = 0; |
@@ -65,12 +73,20 @@ export default { | |||
65 | console.error(e); | 73 | console.error(e); |
66 | this.serverError = true; | 74 | this.serverError = true; |
67 | }); | 75 | }); |
68 | this.fetch(`/api/queue?apikey=${this.item.apikey}`) | 76 | this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`) |
69 | .then((queue) => { | 77 | .then((queue) => { |
70 | this.activity = 0; | 78 | this.activity = 0; |
71 | for (var i = 0; i < queue.length; i++) { | 79 | if (this.item.legacyApi) { |
72 | if (queue[i].series) { | 80 | for (var i = 0; i < queue.length; i++) { |
73 | this.activity++; | 81 | if (queue[i].series) { |
82 | this.activity++; | ||
83 | } | ||
84 | } | ||
85 | } else { | ||
86 | for (const record of queue.records) { | ||
87 | if (record.seriesId) { | ||
88 | this.activity++; | ||
89 | } | ||
74 | } | 90 | } |
75 | } | 91 | } |
76 | }) | 92 | }) |
@@ -2339,9 +2339,9 @@ caniuse-api@^3.0.0: | |||
2339 | lodash.uniq "^4.5.0" | 2339 | lodash.uniq "^4.5.0" |
2340 | 2340 | ||
2341 | caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001219: | 2341 | caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001219: |
2342 | version "1.0.30001245" | 2342 | version "1.0.30001311" |
2343 | resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001245.tgz#45b941bbd833cb0fa53861ff2bae746b3c6ca5d4" | 2343 | resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001311.tgz" |
2344 | integrity sha512-768fM9j1PKXpOCKws6eTo3RHmvTUsG9UrpT4WoREFeZgJBTi4/X9g565azS/rVUGtqb8nt7FjLeF5u4kukERnA== | 2344 | integrity sha512-mleTFtFKfykEeW34EyfhGIFjGCqzhh38Y0LhdQ9aWF+HorZTtdgKV/1hEE0NlFkG2ubvisPV6l400tlbPys98A== |
2345 | 2345 | ||
2346 | case-sensitive-paths-webpack-plugin@^2.3.0: | 2346 | case-sensitive-paths-webpack-plugin@^2.3.0: |
2347 | version "2.4.0" | 2347 | version "2.4.0" |
@@ -2773,10 +2773,10 @@ core-js@^2.4.0: | |||
2773 | resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" | 2773 | resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec" |
2774 | integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== | 2774 | integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ== |
2775 | 2775 | ||
2776 | core-js@^3.17.3: | 2776 | core-js@^3.19.3: |
2777 | version "3.17.3" | 2777 | version "3.20.2" |
2778 | resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.17.3.tgz#8e8bd20e91df9951e903cabe91f9af4a0895bc1e" | 2778 | resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.20.2.tgz#46468d8601eafc8b266bd2dd6bf9dee622779581" |
2779 | integrity sha512-lyvajs+wd8N1hXfzob1LdOCCHFU4bGMbqqmLn1Q4QlCpDqWPpGf+p0nj+LNrvDDG33j0hZXw2nsvvVpHysxyNw== | 2779 | integrity sha512-nuqhq11DcOAbFBV4zCbKeGbKQsUDRqTX0oqx7AttUBuqe3h20ixsE039QHelbL6P4h+9kytVqyEtyZ6gsiwEYw== |
2780 | 2780 | ||
2781 | core-js@^3.6.5: | 2781 | core-js@^3.6.5: |
2782 | version "3.15.2" | 2782 | version "3.15.2" |
@@ -3999,9 +3999,9 @@ flush-write-stream@^1.0.0: | |||
3999 | readable-stream "^2.3.6" | 3999 | readable-stream "^2.3.6" |
4000 | 4000 | ||
4001 | follow-redirects@^1.0.0: | 4001 | follow-redirects@^1.0.0: |
4002 | version "1.14.1" | 4002 | version "1.14.8" |
4003 | resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43" | 4003 | resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.8.tgz#016996fb9a11a100566398b1c6839337d7bfa8fc" |
4004 | integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg== | 4004 | integrity sha512-1x0S9UVJHsQprFcEC/qnNzBLcIxsjAV905f/UkQxbclCsoTWlacCNOpQa/anodLl2uaEKFhfWOvM2Qg77+15zA== |
4005 | 4005 | ||
4006 | for-in@^1.0.2: | 4006 | for-in@^1.0.2: |
4007 | version "1.0.2" | 4007 | version "1.0.2" |
@@ -8227,9 +8227,9 @@ url-loader@^2.2.0: | |||
8227 | schema-utils "^2.5.0" | 8227 | schema-utils "^2.5.0" |
8228 | 8228 | ||
8229 | url-parse@^1.4.3, url-parse@^1.5.1: | 8229 | url-parse@^1.4.3, url-parse@^1.5.1: |
8230 | version "1.5.3" | 8230 | version "1.5.7" |
8231 | resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.3.tgz#71c1303d38fb6639ade183c2992c8cc0686df862" | 8231 | resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.7.tgz#00780f60dbdae90181f51ed85fb24109422c932a" |
8232 | integrity sha512-IIORyIQD9rvj0A4CLWsHkBBJuNqWpFQe224b6j9t/ABmquIS0qDU2pY6kl6AuOrL5OkCXHMCFNe1jBcuAggjvQ== | 8232 | integrity sha512-HxWkieX+STA38EDk7CE9MEryFeHCKzgagxlGvsdS7WBImq9Mk+PGwiT56w82WI3aicwJA8REp42Cxo98c8FZMA== |
8233 | dependencies: | 8233 | dependencies: |
8234 | querystringify "^2.1.1" | 8234 | querystringify "^2.1.1" |
8235 | requires-port "^1.0.0" | 8235 | requires-port "^1.0.0" |