upgrade to 1.6.5

This commit is contained in:
ilmar 2018-04-24 13:31:40 +03:00
parent 7cc7bb1abc
commit 8d27f3cf03
3 changed files with 276 additions and 0 deletions

145
bin/checkAllPads.js Normal file
View File

@ -0,0 +1,145 @@
/*
This is a debug tool. It checks all revisions for data corruption
*/
if(process.argv.length != 2)
{
console.error("Use: node bin/checkAllPads.js");
process.exit(1);
}
//initalize the variables
var db, settings, padManager;
var npm = require("../src/node_modules/npm");
var async = require("../src/node_modules/async");
var Changeset = require("../src/static/js/Changeset");
async.series([
//load npm
function(callback) {
npm.load({}, callback);
},
//load modules
function(callback) {
settings = require('../src/node/utils/Settings');
db = require('../src/node/db/DB');
//initalize the database
db.init(callback);
},
//load pads
function (callback)
{
padManager = require('../src/node/db/PadManager');
padManager.listAllPads(function(err, res)
{
padIds = res.padIDs;
callback(err);
});
},
function (callback)
{
async.forEach(padIds, function(padId, callback)
{
padManager.getPad(padId, function(err, pad) {
if (err) {
callback(err);
}
//check if the pad has a pool
if(pad.pool === undefined )
{
console.error("[" + pad.id + "] Missing attribute pool");
callback();
return;
}
//create an array with key kevisions
//key revisions always save the full pad atext
var head = pad.getHeadRevisionNumber();
var keyRevisions = [];
for(var i=0;i<head;i+=100)
{
keyRevisions.push(i);
}
//run trough all key revisions
async.forEachSeries(keyRevisions, function(keyRev, callback)
{
//create an array of revisions we need till the next keyRevision or the End
var revisionsNeeded = [];
for(var i=keyRev;i<=keyRev+100 && i<=head; i++)
{
revisionsNeeded.push(i);
}
//this array will hold all revision changesets
var revisions = [];
//run trough all needed revisions and get them from the database
async.forEach(revisionsNeeded, function(revNum, callback)
{
db.db.get("pad:"+pad.id+":revs:" + revNum, function(err, revision)
{
revisions[revNum] = revision;
callback(err);
});
}, function(err)
{
if(err)
{
callback(err);
return;
}
//check if the revision exists
if (revisions[keyRev] == null) {
console.error("[" + pad.id + "] Missing revision " + keyRev);
callback();
return;
}
//check if there is a atext in the keyRevisions
if(revisions[keyRev].meta === undefined || revisions[keyRev].meta.atext === undefined)
{
console.error("[" + pad.id + "] Missing atext in revision " + keyRev);
callback();
return;
}
var apool = pad.pool;
var atext = revisions[keyRev].meta.atext;
for(var i=keyRev+1;i<=keyRev+100 && i<=head; i++)
{
try
{
//console.log("[" + pad.id + "] check revision " + i);
var cs = revisions[i].changeset;
atext = Changeset.applyToAText(cs, atext, apool);
}
catch(e)
{
console.error("[" + pad.id + "] Bad changeset at revision " + i + " - " + e.message);
callback();
return;
}
}
callback();
});
}, callback);
});
}, callback);
}
], function (err)
{
if(err) throw err;
else
{
console.log("finished");
process.exit(0);
}
});

48
src/locales/pms.json Normal file
View File

