prevent multiple ports (🔢1234:1234)

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2018-06-26 23:41:46 +01:00
parent 9f3a121abc
commit 96163d1402
No known key found for this signature in database
GPG key ID: 3F879DA5AD802A5E

View file

@ -42,6 +42,7 @@ function matrixLinkify(linkify) {
const S_HASH_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
const S_ROOMALIAS = new linkify.parser.State(ROOMALIAS);
const S_ROOMALIAS_COLON = new linkify.parser.State();
const S_ROOMALIAS_COLON_NUM = new linkify.parser.State(ROOMALIAS);
const roomname_tokens = [
TT.DOT,
@ -72,7 +73,7 @@ function matrixLinkify(linkify) {
S_ROOMALIAS.on(TT.DOT, S_HASH_NAME_COLON_DOMAIN_DOT); // accept repeated TLDs (e.g .org.uk)
S_ROOMALIAS.on(TT.COLON, S_ROOMALIAS_COLON); // do not accept trailing `:`
S_ROOMALIAS_COLON.on(TT.NUM, S_ROOMALIAS); // but do accept :NUM (port specifier)
S_ROOMALIAS_COLON.on(TT.NUM, S_ROOMALIAS_COLON_NUM); // but do accept :NUM (port specifier)
const USERID = function(value) {
@ -89,6 +90,7 @@ function matrixLinkify(linkify) {
const S_AT_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
const S_USERID = new linkify.parser.State(USERID);
const S_USERID_COLON = new linkify.parser.State();
const S_USERID_COLON_NUM = new linkify.parser.State(USERID);
const username_tokens = [
TT.DOT,
@ -117,7 +119,7 @@ function matrixLinkify(linkify) {
S_USERID.on(TT.DOT, S_AT_NAME_COLON_DOMAIN_DOT); // accept repeated TLDs (e.g .org.uk)
S_USERID.on(TT.COLON, S_USERID_COLON); // do not accept trailing `:`
S_USERID_COLON.on(TT.NUM, S_USERID); // but do accept :NUM (port specifier)
S_USERID_COLON.on(TT.NUM, S_USERID_COLON_NUM); // but do accept :NUM (port specifier)
const GROUPID = function(value) {
@ -134,6 +136,7 @@ function matrixLinkify(linkify) {
const S_PLUS_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
const S_GROUPID = new linkify.parser.State(GROUPID);
const S_GROUPID_COLON = new linkify.parser.State();
const S_GROUPID_COLON_NUM = new linkify.parser.State(GROUPID);
const groupid_tokens = [
TT.DOT,
@ -162,7 +165,7 @@ function matrixLinkify(linkify) {
S_GROUPID.on(TT.DOT, S_PLUS_NAME_COLON_DOMAIN_DOT); // accept repeated TLDs (e.g .org.uk)
S_GROUPID.on(TT.COLON, S_GROUPID_COLON); // do not accept trailing `:`
S_GROUPID_COLON.on(TT.NUM, S_GROUPID); // but do accept :NUM (port specifier)
S_GROUPID_COLON.on(TT.NUM, S_GROUPID_COLON_NUM); // but do accept :NUM (port specifier)
}
// stubs, overwritten in MatrixChat's componentDidMount