mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2025-01-08 10:23:29 +01:00
19 lines
601 B
TypeScript
19 lines
601 B
TypeScript
|
/*
|
||
|
* SPDX-FileCopyrightText: dakkar and other Sharkey contributors
|
||
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||
|
*/
|
||
|
|
||
|
import original from 'sanitize-html';
|
||
|
|
||
|
export default function sanitizeHtml(str: string | null): string | null {
|
||
|
if (str == null) return str;
|
||
|
return original(str, {
|
||
|
allowedTags: original.defaults.allowedTags.concat(['img', 'audio', 'video', 'center', 'details', 'summary']),
|
||
|
allowedAttributes: {
|
||
|
...original.defaults.allowedAttributes,
|
||
|
a: original.defaults.allowedAttributes.a.concat(['style']),
|
||
|
img: original.defaults.allowedAttributes.img.concat(['style']),
|
||
|
},
|
||
|
});
|
||
|
}
|