Skip to content

Commit 6db14ba

Browse files
committed
fix: express5
1 parent 6208a04 commit 6db14ba

26 files changed

Lines changed: 200 additions & 207 deletions

bin/checkPad.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const performCheck = async () => {
1717
await db.init();
1818
console.log("Checking if " + padId + " exists")
1919
const padManager = require('ep_etherpad-lite/node/db/PadManager');
20-
if (!await padManager.doesPadExists(padId)) throw new Error('Pad does not exist');
20+
if (!(await padManager.doesPadExists(padId))) throw new Error('Pad does not exist');
2121
const pad = await padManager.getPad(padId);
2222
await pad.check();
2323
console.log('Finished checking pad.');

pnpm-lock.yaml

Lines changed: 137 additions & 142 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node/db/GroupManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ exports.deleteGroup = async (groupID: string): Promise<void> => {
5959

6060
// Delete associated sessions in parallel. This should be done before deleting the group2sessions
6161
// record because deleting a session updates the group2sessions record.
62-
const {sessionIDs = {}} = await db.get(`group2sessions:${groupID}`) || {};
62+
const {sessionIDs = {}} = (await db.get(`group2sessions:${groupID}`)) || {};
6363
await Promise.all(Object.keys(sessionIDs).map(async (sessionId) => {
6464
await sessionManager.deleteSession(sessionId);
6565
}));
@@ -113,7 +113,7 @@ exports.createGroupIfNotExistsFor = async (groupMapper: string|object) => {
113113
throw new CustomError('groupMapper is not a string', 'apierror');
114114
}
115115
const groupID = await db.get(`mapper2group:${groupMapper}`);
116-
if (groupID && await exports.doesGroupExist(groupID)) return {groupID};
116+
if (groupID && (await exports.doesGroupExist(groupID))) return {groupID};
117117
const result = await exports.createGroup();
118118
await Promise.all([
119119
db.set(`mapper2group:${groupMapper}`, result.groupID),

src/node/db/Pad.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,10 @@ class Pad {
116116
meta: {
117117
author: authorId,
118118
timestamp: Date.now(),
119-
...newRev === this.getKeyRevisionNumber(newRev) ? {
119+
...(newRev === this.getKeyRevisionNumber(newRev) ? {
120120
pool: this.pool,
121121
atext: this.atext,
122-
} : {},
122+
} : {}),
123123
},
124124
}),
125125
this.saveToDatabase(),
@@ -135,10 +135,10 @@ class Pad {
135135
pad_utils.warnDeprecated(`${hook} hook author context is deprecated; use authorId instead`);
136136
this.authorId = authorId;
137137
},
138-
...this.head === 0 ? {} : {
138+
...(this.head === 0 ? {} : {
139139
revs: newRev,
140140
changeset: aChangeset,
141-
},
141+
}),
142142
}),
143143
]);
144144
return newRev;

src/node/db/PadManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const globalPads:MapArrayType<any> = {
5757
*
5858
* Updated without db access as new pads are created/old ones removed.
5959
*/
60-
const padList = new class {
60+
const padList = new (class {
6161
private _cachedList: string[] | null;
6262
private _list: Set<string>;
6363
private _loaded: Promise<void> | null;
@@ -95,7 +95,7 @@ const padList = new class {
9595
this._list.delete(name);
9696
this._cachedList = null;
9797
}
98-
}();
98+
})();
9999

100100
// initialises the all-knowing data structure
101101

src/node/db/SecurityManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ exports.checkAccess = async (padID:string, sessionCookie:string, token:string, u
122122

123123
const grant = {
124124
accessStatus: 'grant',
125-
authorID: sessionAuthorID || await authorManager.getAuthorId(token, userSettings),
125+
authorID: sessionAuthorID || (await authorManager.getAuthorId(token, userSettings)),
126126
};
127127

128128
if (!padID.includes('$')) {

src/node/handler/PadMessageHandler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ exports.handleMessage = async (socket:any, message: ClientVarMessage) => {
327327
`IP:${settings.disableIPlogging ? 'ANONYMOUS' : socket.request.ip}`,
328328
`originalAuthorID:${thisSession.author}`,
329329
`newAuthorID:${authorID}`,
330-
...(user && user.username) ? [`username:${user.username}`] : [],
330+
...((user && user.username) ? [`username:${user.username}`] : []),
331331
`message:${message}`,
332332
].join(' '));
333333
}
@@ -1097,7 +1097,7 @@ const handleClientReady = async (socket:any, message: ClientReadyMessage) => {
10971097
if (authorId == null) return;
10981098

10991099
// reuse previously created cache of author's data
1100-
const authorInfo = historicalAuthorData[authorId] || await authorManager.getAuthor(authorId);
1100+
const authorInfo = historicalAuthorData[authorId] || (await authorManager.getAuthor(authorId));
11011101
if (authorInfo == null) {
11021102
messageLogger.error(
11031103
`Author ${authorId} connected via socket.io session ${roomSocket.id} is missing from ` +

src/node/security/SecretRotator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class SecretRotator {
173173
// TODO: This is racy. If two instances start up at the same time and there are no existing
174174
// matching publications, each will generate and publish their own paramters. In practice this
175175
// is unlikely to happen, and if it does it can be fixed by restarting both Etherpad instances.
176-
const dbKeys:string[] = await db.findKeys(`${this._dbPrefix}:*`, null) || [];
176+
const dbKeys:string[] = (await db.findKeys(`${this._dbPrefix}:*`, null)) || [];
177177
let currentParams:any = null;
178178
let currentId = null;
179179
const dbWrites:any[] = [];
@@ -245,7 +245,7 @@ export class SecretRotator {
245245
// The secrets derived from currentParams MUST be the first secrets.
246246
const secrets = await this._deriveSecrets(currentParams, now);
247247
await Promise.all(
248-
allParams.map(async (p) => secrets.push(...await this._deriveSecrets(p, now))));
248+
allParams.map(async (p) => secrets.push(...(await this._deriveSecrets(p, now)))));
249249
// Update this.secrets all at once to avoid race conditions.
250250
this.secrets.length = 0;
251251
this.secrets.push(...secrets);

src/node/utils/Cleanup.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ const createRevision = async (aChangeset: AChangeSet, timestamp: number, isKeyRe
3131
meta: {
3232
author: authorId,
3333
timestamp: timestamp,
34-
...isKeyRev ? {
34+
...(isKeyRev ? {
3535
pool: pool,
3636
atext: atext,
37-
} : {},
37+
} : {}),
3838
},
3939
};
4040
}

src/node/utils/ImportEtherpad.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ exports.setPadRaw = async (padId: string, r: string, authorId = '') => {
4141
// DB key prefixes for pad records. Each key is expected to have the form `${prefix}:${padId}` or
4242
// `${prefix}:${padId}:${otherstuff}`.
4343
const padKeyPrefixes = [
44-
...await hooks.aCallAll('exportEtherpadAdditionalContent'),
44+
...(await hooks.aCallAll('exportEtherpadAdditionalContent')),
4545
'pad',
4646
];
4747

0 commit comments

Comments
 (0)