feat: Instatus webhooks (#1349)

Co-authored-by: Hampus <[email protected]>
This commit is contained in:
JiraliteandHampus authored and GitHub committed 2026-07-09 22:06:56 +02:00
1 parent 8dd230ea2f
commit dec7b63d07
14 files changed
+1300 -27

No files matched your search

+8
View File
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {URLType} from '@fluxer/schema/src/primitives/UrlValidators';
import {decode} from 'html-entities';
import _ from 'lodash';
@@ -43,3 +44,10 @@ export function hasVisibleContent(value: string): boolean {
export function parseString(value: string, maxLength: number) {
return _.truncate(decode(value).trim(), {length: maxLength});
}
export function safeUrl(value: unknown): string | undefined {
if (typeof value !== 'string' || value.length === 0) return undefined;
if (!value.startsWith('http://') && !value.startsWith('https://')) return undefined;
const parsed = URLType.safeParse(value);
return parsed.success ? parsed.data : undefined;
}