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

View file

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

View file

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

View file

@ -81,6 +81,7 @@
"devDependencies": { "devDependencies": {
"@types/async": "^3.2.24", "@types/async": "^3.2.24",
"@types/cross-spawn": "^6.0.6", "@types/cross-spawn": "^6.0.6",
"@types/ejs": "^3.1.5",
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/formidable": "^3.4.5", "@types/formidable": "^3.4.5",
"@types/jsonminify": "^0.4.3", "@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 , langs = require("ep_etherpad-lite/node/hooks/i18n").availableLangs
, pluginUtils = require('ep_etherpad-lite/static/js/pluginfw/shared') , pluginUtils = require('ep_etherpad-lite/static/js/pluginfw/shared')
; ;