IKHSAN
EN Read in EnglishID

pixies

Publik
Branch
master
Commit terakhir
9b0697f26 Oktober 2026

healthChecks.js

Buka raw
import { postJson } from "../util/http.js";

const events = [
    ['minutePassed'],
    ['testStarted', "start"],
    ['testFinished'],
    ['testFailed', "fail"]
];

export default (registerEvent) => {
    for (const [event, path] of events) {
        registerEvent(event, async ({data: c}, payload, activity) => {
            if (!c.url) return;
            await postJson(path ? `${c.url}/${path}` : c.url, payload ?? {},
                {headers: {"user-agent": "Pixies/HealthAgent"}, activity});
        });
    }

    return {
        icon: "fa-solid fa-heart-pulse",
        fields: [
            {name: "url", type: "text", required: true, regex: /https?:\/\/.+/},
            {name: "interval", type: "number", required: false, min: 1, max: 1440}
        ]
    };
};
byte
776
baris
27
Jenis
js
Commit terakhir
26 Oktober 2026