0
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-11-22 11:47:30 +01:00

Added expiry check for frontend

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
Matthew Nickson 2023-02-14 22:41:06 +00:00
parent 05443f9bb7
commit cd796898d0
No known key found for this signature in database
GPG Key ID: BF229DCFD4748E05

View File

@ -1,19 +1,19 @@
const { BeanModel } = require("redbean-node/dist/bean-model");
const { R } = require("redbean-node");
const dayjs = require("dayjs");
class APIKey extends BeanModel {
/**
* Get the current status of this API key
*/
getStatus() {
let expired = false;
if (expired) {
let current = dayjs();
let expiry = dayjs(this.expires);
if (expiry.diff(current) < 0) {
return "expired";
} else if (this.active) {
return "active";
} else if (!this.active) {
return "inactive";
}
return this.active ? "active" : "inactive";
}
/**