Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
commit
338b40face
@ -0,0 +1,12 @@
|
||||
var config;
|
||||
try {
|
||||
config = require("../config/config");
|
||||
if (config.adminEmail === 'i.did.not.read.my.config@cryptpad.fr') {
|
||||
console.log("You can configure the administrator email (adminEmail) in your config/config.js file");
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("You can customize the configuration by copying config/config.example.js to config/config.js");
|
||||
config = require("../config/config.example");
|
||||
}
|
||||
module.exports = config;
|
||||
|
@ -0,0 +1,43 @@
|
||||
/*jshint esversion: 6 */
|
||||
|
||||
var Pins = module.exports;
|
||||
|
||||
/*
|
||||
takes contents of a pinFile (UTF8 string)
|
||||
and the pin file's name
|
||||
returns an array of of channel ids which are pinned
|
||||
|
||||
throw errors on pin logs with invalid pin data
|
||||
*/
|
||||
Pins.calculateFromLog = function (pinFile, fileName) {
|
||||
var pins = {};
|
||||
pinFile.split('\n').filter((x)=>(x)).map((l) => JSON.parse(l)).forEach((l) => {
|
||||
switch (l[0]) {
|
||||
case 'RESET': {
|
||||
pins = {};
|
||||
if (l[1] && l[1].length) { l[1].forEach((x) => { pins[x] = 1; }); }
|
||||
//jshint -W086
|
||||
// fallthrough
|
||||
}
|
||||
case 'PIN': {
|
||||
l[1].forEach((x) => { pins[x] = 1; });
|
||||
break;
|
||||
}
|
||||
case 'UNPIN': {
|
||||
l[1].forEach((x) => { delete pins[x]; });
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// FIXME logging
|
||||
// TODO write to the error log
|
||||
/* Log.error('CORRUPTED_PIN_LOG', {
|
||||
line: JSON.stringify(l),
|
||||
fileName: fileName,
|
||||
}); */
|
||||
console.error(new Error (JSON.stringify(l) + ' ' + fileName));
|
||||
}
|
||||
});
|
||||
return Object.keys(pins);
|
||||
};
|
||||
|
||||
// TODO refactor to include a streaming version for use in rpc.js as well
|
@ -1,7 +0,0 @@
|
||||
var config;
|
||||
try {
|
||||
config = require("../config/config");
|
||||
} catch (e) {
|
||||
config = require("../config/config.example");
|
||||
}
|
||||
module.exports = config;
|
Loading…
Reference in New Issue