Merge remote-tracking branch 'origin/hotfix/v5.1.1' into develop

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Alexander.Trofimov
2018-04-05 16:54:30 +03:00
10 changed files with 93 additions and 38 deletions

View File

@ -2,3 +2,9 @@
## develop
### Back-end
*
## 5.1.1
### Back-end
* Add reconnection.attempts, reconnection.delay options to config - applicable for editor-server connection
* Add sockjs config section for testing purposes
* Fix inconsistent database status after files assemble in case of rapid open/close connection

View File

@ -51,11 +51,9 @@
"port": 8000,
"workerpercpu": 1,
"mode": "development",
"sockjsUrl": "",
"limits_tempfile_upload": 104857600,
"limits_image_size": 26214400,
"limits_image_download_timeout": 120,
"editor_settings_spellchecker_url": "/spellchecker",
"callbackRequestTimeout": 120,
"healthcheckfilepath": "../public/healthcheck.docx",
"savetimeoutdelay": 5000,
@ -168,6 +166,17 @@
"plugins": {
"uri": "/sdkjs-plugins",
"autostart": []
},
"editor":{
"spellcheckerUrl": "/spellchecker",
"reconnection":{
"attempts": 50,
"delay": "2s"
}
},
"sockjs": {
"sockjs_url": "",
"websocket": true
}
}
},

View File

@ -11,9 +11,10 @@
"CoAuthoring": {
"server": {
"port": 8080,
"sockjsUrl": "/office/vendor/sockjs/sockjs.min.js",
"editor_settings_spellchecker_url": "",
"static_content": {
"/fonts": {
"path": "../../../fonts"
},
"/sdkjs": {
"path": "../../../sdkjs"
},
@ -36,6 +37,12 @@
"dbPort": 3306,
"dbUser": "root",
"dbPass": "onlyoffice"
},
"editor": {
"spellcheckerUrl": ""
},
"sockjs": {
"sockjs_url": "/office/vendor/sockjs/sockjs.min.js"
}
}
},

View File

@ -11,9 +11,10 @@
"CoAuthoring": {
"server": {
"port": 8001,
"sockjsUrl": "/web-apps/vendor/sockjs/sockjs.min.js",
"editor_settings_spellchecker_url": "http://127.0.0.1:8080",
"static_content": {
"/fonts": {
"path": "../../../fonts"
},
"/sdkjs": {
"path": "../../../sdkjs"
},
@ -25,9 +26,6 @@
},
"/sdkjs-plugins": {
"path": "../../../sdkjs-plugins"
},
"/fonts": {
"path": "../../../fonts"
}
}
},
@ -39,6 +37,12 @@
"dbPort": 3306,
"dbUser": "root",
"dbPass": "onlyoffice"
},
"editor": {
"spellcheckerUrl": "http://127.0.0.1:8080"
},
"sockjs": {
"sockjs_url": "/web-apps/vendor/sockjs/sockjs.min.js"
}
}
},

View File

