feat: Domain name expiry (#6413)

Co-authored-by: AiroPi <47398145+AiroPi@users.noreply.github.com>
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
Shaan
2025-12-20 16:32:49 +00:00
committed by GitHub
co-authored by AiroPi Frank Elsinga
parent f3c76dbc6f
commit eb0b6cdb09
17 changed files with 926 additions and 14 deletions
+61 -8
View File
@@ -60,13 +60,35 @@
<div class="mt-1 mb-3 ps-2 cert-exp-days col-12 col-xl-6">
<div v-for="day in settings.tlsExpiryNotifyDays" :key="day" class="d-flex align-items-center justify-content-between cert-exp-day-row py-2">
<span>{{ day }} {{ $tc("day", day) }}</span>
<button type="button" class="btn-rm-expiry btn btn-outline-danger ms-2 py-1" :aria-label="$t('Remove the expiry notification')" @click="removeExpiryNotifDay(day)">
<button type="button" class="btn-rm-expiry btn btn-outline-danger ms-2 py-1" :aria-label="$t('Remove the expiry notification')" @click="removeTlsExpiryNotifDay(day)">
<font-awesome-icon icon="times" />
</button>
</div>
</div>
<div class="col-12 col-xl-6">
<ActionInput v-model="expiryNotifInput" :type="'number'" :placeholder="$t('day')" :icon="'plus'" :action="() => addExpiryNotifDay(expiryNotifInput)" :action-aria-label="$t('Add a new expiry notification day')" />
<ActionInput v-model="tlsExpiryNotifInput" :type="'number'" :placeholder="$t('day')" :icon="'plus'" :action="() => addTlsExpiryNotifDay(tlsExpiryNotifInput)" :action-aria-label="$t('Add a new expiry notification day')" />
</div>
<div>
<button class="btn btn-primary" type="button" @click="saveSettings()">
{{ $t("Save") }}
</button>
</div>
</div>
<div class="my-4 pt-4">
<h5 class="my-4 settings-subheading">{{ $t("settingsDomainExpiry") }}</h5>
<p>{{ $t("domainExpiryDescription") }}</p>
<p>{{ $t("notificationDescription") }}</p>
<div class="mt-1 mb-3 ps-2 cert-exp-days col-12 col-xl-6">
<div v-for="day in settings.domainExpiryNotifyDays" :key="day" class="d-flex align-items-center justify-content-between cert-exp-day-row py-2">
<span>{{ day }} {{ $tc("day", day) }}</span>
<button type="button" class="btn-rm-expiry btn btn-outline-danger ms-2 py-1" :aria-label="$t('Remove the expiry notification')" @click="removeDomainExpiryNotifDay(day)">
<font-awesome-icon icon="times" />
</button>
</div>
</div>
<div class="col-12 col-xl-6">
<ActionInput v-model="domainExpiryNotifInput" :type="'number'" :placeholder="$t('day')" :icon="'plus'" :action="() => addDomainExpiryNotifDay(domainExpiryNotifInput)" :action-aria-label="$t('Add a new expiry notification day')" />
</div>
<div>
<button class="btn btn-primary" type="button" @click="saveSettings()">
@@ -96,7 +118,8 @@ export default {
/**
* Variable to store the input for new certificate expiry day.
*/
expiryNotifInput: null,
tlsExpiryNotifInput: null,
domainExpiryNotifInput: null,
};
},
@@ -134,15 +157,15 @@ export default {
methods: {
/**
* Remove a day from expiry notification days.
* Remove a day from tls expiry notification days.
* @param {number} day The day to remove.
* @returns {void}
*/
removeExpiryNotifDay(day) {
removeTlsExpiryNotifDay(day) {
this.settings.tlsExpiryNotifyDays = this.settings.tlsExpiryNotifyDays.filter(d => d !== day);
},
/**
* Add a new expiry notification day.
* Add a new tls expiry notification day.
* Will verify:
* - day is not null or empty string.
* - day is a number.
@@ -151,14 +174,44 @@ export default {
* @param {number} day The day number to add.
* @returns {void}
*/
addExpiryNotifDay(day) {
addTlsExpiryNotifDay(day) {
if (day != null && day !== "") {
const parsedDay = parseInt(day);
if (parsedDay != null && !isNaN(parsedDay) && parsedDay > 0) {
if (!this.settings.tlsExpiryNotifyDays.includes(parsedDay)) {
this.settings.tlsExpiryNotifyDays.push(parseInt(day));
this.settings.tlsExpiryNotifyDays.sort((a, b) => a - b);
this.expiryNotifInput = null;
this.tlsExpiryNotifInput = null;
}
}
}
},
/**
* Remove a day from domain expiry notification days.
* @param {number} day The day to remove.
* @returns {void}
*/
removeDomainExpiryNotifDay(day) {
this.settings.domainExpiryNotifyDays = this.settings.domainExpiryNotifyDays.filter(d => d !== day);
},
/**
* Add a new domain expiry notification day.
* Will verify:
* - day is not null or empty string.
* - day is a number.
* - day is > 0.
* - The day is not already in the list.
* @param {number} day The day number to add.
* @returns {void}
*/
addDomainExpiryNotifDay(day) {
if (day != null && day !== "") {
const parsedDay = parseInt(day);
if (parsedDay != null && !isNaN(parsedDay) && parsedDay > 0) {
if (!this.settings.domainExpiryNotifyDays.includes(parsedDay)) {
this.settings.domainExpiryNotifyDays.push(parseInt(day));
this.settings.domainExpiryNotifyDays.sort((a, b) => a - b);
this.domainExpiryNotifInput = null;
}
}
}