From c904083d1f5064d2e786e0bc6ee3804b91805d24 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 2 Jan 2017 10:52:47 +0800 Subject: Remove manual LZString compression for partial socket io event data --- lib/realtime.js | 4 ---- 1 file changed, 4 deletions(-) (limited to 'lib/realtime.js') diff --git a/lib/realtime.js b/lib/realtime.js index c243ffc1..c66fea0a 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -71,7 +71,6 @@ function emitCheck(note) { authors: note.authors, authorship: note.authorship }; - out = LZString.compressToUTF16(JSON.stringify(out)); realtime.io.to(note.id).emit('check', out); } @@ -301,7 +300,6 @@ function emitOnlineUsers(socket) { var out = { users: users }; - out = LZString.compressToUTF16(JSON.stringify(out)); realtime.io.to(noteId).emit('online users', out); } @@ -330,7 +328,6 @@ function emitRefresh(socket) { createtime: note.createtime, updatetime: note.updatetime }; - out = LZString.compressToUTF16(JSON.stringify(out)); socket.emit('refresh', out); } @@ -863,7 +860,6 @@ function connection(socket) { var out = { users: users }; - out = LZString.compressToUTF16(JSON.stringify(out)); socket.emit('online users', out); }); -- cgit v1.2.3 From f6d8e3ab00370a78c0c788ad1e37a7ff77a53555 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Mon, 2 Jan 2017 10:59:53 +0800 Subject: Remove LZString compression for data storage --- lib/realtime.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/realtime.js') diff --git a/lib/realtime.js b/lib/realtime.js index c66fea0a..a662deeb 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -152,12 +152,10 @@ function finishUpdateNote(note, _note, callback) { if (!note || !note.server) return callback(null, null); var body = note.server.document; var title = note.title = models.Note.parseNoteTitle(body); - title = LZString.compressToBase64(title); - body = LZString.compressToBase64(body); var values = { title: title, content: body, - authorship: LZString.compressToBase64(JSON.stringify(note.authorship)), + authorship: note.authorship, lastchangeuserId: note.lastchangeuser, lastchangeAt: Date.now() }; @@ -459,7 +457,7 @@ function startConnection(socket) { var lastchangeuser = note.lastchangeuserId; var lastchangeuserprofile = note.lastchangeuser ? models.User.getProfile(note.lastchangeuser) : null; - var body = LZString.decompressFromBase64(note.content); + var body = note.content; var createtime = note.createdAt; var updatetime = note.lastchangeAt; var server = new ot.EditorSocketIOServer(body, [], noteId, ifMayEdit, operationCallback); @@ -479,7 +477,7 @@ function startConnection(socket) { notes[noteId] = { id: noteId, alias: note.alias, - title: LZString.decompressFromBase64(note.title), + title: note.title, owner: owner, ownerprofile: ownerprofile, permission: note.permission, @@ -491,7 +489,7 @@ function startConnection(socket) { updatetime: moment(updatetime).valueOf(), server: server, authors: authors, - authorship: note.authorship ? JSON.parse(LZString.decompressFromBase64(note.authorship)) : [] + authorship: note.authorship }; return finishConnection(socket, notes[noteId], users[socket.id]); -- cgit v1.2.3