mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 06:34:39 -04:00
Remove LZString compression for data storage
This commit is contained in:
parent
c904083d1f
commit
f6d8e3ab00
5 changed files with 28 additions and 37 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
// external modules
|
||||
var Sequelize = require("sequelize");
|
||||
var LZString = require('lz-string');
|
||||
var async = require('async');
|
||||
var moment = require('moment');
|
||||
var childProcess = require('child_process');
|
||||
|
@ -214,7 +213,7 @@ module.exports = function (sequelize, DataTypes) {
|
|||
Revision.create({
|
||||
noteId: note.id,
|
||||
lastContent: note.content,
|
||||
length: LZString.decompressFromBase64(note.content).length,
|
||||
length: note.content.length,
|
||||
authorship: note.authorship
|
||||
}).then(function (revision) {
|
||||
Revision.finishSaveNoteRevision(note, revision, callback);
|
||||
|
@ -223,8 +222,8 @@ module.exports = function (sequelize, DataTypes) {
|
|||
});
|
||||
} else {
|
||||
var latestRevision = revisions[0];
|
||||
var lastContent = LZString.decompressFromBase64(latestRevision.content || latestRevision.lastContent);
|
||||
var content = LZString.decompressFromBase64(note.content);
|
||||
var lastContent = latestRevision.content || latestRevision.lastContent;
|
||||
var content = note.content;
|
||||
sendDmpWorker({
|
||||
msg: 'create patch',
|
||||
lastDoc: lastContent,
|
||||
|
@ -244,9 +243,9 @@ module.exports = function (sequelize, DataTypes) {
|
|||
} else {
|
||||
Revision.create({
|
||||
noteId: note.id,
|
||||
patch: LZString.compressToBase64(patch),
|
||||
patch: patch,
|
||||
content: note.content,
|
||||
length: LZString.decompressFromBase64(note.content).length,
|
||||
length: note.content.length,
|
||||
authorship: note.authorship
|
||||
}).then(function (revision) {
|
||||
// clear last revision content to reduce db size
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue