Files
homepage/src/widgets/ntfy/widget.js
T
shamoon 5d71c3aa65
Docker CI / Docker Build & Push (push) Has been cancelled
Lint / Linting Checks (push) Has been cancelled
Release Drafter / Update Release Draft (push) Has been cancelled
Release Drafter / Auto Label PR (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled
Fix: allow empty data for ntfy widget (#6653)
2026-05-10 07:28:31 -07:00

32 lines
614 B
JavaScript

import { asJson } from "utils/proxy/api-helpers";
import credentialedProxyHandler from "utils/proxy/handlers/credentialed";
const noMessages = {
title: null,
message: null,
priority: 3,
time: null,
tags: [],
};
const widget = {
api: "{url}/{endpoint}",
proxyHandler: credentialedProxyHandler,
mappings: {
messages: {
endpoint: "{topic}/json?poll=1&since=latest",
allowEmpty: true,
map: (data) => {
if (Buffer.isBuffer(data) && data.length === 0) {
return noMessages;
}
return asJson(data);
},
},
},
};
export default widget;