diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2022-02-10 21:43:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 21:43:58 +0100 |
commit | 5fdf790e2cbfc11acff8e4d93d55433d28dd678f (patch) | |
tree | c0d93a815445ec67540ee4b8bf285d891f9863eb | |
parent | 5afd21a84c0c405a600ca0faf77b3e178175a3ea (diff) | |
parent | 50b3bddff1545d800cc4deeaa6e73b6eb278460d (diff) | |
download | homer-5fdf790e2cbfc11acff8e4d93d55433d28dd678f.tar.gz homer-5fdf790e2cbfc11acff8e4d93d55433d28dd678f.tar.zst homer-5fdf790e2cbfc11acff8e4d93d55433d28dd678f.zip |
Merge pull request #364 from Zareix/feature/add-prowlarr
Added Prowlarr custom services
-rw-r--r-- | docs/customservices.md | 8 | ||||
-rw-r--r-- | src/components/services/Prowlarr.vue | 94 |
2 files changed, 98 insertions, 4 deletions
diff --git a/docs/customservices.md b/docs/customservices.md index 77109b7..747d7a4 100644 --- a/docs/customservices.md +++ b/docs/customservices.md | |||
@@ -67,18 +67,18 @@ 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 | 82 | ||
83 | ## PaperlessNG | 83 | ## PaperlessNG |
84 | 84 | ||
diff --git a/src/components/services/Prowlarr.vue b/src/components/services/Prowlarr.vue new file mode 100644 index 0000000..c122ca0 --- /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> | ||