mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
Merge branch hotfix/v8.2.1 into master
This commit is contained in:
@ -161,6 +161,9 @@
|
||||
"getChanges": {
|
||||
}
|
||||
},
|
||||
"win-ca": {
|
||||
"inject": "+"
|
||||
},
|
||||
"wopi": {
|
||||
"enable": false,
|
||||
"host" : "",
|
||||
|
||||
@ -58,10 +58,6 @@ const https = require('https');
|
||||
const ca = require('win-ca/api');
|
||||
const util = require('util');
|
||||
|
||||
if(!ca.disabled) {
|
||||
ca({inject: true});
|
||||
}
|
||||
|
||||
const contentDisposition = require('content-disposition');
|
||||
const operationContext = require("./operationContext");
|
||||
|
||||
@ -86,6 +82,9 @@ const cfgRequesFilteringAgent = config.get('services.CoAuthoring.request-filteri
|
||||
const cfgStorageExternalHost = config.get('storage.externalHost');
|
||||
const cfgExternalRequestDirectIfIn = config.get('externalRequest.directIfIn');
|
||||
const cfgExternalRequestAction = config.get('externalRequest.action');
|
||||
const cfgWinCa = config.get('win-ca');
|
||||
|
||||
ca(cfgWinCa);
|
||||
|
||||
const minimumIterationsByteLength = 4;
|
||||
const dnscache = getDnsCache(cfgDnsCache);
|
||||
|
||||
@ -1297,7 +1297,7 @@ function* bindEvents(ctx, docId, callback, baseUrl, opt_userAction, opt_userData
|
||||
}
|
||||
} else {
|
||||
oCallbackUrl = parseUrl(ctx, callback);
|
||||
bChangeBase = c_oAscChangeBase.All;
|
||||
bChangeBase = c_oAscChangeBase.No;
|
||||
if (null !== oCallbackUrl) {
|
||||
let filterStatus = yield* utils.checkHostFilter(ctx, oCallbackUrl.host);
|
||||
if (filterStatus > 0) {
|
||||
@ -1634,7 +1634,8 @@ exports.install = function(server, callbackFunction) {
|
||||
return;
|
||||
}
|
||||
if (getIsShutdown()) {
|
||||
sendFileError(ctx, conn, 'Server shutdow');
|
||||
sendDataDisconnectReason(ctx, conn, constants.SHUTDOWN_CODE, constants.SHUTDOWN_REASON);
|
||||
conn.disconnect(true);
|
||||
return;
|
||||
}
|
||||
conn.baseUrl = utils.getBaseUrlByConnection(ctx, conn);
|
||||
|
||||
@ -247,9 +247,16 @@ async function getOutputData(ctx, cmd, outputData, key, optConn, optAdditionalOu
|
||||
userPassword = await utils.decryptPassword(ctx, encryptedUserPassword);
|
||||
isCorrectPassword = decryptedPassword === userPassword;
|
||||
}
|
||||
if(password && !isCorrectPassword && !formatChecker.isBrowserEditorFormat(originFormat)) {
|
||||
let isNeedPassword = password && !isCorrectPassword;
|
||||
if (isNeedPassword && formatChecker.isBrowserEditorFormat(originFormat)) {
|
||||
//check pdf form
|
||||
//todo check without storage
|
||||
let formEditor = await storage.listObjects(ctx, key + '/Editor.bin');
|
||||
isNeedPassword = 0 !== formEditor.length;
|
||||
}
|
||||
if (isNeedPassword) {
|
||||
ctx.logger.debug("getOutputData password mismatch");
|
||||
if(encryptedUserPassword) {
|
||||
if (encryptedUserPassword) {
|
||||
outputData.setStatus('needpassword');
|
||||
outputData.setData(constants.CONVERT_PASSWORD);
|
||||
} else {
|
||||
|
||||
@ -58,6 +58,7 @@ const commonDefines = require('./../../Common/sources/commondefines');
|
||||
const operationContext = require('./../../Common/sources/operationContext');
|
||||
const tenantManager = require('./../../Common/sources/tenantManager');
|
||||
const staticRouter = require('./routes/static');
|
||||
const ms = require('ms');
|
||||
|
||||
const cfgWopiEnable = config.get('wopi.enable');
|
||||
const cfgWopiDummyEnable = config.get('wopi.dummy.enable');
|
||||
@ -94,16 +95,12 @@ app.set("views", path.resolve(process.cwd(), cfgHtmlTemplate));
|
||||
app.set("view engine", "ejs");
|
||||
const server = http.createServer(app);
|
||||
|
||||
let licenseInfo, licenseOriginal, updatePluginsTime, userPlugins, pluginsLoaded;
|
||||
let licenseInfo, licenseOriginal, updatePluginsTime, userPlugins;
|
||||
const updatePluginsCacheExpire = ms("5m");
|
||||
|
||||
const updatePlugins = (eventType, filename) => {
|
||||
operationContext.global.logger.info('update Folder: %s ; %s', eventType, filename);
|
||||
if (updatePluginsTime && 1000 >= (new Date() - updatePluginsTime)) {
|
||||
return;
|
||||
}
|
||||
operationContext.global.logger.info('update Folder true: %s ; %s', eventType, filename);
|
||||
updatePluginsTime = new Date();
|
||||
pluginsLoaded = false;
|
||||
userPlugins = undefined;
|
||||
};
|
||||
const readLicense = async function () {
|
||||
[licenseInfo, licenseOriginal] = await license.readLicense(cfgLicenseFile);
|
||||
@ -131,9 +128,15 @@ fs.watchFile(cfgLicenseFile, updateLicense);
|
||||
setInterval(updateLicense, 86400000);
|
||||
|
||||
try {
|
||||
fs.watch(config.get('services.CoAuthoring.plugins.path'), updatePlugins);
|
||||
let staticContent = config.get('services.CoAuthoring.server.static_content');
|
||||
let pluginsUri = config.get('services.CoAuthoring.plugins.uri');
|
||||
let pluginsPath = undefined;
|
||||
if (staticContent[pluginsUri]) {
|
||||
pluginsPath = staticContent[pluginsUri].path;
|
||||
}
|
||||
fs.watch(pluginsPath, updatePlugins);
|
||||
} catch (e) {
|
||||
operationContext.global.logger.warn('Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability');
|
||||
operationContext.global.logger.warn('Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability. %s', e.stack);
|
||||
}
|
||||
|
||||
// If you want to use 'development' and 'production',
|
||||
@ -299,12 +302,12 @@ docsCoServer.install(server, () => {
|
||||
});
|
||||
|
||||
const sendUserPlugins = (res, data) => {
|
||||
pluginsLoaded = true;
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify(data));
|
||||
};
|
||||
app.get('/plugins.json', (req, res) => {
|
||||
if (userPlugins && pluginsLoaded) {
|
||||
//fs.watch is not reliable. Set cache expiry time
|
||||
if (userPlugins && (new Date() - updatePluginsTime) < updatePluginsCacheExpire) {
|
||||
sendUserPlugins(res, userPlugins);
|
||||
return;
|
||||
}
|
||||
@ -341,6 +344,7 @@ docsCoServer.install(server, () => {
|
||||
}
|
||||
}
|
||||
|
||||
updatePluginsTime = new Date();
|
||||
userPlugins = {'url': '', 'pluginsData': result, 'autostart': pluginsAutostart};
|
||||
sendUserPlugins(res, userPlugins);
|
||||
});
|
||||
|
||||
@ -35,6 +35,10 @@
|
||||
const util = require("util");
|
||||
const config = require('config');
|
||||
const exifParser = require('exif-parser');
|
||||
//set global window to fix issue https://github.com/photopea/UTIF.js/issues/130
|
||||
if (!global.window) {
|
||||
global.window = global;
|
||||
}
|
||||
const Jimp = require('jimp');
|
||||
const locale = require('windows-locale');
|
||||
const ms = require('ms');
|
||||
|
||||
Reference in New Issue
Block a user