feat: display version and update status for Wg-easy

pull/946/head
3thibaut1304 2025-06-20 21:53:47 +02:00
parent c230392da8
commit 11c9a7a58a
2 changed files with 116 additions and 0 deletions

View File

@ -56,6 +56,7 @@ within Homer:
- [Uptime Kuma](#uptime-kuma)
- [Vaultwarden](#vaultwarden)
- [Wallabag](#wallabag)
- [Wg-easy](#wg-easy)
- [What's Up Docker](#whats-up-docker)
> [!IMPORTANT]
@ -762,6 +763,20 @@ This service displays a version string instead of a subtitle. Example configurat
url: https://wallabag.example.com
```
## Wg-easy
This service displays a version string instead of a subtitle.
If a new version is available, it will also be shown alongside the current one.
The indicator shows if Wg-easy is online, offline. Example configuration:
```yaml
- name: "Wireguard"
type: Wg-easy
logo: assets/tools/sample.png
url: http://wg-easy.example.com
basic_auth: "admin:password"
```
## What's up Docker
What's up Docker allow to display info about the number of container running and the number for which an update is available on your Homer dashboard.

View File

@ -0,0 +1,101 @@
<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">
Version {{ versionstring }}
<span v-if="updateAvailable"> </span>
<span v-if="updateAvailable" style="color: orange; font-weight: 500;">
Update available {{ latestVersion }}
</span>
</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: "Wg-easy",
mixins: [service],
props: {
item: Object,
},
data: () => ({
fetchOk: null,
versionstring: null,
latestVersion: null,
updateAvailable: false,
}),
computed: {
status: function () {
return this.fetchOk ? "online" : "offline";
},
},
created() {
this.fetchStatus();
},
methods: {
fetchStatus: async function () {
let headers = {};
if (this.item.basic_auth) {
const encodedCredentials = btoa(this.item.basic_auth);
headers["Authorization"] = `Basic ${encodedCredentials}`;
}
try {
const response = await this.fetch("/api/information", { headers });
this.fetchOk = true;
this.versionstring = response.currentRelease || "inconnue";
this.updateAvailable = response.updateAvailable;
this.latestVersion = response.latestRelease?.version || null;
} 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>