mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-31 19:02:59 +01:00
lint: Fix straightforward ESLint errors
This commit is contained in:
parent
59c03bde20
commit
6f2f20233f
9 changed files with 57 additions and 67 deletions
|
@ -10,6 +10,8 @@
|
||||||
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
|
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
|
||||||
process.on('unhandledRejection', (err) => { throw err; });
|
process.on('unhandledRejection', (err) => { throw err; });
|
||||||
|
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
if (process.argv.length !== 3) throw new Error('Use: node extractPadData.js $PADID');
|
if (process.argv.length !== 3) throw new Error('Use: node extractPadData.js $PADID');
|
||||||
|
|
||||||
// get the padID
|
// get the padID
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
|
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
|
||||||
process.on('unhandledRejection', (err) => { throw err; });
|
process.on('unhandledRejection', (err) => { throw err; });
|
||||||
|
|
||||||
|
const util = require('util');
|
||||||
|
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
|
|
||||||
const log = (str) => {
|
const log = (str) => {
|
||||||
|
|
|
@ -831,7 +831,7 @@ exports.getStats = async () => {
|
||||||
const isInt = (value) => (parseFloat(value) === parseInt(value, 10)) && !isNaN(value);
|
const isInt = (value) => (parseFloat(value) === parseInt(value, 10)) && !isNaN(value);
|
||||||
|
|
||||||
// gets a pad safe
|
// gets a pad safe
|
||||||
async function getPadSafe(padID, shouldExist, text) {
|
const getPadSafe = async (padID, shouldExist, text) => {
|
||||||
// check if padID is a string
|
// check if padID is a string
|
||||||
if (typeof padID !== 'string') {
|
if (typeof padID !== 'string') {
|
||||||
throw new CustomError('padID is not a string', 'apierror');
|
throw new CustomError('padID is not a string', 'apierror');
|
||||||
|
@ -857,7 +857,7 @@ async function getPadSafe(padID, shouldExist, text) {
|
||||||
|
|
||||||
// pad exists, let's get it
|
// pad exists, let's get it
|
||||||
return padManager.getPad(padID, text);
|
return padManager.getPad(padID, text);
|
||||||
}
|
};
|
||||||
|
|
||||||
// checks if a rev is a legal number
|
// checks if a rev is a legal number
|
||||||
// pre-condition is that `rev` is not undefined
|
// pre-condition is that `rev` is not undefined
|
||||||
|
|
|
@ -135,7 +135,7 @@ exports.createAuthorIfNotExistsFor = async (authorMapper, name) => {
|
||||||
* @param {String} mapperkey The database key name for this mapper
|
* @param {String} mapperkey The database key name for this mapper
|
||||||
* @param {String} mapper The mapper
|
* @param {String} mapper The mapper
|
||||||
*/
|
*/
|
||||||
async function mapAuthorWithDBKey(mapperkey, mapper) {
|
const mapAuthorWithDBKey = async (mapperkey, mapper) => {
|
||||||
// try to map to an author
|
// try to map to an author
|
||||||
const author = await db.get(`${mapperkey}:${mapper}`);
|
const author = await db.get(`${mapperkey}:${mapper}`);
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ async function mapAuthorWithDBKey(mapperkey, mapper) {
|
||||||
|
|
||||||
// return the author
|
// return the author
|
||||||
return {authorID: author};
|
return {authorID: author};
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function that creates the database entry for an author
|
* Internal function that creates the database entry for an author
|
||||||
|
|
|
@ -29,7 +29,7 @@ const util = require('util');
|
||||||
|
|
||||||
// set database settings
|
// set database settings
|
||||||
const db =
|
const db =
|
||||||
new ueberDB.database(settings.dbType, settings.dbSettings, null, log4js.getLogger('ueberDB'));
|
new ueberDB.Database(settings.dbType, settings.dbSettings, null, log4js.getLogger('ueberDB'));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The UeberDB Object that provides the database functions
|
* The UeberDB Object that provides the database functions
|
||||||
|
|
|
@ -32,7 +32,7 @@ exports.cleanText = (txt) => txt.replace(/\r\n/g, '\n')
|
||||||
.replace(/\t/g, ' ')
|
.replace(/\t/g, ' ')
|
||||||
.replace(/\xa0/g, ' ');
|
.replace(/\xa0/g, ' ');
|
||||||
|
|
||||||
const Pad = function Pad(id) {
|
const Pad = function (id) {
|
||||||
this.atext = Changeset.makeAText('\n');
|
this.atext = Changeset.makeAText('\n');
|
||||||
this.pool = new AttributePool();
|
this.pool = new AttributePool();
|
||||||
this.head = -1;
|
this.head = -1;
|
||||||
|
@ -44,32 +44,29 @@ const Pad = function Pad(id) {
|
||||||
|
|
||||||
exports.Pad = Pad;
|
exports.Pad = Pad;
|
||||||
|
|
||||||
Pad.prototype.apool = function apool() {
|
Pad.prototype.apool = function () {
|
||||||
return this.pool;
|
return this.pool;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getHeadRevisionNumber = function getHeadRevisionNumber() {
|
Pad.prototype.getHeadRevisionNumber = function () {
|
||||||
return this.head;
|
return this.head;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getSavedRevisionsNumber = function getSavedRevisionsNumber() {
|
Pad.prototype.getSavedRevisionsNumber = function () {
|
||||||
return this.savedRevisions.length;
|
return this.savedRevisions.length;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getSavedRevisionsList = function getSavedRevisionsList() {
|
Pad.prototype.getSavedRevisionsList = function () {
|
||||||
const savedRev = [];
|
const savedRev = this.savedRevisions.map((rev) => rev.revNum);
|
||||||
for (const rev in this.savedRevisions) {
|
|
||||||
savedRev.push(this.savedRevisions[rev].revNum);
|
|
||||||
}
|
|
||||||
savedRev.sort((a, b) => a - b);
|
savedRev.sort((a, b) => a - b);
|
||||||
return savedRev;
|
return savedRev;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getPublicStatus = function getPublicStatus() {
|
Pad.prototype.getPublicStatus = function () {
|
||||||
return this.publicStatus;
|
return this.publicStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.appendRevision = async function appendRevision(aChangeset, author) {
|
Pad.prototype.appendRevision = async function (aChangeset, author) {
|
||||||
if (!author) {
|
if (!author) {
|
||||||
author = '';
|
author = '';
|
||||||
}
|
}
|
||||||
|
@ -115,7 +112,7 @@ Pad.prototype.appendRevision = async function appendRevision(aChangeset, author)
|
||||||
};
|
};
|
||||||
|
|
||||||
// save all attributes to the database
|
// save all attributes to the database
|
||||||
Pad.prototype.saveToDatabase = async function saveToDatabase() {
|
Pad.prototype.saveToDatabase = async function () {
|
||||||
const dbObject = {};
|
const dbObject = {};
|
||||||
|
|
||||||
for (const attr in this) {
|
for (const attr in this) {
|
||||||
|
@ -133,24 +130,24 @@ Pad.prototype.saveToDatabase = async function saveToDatabase() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// get time of last edit (changeset application)
|
// get time of last edit (changeset application)
|
||||||
Pad.prototype.getLastEdit = function getLastEdit() {
|
Pad.prototype.getLastEdit = function () {
|
||||||
const revNum = this.getHeadRevisionNumber();
|
const revNum = this.getHeadRevisionNumber();
|
||||||
return db.getSub(`pad:${this.id}:revs:${revNum}`, ['meta', 'timestamp']);
|
return db.getSub(`pad:${this.id}:revs:${revNum}`, ['meta', 'timestamp']);
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getRevisionChangeset = function getRevisionChangeset(revNum) {
|
Pad.prototype.getRevisionChangeset = function (revNum) {
|
||||||
return db.getSub(`pad:${this.id}:revs:${revNum}`, ['changeset']);
|
return db.getSub(`pad:${this.id}:revs:${revNum}`, ['changeset']);
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getRevisionAuthor = function getRevisionAuthor(revNum) {
|
Pad.prototype.getRevisionAuthor = function (revNum) {
|
||||||
return db.getSub(`pad:${this.id}:revs:${revNum}`, ['meta', 'author']);
|
return db.getSub(`pad:${this.id}:revs:${revNum}`, ['meta', 'author']);
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getRevisionDate = function getRevisionDate(revNum) {
|
Pad.prototype.getRevisionDate = function (revNum) {
|
||||||
return db.getSub(`pad:${this.id}:revs:${revNum}`, ['meta', 'timestamp']);
|
return db.getSub(`pad:${this.id}:revs:${revNum}`, ['meta', 'timestamp']);
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getAllAuthors = function getAllAuthors() {
|
Pad.prototype.getAllAuthors = function () {
|
||||||
const authors = [];
|
const authors = [];
|
||||||
|
|
||||||
for (const key in this.pool.numToAttrib) {
|
for (const key in this.pool.numToAttrib) {
|
||||||
|
@ -162,7 +159,7 @@ Pad.prototype.getAllAuthors = function getAllAuthors() {
|
||||||
return authors;
|
return authors;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getInternalRevisionAText = async function getInternalRevisionAText(targetRev) {
|
Pad.prototype.getInternalRevisionAText = async function (targetRev) {
|
||||||
const keyRev = this.getKeyRevisionNumber(targetRev);
|
const keyRev = this.getKeyRevisionNumber(targetRev);
|
||||||
|
|
||||||
// find out which changesets are needed
|
// find out which changesets are needed
|
||||||
|
@ -197,11 +194,11 @@ Pad.prototype.getInternalRevisionAText = async function getInternalRevisionAText
|
||||||
return atext;
|
return atext;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getRevision = function getRevisionChangeset(revNum) {
|
Pad.prototype.getRevision = function (revNum) {
|
||||||
return db.get(`pad:${this.id}:revs:${revNum}`);
|
return db.get(`pad:${this.id}:revs:${revNum}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getAllAuthorColors = async function getAllAuthorColors() {
|
Pad.prototype.getAllAuthorColors = async function () {
|
||||||
const authors = this.getAllAuthors();
|
const authors = this.getAllAuthors();
|
||||||
const returnTable = {};
|
const returnTable = {};
|
||||||
const colorPalette = authorManager.getColorPalette();
|
const colorPalette = authorManager.getColorPalette();
|
||||||
|
@ -215,7 +212,7 @@ Pad.prototype.getAllAuthorColors = async function getAllAuthorColors() {
|
||||||
return returnTable;
|
return returnTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getValidRevisionRange = function getValidRevisionRange(startRev, endRev) {
|
Pad.prototype.getValidRevisionRange = function (startRev, endRev) {
|
||||||
startRev = parseInt(startRev, 10);
|
startRev = parseInt(startRev, 10);
|
||||||
const head = this.getHeadRevisionNumber();
|
const head = this.getHeadRevisionNumber();
|
||||||
endRev = endRev ? parseInt(endRev, 10) : head;
|
endRev = endRev ? parseInt(endRev, 10) : head;
|
||||||
|
@ -236,15 +233,15 @@ Pad.prototype.getValidRevisionRange = function getValidRevisionRange(startRev, e
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getKeyRevisionNumber = function getKeyRevisionNumber(revNum) {
|
Pad.prototype.getKeyRevisionNumber = function (revNum) {
|
||||||
return Math.floor(revNum / 100) * 100;
|
return Math.floor(revNum / 100) * 100;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.text = function text() {
|
Pad.prototype.text = function () {
|
||||||
return this.atext.text;
|
return this.atext.text;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.setText = async function setText(newText) {
|
Pad.prototype.setText = async function (newText) {
|
||||||
// clean the new text
|
// clean the new text
|
||||||
newText = exports.cleanText(newText);
|
newText = exports.cleanText(newText);
|
||||||
|
|
||||||
|
@ -264,7 +261,7 @@ Pad.prototype.setText = async function setText(newText) {
|
||||||
await this.appendRevision(changeset);
|
await this.appendRevision(changeset);
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.appendText = async function appendText(newText) {
|
Pad.prototype.appendText = async function (newText) {
|
||||||
// clean the new text
|
// clean the new text
|
||||||
newText = exports.cleanText(newText);
|
newText = exports.cleanText(newText);
|
||||||
|
|
||||||
|
@ -277,7 +274,7 @@ Pad.prototype.appendText = async function appendText(newText) {
|
||||||
await this.appendRevision(changeset);
|
await this.appendRevision(changeset);
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.appendChatMessage = async function appendChatMessage(text, userId, time) {
|
Pad.prototype.appendChatMessage = async function (text, userId, time) {
|
||||||
this.chatHead++;
|
this.chatHead++;
|
||||||
// save the chat entry in the database
|
// save the chat entry in the database
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
@ -286,7 +283,7 @@ Pad.prototype.appendChatMessage = async function appendChatMessage(text, userId,
|
||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getChatMessage = async function getChatMessage(entryNum) {
|
Pad.prototype.getChatMessage = async function (entryNum) {
|
||||||
// get the chat entry
|
// get the chat entry
|
||||||
const entry = await db.get(`pad:${this.id}:chat:${entryNum}`);
|
const entry = await db.get(`pad:${this.id}:chat:${entryNum}`);
|
||||||
|
|
||||||
|
@ -298,7 +295,7 @@ Pad.prototype.getChatMessage = async function getChatMessage(entryNum) {
|
||||||
return entry;
|
return entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getChatMessages = async function getChatMessages(start, end) {
|
Pad.prototype.getChatMessages = async function (start, end) {
|
||||||
// collect the numbers of chat entries and in which order we need them
|
// collect the numbers of chat entries and in which order we need them
|
||||||
const neededEntries = [];
|
const neededEntries = [];
|
||||||
for (let order = 0, entryNum = start; entryNum <= end; ++order, ++entryNum) {
|
for (let order = 0, entryNum = start; entryNum <= end; ++order, ++entryNum) {
|
||||||
|
@ -326,7 +323,7 @@ Pad.prototype.getChatMessages = async function getChatMessages(start, end) {
|
||||||
return cleanedEntries;
|
return cleanedEntries;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.init = async function init(text) {
|
Pad.prototype.init = async function (text) {
|
||||||
// replace text with default text if text isn't set
|
// replace text with default text if text isn't set
|
||||||
if (text == null) {
|
if (text == null) {
|
||||||
text = settings.defaultPadText;
|
text = settings.defaultPadText;
|
||||||
|
@ -355,8 +352,7 @@ Pad.prototype.init = async function init(text) {
|
||||||
hooks.callAll('padLoad', {pad: this});
|
hooks.callAll('padLoad', {pad: this});
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.copy = async function copy(destinationID, force) {
|
Pad.prototype.copy = async function (destinationID, force) {
|
||||||
let destGroupID;
|
|
||||||
const sourceID = this.id;
|
const sourceID = this.id;
|
||||||
|
|
||||||
// Kick everyone from this pad.
|
// Kick everyone from this pad.
|
||||||
|
@ -367,16 +363,11 @@ Pad.prototype.copy = async function copy(destinationID, force) {
|
||||||
// flush the source pad:
|
// flush the source pad:
|
||||||
await this.saveToDatabase();
|
await this.saveToDatabase();
|
||||||
|
|
||||||
|
// if it's a group pad, let's make sure the group exists.
|
||||||
|
const destGroupID = await this.checkIfGroupExistAndReturnIt(destinationID);
|
||||||
|
|
||||||
try {
|
// if force is true and already exists a Pad with the same id, remove that Pad
|
||||||
// if it's a group pad, let's make sure the group exists.
|
await this.removePadIfForceIsTrueAndAlreadyExist(destinationID, force);
|
||||||
destGroupID = await this.checkIfGroupExistAndReturnIt(destinationID);
|
|
||||||
|
|
||||||
// if force is true and already exists a Pad with the same id, remove that Pad
|
|
||||||
await this.removePadIfForceIsTrueAndAlreadyExist(destinationID, force);
|
|
||||||
} catch (err) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy the 'pad' entry
|
// copy the 'pad' entry
|
||||||
const pad = await db.get(`pad:${sourceID}`);
|
const pad = await db.get(`pad:${sourceID}`);
|
||||||
|
@ -423,7 +414,7 @@ Pad.prototype.copy = async function copy(destinationID, force) {
|
||||||
return {padID: destinationID};
|
return {padID: destinationID};
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.checkIfGroupExistAndReturnIt = async function checkIfGroupExistAndReturnIt(destinationID) {
|
Pad.prototype.checkIfGroupExistAndReturnIt = async function (destinationID) {
|
||||||
let destGroupID = false;
|
let destGroupID = false;
|
||||||
|
|
||||||
if (destinationID.indexOf('$') >= 0) {
|
if (destinationID.indexOf('$') >= 0) {
|
||||||
|
@ -438,7 +429,7 @@ Pad.prototype.checkIfGroupExistAndReturnIt = async function checkIfGroupExistAnd
|
||||||
return destGroupID;
|
return destGroupID;
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.removePadIfForceIsTrueAndAlreadyExist = async function removePadIfForceIsTrueAndAlreadyExist(destinationID, force) {
|
Pad.prototype.removePadIfForceIsTrueAndAlreadyExist = async function (destinationID, force) {
|
||||||
// if the pad exists, we should abort, unless forced.
|
// if the pad exists, we should abort, unless forced.
|
||||||
const exists = await padManager.doesPadExist(destinationID);
|
const exists = await padManager.doesPadExist(destinationID);
|
||||||
|
|
||||||
|
@ -461,29 +452,24 @@ Pad.prototype.removePadIfForceIsTrueAndAlreadyExist = async function removePadIf
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.copyAuthorInfoToDestinationPad = function copyAuthorInfoToDestinationPad(destinationID) {
|
Pad.prototype.copyAuthorInfoToDestinationPad = function (destinationID) {
|
||||||
// add the new sourcePad to all authors who contributed to the old one
|
// add the new sourcePad to all authors who contributed to the old one
|
||||||
this.getAllAuthors().forEach((authorID) => {
|
this.getAllAuthors().forEach((authorID) => {
|
||||||
authorManager.addPad(authorID, destinationID);
|
authorManager.addPad(authorID, destinationID);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.copyPadWithoutHistory = async function copyPadWithoutHistory(destinationID, force) {
|
Pad.prototype.copyPadWithoutHistory = async function (destinationID, force) {
|
||||||
let destGroupID;
|
|
||||||
const sourceID = this.id;
|
const sourceID = this.id;
|
||||||
|
|
||||||
// flush the source pad
|
// flush the source pad
|
||||||
this.saveToDatabase();
|
this.saveToDatabase();
|
||||||
|
|
||||||
try {
|
// if it's a group pad, let's make sure the group exists.
|
||||||
// if it's a group pad, let's make sure the group exists.
|
const destGroupID = await this.checkIfGroupExistAndReturnIt(destinationID);
|
||||||
destGroupID = await this.checkIfGroupExistAndReturnIt(destinationID);
|
|
||||||
|
|
||||||
// if force is true and already exists a Pad with the same id, remove that Pad
|
// if force is true and already exists a Pad with the same id, remove that Pad
|
||||||
await this.removePadIfForceIsTrueAndAlreadyExist(destinationID, force);
|
await this.removePadIfForceIsTrueAndAlreadyExist(destinationID, force);
|
||||||
} catch (err) {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
const sourcePad = await padManager.getPad(sourceID);
|
const sourcePad = await padManager.getPad(sourceID);
|
||||||
|
|
||||||
|
@ -526,7 +512,7 @@ Pad.prototype.copyPadWithoutHistory = async function copyPadWithoutHistory(desti
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
Pad.prototype.remove = async function remove() {
|
Pad.prototype.remove = async function () {
|
||||||
const padID = this.id;
|
const padID = this.id;
|
||||||
const p = [];
|
const p = [];
|
||||||
|
|
||||||
|
@ -579,12 +565,12 @@ Pad.prototype.remove = async function remove() {
|
||||||
};
|
};
|
||||||
|
|
||||||
// set in db
|
// set in db
|
||||||
Pad.prototype.setPublicStatus = async function setPublicStatus(publicStatus) {
|
Pad.prototype.setPublicStatus = async function (publicStatus) {
|
||||||
this.publicStatus = publicStatus;
|
this.publicStatus = publicStatus;
|
||||||
await this.saveToDatabase();
|
await this.saveToDatabase();
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.addSavedRevision = async function addSavedRevision(revNum, savedById, label) {
|
Pad.prototype.addSavedRevision = async function (revNum, savedById, label) {
|
||||||
// if this revision is already saved, return silently
|
// if this revision is already saved, return silently
|
||||||
for (const i in this.savedRevisions) {
|
for (const i in this.savedRevisions) {
|
||||||
if (this.savedRevisions[i] && this.savedRevisions[i].revNum === revNum) {
|
if (this.savedRevisions[i] && this.savedRevisions[i].revNum === revNum) {
|
||||||
|
@ -605,6 +591,6 @@ Pad.prototype.addSavedRevision = async function addSavedRevision(revNum, savedBy
|
||||||
await this.saveToDatabase();
|
await this.saveToDatabase();
|
||||||
};
|
};
|
||||||
|
|
||||||
Pad.prototype.getSavedRevisions = function getSavedRevisions() {
|
Pad.prototype.getSavedRevisions = function () {
|
||||||
return this.savedRevisions;
|
return this.savedRevisions;
|
||||||
};
|
};
|
||||||
|
|
|
@ -250,7 +250,7 @@ const listSessionsWithDBKey = async (dbkey) => {
|
||||||
const sessions = sessionObject ? sessionObject.sessionIDs : null;
|
const sessions = sessionObject ? sessionObject.sessionIDs : null;
|
||||||
|
|
||||||
// iterate through the sessions and get the sessioninfos
|
// iterate through the sessions and get the sessioninfos
|
||||||
for (const sessionID in sessions) {
|
for (const sessionID of Object.keys(sessions || {})) {
|
||||||
try {
|
try {
|
||||||
const sessionInfo = await exports.getSessionInfo(sessionID);
|
const sessionInfo = await exports.getSessionInfo(sessionID);
|
||||||
sessions[sessionID] = sessionInfo;
|
sessions[sessionID] = sessionInfo;
|
||||||
|
|
|
@ -42,7 +42,7 @@ const runTests = () => {
|
||||||
|
|
||||||
const literal = (v) => {
|
const literal = (v) => {
|
||||||
if ((typeof v) === 'string') {
|
if ((typeof v) === 'string') {
|
||||||
return `"${v.replace(/[\\\"]/g, '\\$1').replace(/\n/g, '\\n')}"`;
|
return `"${v.replace(/[\\"]/g, '\\$1').replace(/\n/g, '\\n')}"`;
|
||||||
} else { return JSON.stringify(v); }
|
} else { return JSON.stringify(v); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ exports.padOptions = {
|
||||||
alwaysShowChat: false,
|
alwaysShowChat: false,
|
||||||
chatAndUsers: false,
|
chatAndUsers: false,
|
||||||
lang: 'en-gb',
|
lang: 'en-gb',
|
||||||
},
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether certain shortcut keys are enabled for a user in the pad
|
* Whether certain shortcut keys are enabled for a user in the pad
|
||||||
|
@ -169,7 +169,7 @@ exports.padShortcutEnabled = {
|
||||||
ctrlHome: true,
|
ctrlHome: true,
|
||||||
pageUp: true,
|
pageUp: true,
|
||||||
pageDown: true,
|
pageDown: true,
|
||||||
},
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The toolbar buttons and order.
|
* The toolbar buttons and order.
|
||||||
|
@ -466,7 +466,7 @@ exports.getEpVersion = () => require('../../package.json').version;
|
||||||
* both "settings.json" and "credentials.json".
|
* both "settings.json" and "credentials.json".
|
||||||
*/
|
*/
|
||||||
const storeSettings = (settingsObj) => {
|
const storeSettings = (settingsObj) => {
|
||||||
for (const i in settingsObj) {
|
for (const i of Object.keys(settingsObj || {})) {
|
||||||
// test if the setting starts with a lowercase character
|
// test if the setting starts with a lowercase character
|
||||||
if (i.charAt(0).search('[a-z]') !== 0) {
|
if (i.charAt(0).search('[a-z]') !== 0) {
|
||||||
console.warn(`Settings should start with a lowercase character: '${i}'`);
|
console.warn(`Settings should start with a lowercase character: '${i}'`);
|
||||||
|
|
Loading…
Reference in a new issue