From 35c7d0c3205bcffb1900c650dca19362ebf167be Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Mon, 13 Jan 2025 11:56:44 -0500 Subject: [PATCH] feat(apprise): Add markdown ENV option --- notifiers/apprise/program.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/notifiers/apprise/program.ts b/notifiers/apprise/program.ts index b971196..773d9c9 100644 --- a/notifiers/apprise/program.ts +++ b/notifiers/apprise/program.ts @@ -5,12 +5,14 @@ import { URLData } from "../common/atomic.ts"; import { nonEmptyStringOrDefault, normalizeWebAddress, parseArrayFromMaybeString, truncateStringToLength } from "../common/stringUtils.ts"; import { isPortReachable, joinedUrl } from "../common/networkUtils.ts"; import { titleAndSubtitle } from "../common/notifierBuilder.ts"; +import { valToBoolean } from "../../common/utils.ts"; interface AppriseOptions { endpoint: URLData urls: string[] keys: string[] tag?: string + markdown?: boolean } const upstreamFailureHint = 'HINT: Status 424 means a dependency upstream of Apprise failed. This is usually a connection or authentication issue. Check Apprise logs to see more details.'; @@ -19,6 +21,8 @@ const shortKey = truncateStringToLength(10); const parseAppriseOptions = async (): Promise => { + const markdown = valToBoolean(Deno.env.get("MARKDOWN")); + const host = nonEmptyStringOrDefault(Deno.env.get("APPRISE_HOST") as string); if(host === undefined) { @@ -64,7 +68,7 @@ const parseAppriseOptions = async (): Promise => { } } - return {endpoint, urls, keys, tag}; + return {endpoint, urls, keys, tag, markdown}; } const callApi = async (req: Request): Promise => { @@ -204,7 +208,7 @@ const program = async () => { let data: CommonAlert; try { - data = parseAlert(alert, { ...commonOpts }); + data = parseAlert(alert, { ...commonOpts, markdown: appriseOptions.markdown }); } catch (e) { console.debug("Komodo Alert Payload:", alert); console.error(e); -- 2.51.2