mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
pad: Delete unused ip
and userAgent
client vars
This commit is contained in:
parent
98066184b2
commit
750c7cb1cf
4 changed files with 0 additions and 87 deletions
|
@ -133,9 +133,7 @@ exports.handleDisconnect = async (socket) => {
|
||||||
data: {
|
data: {
|
||||||
type: 'USER_LEAVE',
|
type: 'USER_LEAVE',
|
||||||
userInfo: {
|
userInfo: {
|
||||||
ip: '127.0.0.1',
|
|
||||||
colorId: color,
|
colorId: color,
|
||||||
userAgent: 'Anonymous',
|
|
||||||
userId: session.author,
|
userId: session.author,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -489,8 +487,6 @@ async function handleUserInfoUpdate(socket, message) {
|
||||||
// set a null name, when there is no name set. cause the client wants it null
|
// set a null name, when there is no name set. cause the client wants it null
|
||||||
name: message.data.userInfo.name || null,
|
name: message.data.userInfo.name || null,
|
||||||
colorId: message.data.userInfo.colorId,
|
colorId: message.data.userInfo.colorId,
|
||||||
userAgent: 'Anonymous',
|
|
||||||
ip: '127.0.0.1',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -1095,9 +1091,7 @@ async function handleClientReady(socket, message, authorID) {
|
||||||
data: {
|
data: {
|
||||||
type: 'USER_NEWINFO',
|
type: 'USER_NEWINFO',
|
||||||
userInfo: {
|
userInfo: {
|
||||||
ip: '127.0.0.1',
|
|
||||||
colorId: authorColorId,
|
colorId: authorColorId,
|
||||||
userAgent: 'Anonymous',
|
|
||||||
userId: authorID,
|
userId: authorID,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1146,10 +1140,8 @@ async function handleClientReady(socket, message, authorID) {
|
||||||
data: {
|
data: {
|
||||||
type: 'USER_NEWINFO',
|
type: 'USER_NEWINFO',
|
||||||
userInfo: {
|
userInfo: {
|
||||||
ip: '127.0.0.1',
|
|
||||||
colorId: authorInfo.colorId,
|
colorId: authorInfo.colorId,
|
||||||
name: authorInfo.name,
|
name: authorInfo.name,
|
||||||
userAgent: 'Anonymous',
|
|
||||||
userId: authorId,
|
userId: authorId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -234,8 +234,6 @@ function handshake() {
|
||||||
|
|
||||||
// set some client vars
|
// set some client vars
|
||||||
clientVars = obj.data;
|
clientVars = obj.data;
|
||||||
clientVars.userAgent = 'Anonymous';
|
|
||||||
clientVars.collab_client_vars.clientAgent = 'Anonymous';
|
|
||||||
|
|
||||||
// initalize the pad
|
// initalize the pad
|
||||||
pad._afterHandshake();
|
pad._afterHandshake();
|
||||||
|
@ -333,9 +331,6 @@ var pad = {
|
||||||
getColorPalette() {
|
getColorPalette() {
|
||||||
return clientVars.colorPalette;
|
return clientVars.colorPalette;
|
||||||
},
|
},
|
||||||
getDisplayUserAgent() {
|
|
||||||
return padutils.uaDisplay(clientVars.userAgent);
|
|
||||||
},
|
|
||||||
getIsDebugEnabled() {
|
getIsDebugEnabled() {
|
||||||
return clientVars.debugEnabled;
|
return clientVars.debugEnabled;
|
||||||
},
|
},
|
||||||
|
@ -427,7 +422,6 @@ var pad = {
|
||||||
name: clientVars.userName,
|
name: clientVars.userName,
|
||||||
ip: pad.getClientIp(),
|
ip: pad.getClientIp(),
|
||||||
colorId: clientVars.userColor,
|
colorId: clientVars.userColor,
|
||||||
userAgent: pad.getDisplayUserAgent(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
padimpexp.init(this);
|
padimpexp.init(this);
|
||||||
|
|
|
@ -143,17 +143,6 @@ const paduserlist = (function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRowNode(tr, data) {
|
|
||||||
if (data.titleText) {
|
|
||||||
const titleText = data.titleText;
|
|
||||||
window.setTimeout(() => {
|
|
||||||
/* tr.attr('title', titleText)*/
|
|
||||||
}, 0);
|
|
||||||
} else {
|
|
||||||
tr.removeAttr('title');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleOtherUserInputs() {
|
function handleOtherUserInputs() {
|
||||||
// handle 'INPUT' elements for naming other unnamed users
|
// handle 'INPUT' elements for naming other unnamed users
|
||||||
$('#otheruserstable input.newinput').each(function () {
|
$('#otheruserstable input.newinput').each(function () {
|
||||||
|
@ -195,7 +184,6 @@ const paduserlist = (function () {
|
||||||
rowsFadingIn.push(row);
|
rowsFadingIn.push(row);
|
||||||
tr = createRow(domId, createEmptyRowTds(getAnimationHeight(ANIMATION_START)), authorId);
|
tr = createRow(domId, createEmptyRowTds(getAnimationHeight(ANIMATION_START)), authorId);
|
||||||
}
|
}
|
||||||
handleRowNode(tr, data);
|
|
||||||
$('table#otheruserstable').show();
|
$('table#otheruserstable').show();
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
$('table#otheruserstable').prepend(tr);
|
$('table#otheruserstable').prepend(tr);
|
||||||
|
@ -221,7 +209,6 @@ const paduserlist = (function () {
|
||||||
// not currently animating
|
// not currently animating
|
||||||
const tr = rowNode(row);
|
const tr = rowNode(row);
|
||||||
replaceUserRowContents(tr, getAnimationHeight(0), row.data).find('td').css('opacity', (row.opacity === undefined ? 1 : row.opacity));
|
replaceUserRowContents(tr, getAnimationHeight(0), row.data).find('td').css('opacity', (row.opacity === undefined ? 1 : row.opacity));
|
||||||
handleRowNode(tr, data);
|
|
||||||
handleOtherUserInputs();
|
handleOtherUserInputs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,14 +259,12 @@ const paduserlist = (function () {
|
||||||
} else if (step == -OPACITY_STEPS + 1) {
|
} else if (step == -OPACITY_STEPS + 1) {
|
||||||
node.empty().append(createUserRowTds(animHeight, row.data))
|
node.empty().append(createUserRowTds(animHeight, row.data))
|
||||||
.find('td').css('opacity', baseOpacity * 1 / OPACITY_STEPS);
|
.find('td').css('opacity', baseOpacity * 1 / OPACITY_STEPS);
|
||||||
handleRowNode(node, row.data);
|
|
||||||
} else if (step < 0) {
|
} else if (step < 0) {
|
||||||
node.find('td').css('opacity', baseOpacity * (OPACITY_STEPS - (-step)) / OPACITY_STEPS).height(animHeight);
|
node.find('td').css('opacity', baseOpacity * (OPACITY_STEPS - (-step)) / OPACITY_STEPS).height(animHeight);
|
||||||
} else if (step == 0) {
|
} else if (step == 0) {
|
||||||
// set HTML in case modified during animation
|
// set HTML in case modified during animation
|
||||||
node.empty().append(createUserRowTds(animHeight, row.data))
|
node.empty().append(createUserRowTds(animHeight, row.data))
|
||||||
.find('td').css('opacity', baseOpacity * 1).height(animHeight);
|
.find('td').css('opacity', baseOpacity * 1).height(animHeight);
|
||||||
handleRowNode(node, row.data);
|
|
||||||
rowsFadingIn.splice(i, 1); // remove from set
|
rowsFadingIn.splice(i, 1); // remove from set
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,8 +465,6 @@ const paduserlist = (function () {
|
||||||
userData.status = '';
|
userData.status = '';
|
||||||
userData.activity = '';
|
userData.activity = '';
|
||||||
userData.id = info.userId;
|
userData.id = info.userId;
|
||||||
// Firefox ignores \n in title text; Safari does a linebreak
|
|
||||||
userData.titleText = [info.userAgent || '', info.ip || ''].join(' \n');
|
|
||||||
|
|
||||||
const existingIndex = findExistingIndex(info.userId);
|
const existingIndex = findExistingIndex(info.userId);
|
||||||
|
|
||||||
|
|
|
@ -50,62 +50,6 @@ var padutils = {
|
||||||
}
|
}
|
||||||
return [pad.getClientIp(), encodeNum(+new Date(), 7), encodeNum(Math.floor(Math.random() * 1e9), 4)].join('.');
|
return [pad.getClientIp(), encodeNum(+new Date(), 7), encodeNum(Math.floor(Math.random() * 1e9), 4)].join('.');
|
||||||
},
|
},
|
||||||
uaDisplay(ua) {
|
|
||||||
let m;
|
|
||||||
|
|
||||||
function clean(a) {
|
|
||||||
const maxlen = 16;
|
|
||||||
a = a.replace(/[^a-zA-Z0-9\.]/g, '');
|
|
||||||
if (a.length > maxlen) {
|
|
||||||
a = a.substr(0, maxlen);
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkver(name) {
|
|
||||||
const m = ua.match(RegExp(`${name}\\/([\\d\\.]+)`));
|
|
||||||
if (m && m.length > 1) {
|
|
||||||
return clean(name + m[1]);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// firefox
|
|
||||||
if (checkver('Firefox')) {
|
|
||||||
return checkver('Firefox');
|
|
||||||
}
|
|
||||||
|
|
||||||
// misc browsers, including IE
|
|
||||||
m = ua.match(/compatible; ([^;]+);/);
|
|
||||||
if (m && m.length > 1) {
|
|
||||||
return clean(m[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// iphone
|
|
||||||
if (ua.match(/\(iPhone;/)) {
|
|
||||||
return 'iPhone';
|
|
||||||
}
|
|
||||||
|
|
||||||
// chrome
|
|
||||||
if (checkver('Chrome')) {
|
|
||||||
return checkver('Chrome');
|
|
||||||
}
|
|
||||||
|
|
||||||
// safari
|
|
||||||
m = ua.match(/Safari\/[\d\.]+/);
|
|
||||||
if (m) {
|
|
||||||
let v = '?';
|
|
||||||
m = ua.match(/Version\/([\d\.]+)/);
|
|
||||||
if (m && m.length > 1) {
|
|
||||||
v = m[1];
|
|
||||||
}
|
|
||||||
return clean(`Safari${v}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// everything else
|
|
||||||
const x = ua.split(' ')[0];
|
|
||||||
return clean(x);
|
|
||||||
},
|
|
||||||
// e.g. "Thu Jun 18 2009 13:09"
|
// e.g. "Thu Jun 18 2009 13:09"
|
||||||
simpleDateTime(date) {
|
simpleDateTime(date) {
|
||||||
const d = new Date(+date); // accept either number or date
|
const d = new Date(+date); // accept either number or date
|
||||||
|
|
Loading…
Reference in a new issue