@ -10,8 +10,11 @@
"services": {
"CoAuthoring": {
"server": {
"sockjsUrl": "/web-apps/vendor/sockjs/sockjs.min.js",
"static_content": {
"/fonts": {
"path": "/var/www/onlyoffice/documentserver/fonts",
"options": {"maxAge": "7d"}
},
"/sdkjs": {
"path": "/var/www/onlyoffice/documentserver/sdkjs",
"options": {"maxAge": "7d"}
@ -32,6 +35,9 @@
},
"utils": {
"utils_common_fontdir": "/usr/share/fonts"
},
"sockjs": {
"sockjs_url": "/web-apps/vendor/sockjs/sockjs.min.js"
}
}
},

View File

@ -10,8 +10,11 @@
"services": {
"CoAuthoring": {
"server": {
"sockjsUrl": "/web-apps/vendor/sockjs/sockjs.min.js",
"static_content": {
"/fonts": {
"path": "../../../fonts",
"options": {"maxAge": "7d"}
},
"/sdkjs": {
"path": "../../../sdkjs",
"options": {"maxAge": "7d"}
@ -32,6 +35,9 @@
},
"utils": {
"utils_common_fontdir": "C:\\Windows\\Fonts"
},
"sockjs": {
"sockjs_url": "/web-apps/vendor/sockjs/sockjs.min.js"
}
}
},

View File

@ -100,7 +100,8 @@ const pubsubRedis = require('./pubsubRedis');
const pubsubService = require('./' + config.get('pubsub.name'));
const queueService = require('./../../Common/sources/taskqueueRabbitMQ');
const rabbitMQCore = require('./../../Common/sources/rabbitMQCore');
const cfgSpellcheckerUrl = config.get('server.editor_settings_spellchecker_url');
let cfgEditor = JSON.parse(JSON.stringify(config.get('editor')));
cfgEditor['reconnection']['delay'] = ms(cfgEditor['reconnection']['delay']);
const cfgCallbackRequestTimeout = config.get('server.callbackRequestTimeout');
//The waiting time to document assembly when all out(not 0 in case of F5 in the browser)
const cfgAscSaveTimeOutDelay = config.get('server.savetimeoutdelay');
@ -122,7 +123,7 @@ const cfgExpSessionIdle = ms(config.get('expire.sessionidle'));
const cfgExpSessionAbsolute = ms(config.get('expire.sessionabsolute'));
const cfgExpSessionCloseCommand = ms(config.get('expire.sessionclosecommand'));
const cfgExpUpdateVersionStatus = ms(config.get('expire.updateVersionStatus'));
const cfgSockjsUrl = config.get('server.sockjsUrl');
const cfgSockjs = config.get('sockjs');
const cfgTokenEnableBrowser = config.get('token.enable.browser');
const cfgTokenEnableRequestInbox = config.get('token.enable.request.inbox');
const cfgTokenEnableRequestOutbox = config.get('token.enable.request.outbox');
@ -1148,8 +1149,7 @@ exports.getRequestParams = getRequestParams;
exports.checkJwtHeader = checkJwtHeader;
exports.checkJwtPayloadHash = checkJwtPayloadHash;
exports.install = function(server, callbackFunction) {
var sockjs_opts = {sockjs_url: cfgSockjsUrl},
sockjs_echo = sockjs.createServer(sockjs_opts),
var sockjs_echo = sockjs.createServer(cfgSockjs),
urlParse = new RegExp("^/doc/([" + constants.DOC_ID_PATTERN + "]*)/c.+", 'i');
sockjs_echo.on('connection', function(conn) {
@ -2217,10 +2217,11 @@ exports.install = function(server, callbackFunction) {
indexUser: conn.user.indexUser,
hasForgotten: opt_hasForgotten,
jwt: (!bIsRestore && cfgTokenEnableBrowser) ? fillJwtByConnection(conn) : undefined,
g_cAscSpellCheckUrl: cfgSpellcheckerUrl,
g_cAscSpellCheckUrl: cfgEditor["spellcheckerUrl"],
buildVersion: commonDefines.buildVersion,
buildNumber: commonDefines.buildNumber,
licenseType: conn.licenseType
licenseType: conn.licenseType,
settings: cfgEditor
};
sendData(conn, sendObject);//Or 0 if fails
}

View File

@ -638,6 +638,14 @@ function* commandSfcCallback(cmd, isSfcm) {
statusOk = docsCoServer.c_oAscServerStatus.MustSave;
statusErr = docsCoServer.c_oAscServerStatus.Corrupted;
}
let updateMask = new taskResult.TaskResultData();
updateMask.key = docId;
updateMask.status = taskResult.FileStatus.SaveVersion;
updateMask.statusInfo = cmd.getData();
let updateIfTask = new taskResult.TaskResultData();
updateIfTask.status = taskResult.FileStatus.UpdateVersion;
updateIfTask.statusInfo = Math.floor(Date.now() / 60000);//minutes
let updateIfRes;
if (getRes) {
logger.debug('Callback commandSfcCallback: docId = %s callback = %s', docId, getRes.server.href);
var outputSfc = new commonDefines.OutputSfcData();
@ -727,15 +735,10 @@ function* commandSfcCallback(cmd, isSfcm) {
var lastSaveDate = lastSave ? new Date(lastSave.time) : new Date();
outputSfc.setLastSave(lastSaveDate.toISOString());
outputSfc.setNotModified(notModified);
var updateMask = new taskResult.TaskResultData();
updateMask.key = docId;
updateMask.status = taskResult.FileStatus.SaveVersion;
updateMask.statusInfo = cmd.getData();
var updateIfTask = new taskResult.TaskResultData();
updateIfTask.status = taskResult.FileStatus.UpdateVersion;
updateIfTask.statusInfo = Math.floor(Date.now() / 60000);//minutes
var updateIfRes = yield taskResult.updateIf(updateIfTask, updateMask);
updateIfRes = yield taskResult.updateIf(updateIfTask, updateMask);
if (updateIfRes.affectedRows > 0) {
updateMask.status = updateIfTask.status;
updateMask.statusInfo = updateIfTask.statusInfo;
var replyStr = null;
try {
replyStr = yield* docsCoServer.sendServerRequest(docId, uri, outputSfc, checkAuthorizationLength);
@ -756,19 +759,17 @@ function* commandSfcCallback(cmd, isSfcm) {
requestRes = (null == savedVal || '1' === savedVal);
}
if (requestRes) {
updateIfTask = undefined;
yield docsCoServer.cleanDocumentOnExitPromise(docId, true);
if (isOpenFromForgotten) {
//remove forgotten file in cache
yield cleanupCache(docId);
}
} else {
var updateTask = new taskResult.TaskResultData();
updateTask.key = docId;
updateTask.status = taskResult.FileStatus.Ok;
updateTask.statusInfo = constants.NO_ERROR;
yield taskResult.update(updateTask);
storeForgotten = true;
}
} else {
updateIfTask = undefined;
}
}
}
@ -776,6 +777,15 @@ function* commandSfcCallback(cmd, isSfcm) {
logger.warn('Empty Callback commandSfcCallback: docId = %s', docId);
storeForgotten = true;
}
if (undefined !== updateIfTask && !isSfcm) {
logger.debug('commandSfcCallback restore FileStatus.Ok status: docId = %s', docId);
updateIfTask.status = taskResult.FileStatus.Ok;
updateIfTask.statusInfo = constants.NO_ERROR;
updateIfRes = yield taskResult.updateIf(updateIfTask, updateMask);
if (!(updateIfRes.affectedRows > 0)) {
logger.debug('commandSfcCallback restore FileStatus.Ok status failed: docId = %s', docId);
}
}
if (storeForgotten && (!isError || isErrorCorrupted)) {
try {
logger.debug("storeForgotten: docId = %s", docId);

View File

@ -9,6 +9,8 @@ GRUNT_FILES = Gruntfile.js.out
PRODUCT_VERSION ?= 0.0.0
BUILD_NUMBER ?= 0
DOCUMENT_ROOT ?= /var/www/onlyoffice/documentserver
ifeq ($(OS),Windows_NT)
PLATFORM := win
EXEC_EXT := .exe
@ -146,6 +148,7 @@ install:
sudo adduser --quiet --home /var/www/onlyoffice --system --group onlyoffice
sudo mkdir -p /var/www/onlyoffice/documentserver
sudo mkdir -p /var/www/onlyoffice/documentserver/fonts
sudo mkdir -p /var/log/onlyoffice/documentserver
sudo mkdir -p /var/lib/onlyoffice/documentserver/App_Data
@ -168,11 +171,15 @@ install:
sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/bin/libicudata.so.55 /lib/libicudata.so.55
sudo ln -s /var/www/onlyoffice/documentserver/server/FileConverter/bin/libicuuc.so.55 /lib/libicuuc.so.55
sudo -u onlyoffice "/var/www/onlyoffice/documentserver/server/tools/AllFontsGen"\
"/usr/share/fonts"\
"/var/www/onlyoffice/documentserver/sdkjs/common/AllFonts.js"\
"/var/www/onlyoffice/documentserver/sdkjs/common/Images"\
"/var/www/onlyoffice/documentserver/server/FileConverter/bin/font_selection.bin"
sudo -u onlyoffice "${DOCUMENT_ROOT}/server/tools/AllFontsGen"\
--input="${DOCUMENT_ROOT}/core-fonts"\
--allfonts-web="${DOCUMENT_ROOT}/sdkjs/common/AllFonts.js"\
--allfonts="${DOCUMENT_ROOT}/server/FileConverter/bin/AllFonts.js"\
--images="${DOCUMENT_ROOT}/sdkjs/common/Images"\
--selection="${DOCUMENT_ROOT}/server/FileConverter/bin/font_selection.bin"\
--output-web="${DOCUMENT_ROOT}/fonts"\
--use-system="true"
uninstall:
sudo userdel onlyoffice

View File

@ -38,7 +38,7 @@ const logger = require('./../../Common/sources/logger');
const utils = require('./../../Common/sources/utils');
const fs = require('fs');
const co = require('co');
const cfgSockjsUrl = require('config').get('services.CoAuthoring.server.sockjsUrl');
const cfgSockjs = require('config').get('services.CoAuthoring.sockjs');
const languages = require('./languages');
const allLanguages = languages.allLanguages;
const path = require('path');
@ -92,8 +92,7 @@ exports.install = function (server, callbackFunction) {
});
});
const sockjs_opts = {sockjs_url: cfgSockjsUrl};
const sockjs_echo = sockjs.createServer(sockjs_opts);
const sockjs_echo = sockjs.createServer(cfgSockjs);
sockjs_echo.on('connection', function (conn) {
if (!conn) {