summaryrefslogtreecommitdiff
path: root/lib/workers
diff options
context:
space:
mode:
authorWu Cheng-Han2017-01-02 10:59:53 +0800
committerWu Cheng-Han2017-01-02 10:59:53 +0800
commitf6d8e3ab00370a78c0c788ad1e37a7ff77a53555 (patch)
treec5bc7cf24ba0022893a2992d25d90280c38fa1d9 /lib/workers
parentc904083d1f5064d2e786e0bc6ee3804b91805d24 (diff)
Remove LZString compression for data storage
Diffstat (limited to 'lib/workers')
-rw-r--r--lib/workers/dmpWorker.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/workers/dmpWorker.js b/lib/workers/dmpWorker.js
index fae36191..5b4b6aa2 100644
--- a/lib/workers/dmpWorker.js
+++ b/lib/workers/dmpWorker.js
@@ -1,5 +1,4 @@
// external modules
-var LZString = require('lz-string');
var DiffMatchPatch = require('diff-match-patch');
var dmp = new DiffMatchPatch();
@@ -80,10 +79,10 @@ function getRevision(revisions, count) {
for (var i = 0; i < count; i++) {
var revision = revisions[i];
if (i == 0) {
- startContent = LZString.decompressFromBase64(revision.content || revision.lastContent);
+ startContent = revision.content || revision.lastContent;
}
if (i != count - 1) {
- var patch = dmp.patch_fromText(LZString.decompressFromBase64(revision.patch));
+ var patch = dmp.patch_fromText(revision.patch);
applyPatches = applyPatches.concat(patch);
}
lastPatch = revision.patch;
@@ -105,11 +104,11 @@ function getRevision(revisions, count) {
for (var i = l; i >= count - 1; i--) {
var revision = revisions[i];
if (i == l) {
- startContent = LZString.decompressFromBase64(revision.lastContent);
+ startContent = revision.lastContent;
authorship = revision.authorship;
}
if (revision.patch) {
- var patch = dmp.patch_fromText(LZString.decompressFromBase64(revision.patch));
+ var patch = dmp.patch_fromText(revision.patch);
applyPatches = applyPatches.concat(patch);
}
lastPatch = revision.patch;
@@ -123,8 +122,8 @@ function getRevision(revisions, count) {
}
var data = {
content: finalContent,
- patch: dmp.patch_fromText(LZString.decompressFromBase64(lastPatch)),
- authorship: authorship ? JSON.parse(LZString.decompressFromBase64(authorship)) : null
+ patch: dmp.patch_fromText(lastPatch),
+ authorship: authorship
};
var ms_end = (new Date()).getTime();
if (config.debug) {