diff options
author | cel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519> | 2020-11-26 20:12:54 -0500 |
---|---|---|
committer | cel <cel@lOUVT+Phkvai9a/cCS/RKo+S9hnPAQdVixms/7ldpPA=.ed25519> | 2020-11-26 20:54:34 -0500 |
commit | a255497647e95715d232ef3582a5afa1c0e1d7b3 (patch) | |
tree | 3307834108e7a3ba536748a9e27a6e7f6158b922 /lib/util.js | |
parent | 81d480f805f7e848f179ae9d877459d56c3d6ac9 (diff) | |
download | patchfoo-a255497647e95715d232ef3582a5afa1c0e1d7b3.tar.gz patchfoo-a255497647e95715d232ef3582a5afa1c0e1d7b3.zip |
Don't over-linkify channels in raw msg
Diffstat (limited to 'lib/util.js')
-rw-r--r-- | lib/util.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/util.js b/lib/util.js index 519289a..2fa5c63 100644 --- a/lib/util.js +++ b/lib/util.js @@ -7,6 +7,7 @@ var u = exports u.ssbRefRegex = /((?:@|%|&|ssb:\/\/%)[A-Za-z0-9\/+]{43}=\.[\w\d]+)/g u.ssbRefRegexOnly = /^(?:@|%|&|ssb:\/\/%)[A-Za-z0-9\/+]{43}=\.[\w\d]+$/ u.ssbRefEncRegex = /((?:ssb:\/\/)?(?:[@%&]|%26|%40|%25)(?:[A-Za-z0-9\/+]|%2[fF]|%2[bB]){43}(?:=|%3[dD])\.[\w\d]+)/g +u.channelRegex = /^#[^\s#]+$/ u.isRef = function (str) { if (!str) return false @@ -14,6 +15,12 @@ u.isRef = function (str) { return u.ssbRefRegexOnly.test(str) } +u.isChannel = function (value) { + return typeof value === 'string' + && value.length < 30 + && u.channelRegex.test(value) +} + u.readNext = function (fn) { var next return function (end, cb) { |