From 8ca4aa4327d0040a3d14291b53077c195ca17911 Mon Sep 17 00:00:00 2001 From: rainbownapkin Date: Sun, 6 Feb 2022 02:14:51 +0000 Subject: [PATCH] Panama Red Hotfix 1: removed - and _ from username symbol mask, embedded links in chat now open in new tab, links to imgur posts now embed as .gif's (ie: https://imgur.com/C2okGV6) --- www/js/fembed.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/www/js/fembed.js b/www/js/fembed.js index 1f69054c..0b251ee8 100644 --- a/www/js/fembed.js +++ b/www/js/fembed.js @@ -14,15 +14,20 @@ function checkMedia(fname){//check if link points ot media } function checkEmbed(word, isEmote){ - let regex = /[!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/g;//symbol mask for username + let regex = /[!"#$%&'()*+,./:;<=>?@[\]^`{|}~]/g;//symbol mask for username let tregex = /["#$%&'()*+,-./:;<=>?@[\]^_`{|}~]/g;//symbol mask for tokes let stripd = word.replace(regex, '');//stripped word for username detection let tstripd = word.replace(tregex, '');//stripeed word for !toke command detection if(word.includes(proto[0]) || word.includes(proto[1])){//check if it starts with a supported proto if(checkMedia(word) != 0){//check if media return '';//embed media - }else if(!isEmote){ - return '' + word + '';//embed link + }else if(!isEmote){//if its a link + if(word.includes("imgur.com")){ + if(word.length > 20 && word.length < 28){ + return '';//embed media + } + } + return '' + word + '';//embed link }else{ return word; }