render email as plain text in checklist and postinstall

This commit is contained in:
Girish Ramakrishnan
2026-02-04 14:43:02 +01:00
parent cd1df37ed3
commit c4055271a8
3 changed files with 29 additions and 9 deletions
+22
View File
@@ -1,6 +1,26 @@
import { prettyBinarySize } from '@cloudron/pankow/utils';
import { RELAY_PROVIDERS, ISTATES, STORAGE_PROVIDERS } from './constants.js';
import { Marked } from 'marked';
function safeMarked() {
const marked = new Marked({
renderer: {
link({ href, title, text }) {
if (href && href.startsWith('mailto:')) return text; // mailto is rendered as text
const titleAttr = title ? ` title="${title}"` : '';
const isAbsolute = href && (href.startsWith('http://') || href.startsWith('https://') || href.startsWith('//'));
const targetAttr = isAbsolute ? ' target="_blank"' : '';
return `<a href="${href}"${targetAttr}${titleAttr}>${text}</a>`;
}
}
});
return marked;
}
function renderSafeMarkdown(text) {
return safeMarked().parse(text);
}
function prettyRelayProviderName(provider) {
if (provider === 'noop') return 'Disabled (no email will be sent)';
@@ -762,6 +782,7 @@ function parseFullBackupPath(fullPath) {
// named exports
export {
renderSafeMarkdown,
prettyRelayProviderName,
download,
mountlike,
@@ -784,6 +805,7 @@ export {
// default export
export default {
renderSafeMarkdown,
prettyRelayProviderName,
download,
mountlike,