Skip to content

Commit 8588d99

Browse files
authored
chore: migrated settings to esm6 (#7062)
* chore: migrated settings to esm6 * chore: fixed frontends * chore: fixed missing usage of specialpages * chore: fixed last errors for settings * chore: fixed favicon test
1 parent 920308a commit 8588d99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+698
-562
lines changed

bin/createUserSession.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import process from "node:process";
1818

1919

2020
process.on('unhandledRejection', (err) => { throw err; });
21-
const settings = require('ep_etherpad-lite/node/utils/Settings');
21+
import settings from 'ep_etherpad-lite/node/utils/Settings';
2222
(async () => {
2323
axios.defaults.baseURL = `http://${settings.ip}:${settings.port}`;
2424
const api = axios;

bin/importSqlFile.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
// As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an
44
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
55
import util from "node:util";
6-
const fs = require('fs');
6+
import fs from 'node:fs';
77
import log4js from 'log4js';
88
import readline from 'readline';
9-
import {Database} from "ueberdb2";
9+
import {Database, DatabaseType} from "ueberdb2";
1010
import process from "node:process";
1111

12-
const settings = require('ep_etherpad-lite/node/utils/Settings');
12+
import settings from 'ep_etherpad-lite/node/utils/Settings';
1313
process.on('unhandledRejection', (err) => { throw err; });
1414
const startTime = Date.now();
1515

@@ -58,7 +58,7 @@ const unescape = (val: string) => {
5858
json: false, // data is already json encoded
5959
};
6060
const db = new Database( // eslint-disable-line new-cap
61-
settings.dbType,
61+
settings.dbType as DatabaseType,
6262
settings.dbSettings,
6363
dbWrapperSettings,
6464
log4js.getLogger('ueberDB'));

bin/migrateDB.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import {readFileSync} from 'node:fs'
33
import {Database, DatabaseType} from "ueberdb2";
44
import path from "node:path";
5-
const settings = require('ep_etherpad-lite/node/utils/Settings');
5+
import settings from 'ep_etherpad-lite/node/utils/Settings';
66

77

88
// file1 = source, file2 = target

bin/migrateDirtyDBtoRealDB.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
'use strict';
22

33
import process from 'node:process';
4-
import {Database} from "ueberdb2";
4+
import {Database, DatabaseType} from "ueberdb2";
55
import log4js from 'log4js';
6-
import util from 'util';
7-
const settings = require('ep_etherpad-lite/node/utils/Settings');
6+
import settings from 'ep_etherpad-lite/node/utils/Settings';
87

98
// As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an
109
// unhandled rejection into an uncaught exception, which does cause Node.js to exit.
@@ -24,7 +23,7 @@ process.on('unhandledRejection', (err) => { throw err; });
2423
writeInterval: 0, // Write directly to the database, don't buffer
2524
};
2625
const db = new Database( // eslint-disable-line new-cap
27-
settings.dbType,
26+
settings.dbType as DatabaseType,
2827
settings.dbSettings,
2928
dbWrapperSettings,
3029
log4js.getLogger('ueberDB'));

bin/rebuildPad.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
'use strict';
2-
31
/*
42
This is a repair tool. It rebuilds an old pad at a new pad location up to a
53
known "good" revision.

pnpm-lock.yaml

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

src/node/db/DB.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
* limitations under the License.
2222
*/
2323

24-
import {Database} from 'ueberdb2';
25-
const settings = require('../utils/Settings');
24+
import {Database, DatabaseType} from 'ueberdb2';
25+
import settings from '../utils/Settings';
2626
import log4js from 'log4js';
2727
const stats = require('../stats')
2828

@@ -37,7 +37,7 @@ exports.db = null;
3737
* Initializes the database with the settings provided by the settings module
3838
*/
3939
exports.init = async () => {
40-
exports.db = new Database(settings.dbType, settings.dbSettings, null, logger);
40+
exports.db = new Database(settings.dbType as DatabaseType, settings.dbSettings, null, logger);
4141
await exports.db.init();
4242
if (exports.db.metrics != null) {
4343
for (const [metric, value] of Object.entries(exports.db.metrics)) {

src/node/db/Pad.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import AttributePool from '../../static/js/AttributePool';
1414
const Stream = require('../utils/Stream');
1515
const assert = require('assert').strict;
1616
const db = require('./DB');
17-
const settings = require('../utils/Settings');
17+
import settings from '../utils/Settings';
1818
const authorManager = require('./AuthorManager');
1919
const padManager = require('./PadManager');
2020
const padMessageHandler = require('../handler/PadMessageHandler');

src/node/db/PadManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {PadType} from "../types/PadType";
2525
const CustomError = require('../utils/customError');
2626
const Pad = require('../db/Pad');
2727
const db = require('./DB');
28-
const settings = require('../utils/Settings');
28+
import settings from '../utils/Settings';
2929

3030
/**
3131
* A cache of all loaded Pads.

src/node/db/SecurityManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const hooks = require('../../static/js/pluginfw/hooks');
2626
const padManager = require('./PadManager');
2727
import readOnlyManager from './ReadOnlyManager';
2828
const sessionManager = require('./SessionManager');
29-
const settings = require('../utils/Settings');
29+
import settings from '../utils/Settings';
3030
const webaccess = require('../hooks/express/webaccess');
3131
const log4js = require('log4js');
3232
const authLogger = log4js.getLogger('auth');

0 commit comments

Comments
 (0)