Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (data.from === 'dat-gitter') {
var split = data.message.split(/(\([\S]*\))/)
data.gitter = true
// long gitter messages don't have username at beginning
if (split.length > 1) {
data.from = split[1].slice(1,split[1].length - 1)
data.message = split[2]
} else {
// continued message, get previous message user
data.from = state.messages[0].from
data.message = split[0]
}
}
data.moment = moment(data.timestamp)
data.html = Autolinker.link(data.message)
return data
}
const formatMessageForFrequencyLinks = (message: string): string => {
if (!message) {
return '';
}
const cleanMessage = sanitizeHtml(message);
const linkedMessage = Autolinker.link(
cleanMessage.replace(
FREQUENCIES,
`$1https://spectrum.chat/${activeCommunity}/$2`,
),
);
// Remove the "spectrum.chat" part from the link text so in the message
// you just see "~frequency", but it's linked to the frequency
return linkedMessage.replace(FREQUENCY_ANCHORS, '>$1');
};
ALLOWED_ATTR: ['href'],
ALLOW_DATA_ATTR: false
})
return h('.message', [image].concat([
h('.right', [
h('span.sender', message.sender),
h('span.timestamp', message.timestamp),
h('span.content', convertHTML('<span>' + pureContent + '</span>'))
])
]))
} else {
return h('.message.message-without-image', [
h('span.sender', message.sender),
h('span.timestamp', message.timestamp),
h('span.content', convertHTML('<span>' + autolinker.link(message.content, { stripPrefix: false }) + '</span>'))
])
}
})
.then(function(results) {
var user = Object.assign({}, results[0], results[1]);
var user_counts = _.result(user, 'counts');
var text = Autolinker.link(_.result(user, 'bio', ''), { mention: 'instagram', hashtag: 'instagram' });
return _.pick(
Object.assign(
user_to_account(user),
{
text: text,
stats: {
content: Number(_.result(user_counts, 'media')),
followers: Number(_.result(user_counts, 'followed_by')),
following: Number(_.result(user_counts, 'follows'))
},
content: results[2] && {
api: 'instagram',
type: 'account_content',
id: _.result(user, 'username'),
content: _.map(results[2], media_to_content)
autolinkedText(tweet) {
let text = tweet.text;
for (let entity of tweet.entities.urls) {
text = text.replace(entity.url, entity.expanded_url);
}
for (let entity of (tweet.entities.media || [])) {
text = text.replace(entity.url, entity.display_url);
}
return {
__html: Autolinker.link(
text.replace(/\n/g, '<br>'),
{ className: 'external-link' },
),
};
}
formatMessage(message) {
if (!message) {
return '';
}
let cleanMessage = sanitizeHtml(message);
let linkedMessage = Autolinker.link(cleanMessage);
return linkedMessage;
}
renderSnippetDescription (gist) {
const { title, description, customTags } = descriptionParser(gist.brief.description)
const htmlForDescriptionSection = []
if (title.length > 0) {
htmlForDescriptionSection.push(<div>{ title }</div>)
}
htmlForDescriptionSection.push(
<div>
)
htmlForDescriptionSection.push(
<div>
{ customTags.length > 0
? <span>
<div>
<span>{ customTags.substring('#tags:'.length) }</span>
: null }
<span></span></div></span></div></div>
let getDescription = () => {
const safeDescription = escape(props.repo.description);
return {
__html: Autolinker.link(safeDescription, {
email: false,
phone: false,
twitter: false,
}),
};
};