mirror of
https://github.com/ether/etherpad-lite.git
synced 2026-01-23 02:35:34 +00:00
chore: moved first files to esm (#7061)
* chore: moved first files to esm * chore: moved first files to esm * chore: fix read only manager
This commit is contained in:
parent
0ed5603230
commit
920308a627
22 changed files with 96 additions and 76 deletions
36
pnpm-lock.yaml
generated
36
pnpm-lock.yaml
generated
|
|
@ -136,7 +136,7 @@ importers:
|
|||
devDependencies:
|
||||
vitepress:
|
||||
specifier: ^2.0.0-alpha.9
|
||||
version: 2.0.0-alpha.9(@types/node@24.1.0)(axios@1.10.0)(jwt-decode@4.0.0)(postcss@8.5.6)(tsx@4.20.3)(typescript@5.8.3)
|
||||
version: 2.0.0-alpha.9(@types/node@24.1.0)(axios@1.11.0)(jwt-decode@4.0.0)(postcss@8.5.6)(tsx@4.20.3)(typescript@5.8.3)
|
||||
|
||||
src:
|
||||
dependencies:
|
||||
|
|
@ -144,8 +144,8 @@ importers:
|
|||
specifier: ^3.2.6
|
||||
version: 3.2.6
|
||||
axios:
|
||||
specifier: ^1.10.0
|
||||
version: 1.10.0
|
||||
specifier: ^1.11.0
|
||||
version: 1.11.0
|
||||
cookie-parser:
|
||||
specifier: ^1.4.7
|
||||
version: 1.4.7
|
||||
|
|
@ -170,9 +170,6 @@ importers:
|
|||
express-session:
|
||||
specifier: ^1.18.2
|
||||
version: 1.18.2
|
||||
fast-deep-equal:
|
||||
specifier: ^3.1.3
|
||||
version: 3.1.3
|
||||
find-root:
|
||||
specifier: 1.1.0
|
||||
version: 1.1.0
|
||||
|
|
@ -312,6 +309,9 @@ importers:
|
|||
'@types/jsdom':
|
||||
specifier: ^21.1.7
|
||||
version: 21.1.7
|
||||
'@types/jsonminify':
|
||||
specifier: ^0.4.3
|
||||
version: 0.4.3
|
||||
'@types/jsonwebtoken':
|
||||
specifier: ^9.0.10
|
||||
version: 9.0.10
|
||||
|
|
@ -1615,6 +1615,9 @@ packages:
|
|||
'@types/json5@0.0.29':
|
||||
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
|
||||
|
||||
'@types/jsonminify@0.4.3':
|
||||
resolution: {integrity: sha512-+oz7EbPz1Nwmn/sr3UztgXpRhdFpvFrjGi5ictEYxUri5ZvQMTcdTi36MTfD/gCb1A5xhJKdH8Hwz2uz5k6s9A==}
|
||||
|
||||
'@types/jsonwebtoken@9.0.10':
|
||||
resolution: {integrity: sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==}
|
||||
|
||||
|
|
@ -2171,6 +2174,9 @@ packages:
|
|||
axios@1.10.0:
|
||||
resolution: {integrity: sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==}
|
||||
|
||||
axios@1.11.0:
|
||||
resolution: {integrity: sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==}
|
||||
|
||||
bail@2.0.2:
|
||||
resolution: {integrity: sha512-0xO6mYd7JB2YesxDKplafRpsiOzPt9V02ddPCLbY1xYGPOX24NTyN50qnUxgCPcSoYMhKpAuBTjQoRZCAkUDRw==}
|
||||
|
||||
|
|
@ -6049,6 +6055,8 @@ snapshots:
|
|||
|
||||
'@types/json5@0.0.29': {}
|
||||
|
||||
'@types/jsonminify@0.4.3': {}
|
||||
|
||||
'@types/jsonwebtoken@9.0.10':
|
||||
dependencies:
|
||||
'@types/ms': 2.1.0
|
||||
|
|
@ -6527,13 +6535,13 @@ snapshots:
|
|||
'@vueuse/shared': 13.6.0(vue@3.5.18(typescript@5.8.3))
|
||||
vue: 3.5.18(typescript@5.8.3)
|
||||
|
||||
'@vueuse/integrations@13.6.0(axios@1.10.0)(focus-trap@7.6.5)(jwt-decode@4.0.0)(vue@3.5.18(typescript@5.8.3))':
|
||||
'@vueuse/integrations@13.6.0(axios@1.11.0)(focus-trap@7.6.5)(jwt-decode@4.0.0)(vue@3.5.18(typescript@5.8.3))':
|
||||
dependencies:
|
||||
'@vueuse/core': 13.6.0(vue@3.5.18(typescript@5.8.3))
|
||||
'@vueuse/shared': 13.6.0(vue@3.5.18(typescript@5.8.3))
|
||||
vue: 3.5.18(typescript@5.8.3)
|
||||
optionalDependencies:
|
||||
axios: 1.10.0
|
||||
axios: 1.11.0
|
||||
focus-trap: 7.6.5
|
||||
jwt-decode: 4.0.0
|
||||
|
||||
|
|
@ -6678,6 +6686,14 @@ snapshots:
|
|||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
axios@1.11.0:
|
||||
dependencies:
|
||||
follow-redirects: 1.15.9
|
||||
form-data: 4.0.4
|
||||
proxy-from-env: 1.1.0
|
||||
transitivePeerDependencies:
|
||||
- debug
|
||||
|
||||
bail@2.0.2: {}
|
||||
|
||||
balanced-match@1.0.2: {}
|
||||
|
|
@ -9686,7 +9702,7 @@ snapshots:
|
|||
fsevents: 2.3.3
|
||||
tsx: 4.20.3
|
||||
|
||||
vitepress@2.0.0-alpha.9(@types/node@24.1.0)(axios@1.10.0)(jwt-decode@4.0.0)(postcss@8.5.6)(tsx@4.20.3)(typescript@5.8.3):
|
||||
vitepress@2.0.0-alpha.9(@types/node@24.1.0)(axios@1.11.0)(jwt-decode@4.0.0)(postcss@8.5.6)(tsx@4.20.3)(typescript@5.8.3):
|
||||
dependencies:
|
||||
'@docsearch/css': 4.0.0-beta.5
|
||||
'@docsearch/js': 4.0.0-beta.5
|
||||
|
|
@ -9698,7 +9714,7 @@ snapshots:
|
|||
'@vue/devtools-api': 7.7.7
|
||||
'@vue/shared': 3.5.18
|
||||
'@vueuse/core': 13.6.0(vue@3.5.18(typescript@5.8.3))
|
||||
'@vueuse/integrations': 13.6.0(axios@1.10.0)(focus-trap@7.6.5)(jwt-decode@4.0.0)(vue@3.5.18(typescript@5.8.3))
|
||||
'@vueuse/integrations': 13.6.0(axios@1.11.0)(focus-trap@7.6.5)(jwt-decode@4.0.0)(vue@3.5.18(typescript@5.8.3))
|
||||
focus-trap: 7.6.5
|
||||
mark.js: 8.11.1
|
||||
minisearch: 7.1.2
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import {Attribute} from "../../static/js/types/Attribute";
|
|||
const CustomError = require('../utils/customError');
|
||||
const padManager = require('./PadManager');
|
||||
const padMessageHandler = require('../handler/PadMessageHandler');
|
||||
const readOnlyManager = require('./ReadOnlyManager');
|
||||
import readOnlyManager from './ReadOnlyManager';
|
||||
const groupManager = require('./GroupManager');
|
||||
const authorManager = require('./AuthorManager');
|
||||
const sessionManager = require('./SessionManager');
|
||||
|
|
|
|||
|
|
@ -20,12 +20,11 @@ const padManager = require('./PadManager');
|
|||
const padMessageHandler = require('../handler/PadMessageHandler');
|
||||
const groupManager = require('./GroupManager');
|
||||
const CustomError = require('../utils/customError');
|
||||
const readOnlyManager = require('./ReadOnlyManager');
|
||||
const randomString = require('../utils/randomstring');
|
||||
import readOnlyManager from './ReadOnlyManager';
|
||||
import randomString from '../utils/randomstring';
|
||||
const hooks = require('../../static/js/pluginfw/hooks');
|
||||
import pad_utils from "../../static/js/pad_utils";
|
||||
import {SmartOpAssembler} from "../../static/js/SmartOpAssembler";
|
||||
import {} from '../utils/promises';
|
||||
import {timesLimit} from "async";
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
|
||||
const db = require('./DB');
|
||||
const randomString = require('../utils/randomstring');
|
||||
import randomString from '../utils/randomstring';
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -29,14 +29,14 @@ const randomString = require('../utils/randomstring');
|
|||
* @param {String} id the pad's id
|
||||
* @return {Boolean} true if the id is readonly
|
||||
*/
|
||||
exports.isReadOnlyId = (id:string) => id.startsWith('r.');
|
||||
const isReadOnlyId = (id:string) => id.startsWith('r.');
|
||||
|
||||
/**
|
||||
* returns a read only id for a pad
|
||||
* @param {String} padId the id of the pad
|
||||
* @return {String} the read only id
|
||||
*/
|
||||
exports.getReadOnlyId = async (padId:string) => {
|
||||
const getReadOnlyId = async (padId:string) => {
|
||||
// check if there is a pad2readonly entry
|
||||
let readOnlyId = await db.get(`pad2readonly:${padId}`);
|
||||
|
||||
|
|
@ -57,19 +57,29 @@ exports.getReadOnlyId = async (padId:string) => {
|
|||
* @param {String} readOnlyId read only id
|
||||
* @return {String} the padId
|
||||
*/
|
||||
exports.getPadId = async (readOnlyId:string) => await db.get(`readonly2pad:${readOnlyId}`);
|
||||
const getPadId = async (readOnlyId:string) => await db.get(`readonly2pad:${readOnlyId}`);
|
||||
|
||||
/**
|
||||
* returns the padId and readonlyPadId in an object for any id
|
||||
* @param {String} id read only id or real pad id
|
||||
* @return {Object} an object with the padId and readonlyPadId
|
||||
*/
|
||||
exports.getIds = async (id:string) => {
|
||||
const readonly = exports.isReadOnlyId(id);
|
||||
const getIds = async (id:string) => {
|
||||
const readonly = isReadOnlyId(id);
|
||||
|
||||
// Might be null, if this is an unknown read-only id
|
||||
const readOnlyPadId = readonly ? id : await exports.getReadOnlyId(id);
|
||||
const padId = readonly ? await exports.getPadId(id) : id;
|
||||
const readOnlyPadId = readonly ? id : await getReadOnlyId(id);
|
||||
const padId = readonly ? await getPadId(id) : id;
|
||||
|
||||
return {readOnlyPadId, padId, readonly};
|
||||
};
|
||||
|
||||
export default {
|
||||
isReadOnlyId,
|
||||
getReadOnlyId,
|
||||
getPadId,
|
||||
getIds,
|
||||
// Export for testing purposes
|
||||
__getReadOnlyId: getReadOnlyId, // eslint-disable-line no-underscore-dangle
|
||||
__getPadId: getPadId, // eslint-disable-line no-underscore-dangle
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import {UserSettingsObject} from "../types/UserSettingsObject";
|
|||
const authorManager = require('./AuthorManager');
|
||||
const hooks = require('../../static/js/pluginfw/hooks');
|
||||
const padManager = require('./PadManager');
|
||||
const readOnlyManager = require('./ReadOnlyManager');
|
||||
import readOnlyManager from './ReadOnlyManager';
|
||||
const sessionManager = require('./SessionManager');
|
||||
const settings = require('../utils/Settings');
|
||||
const webaccess = require('../hooks/express/webaccess');
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
const CustomError = require('../utils/customError');
|
||||
import {firstSatisfies} from '../utils/promises';
|
||||
const randomString = require('../utils/randomstring');
|
||||
import randomString from '../utils/randomstring';
|
||||
const db = require('./DB');
|
||||
const groupManager = require('./GroupManager');
|
||||
const authorManager = require('./AuthorManager');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
const absolutePaths = require('../utils/AbsolutePaths');
|
||||
import fs from 'fs';
|
||||
import log4js from 'log4js';
|
||||
const randomString = require('../utils/randomstring');
|
||||
import randomString from '../utils/randomstring';
|
||||
const argv = require('../utils/Cli').argv;
|
||||
const settings = require('../utils/Settings');
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import AttributePool from '../../static/js/AttributePool';
|
|||
const AttributeManager = require('../../static/js/AttributeManager');
|
||||
const authorManager = require('../db/AuthorManager');
|
||||
import padutils from '../../static/js/pad_utils';
|
||||
const readOnlyManager = require('../db/ReadOnlyManager');
|
||||
import readOnlyManager from '../db/ReadOnlyManager';
|
||||
const settings = require('../utils/Settings');
|
||||
const securityManager = require('../db/SecurityManager');
|
||||
const plugins = require('../../static/js/pluginfw/plugin_defs');
|
||||
|
|
|
|||
|
|
@ -2,18 +2,16 @@
|
|||
|
||||
|
||||
import {PadQueryResult, PadSearchQuery} from "../../types/PadSearchQuery";
|
||||
import {PadType} from "../../types/PadType";
|
||||
import log4js from 'log4js';
|
||||
|
||||
const eejs = require('../../eejs');
|
||||
const fsp = require('fs').promises;
|
||||
const hooks = require('../../../static/js/pluginfw/hooks');
|
||||
const plugins = require('../../../static/js/pluginfw/plugins');
|
||||
const settings = require('../../utils/Settings');
|
||||
const UpdateCheck = require('../../utils/UpdateCheck');
|
||||
import {getLatestVersion} from '../../utils/UpdateCheck';
|
||||
const padManager = require('../../db/PadManager');
|
||||
const api = require('../../db/API');
|
||||
const cleanup = require('../../utils/Cleanup');
|
||||
import {deleteRevisions} from '../../utils/Cleanup';
|
||||
|
||||
|
||||
const queryPadLimit = 12;
|
||||
|
|
@ -100,7 +98,7 @@ exports.socketio = (hookName: string, {io}: any) => {
|
|||
installedParts: plugins.getParts(),
|
||||
installedServerHooks: mapToObject(hooks),
|
||||
installedClientHooks: mapToObject(clientHooks),
|
||||
latestVersion: UpdateCheck.getLatestVersion(),
|
||||
latestVersion: getLatestVersion(),
|
||||
})
|
||||
});
|
||||
|
||||
|
|
@ -265,7 +263,7 @@ exports.socketio = (hookName: string, {io}: any) => {
|
|||
if (padExists) {
|
||||
logger.info(`Cleanup pad revisions: ${padId}`);
|
||||
try {
|
||||
const result = await cleanup.deleteRevisions(padId, settings.cleanup.keepRevisions)
|
||||
const result = await deleteRevisions(padId, settings.cleanup.keepRevisions)
|
||||
if (result) {
|
||||
socket.emit('results:cleanupPadRevisions', {
|
||||
padId: padId,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const settings = require('../../utils/Settings');
|
|||
const exportHandler = require('../../handler/ExportHandler');
|
||||
const importHandler = require('../../handler/ImportHandler');
|
||||
const padManager = require('../../db/PadManager');
|
||||
const readOnlyManager = require('../../db/ReadOnlyManager');
|
||||
import readOnlyManager from '../../db/ReadOnlyManager';
|
||||
const rateLimit = require('express-rate-limit');
|
||||
const securityManager = require('../../db/SecurityManager');
|
||||
const webaccess = require('./webaccess');
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import {SettingsUser} from "../../types/SettingsUser";
|
|||
const httpLogger = log4js.getLogger('http');
|
||||
const settings = require('../../utils/Settings');
|
||||
const hooks = require('../../../static/js/pluginfw/hooks');
|
||||
const readOnlyManager = require('../../db/ReadOnlyManager');
|
||||
import readOnlyManager from '../../db/ReadOnlyManager';
|
||||
|
||||
hooks.deprecationNotices.authFailure = 'use the authnFailure and authzFailure hooks instead';
|
||||
|
||||
|
|
|
|||
|
|
@ -68,11 +68,11 @@ if (process.env['https_proxy']) {
|
|||
* early check for version compatibility before calling
|
||||
* any modules that require newer versions of NodeJS
|
||||
*/
|
||||
const NodeVersion = require('./utils/NodeVersion');
|
||||
NodeVersion.enforceMinNodeVersion(pkg.engines.node.replace(">=", ""));
|
||||
NodeVersion.checkDeprecationStatus(pkg.engines.node.replace(">=", ""), '2.1.0');
|
||||
import {enforceMinNodeVersion, checkDeprecationStatus} from './utils/NodeVersion';
|
||||
enforceMinNodeVersion(pkg.engines.node.replace(">=", ""));
|
||||
checkDeprecationStatus(pkg.engines.node.replace(">=", ""), '2.1.0');
|
||||
|
||||
const UpdateCheck = require('./utils/UpdateCheck');
|
||||
import {check} from './utils/UpdateCheck';
|
||||
const db = require('./db/DB');
|
||||
const express = require('./hooks/express');
|
||||
const hooks = require('../static/js/pluginfw/hooks');
|
||||
|
|
@ -128,8 +128,8 @@ exports.start = async () => {
|
|||
startDoneGate = new Gate();
|
||||
state = State.STARTING;
|
||||
try {
|
||||
// Check if Etherpad version is up-to-date
|
||||
UpdateCheck.check();
|
||||
// Check if the Etherpad version is up to date
|
||||
check();
|
||||
|
||||
// @ts-ignore
|
||||
stats.gauge('memoryUsage', () => process.memoryUsage().rss);
|
||||
|
|
|
|||
|
|
@ -3,15 +3,16 @@
|
|||
import {AChangeSet} from "../types/PadType";
|
||||
import {Revision} from "../types/Revision";
|
||||
|
||||
const promises = require('./promises');
|
||||
import {timesLimit, firstSatisfies} from './promises';
|
||||
const padManager = require('ep_etherpad-lite/node/db/PadManager');
|
||||
const db = require('ep_etherpad-lite/node/db/DB');
|
||||
const Changeset = require('ep_etherpad-lite/static/js/Changeset');
|
||||
const padMessageHandler = require('ep_etherpad-lite/node/handler/PadMessageHandler');
|
||||
const log4js = require('log4js');
|
||||
import log4js from 'log4js';
|
||||
const logger = log4js.getLogger('cleanup');
|
||||
|
||||
exports.deleteAllRevisions = async (padID: string): Promise<void> => {
|
||||
|
||||
export const deleteAllRevisions = async (padID: string): Promise<void> => {
|
||||
|
||||
const randomPadId = padID + 'aertdfdf' + Math.random().toString(10)
|
||||
|
||||
|
|
@ -39,7 +40,7 @@ const createRevision = async (aChangeset: AChangeSet, timestamp: number, isKeyRe
|
|||
};
|
||||
}
|
||||
|
||||
exports.deleteRevisions = async (padId: string, keepRevisions: number): Promise<boolean> => {
|
||||
export const deleteRevisions = async (padId: string, keepRevisions: number): Promise<boolean> => {
|
||||
|
||||
logger.debug('Start cleanup revisions', padId)
|
||||
|
||||
|
|
@ -61,14 +62,14 @@ exports.deleteRevisions = async (padId: string, keepRevisions: number): Promise<
|
|||
|
||||
const revisions: Revision[] = [];
|
||||
|
||||
await promises.timesLimit(keepRevisions + 1, 500, async (i: number) => {
|
||||
await timesLimit(keepRevisions + 1, 500, async (i: number) => {
|
||||
const rev = i + cleanupUntilRevision
|
||||
revisions[rev] = await pad.getRevision(rev)
|
||||
});
|
||||
|
||||
logger.debug('Loaded revisions: ', revisions.length)
|
||||
|
||||
await promises.timesLimit(pad.head + 1, 500, async (i: string) => {
|
||||
await timesLimit(pad.head + 1, 500, async (i: string) => {
|
||||
await db.remove(`pad:${padId}:revs:${i}`, null);
|
||||
});
|
||||
|
||||
|
|
@ -105,7 +106,7 @@ exports.deleteRevisions = async (padId: string, keepRevisions: number): Promise<
|
|||
|
||||
p.push(db.set(`pad:${padId}:revs:0`, revision))
|
||||
|
||||
p.push(promises.timesLimit(keepRevisions, 500, async (i: number) => {
|
||||
p.push(timesLimit(keepRevisions, 500, async (i: number) => {
|
||||
const rev = i + cleanupUntilRevision + 1
|
||||
const newRev = rev - cleanupUntilRevision;
|
||||
|
||||
|
|
@ -135,7 +136,7 @@ exports.deleteRevisions = async (padId: string, keepRevisions: number): Promise<
|
|||
return true
|
||||
}
|
||||
|
||||
exports.checkTodos = async () => {
|
||||
export const checkTodos = async () => {
|
||||
await new Promise(resolve => setTimeout(resolve, 5000));
|
||||
|
||||
// TODO: Move to settings
|
||||
|
|
@ -156,7 +157,7 @@ exports.checkTodos = async () => {
|
|||
}
|
||||
|
||||
try {
|
||||
const result = await exports.deleteRevisions(padId, settings.keepRevisions)
|
||||
const result = await deleteRevisions(padId, settings.keepRevisions)
|
||||
if (result) {
|
||||
logger.info('successful cleaned up pad: ', padId)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const semver = require('semver');
|
|||
*
|
||||
* @param {String} minNodeVersion Minimum required Node version
|
||||
*/
|
||||
exports.enforceMinNodeVersion = (minNodeVersion: string) => {
|
||||
export const enforceMinNodeVersion = (minNodeVersion: string) => {
|
||||
const currentNodeVersion = process.version;
|
||||
|
||||
// we cannot use template literals, since we still do not know if we are
|
||||
|
|
@ -49,7 +49,7 @@ exports.enforceMinNodeVersion = (minNodeVersion: string) => {
|
|||
* @param {Function} epRemovalVersion Etherpad version that will remove support for deprecated
|
||||
* Node releases
|
||||
*/
|
||||
exports.checkDeprecationStatus = (lowestNonDeprecatedNodeVersion: string, epRemovalVersion:Function) => {
|
||||
export const checkDeprecationStatus = (lowestNonDeprecatedNodeVersion: string, epRemovalVersion: string) => {
|
||||
const currentNodeVersion = process.version;
|
||||
|
||||
if (semver.lt(currentNodeVersion, lowestNonDeprecatedNodeVersion)) {
|
||||
|
|
|
|||
|
|
@ -32,14 +32,13 @@ import {SettingsNode, SettingsTree} from "./SettingsTree";
|
|||
import {coerce} from "semver";
|
||||
|
||||
const absolutePaths = require('./AbsolutePaths');
|
||||
const deepEqual = require('fast-deep-equal/es6');
|
||||
const fs = require('fs');
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
const argv = require('./Cli').argv;
|
||||
const jsonminify = require('jsonminify');
|
||||
const log4js = require('log4js');
|
||||
const randomString = require('./randomstring');
|
||||
import jsonminify from 'jsonminify';
|
||||
import log4js from 'log4js';
|
||||
import randomString from './randomstring';
|
||||
const suppressDisableMsg = ' -- To suppress these warning messages change ' +
|
||||
'suppressErrorsInPadText to true in your settings.json\n';
|
||||
const _ = require('underscore');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
'use strict';
|
||||
const semver = require('semver');
|
||||
import semver from 'semver';
|
||||
const settings = require('./Settings');
|
||||
import axios from 'axios';
|
||||
const headers = {
|
||||
|
|
@ -37,12 +37,12 @@ const loadEtherpadInformations = () => {
|
|||
}
|
||||
|
||||
|
||||
exports.getLatestVersion = () => {
|
||||
exports.needsUpdate().catch();
|
||||
export const getLatestVersion = () => {
|
||||
needsUpdate().catch();
|
||||
return infos?.latestVersion;
|
||||
};
|
||||
|
||||
exports.needsUpdate = async (cb?: Function) => {
|
||||
const needsUpdate = async (cb?: Function) => {
|
||||
try {
|
||||
const info = await loadEtherpadInformations()
|
||||
if (semver.gt(info!.latestVersion, settings.getEpVersion())) {
|
||||
|
|
@ -54,10 +54,10 @@ exports.needsUpdate = async (cb?: Function) => {
|
|||
}
|
||||
};
|
||||
|
||||
exports.check = () => {
|
||||
exports.needsUpdate((needsUpdate: boolean) => {
|
||||
export const check = () => {
|
||||
needsUpdate((needsUpdate: boolean) => {
|
||||
if (needsUpdate) {
|
||||
console.warn(`Update available: Download the actual version ${infos.latestVersion}`);
|
||||
}
|
||||
});
|
||||
}).then(()=>{});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
'use strict';
|
||||
/**
|
||||
* Generates a random String with the given length. Is needed to generate the
|
||||
* Author, Group, readonly, session Ids
|
||||
*/
|
||||
const cryptoMod = require('crypto');
|
||||
import cryptoMod from 'crypto';
|
||||
|
||||
const randomString = (len: number) => cryptoMod.randomBytes(len).toString('hex');
|
||||
|
||||
module.exports = randomString;
|
||||
export default randomString;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"async": "^3.2.6",
|
||||
"axios": "^1.10.0",
|
||||
"axios": "^1.11.0",
|
||||
"cookie-parser": "^1.4.7",
|
||||
"cross-env": "^7.0.3",
|
||||
"cross-spawn": "^7.0.6",
|
||||
|
|
@ -40,7 +40,6 @@
|
|||
"express": "^5.1.0",
|
||||
"express-rate-limit": "^8.0.1",
|
||||
"express-session": "^1.18.2",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
"find-root": "1.1.0",
|
||||
"formidable": "^3.5.4",
|
||||
"http-errors": "^2.0.0",
|
||||
|
|
@ -85,14 +84,15 @@
|
|||
"devDependencies": {
|
||||
"@playwright/test": "^1.54.1",
|
||||
"@types/async": "^3.2.24",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/cookie-parser": "^1.4.9",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/express-session": "^1.18.2",
|
||||
"@types/formidable": "^3.4.5",
|
||||
"@types/http-errors": "^2.0.5",
|
||||
"@types/jquery": "^3.5.32",
|
||||
"@types/js-cookie": "^3.0.6",
|
||||
"@types/jsdom": "^21.1.7",
|
||||
"@types/jsonminify": "^0.4.3",
|
||||
"@types/jsonwebtoken": "^9.0.10",
|
||||
"@types/mime-types": "^3.0.1",
|
||||
"@types/mocha": "^10.0.9",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import {MapArrayType} from "../../../node/types/MapType";
|
||||
|
||||
import {timesLimit} from '../../../node/utils/promises';
|
||||
import {describe, it, expect} from "vitest";
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const common = require('../common');
|
|||
const exportEtherpad = require('../../../node/utils/ExportEtherpad');
|
||||
const padManager = require('../../../node/db/PadManager');
|
||||
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
||||
const readOnlyManager = require('../../../node/db/ReadOnlyManager');
|
||||
import readOnlyManager from '../../../node/db/ReadOnlyManager';
|
||||
|
||||
describe(__filename, function () {
|
||||
let padId:string;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const assert = require('assert').strict;
|
|||
const common = require('../common');
|
||||
const padManager = require('../../../node/db/PadManager');
|
||||
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
||||
const readOnlyManager = require('../../../node/db/ReadOnlyManager');
|
||||
import readOnlyManager from '../../../node/db/ReadOnlyManager';
|
||||
|
||||
describe(__filename, function () {
|
||||
let agent:any;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const assert = require('assert').strict;
|
|||
const common = require('../common');
|
||||
const padManager = require('../../../node/db/PadManager');
|
||||
const plugins = require('../../../static/js/pluginfw/plugin_defs');
|
||||
const readOnlyManager = require('../../../node/db/ReadOnlyManager');
|
||||
import readOnlyManager from '../../../node/db/ReadOnlyManager';
|
||||
const settings = require('../../../node/utils/Settings');
|
||||
const socketIoRouter = require('../../../node/handler/SocketIORouter');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue