diff --git a/bin/checkAllPads.ts b/bin/checkAllPads.ts index a192be794..a967413d1 100644 --- a/bin/checkAllPads.ts +++ b/bin/checkAllPads.ts @@ -2,6 +2,7 @@ /* * This is a debug tool. It checks all revisions for data corruption */ +import process from "node:process"; // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an // unhandled rejection into an uncaught exception, which does cause Node.js to exit. diff --git a/bin/checkPad.ts b/bin/checkPad.ts index 1e411693f..09f3d30c5 100644 --- a/bin/checkPad.ts +++ b/bin/checkPad.ts @@ -2,6 +2,7 @@ /* * This is a debug tool. It checks all revisions for data corruption */ +import process from "node:process"; // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an // unhandled rejection into an uncaught exception, which does cause Node.js to exit. diff --git a/bin/createUserSession.ts b/bin/createUserSession.ts index 9f340ae9b..1dbab0d69 100644 --- a/bin/createUserSession.ts +++ b/bin/createUserSession.ts @@ -7,11 +7,11 @@ // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an // unhandled rejection into an uncaught exception, which does cause Node.js to exit. -import fs from "fs"; +import fs from "node:fs"; -import path from "path"; +import path from "node:path"; -import querystring from "querystring"; +import querystring from "node:querystring"; import axios from 'axios' diff --git a/bin/deleteAllGroupSessions.ts b/bin/deleteAllGroupSessions.ts index d10943382..23d21c594 100644 --- a/bin/deleteAllGroupSessions.ts +++ b/bin/deleteAllGroupSessions.ts @@ -5,10 +5,10 @@ // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an // unhandled rejection into an uncaught exception, which does cause Node.js to exit. -import path from "path"; +import path from "node:path"; -import fs from "fs"; -import process from "process"; +import fs from "node:fs"; +import process from "node:process"; process.on('unhandledRejection', (err) => { throw err; }); import axios from 'axios' diff --git a/bin/deletePad.ts b/bin/deletePad.ts index a9d60190e..20037bb33 100644 --- a/bin/deletePad.ts +++ b/bin/deletePad.ts @@ -7,10 +7,10 @@ // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an // unhandled rejection into an uncaught exception, which does cause Node.js to exit. -import path from "path"; +import path from "node:path"; -import fs from "fs"; -import process from "process"; +import fs from "node:fs"; +import process from "node:process"; import axios from "axios"; process.on('unhandledRejection', (err) => { throw err; }); diff --git a/bin/extractPadData.ts b/bin/extractPadData.ts index 5c64cf0b4..3c10a3acc 100644 --- a/bin/extractPadData.ts +++ b/bin/extractPadData.ts @@ -8,9 +8,8 @@ // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an // unhandled rejection into an uncaught exception, which does cause Node.js to exit. -import util from "util"; -import process from "process"; -import dirtyDB from "ueberdb2"; +import util from "node:util"; +import process from "node:process"; process.on('unhandledRejection', (err) => { throw err; }); if (process.argv.length !== 3) throw new Error('Use: node extractPadData.js $PADID'); @@ -40,7 +39,7 @@ const padId = process.argv[2]; const pad = await padManager.getPad(padId); // add all authors - neededDBValues.push(...pad.getAllAuthors().map((author) => `globalAuthor:${author}`)); + neededDBValues.push(...pad.getAllAuthors().map((author: string) => `globalAuthor:${author}`)); // add all revisions for (let rev = 0; rev <= pad.head; ++rev) { diff --git a/bin/importSqlFile.ts b/bin/importSqlFile.ts index 5d137dd92..23ad9b7d1 100644 --- a/bin/importSqlFile.ts +++ b/bin/importSqlFile.ts @@ -2,7 +2,7 @@ // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an // unhandled rejection into an uncaught exception, which does cause Node.js to exit. -import util from "util"; +import util from "node:util"; const fs = require('fs'); import log4js from 'log4js'; import readline from 'readline'; diff --git a/bin/plugins/checkPlugin.ts b/bin/plugins/checkPlugin.ts index d5d22c0e2..73afd4e19 100644 --- a/bin/plugins/checkPlugin.ts +++ b/bin/plugins/checkPlugin.ts @@ -10,18 +10,18 @@ * node bin/plugins/checkPlugin.js ep_whatever autopush */ -import process from 'process'; +import process from 'node:process'; // As of v14, Node.js does not exit when there is an unhandled Promise rejection. Convert an // unhandled rejection into an uncaught exception, which does cause Node.js to exit. process.on('unhandledRejection', (err) => { throw err; }); import {strict as assert} from 'assert'; -import fs from 'fs'; +import fs from 'node:fs'; const fsp = fs.promises; -import childProcess from 'child_process'; +import childProcess from 'node:child_process'; import log4js from 'log4js'; -import path from 'path'; +import path from 'node:path'; const logger = log4js.getLogger('checkPlugin'); diff --git a/bin/release.ts b/bin/release.ts index 580f56e9e..ac60ce6d4 100644 --- a/bin/release.ts +++ b/bin/release.ts @@ -4,12 +4,12 @@ // unhandled rejection into an uncaught exception, which does cause Node.js to exit. process.on('unhandledRejection', (err) => { throw err; }); -import fs from 'fs'; -import childProcess from 'child_process'; +import fs from 'node:fs'; +import childProcess from 'node:child_process'; import log4js from 'log4js'; -import path from 'path'; +import path from 'node:path'; import semver from 'semver'; -import {exec} from 'child_process'; +import {exec} from 'node:child_process'; log4js.configure({appenders: {console: {type: 'console'}}, categories: { diff --git a/bin/repairPad.ts b/bin/repairPad.ts index f1a55238e..848b7205f 100644 --- a/bin/repairPad.ts +++ b/bin/repairPad.ts @@ -1,6 +1,6 @@ 'use strict'; -import process from "process"; +import process from "node:process"; /* * This is a repair tool. It extracts all datas of a pad, removes and inserts them again. diff --git a/src/static/js/socketio.js b/src/static/js/socketio.js index 3bc7dba58..4d9e0940f 100644 --- a/src/static/js/socketio.js +++ b/src/static/js/socketio.js @@ -22,14 +22,15 @@ const connect = (etherpadBaseUrl, namespace = '/', options = {}) => { let socketOptions = { path: socketioUrl.pathname, - upgrade: true, - transports: ["websocket"] - } + upgrade: true, + transports: ['websocket'], + }; socketOptions = Object.assign(options, socketOptions); - + const socket = io(namespaceUrl.href, socketOptions); socket.on('connect_error', (error) => { + console.log('Error connecting to pad', error); if (socket.io.engine.transports.indexOf('polling') === -1) { console.warn('WebSocket connection failed. Falling back to long-polling.'); socket.io.opts.transports = ['polling'];