Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
function isObject (o) {
return o && typeof o === 'object'
}
function toBase64 (s) {
if (isString(s)) return s
else s.toString('base64') // assume a buffer
}
function isString (s) {
return typeof s === 'string'
}
var feedIdRegex = new RegExp(ref.feedIdRegex)
function toMultiserverAddress (address) {
if (isObject(address)) {
if (ref.isFeed(address.key)) {
address.key = address.key.match(feedIdRegex)[1]
}
var protocol = 'net'
if (address.host.endsWith('.onion')) { protocol = 'onion' }
return [protocol, address.host, address.port].join(':') + '~' + ['shs', toBase64(address.key)].join(':')
}
return address
}
function Markdown(markdownText: string) {
const linkifySsbFeeds = linkifyRegex(Ref.feedIdRegex);
const linkifySsbMsgs = linkifyRegex(Ref.msgIdRegex);
return $(ReactMarkdown, {
source: remark()
.use(gemojiToEmoji)
.use(linkifySsbFeeds)
.use(linkifySsbMsgs)
.use(imagesToSsbServeBlobs)
.processSync(markdownText).contents,
astPlugins: [normalizeForReactNative()],
allowedTypes: Object.keys(renderers),
renderers,
});
}