Fixed settings.

This commit is contained in:
SamTV12345 2024-02-21 22:34:18 +01:00
parent ff5a0688f3
commit 6060abdd26
5 changed files with 8 additions and 9 deletions

View file

@ -20,11 +20,11 @@
* require("./index").require("./path/to/template.ejs")
*/
const ejs = require('ejs');
const fs = require('fs');
import ejs from 'ejs';
import fs from 'fs';
const hooks = require('../../static/js/pluginfw/hooks.js');
const path = require('path');
const resolve = require('resolve');
import path from 'path';
import resolve from 'resolve';
import {root, settings} from '../utils/Settings'
const templateCache = new Map();
@ -86,8 +86,7 @@ exports.require = (name: string, args: any, mod: any) => {
const cache = settings.maxAge !== 0;
const template = cache && templateCache.get(ejspath) || ejs.compile(
'<% e._init({get: () => __output, set: (s) => { __output = s; }}); %>' +
`${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`,
{filename: ejspath});
`${fs.readFileSync(ejspath).toString()}<% e._exit(); %>`, {filename: ejspath});
if (cache) templateCache.set(ejspath, template);
exports.info.args.push(args);

View file

@ -24,7 +24,7 @@ const fs = require('fs');
const api = require('../db/API');
const log4js = require('log4js');
const padManager = require('../db/PadManager');
const randomString = require('../utils/randomstring');
import randomString from "../utils/randomstring";
const argv = require('../utils/Cli').argv;
const createHTTPError = require('http-errors');

View file

@ -852,4 +852,3 @@ export const exportedForTestingOnly = {
// initially load settings
reloadSettings();

View file

@ -81,6 +81,7 @@
"devDependencies": {
"@types/async": "^3.2.24",
"@types/cross-spawn": "^6.0.6",
"@types/ejs": "^3.1.5",
"@types/express": "^4.17.21",
"@types/formidable": "^3.4.5",
"@types/jsonminify": "^0.4.3",

View file

@ -1,5 +1,5 @@
<%
var settings = require("ep_etherpad-lite/node/utils/Settings")
import {settings} from 'ep_etherpad-lite/node/utils/Settings';
, langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
, pluginUtils = require('ep_etherpad-lite/static/js/pluginfw/shared')
;