Added underscores and dashes to usernames
This commit is contained in:
parent
23ceb74883
commit
d3aa4b8274
|
|
@ -25,9 +25,19 @@ module.exports.user = function(field = 'user'){
|
|||
[field]: {
|
||||
escape: true,
|
||||
trim: true,
|
||||
isAlphanumeric: {
|
||||
errorMessage: "Usernames must be alphanumeric."
|
||||
//Caution: Nerd Rant
|
||||
//isAlphanumerics only takes locale for the option flag in schemas for some reason...
|
||||
matches: {
|
||||
//See this is the shit I'm talking about, WHY IS THIS CALLED OPTIONS? IT SHOULD BE PATTERN
|
||||
//OPTIONS IS SUPPOSED TO BE AN OBJECT THAT PASSES EXTRA VALUES THATS LITERALLY HOW EVERYTHING ELSE IN THIS FUCKING LIBRARY WORKS
|
||||
//WHO FUCKING WROTE THIS SHIT!?!?!?!?!
|
||||
//HOW IS THIS ACCEPTED ON ONE OF THE MOST WIDELY USED VALIDATION LIBRARIES ON THE WEB!??!?!?!!?
|
||||
//IT'S NOT EVEN FUCKING DOCUMENTED ANYWHERE!!!!!!!!!!!!
|
||||
//WEBDEVS, GET YOUR FUCKING SHIT TOGETHER, FUCK!
|
||||
options: [/^[A-Za-z0-9-_]+$/],
|
||||
errorMessage: "Usernames can only contain numbers, letters, underscores, and dashes."
|
||||
},
|
||||
//matches: /^[A-Za-z0-9-_]+$/,
|
||||
isLength: {
|
||||
options: {
|
||||
min: 1,
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ p.panel-head-element{
|
|||
|
||||
.chat-entry-username{
|
||||
margin: auto 0.2em auto 0;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
.chat-entry-body{
|
||||
|
|
@ -203,6 +204,7 @@ span.user-entry{
|
|||
font-size: 1em;
|
||||
width: fit-content;
|
||||
user-select: none;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
.whisper{
|
||||
|
|
|
|||
|
|
@ -73,11 +73,11 @@ class chatPostprocessor{
|
|||
//Create an empty array to hold the body
|
||||
this.messageArray = [];
|
||||
|
||||
//Escape any sanatized char codes as we use .textContent for double-safety, and to prevent splitting of char codes
|
||||
//Split string by word-boundries on words and non-word boundries around whitespace, with negative lookaheads to exclude file seperators so we don't split link placeholders
|
||||
//Unescape any sanatized char codes as we use .textContent for double-safety, and to prevent splitting of char codes
|
||||
//Split string by word-boundries on words and non-word boundries around whitespace, with negative lookaheads to exclude file seperators so we don't split link placeholders, and dashes so we dont split usernames and other things
|
||||
//Also split by any invisble whitespace as a crutch to handle mushed links/emotes
|
||||
//If we can one day figure out how to split non-repeating special chars instead of special chars with whitespace, that would be perf, unfortunately my brain hasn't rotted enough to understand regex like that just yet.
|
||||
const splitString = utils.unescapeEntities(this.rawData.msg).split(/(?<!␜)(?=\w)\b|(?<=\w)\b|(?=\s)\B|(?<=\s)\B|ㅤ/g);
|
||||
const splitString = utils.unescapeEntities(this.rawData.msg).split(/(?<!-)(?<!␜)(?=\w)\b|(?!-)(?<=\w)\b|(?=\s)\B|(?<=\s)\B|ㅤ/g);
|
||||
|
||||
//for each word in the splitstring
|
||||
splitString.forEach((string) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue