mirror of https://github.com/bastienwirtz/homer
Merge e2ca5d5819
into c230392da8
commit
91fefbcca2
|
@ -30,6 +30,7 @@ within Homer:
|
|||
- [Matrix](#matrix)
|
||||
- [Mealie](#mealie)
|
||||
- [Medusa](#medusa)
|
||||
- [Miniflux](#miniflux)
|
||||
- [Nextcloud](#nextcloud)
|
||||
- [OctoPrint / Moonraker](#octoprintmoonraker)
|
||||
- [Olivetin](#olivetin)
|
||||
|
@ -350,6 +351,21 @@ 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.
|
||||
|
||||
## Miniflux
|
||||
|
||||
This service displays a version string instead of a subtitle. The indicator
|
||||
shows if Miniflux is online or offline.
|
||||
|
||||
Example configuration:
|
||||
|
||||
```yaml
|
||||
- name: "Miniflux"
|
||||
type: "Miniflux"
|
||||
logo: "assets/tools/sample.png"
|
||||
url: "http://miniflux.example.com"
|
||||
apikey: "<---insert-api-key-here--->"
|
||||
```
|
||||
|
||||
## Nextcloud
|
||||
|
||||
This service displays a version string instead of a subtitle. The indicator
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
<template>
|
||||
<Generic :item="item">
|
||||
<template #content>
|
||||
<p class="title is-4">{{ item.name }}</p>
|
||||
<p class="subtitle is-6">
|
||||
<template v-if="item.subtitle">
|
||||
{{ item.subtitle }}
|
||||
</template>
|
||||
<template v-else-if="versionstring">
|
||||
Unreads {{ versionstring }}
|
||||
</template>
|
||||
</p>
|
||||
</template>
|
||||
<template #indicator>
|
||||
<div v-if="status" class="status" :class="status">
|
||||
{{ status }}
|
||||
</div>
|
||||
</template>
|
||||
</Generic>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import service from "@/mixins/service.js";
|
||||
|
||||
export default {
|
||||
name: "Miniflux",
|
||||
mixins: [service],
|
||||
props: {
|
||||
item: Object,
|
||||
},
|
||||
data: () => ({
|
||||
status: null,
|
||||
versionstring: null,
|
||||
}),
|
||||
created() {
|
||||
this.fetchStatus();
|
||||
this.fetchUnreads();
|
||||
},
|
||||
methods: {
|
||||
fetchStatus: async function () {
|
||||
const headers = {
|
||||
'X-Auth-Token': this.item.apikey,
|
||||
};
|
||||
this.fetch("/v1/version", { headers })
|
||||
.then((response) => {
|
||||
this.status = "online";
|
||||
// this.versionstring = response.version;
|
||||
})
|
||||
.catch((e) => {
|
||||
this.status = "offline";
|
||||
console.log(e);
|
||||
});
|
||||
},
|
||||
fetchUnreads: async function() {
|
||||
const headers = {
|
||||
'X-Auth-Token': this.item.apikey,
|
||||
};
|
||||
this.fetch("/v1/feeds/counters", { headers })
|
||||
.then((response) => {
|
||||
this.versionstring = this.countUnreads(response.unreads);
|
||||
})
|
||||
.catch((e) => {
|
||||
console.log(e);
|
||||
});
|
||||
},
|
||||
countUnreads: function (unreads) {
|
||||
// count all values on the array
|
||||
return Object.values(unreads).reduce((a, b) => a + b, 0);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.status {
|
||||
font-size: 0.8rem;
|
||||
color: var(--text-title);
|
||||
white-space: nowrap;
|
||||
margin-left: 0.25rem;
|
||||
|
||||
&.online:before {
|
||||
background-color: #94e185;
|
||||
border-color: #78d965;
|
||||
box-shadow: 0 0 5px 1px #94e185;
|
||||
}
|
||||
|
||||
&.offline:before {
|
||||
background-color: #c9404d;
|
||||
border-color: #c42c3b;
|
||||
box-shadow: 0 0 5px 1px #c9404d;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: " ";
|
||||
display: inline-block;
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
margin-right: 10px;
|
||||
border: 1px solid #000;
|
||||
border-radius: 7px;
|
||||
}
|
||||
}
|
||||
</style>
|
Loading…
Reference in New Issue