Add max chat message length config option
This commit is contained in:
parent
ed410fdebe
commit
986207b46b
|
@ -128,6 +128,8 @@ max-channels-per-user: 5
|
||||||
max-accounts-per-ip: 5
|
max-accounts-per-ip: 5
|
||||||
# Minimum number of seconds between guest logins from the same IP
|
# Minimum number of seconds between guest logins from the same IP
|
||||||
guest-login-delay: 60
|
guest-login-delay: 60
|
||||||
|
# Maximum character length of a chat message
|
||||||
|
max-chat-msg-length: 320
|
||||||
|
|
||||||
# Allows you to customize the path divider. The /r/ in http://localhost/r/yourchannel
|
# Allows you to customize the path divider. The /r/ in http://localhost/r/yourchannel
|
||||||
# Acceptable characters are a-z A-Z 0-9 _ and -
|
# Acceptable characters are a-z A-Z 0-9 _ and -
|
||||||
|
|
|
@ -162,7 +162,7 @@ ChatModule.prototype.handleChatMsg = function (user, data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.msg = data.msg.substring(0, 320);
|
data.msg = data.msg.substring(0, Config.get("max-chat-msg-length"));
|
||||||
|
|
||||||
// Restrict new accounts/IPs from chatting and posting links
|
// Restrict new accounts/IPs from chatting and posting links
|
||||||
if (this.restrictNewAccount(user, data)) {
|
if (this.restrictNewAccount(user, data)) {
|
||||||
|
@ -248,7 +248,7 @@ ChatModule.prototype.handlePm = function (user, data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data.msg = data.msg.substring(0, 320);
|
data.msg = data.msg.substring(0, Config.get("max-chat-msg-length"));
|
||||||
var to = null;
|
var to = null;
|
||||||
for (var i = 0; i < this.channel.users.length; i++) {
|
for (var i = 0; i < this.channel.users.length; i++) {
|
||||||
if (this.channel.users[i].getLowerName() === data.to) {
|
if (this.channel.users[i].getLowerName() === data.to) {
|
||||||
|
|
|
@ -71,6 +71,7 @@ var defaults = {
|
||||||
"max-channels-per-user": 5,
|
"max-channels-per-user": 5,
|
||||||
"max-accounts-per-ip": 5,
|
"max-accounts-per-ip": 5,
|
||||||
"guest-login-delay": 60,
|
"guest-login-delay": 60,
|
||||||
|
"max-chat-msg-length": 320,
|
||||||
aliases: {
|
aliases: {
|
||||||
"purge-interval": 3600000,
|
"purge-interval": 3600000,
|
||||||
"max-age": 2592000000
|
"max-age": 2592000000
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import CyTubeUtil from '../../utilities';
|
import CyTubeUtil from '../../utilities';
|
||||||
|
import Config from '../../config';
|
||||||
import { sanitizeText } from '../../xss';
|
import { sanitizeText } from '../../xss';
|
||||||
import { sendPug } from '../pug';
|
import { sendPug } from '../pug';
|
||||||
import * as HTTPStatus from '../httpstatus';
|
import * as HTTPStatus from '../httpstatus';
|
||||||
|
@ -27,7 +28,8 @@ export default function initialize(app, ioConfig, chanPath, getBannedChannel) {
|
||||||
|
|
||||||
sendPug(res, 'channel', {
|
sendPug(res, 'channel', {
|
||||||
channelName: req.params.channel,
|
channelName: req.params.channel,
|
||||||
sioSource: `${socketBaseURL}/socket.io/socket.io.js`
|
sioSource: `${socketBaseURL}/socket.io/socket.io.js`,
|
||||||
|
maxMsgLen: Config.get("max-chat-msg-length")
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ html(lang="en")
|
||||||
#userlist
|
#userlist
|
||||||
#messagebuffer.linewrap
|
#messagebuffer.linewrap
|
||||||
form(action="javascript:void(0)")
|
form(action="javascript:void(0)")
|
||||||
input#chatline.form-control(type="text", maxlength="320", style="display: none")
|
input#chatline.form-control(type="text", maxlength=`${maxMsgLen}`, style="display: none")
|
||||||
#guestlogin.input-group
|
#guestlogin.input-group
|
||||||
span.input-group-addon Guest login
|
span.input-group-addon Guest login
|
||||||
input#guestname.form-control(type="text", placeholder="Name")
|
input#guestname.form-control(type="text", placeholder="Name")
|
||||||
|
|
Loading…
Reference in a new issue