Add Gitea custom service

pull/837/head
Adam Monsen 2023-05-21 12:18:22 -07:00 committed by Bastien Wirtz
parent a8629ba80c
commit 496f9083b2
2 changed files with 101 additions and 0 deletions

View File

@ -16,6 +16,7 @@ within Homer:
- [CopyToClipboard](#copy-to-clipboard)
- [Emby / Jellyfin](#emby--jellyfin)
- [FreshRSS](#freshrss)
- [Gitea / Forgejo](#gitea--forgejo)
- [Gotify](#gotify)
- [Healthchecks](#healthchecks)
- [Home Assistant](#home-assistant)
@ -116,6 +117,17 @@ The FreshRSS service displays unread and subscriptions counts from your FreshRSS
updateInterval: 5000 # (Optional) Interval (in ms) for updating the stats
```
## Gitea / Forgejo
This service displays a version string instead of a subtitle. Example configuration:
```yaml
- name: Forgejo
type: Gitea
logo: assets/tools/sample.png
url: http://git.example.com
```
## Gotify
The Gotify service will show the number of currently oustanding messages

View File

@ -0,0 +1,89 @@
<template>
<Generic :item="item">
<template #content>
<p class="title is-4">{{ item.name }}</p>
<p class="subtitle is-6">
<template v-if="versionstring">
Version {{ 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";
import Generic from "./Generic.vue";
export default {
name: "Gitea",
components: {
Generic,
},
mixins: [service],
props: {
item: Object,
},
data: () => ({
fetchOk: null,
versionstring: null,
}),
computed: {
status: function () {
return this.fetchOk ? "online" : "offline";
},
},
created() {
this.fetchStatus();
},
methods: {
fetchStatus: async function () {
this.fetch("/swagger.v1.json")
.then((response) => {
this.fetchOk = true;
this.versionstring = response.info.version;
})
.catch((e) => {
this.fetchOk = false;
console.log(e);
});
},
},
};
</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>