mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-15 12:45:11 +08:00
prevent multiple ports (🔢1234:1234)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
9f3a121abc
commit
96163d1402
@ -42,6 +42,7 @@ function matrixLinkify(linkify) {
|
|||||||
const S_HASH_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
|
const S_HASH_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
|
||||||
const S_ROOMALIAS = new linkify.parser.State(ROOMALIAS);
|
const S_ROOMALIAS = new linkify.parser.State(ROOMALIAS);
|
||||||
const S_ROOMALIAS_COLON = new linkify.parser.State();
|
const S_ROOMALIAS_COLON = new linkify.parser.State();
|
||||||
|
const S_ROOMALIAS_COLON_NUM = new linkify.parser.State(ROOMALIAS);
|
||||||
|
|
||||||
const roomname_tokens = [
|
const roomname_tokens = [
|
||||||
TT.DOT,
|
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.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.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) {
|
const USERID = function(value) {
|
||||||
@ -89,6 +90,7 @@ function matrixLinkify(linkify) {
|
|||||||
const S_AT_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
|
const S_AT_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
|
||||||
const S_USERID = new linkify.parser.State(USERID);
|
const S_USERID = new linkify.parser.State(USERID);
|
||||||
const S_USERID_COLON = new linkify.parser.State();
|
const S_USERID_COLON = new linkify.parser.State();
|
||||||
|
const S_USERID_COLON_NUM = new linkify.parser.State(USERID);
|
||||||
|
|
||||||
const username_tokens = [
|
const username_tokens = [
|
||||||
TT.DOT,
|
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.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.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) {
|
const GROUPID = function(value) {
|
||||||
@ -134,6 +136,7 @@ function matrixLinkify(linkify) {
|
|||||||
const S_PLUS_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
|
const S_PLUS_NAME_COLON_DOMAIN_DOT = new linkify.parser.State();
|
||||||
const S_GROUPID = new linkify.parser.State(GROUPID);
|
const S_GROUPID = new linkify.parser.State(GROUPID);
|
||||||
const S_GROUPID_COLON = new linkify.parser.State();
|
const S_GROUPID_COLON = new linkify.parser.State();
|
||||||
|
const S_GROUPID_COLON_NUM = new linkify.parser.State(GROUPID);
|
||||||
|
|
||||||
const groupid_tokens = [
|
const groupid_tokens = [
|
||||||
TT.DOT,
|
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.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.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
|
// stubs, overwritten in MatrixChat's componentDidMount
|
||||||
|
Loading…
Reference in New Issue
Block a user