]> git.immae.eu Git - github/bastienwirtz/homer.git/commitdiff
Merge branch 'main' into fix/sonarr-radarr-api 365/head
authorBastien Wirtz <bastien.wirtz@gmail.com>
Thu, 10 Feb 2022 20:50:53 +0000 (21:50 +0100)
committerGitHub <noreply@github.com>
Thu, 10 Feb 2022 20:50:53 +0000 (21:50 +0100)
README.md
docs/customservices.md
src/components/services/Prowlarr.vue [new file with mode: 0644]
yarn.lock

index 2dd2b42b50dd6bba697c50b7404ec55b01a4d176..5ea80fb84575b865f964fe2fa69be5fe58c8fd98 100644 (file)
--- a/README.md
+++ b/README.md
@@ -56,7 +56,7 @@
 - Search
 - Grouping
 - Theme customization
-- Offline heath check
+- Offline health check
 - keyboard shortcuts:
   - `/` Start searching.
   - `Escape` Stop searching.
index 93179076bae6b9112fe17b7ecef3bca682e26b53..7e3e6b3e60a9c4f48962e10b3087f73e6ab180a3 100644 (file)
@@ -67,18 +67,18 @@ Two lines are needed in the config.yml :
 The url must be the root url of Medusa application.
 The Medusa API key can be found in General configuration > Interface. It is needed to access Medusa API.
 
-## Lidarr, Sonarr and Radarr
+## Lidarr, Prowlarr, Sonarr and Radarr
 
 This service displays Activity (blue), Warning (orange) or Error (red) notifications bubbles from the Lidarr, Radarr or Sonarr application.
 Two lines are needed in the config.yml :
 
 ```yaml
-  type: "Lidarr", "Radarr" or "Sonarr"
+  type: "Lidarr", "Prowlarr", "Radarr" or "Sonarr"
   apikey: "01234deb70424befb1f4ef6a23456789"
 ```
 
-The url must be the root url of Lidarr, Radarr or Sonarr application.
-The Lidarr, Radarr or Sonarr API key can be found in Settings > General. It is needed to access the API.
+The url must be the root url of Lidarr, Prowlarr, Radarr or Sonarr application.
+The Lidarr, Prowlarr, Radarr or Sonarr API key can be found in Settings > General. It is needed to access the API.
 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: 
 
 ```yaml
diff --git a/src/components/services/Prowlarr.vue b/src/components/services/Prowlarr.vue
new file mode 100644 (file)
index 0000000..c122ca0
--- /dev/null
@@ -0,0 +1,94 @@
+<template>
+  <Generic :item="item">
+    <template #indicator>
+      <div class="notifs">
+        <strong v-if="warnings > 0" class="notif warnings" title="Warning">
+          {{ warnings }}
+        </strong>
+        <strong v-if="errors > 0" class="notif errors" title="Error">
+          {{ errors }}
+        </strong>
+        <strong
+          v-if="serverError"
+          class="notif errors"
+          title="Connection error to Prowlarr API, check url and apikey in config.yml"
+        >
+          ?
+        </strong>
+      </div>
+    </template>
+  </Generic>
+</template>
+
+<script>
+import service from "@/mixins/service.js"
+import Generic from "./Generic.vue"
+
+export default {
+  name: "Prowlarr",
+  mixins: [service],
+  props: {
+    item: Object,
+  },
+  components: {
+    Generic,
+  },
+  data: () => {
+    return {
+      warnings: null,
+      errors: null,
+      serverError: false,
+    }
+  },
+  created: function () {
+    this.fetchConfig()
+  },
+  methods: {
+    fetchConfig: function () {
+      this.fetch(`/api/v1/health?apikey=${this.item.apikey}`)
+        .then((health) => {
+          this.warnings = 0
+          this.errors = 0
+          for (var i = 0; i < health.length; i++) {
+            if (health[i].type == "warning") {
+              this.warnings++
+            } else if (health[i].type == "error") {
+              this.errors++
+            }
+          }
+        })
+        .catch((e) => {
+          console.error(e)
+          this.serverError = true
+        })
+    },
+  },
+}
+</script>
+
+<style scoped lang="scss">
+.notifs {
+  position: absolute;
+  color: white;
+  font-family: sans-serif;
+  top: 0.3em;
+  right: 0.5em;
+
+  .notif {
+    display: inline-block;
+    padding: 0.2em 0.35em;
+    border-radius: 0.25em;
+    position: relative;
+    margin-left: 0.3em;
+    font-size: 0.8em;
+
+    &.warnings {
+      background-color: #d08d2e;
+    }
+
+    &.errors {
+      background-color: #e51111;
+    }
+  }
+}
+</style>
index ca36eb70dbb937cdc521e2d8fced4e0ae9823de8..f3a16d9f8fdbefea7f362c1a8fcadd27bcf6f280 100644 (file)
--- a/yarn.lock
+++ b/yarn.lock
@@ -2773,10 +2773,10 @@ core-js@^2.4.0:
   resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec"
   integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==
 
-core-js@^3.17.3:
-  version "3.17.3"
-  resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.17.3.tgz#8e8bd20e91df9951e903cabe91f9af4a0895bc1e"
-  integrity sha512-lyvajs+wd8N1hXfzob1LdOCCHFU4bGMbqqmLn1Q4QlCpDqWPpGf+p0nj+LNrvDDG33j0hZXw2nsvvVpHysxyNw==
+core-js@^3.19.3:
+  version "3.20.2"
+  resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.20.2.tgz#46468d8601eafc8b266bd2dd6bf9dee622779581"
+  integrity sha512-nuqhq11DcOAbFBV4zCbKeGbKQsUDRqTX0oqx7AttUBuqe3h20ixsE039QHelbL6P4h+9kytVqyEtyZ6gsiwEYw==
 
 core-js@^3.6.5:
   version "3.15.2"
@@ -3999,9 +3999,9 @@ flush-write-stream@^1.0.0:
     readable-stream "^2.3.6"
 
 follow-redirects@^1.0.0:
-  version "1.14.1"
-  resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43"
-  integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==
+  version "1.14.7"
+  resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685"
+  integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==
 
 for-in@^1.0.2:
   version "1.0.2"