@ -0,0 +1,48 @@
{
"@metadata": {
"authors": [
"Borichèt"
]
},
"index.newPad": "Feuj neuv",
"index.createOpenPad": "o creé/duverté un feuj antitolà:",
"pad.toolbar.bold.title": "Grassèt (Ctrl+B)",
"pad.toolbar.italic.title": "Corsiv (Ctrl+I)",
"pad.toolbar.underline.title": "Sotlignà (Ctrl+U)",
"pad.toolbar.strikethrough.title": "Barà (Ctrl+5)",
"pad.toolbar.ol.title": "Lista ordinà (Ctrl+Shift+N)",
"pad.toolbar.ul.title": "Lista nen ordinà (Ctrl+Shift+L)",
"pad.toolbar.indent.title": "Andenté (TAB)",
"pad.toolbar.unindent.title": "Disandenté (Maj+TAB)",
"pad.toolbar.undo.title": "Anulé (Ctrl+Z)",
"pad.toolbar.redo.title": "Ristabilì (Ctrl+Y)",
"pad.toolbar.clearAuthorship.title": "Dëscancelé ij color ch'a identìfico j'autor (Ctrl+Shift+C)",
"pad.toolbar.import_export.title": "Amporté/Esporté da/vers dij formà d'archivi diferent",
"pad.toolbar.timeslider.title": "Stòria dinàmica",
"pad.toolbar.savedRevision.title": "Argistré la revision",
"pad.toolbar.settings.title": "Paràmeter",
"pad.toolbar.embed.title": "Partagé e antëgré ës feuj",
"pad.toolbar.showusers.title": "Smon-e j'utent ansima a 's feuj",
"pad.colorpicker.save": "Argistré",
"pad.colorpicker.cancel": "Anulé",
"pad.loading": "Antramentr ch'as caria…",
"pad.noCookie": "Ël bëscotin a l'é nen ëstàit trovà. Për piasì, ch'a autorisa ij bëscotin su sò navigador!",
"pad.passwordRequired": "A l'ha da manca ëd na ciav për acede a cost feuj-sì",
"pad.permissionDenied": "A l'ha nen ël përmess d'acede a 's feuj-sì",
"pad.wrongPassword": "Soa ciav a l'era nen giusta",
"pad.settings.padSettings": "Paràmeter dël feuj",
"pad.settings.myView": "Mia vista",
"pad.settings.stickychat": "Ciaciarade sempe an slë scren",
"pad.settings.chatandusers": "Smon-e le ciaciarade e j'utent",
"pad.settings.colorcheck": "Color d'identificassion",
"pad.settings.linenocheck": "Nùmer ëd linia",
"pad.settings.rtlcheck": "Ël contnù, dev-lo esse lesù da drita a snistra?",
"pad.settings.fontType": "Sòrt ëd caràter:",
"pad.settings.globalView": "Vista d'ansem",
"pad.settings.language": "Lenga:",
"pad.importExport.import_export": "Amporté/Esporté",
"pad.importExport.import": "Carié n'archivi o document ëd test",
"pad.importExport.importSuccessful": "Bele fàit!",
"pad.importExport.export": "Esporté ël feuj atual coma:",
"pad.importExport.exportetherpad": "Etherpad"
}

View File

@ -0,0 +1,83 @@
const RESERVED_WORDS = [
'abstract',
'arguments',
'await',
'boolean',
'break',
'byte',
'case',
'catch',
'char',
'class',
'const',
'continue',
'debugger',
'default',
'delete',
'do',
'double',
'else',
'enum',
'eval',
'export',
'extends',
'false',
'final',
'finally',
'float',
'for',
'function',
'goto',
'if',
'implements',
'import',
'in',
'instanceof',
'int',
'interface',
'let',
'long',
'native',
'new',
'null',
'package',
'private',
'protected',
'public',
'return',
'short',
'static',
'super',
'switch',
'synchronized',
'this',
'throw',
'throws',
'transient',
'true',
'try',
'typeof',
'var',
'void',
'volatile',
'while',
'with',
'yield'
];
const regex = /^[a-zA-Z_$][0-9a-zA-Z_$]*(?:\[(?:".+"|\'.+\'|\d+)\])*?$/;
module.exports.check = function(inputStr) {
var isValid = true;
inputStr.split(".").forEach(function(part) {
if (!regex.test(part)) {
isValid = false;
}
if (RESERVED_WORDS.indexOf(part) !== -1) {
isValid = false;
}
});
return isValid;
}