mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 13:35:42 +09:00
feat: Instatus webhooks (#1349)
Co-authored-by: Hampus <[email protected]>
This commit is contained in:
1 parent
8dd230ea2f
commit
dec7b63d07
14 files changed
+1300
-27
No files matched your search
@@ -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;
|
||||
}
|
||||
Reference in new issue
Block a user