feat(prayer-times): add Jakarta prayer time plugins and enhance ntfy integration
- Introduced two new plugins: `jakarta-prayer-time-parser-for-ntfy` for formatting prayer times as ntfy Markdown, and `jakarta-prayer-time-today-and-tomorrow` for fetching prayer times from Kemenag for today and tomorrow. - Enhanced `ntfy.js` to support improved Markdown header handling and added a utility function for Markdown configuration validation. - Updated plugin metadata and descriptions for clarity on functionality and usage. - Implemented robust error handling and logging for better debugging and user feedback.
This commit is contained in:
@@ -15,13 +15,24 @@ function ntfyHeaders(ctx) {
|
||||
headers.Title = ctx.data.title;
|
||||
}
|
||||
|
||||
if (ctx.config?.markdown === true) {
|
||||
headers.md = "true";
|
||||
if (isMarkdownEnabled(ctx.config?.markdown)) {
|
||||
// ntfy accepts X-Markdown / Markdown / md with true | 1 | yes
|
||||
headers.Markdown = "yes";
|
||||
log.info("ntfy: Markdown enabled");
|
||||
}
|
||||
|
||||
return headers;
|
||||
}
|
||||
|
||||
function isMarkdownEnabled(value) {
|
||||
if (value === true || value === 1) return true;
|
||||
if (typeof value === "string") {
|
||||
const v = value.trim().toLowerCase();
|
||||
return v === "true" || v === "yes" || v === "1";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function resolveFingerprintKey(config) {
|
||||
const fingerprint = config?.fingerprint;
|
||||
if (fingerprint === true) return "fingerprint:ntfy";
|
||||
@@ -156,7 +167,8 @@ ntfy.meta = {
|
||||
markdown: {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
description: "Send as Markdown (ntfy md header)",
|
||||
description:
|
||||
"Render body as Markdown (sets Markdown: yes; aliases X-Markdown / md also accepted by ntfy)",
|
||||
},
|
||||
fingerprint: {
|
||||
type: "string",
|
||||
|
||||
Reference in New Issue
Block a user