mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
release/v5.2.0
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ FileConverter/bin/*.S
|
||||
FileConverter/bin/font_selection.bin
|
||||
FileConverter/bin/HtmlFileInternal
|
||||
FileConverter/bin/core.zip
|
||||
FileConverter/bin/core.tar.gz
|
||||
FileConverter/bin/core
|
||||
DocService/npm-debug.log
|
||||
build
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
# Change log
|
||||
## develop
|
||||
### Back-end
|
||||
*
|
||||
|
||||
## 5.1.1
|
||||
### Back-end
|
||||
* Add reconnection.attempts, reconnection.delay options to config - applicable for editor-server connection
|
||||
|
||||
@ -78,8 +78,7 @@
|
||||
"utils_common_fontdir": "null",
|
||||
"utils_fonts_search_patterns": "*.ttf;*.ttc;*.otf",
|
||||
"resource_expires": 31536000,
|
||||
"limits_image_types_upload": "jpg;png;gif;bmp",
|
||||
"limits_image_types_copy": "jpg;png;gif;bmp;svg"
|
||||
"limits_image_types_upload": "jpg;png;gif;bmp"
|
||||
},
|
||||
"sql": {
|
||||
"type": "postgres",
|
||||
@ -187,7 +186,7 @@
|
||||
},
|
||||
"FileConverter": {
|
||||
"converter": {
|
||||
"maxDownloadBytes": 100000000,
|
||||
"maxDownloadBytes": 104857600,
|
||||
"downloadTimeout": 120,
|
||||
"downloadAttemptMaxCount": 3,
|
||||
"downloadAttemptDelay": 1000,
|
||||
@ -198,6 +197,7 @@
|
||||
"docbuilderPath": "null",
|
||||
"docbuilderAllFontsPath": "null",
|
||||
"args": "",
|
||||
"spawnOptions": {},
|
||||
"errorfiles": "",
|
||||
"streamWriterBufferSize": 8388608,
|
||||
"maxRedeliveredCount": 2,
|
||||
|
||||
@ -27,6 +27,10 @@
|
||||
"path": "/var/www/onlyoffice/documentserver/server/welcome",
|
||||
"options": {"maxAge": "7d"}
|
||||
},
|
||||
"/info": {
|
||||
"path": "/var/www/onlyoffice/documentserver/server/info",
|
||||
"options": {"maxAge": "7d"}
|
||||
},
|
||||
"/sdkjs-plugins": {
|
||||
"path": "/var/www/onlyoffice/documentserver/sdkjs-plugins",
|
||||
"options": {"maxAge": "7d"}
|
||||
|
||||
@ -30,6 +30,10 @@
|
||||
"/welcome": {
|
||||
"path": "../../welcome",
|
||||
"options": {"maxAge": "7d"}
|
||||
},
|
||||
"/info": {
|
||||
"path": "../../info",
|
||||
"options": {"maxAge": "7d"}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -122,6 +122,7 @@ exports.AVS_OFFICESTUDIO_FILE_OTHER_OLD_PRESENTATION = exports.AVS_OFFICESTUDIO_
|
||||
exports.AVS_OFFICESTUDIO_FILE_OTHER_OLD_DRAWING = exports.AVS_OFFICESTUDIO_FILE_OTHER + 0x0006;
|
||||
exports.AVS_OFFICESTUDIO_FILE_OTHER_TEAMLAB_INNER = exports.AVS_OFFICESTUDIO_FILE_OTHER + 0x0007;
|
||||
exports.AVS_OFFICESTUDIO_FILE_OTHER_JSON = exports.AVS_OFFICESTUDIO_FILE_OTHER + 0x0008; // Для mail-merge
|
||||
exports.AVS_OFFICESTUDIO_FILE_OTHER_PDFA = exports.AVS_OFFICESTUDIO_FILE_OTHER + 0x0101;
|
||||
exports.AVS_OFFICESTUDIO_FILE_TEAMLAB = 0x1000;
|
||||
exports.AVS_OFFICESTUDIO_FILE_TEAMLAB_DOCY = exports.AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0001;
|
||||
exports.AVS_OFFICESTUDIO_FILE_TEAMLAB_XLSY = exports.AVS_OFFICESTUDIO_FILE_TEAMLAB + 0x0002;
|
||||
@ -205,6 +206,7 @@ exports.REDIS_KEY_SHUTDOWN = 'shutdown';
|
||||
exports.REDIS_KEY_COLLECT_LOST = 'collectlost';
|
||||
exports.REDIS_KEY_LICENSE = 'license';
|
||||
exports.REDIS_KEY_LICENSE_T = 'licenseT';
|
||||
exports.REDIS_KEY_EDITOR_CONNECTIONS = 'editorconnections';
|
||||
|
||||
exports.SHUTDOWN_CODE = 4001;
|
||||
exports.SHUTDOWN_REASON = 'server shutdown';
|
||||
|
||||
@ -333,6 +333,7 @@ exports.getStringFromFormat = function(format) {
|
||||
return 'csv';
|
||||
|
||||
case constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF:
|
||||
case constants.AVS_OFFICESTUDIO_FILE_OTHER_PDFA:
|
||||
return 'pdf';
|
||||
case constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_SWF:
|
||||
return 'swf';
|
||||
|
||||
@ -64,7 +64,10 @@ exports.readLicense = function*() {
|
||||
connections: constants.LICENSE_CONNECTIONS,
|
||||
usersCount: 0,
|
||||
usersExpire: constants.LICENSE_EXPIRE_USERS_ONE_DAY,
|
||||
hasLicense: false
|
||||
hasLicense: false,
|
||||
plugins: false,
|
||||
buildDate: oBuildDate,
|
||||
endDate: null
|
||||
};
|
||||
let checkFile = false;
|
||||
try {
|
||||
@ -79,6 +82,7 @@ exports.readLicense = function*() {
|
||||
const publicKey = '-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRhGF7X4A0ZVlEg594WmODVVUI\niiPQs04aLmvfg8SborHss5gQXu0aIdUT6nb5rTh5hD2yfpF2WIW6M8z0WxRhwicg\nXwi80H1aLPf6lEPPLvN29EhQNjBpkFkAJUbS8uuhJEeKw0cE49g80eBBF4BCqSL6\nPFQbP9/rByxdxEoAIQIDAQAB\n-----END PUBLIC KEY-----\n';
|
||||
if (verify.verify(publicKey, sign, 'hex')) {
|
||||
const endDate = new Date(oLicense['end_date']);
|
||||
res.endDate = endDate;
|
||||
const isTrial = (true === oLicense['trial'] || 'true' === oLicense['trial']); // Someone who likes to put json string instead of bool
|
||||
res.mode = isTrial ? c_LM.Trial : getLicenseMode(oLicense['mode']);
|
||||
const checkDate = c_LM.Trial === res.mode ? new Date() : oBuildDate;
|
||||
@ -92,6 +96,7 @@ exports.readLicense = function*() {
|
||||
|
||||
res.light = (true === oLicense['light'] || 'true' === oLicense['light']); // Someone who likes to put json string instead of bool
|
||||
res.branding = (true === oLicense['branding'] || 'true' === oLicense['branding']); // Someone who likes to put json string instead of bool
|
||||
res.plugins = true === oLicense['plugins'];
|
||||
if (oLicense.hasOwnProperty('connections')) {
|
||||
res.connections = oLicense['connections'] >> 0;
|
||||
}
|
||||
|
||||
@ -40,13 +40,17 @@ var cfgRabbitSocketOptions = config.get('rabbitmq.socketOptions');
|
||||
|
||||
var RECONNECT_TIMEOUT = 1000;
|
||||
|
||||
function connetPromise(closeCallback) {
|
||||
function connetPromise(reconnectOnConnectionError, closeCallback) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
function startConnect() {
|
||||
amqp.connect(cfgRabbitUrl, cfgRabbitSocketOptions, function(err, conn) {
|
||||
if (null != err) {
|
||||
logger.error('[AMQP] %s', err.stack);
|
||||
setTimeout(startConnect, RECONNECT_TIMEOUT);
|
||||
if (reconnectOnConnectionError) {
|
||||
setTimeout(startConnect, RECONNECT_TIMEOUT);
|
||||
} else {
|
||||
reject(err);
|
||||
}
|
||||
} else {
|
||||
conn.on('error', function(err) {
|
||||
logger.error('[AMQP] conn error', err.stack);
|
||||
|
||||
@ -50,7 +50,7 @@ function init(taskqueue, isAddTask, isAddResponse, isAddTaskReceive, isAddRespon
|
||||
return co(function* () {
|
||||
var e = null;
|
||||
try {
|
||||
var conn = yield rabbitMQCore.connetPromise(function() {
|
||||
var conn = yield rabbitMQCore.connetPromise(true, function() {
|
||||
clear(taskqueue);
|
||||
if (!taskqueue.isClose) {
|
||||
init(taskqueue, isAddTask, isAddResponse, isAddTaskReceive, isAddResponseReceive, null);
|
||||
|
||||
@ -159,6 +159,7 @@ const redisKeyForceSaveTimer = cfgRedisPrefix + constants.REDIS_KEY_FORCE_SAVE_T
|
||||
const redisKeyForceSaveTimerLock = cfgRedisPrefix + constants.REDIS_KEY_FORCE_SAVE_TIMER_LOCK;
|
||||
const redisKeySaved = cfgRedisPrefix + constants.REDIS_KEY_SAVED;
|
||||
const redisKeyPresenceUniqueUsers = cfgRedisPrefix + constants.REDIS_KEY_PRESENCE_UNIQUE_USERS;
|
||||
const redisKeyEditorConnections = cfgRedisPrefix + constants.REDIS_KEY_EDITOR_CONNECTIONS;
|
||||
|
||||
const EditorTypes = {
|
||||
document : 0,
|
||||
@ -173,7 +174,7 @@ let connections = []; // Активные соединения
|
||||
let lockDocumentsTimerId = {};//to drop connection that can't unlockDocument
|
||||
let pubsub;
|
||||
let queue;
|
||||
let licenseInfo = {type: constants.LICENSE_RESULT.Error, light: false, branding: false};
|
||||
let licenseInfo = {type: constants.LICENSE_RESULT.Error, light: false, branding: false, plugins: false};
|
||||
let shutdownFlag = false;
|
||||
|
||||
const MIN_SAVE_EXPIRATION = 60000;
|
||||
@ -181,6 +182,10 @@ const FORCE_SAVE_EXPIRATION = Math.min(Math.max(cfgForceSaveInterval, MIN_SAVE_E
|
||||
cfgQueueRetentionPeriod * 1000);
|
||||
const HEALTH_CHECK_KEY_MAX = 10000;
|
||||
|
||||
const PRECISION = [{name: 'hour', val: ms('1h')}, {name: 'day', val: ms('1d')}, {name: 'week', val: ms('7d')},
|
||||
{name: 'month', val: ms('31d')},
|
||||
];
|
||||
|
||||
function getIsShutdown() {
|
||||
return shutdownFlag;
|
||||
}
|
||||
@ -619,13 +624,12 @@ function* sendServerRequest(docId, uri, dataObject, opt_checkAuthorization) {
|
||||
let auth;
|
||||
if (cfgTokenEnableRequestOutbox) {
|
||||
auth = utils.fillJwtForRequest(dataObject);
|
||||
if (opt_checkAuthorization && !opt_checkAuthorization(auth, dataObject)) {
|
||||
auth = utils.fillJwtForRequest(dataObject);
|
||||
logger.warn('authorization reduced to: docId = %s; length=%d', docId, auth.length);
|
||||
}
|
||||
if (cfgTokenOutboxInBody) {
|
||||
dataObject = {token: auth};
|
||||
auth = undefined;
|
||||
} else if (opt_checkAuthorization && !opt_checkAuthorization(auth, dataObject)) {
|
||||
auth = utils.fillJwtForRequest(dataObject);
|
||||
logger.warn('authorization reduced to: docId = %s; length=%d', docId, auth.length);
|
||||
}
|
||||
}
|
||||
let res = yield utils.postRequestPromise(uri, JSON.stringify(dataObject), cfgCallbackRequestTimeout * 1000, auth);
|
||||
@ -1396,7 +1400,7 @@ exports.install = function(server, callbackFunction) {
|
||||
|
||||
//Давайдосвиданья!
|
||||
//Release locks
|
||||
userLocks = yield* getUserLocks(docId, conn.sessionId);
|
||||
userLocks = yield* getUserLocks(docId, conn.user.id);
|
||||
if (0 < userLocks.length) {
|
||||
//todo на close себе ничего не шлем
|
||||
//sendReleaseLock(conn, userLocks);
|
||||
@ -1486,13 +1490,13 @@ exports.install = function(server, callbackFunction) {
|
||||
yield utils.promiseRedis(multi, multi.exec);
|
||||
}
|
||||
}
|
||||
function* getUserLocks(docId, sessionId) {
|
||||
function* getUserLocks(docId, userId) {
|
||||
var userLocks = [], i;
|
||||
var toCache = [];
|
||||
var docLock = yield* getAllLocks(docId);
|
||||
for (i = 0; i < docLock.length; ++i) {
|
||||
var elem = docLock[i];
|
||||
if (elem.sessionId === sessionId) {
|
||||
if (elem.user === userId) {
|
||||
userLocks.push(elem);
|
||||
} else {
|
||||
toCache.push(JSON.stringify(elem));
|
||||
@ -1558,7 +1562,7 @@ exports.install = function(server, callbackFunction) {
|
||||
//Release locks
|
||||
if (isSave && conn) {
|
||||
if (releaseLocks) {
|
||||
const userLocks = yield* getUserLocks(docId, conn.sessionId);
|
||||
const userLocks = yield* getUserLocks(docId, userId);
|
||||
if (0 < userLocks.length) {
|
||||
sendReleaseLock(conn, userLocks);
|
||||
yield* publish({
|
||||
@ -1804,7 +1808,7 @@ exports.install = function(server, callbackFunction) {
|
||||
if (permissions && mode) {
|
||||
//as in web-apps/apps/documenteditor/main/app/controller/Main.js
|
||||
return ((permissions.edit !== false || permissions.review === true) && mode !== 'view') ||
|
||||
permissions.comment === true;
|
||||
permissions.comment === true || permissions.fillForms === true;
|
||||
} else {
|
||||
return def;
|
||||
}
|
||||
@ -2250,7 +2254,7 @@ exports.install = function(server, callbackFunction) {
|
||||
function* onMessage(conn, data) {
|
||||
var docId = conn.docId;
|
||||
var userId = conn.user.id;
|
||||
var msg = {docid: docId, message: data.message, time: Date.now(), user: userId, username: conn.user.username};
|
||||
var msg = {docid: docId, message: data.message, time: Date.now(), user: userId, useridoriginal: conn.user.idOriginal, username: conn.user.username};
|
||||
var msgStr = JSON.stringify(msg);
|
||||
var multi = redisClient.multi([
|
||||
['rpush', redisKeyMessage + docId, msgStr],
|
||||
@ -2306,7 +2310,7 @@ exports.install = function(server, callbackFunction) {
|
||||
var toCache = [];
|
||||
for (i = 0; i < arrayBlocks.length; ++i) {
|
||||
var block = arrayBlocks[i];
|
||||
var elem = {time: Date.now(), user: userId, block: block, sessionId: conn.sessionId};
|
||||
var elem = {time: Date.now(), user: userId, block: block};
|
||||
documentLocks[block] = elem;
|
||||
toCache.push(JSON.stringify(elem));
|
||||
}
|
||||
@ -2331,7 +2335,7 @@ exports.install = function(server, callbackFunction) {
|
||||
var toCache = [];
|
||||
for (i = 0; i < arrayBlocks.length; ++i) {
|
||||
var block = arrayBlocks[i];
|
||||
var elem = {time: Date.now(), user: userId, block: block, sessionId: conn.sessionId};
|
||||
var elem = {time: Date.now(), user: userId, block: block};
|
||||
documentLocks.push(elem);
|
||||
toCache.push(JSON.stringify(elem));
|
||||
}
|
||||
@ -2356,7 +2360,7 @@ exports.install = function(server, callbackFunction) {
|
||||
var toCache = [];
|
||||
for (i = 0; i < arrayBlocks.length; ++i) {
|
||||
var block = arrayBlocks[i];
|
||||
var elem = {time: Date.now(), user: userId, block: block, sessionId: conn.sessionId};
|
||||
var elem = {time: Date.now(), user: userId, block: block};
|
||||
documentLocks.push(elem);
|
||||
toCache.push(JSON.stringify(elem));
|
||||
}
|
||||
@ -2383,7 +2387,7 @@ exports.install = function(server, callbackFunction) {
|
||||
// Для Excel необходимо делать пересчет lock-ов при добавлении/удалении строк/столбцов
|
||||
function* saveChanges(conn, data) {
|
||||
const docId = conn.docId, userId = conn.user.id;
|
||||
logger.info("Start saveChanges docid: %s", docId);
|
||||
logger.info("Start saveChanges docid: %s; reSave: %s", docId, data.reSave);
|
||||
|
||||
let puckerIndex = yield* getChangesIndex(docId);
|
||||
|
||||
@ -2446,7 +2450,7 @@ exports.install = function(server, callbackFunction) {
|
||||
let userLocks = [];
|
||||
if (data.releaseLocks) {
|
||||
//Release locks
|
||||
userLocks = yield* getUserLocks(docId, conn.sessionId);
|
||||
userLocks = yield* getUserLocks(docId, userId);
|
||||
}
|
||||
// Для данного пользователя снимаем Lock с документа, если пришел флаг unlock
|
||||
const checkEndAuthLockRes = yield* checkEndAuthLock(data.unlock, false, docId, userId);
|
||||
@ -2688,7 +2692,8 @@ exports.install = function(server, callbackFunction) {
|
||||
rights: rights,
|
||||
buildVersion: commonDefines.buildVersion,
|
||||
buildNumber: commonDefines.buildNumber,
|
||||
branding: licenseInfo.branding
|
||||
branding: licenseInfo.branding,
|
||||
plugins: licenseInfo.plugins
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
@ -2952,6 +2957,19 @@ exports.install = function(server, callbackFunction) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function* collectStats(countEdit, countView) {
|
||||
let now = Date.now();
|
||||
var multi = redisClient.multi(
|
||||
[
|
||||
['lpop', redisKeyEditorConnections],
|
||||
['rpush', redisKeyEditorConnections, JSON.stringify({time: now, edit: countEdit, view: countView})]
|
||||
]);
|
||||
let multiRes = yield utils.promiseRedis(multi, multi.exec);
|
||||
if (multiRes.length > 1 && JSON.parse(multiRes[0]).time > now - PRECISION[PRECISION.length - 1].val) {
|
||||
yield utils.promiseRedis(redisClient, redisClient.lpush, redisKeyEditorConnections, multiRes[0]);
|
||||
}
|
||||
}
|
||||
function expireDoc() {
|
||||
var cronJob = this;
|
||||
return co(function* () {
|
||||
@ -3006,6 +3024,7 @@ exports.install = function(server, callbackFunction) {
|
||||
idSet.forEach(function(value1, value2, set) {
|
||||
commands.push(['zadd', redisKeyDocuments, expireAt, value1]);
|
||||
});
|
||||
yield* collectStats(countEdit, countView);
|
||||
if (commands.length > 0) {
|
||||
var multi = redisClient.multi(commands);
|
||||
yield utils.promiseRedis(multi, multi.exec);
|
||||
@ -3061,10 +3080,14 @@ exports.healthCheck = function(req, res) {
|
||||
//database
|
||||
promises.push(sqlBase.healthCheck());
|
||||
//redis
|
||||
promises.push(utils.promiseRedis(redisClient, redisClient.ping));
|
||||
yield Promise.all(promises);
|
||||
if (redisClient.connected) {
|
||||
promises.push(utils.promiseRedis(redisClient, redisClient.ping));
|
||||
yield Promise.all(promises);
|
||||
} else {
|
||||
throw new Error('redis disconnected');
|
||||
}
|
||||
//rabbitMQ
|
||||
let conn = yield rabbitMQCore.connetPromise(function() {});
|
||||
let conn = yield rabbitMQCore.connetPromise(false, function() {});
|
||||
yield rabbitMQCore.closePromise(conn);
|
||||
//storage
|
||||
const clusterId = cluster.isWorker ? cluster.worker.id : '';
|
||||
@ -3084,10 +3107,85 @@ exports.healthCheck = function(req, res) {
|
||||
} catch (err) {
|
||||
logger.error('healthCheck error\r\n%s', err.stack);
|
||||
} finally {
|
||||
res.setHeader('Content-Type', 'text/plain');
|
||||
res.send(output.toString());
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.licenseInfo = function(req, res) {
|
||||
return co(function*() {
|
||||
let isError = false;
|
||||
let output = {
|
||||
connectionsStat: {}, licenseInfo: {}, serverInfo: {
|
||||
buildVersion: commonDefines.buildVersion, buildNumber: commonDefines.buildNumber,
|
||||
}
|
||||
};
|
||||
Object.assign(output.licenseInfo, licenseInfo);
|
||||
try {
|
||||
logger.debug('licenseInfo start');
|
||||
var precisionSum = {};
|
||||
for (let i = 0; i < PRECISION.length; ++i) {
|
||||
precisionSum[PRECISION[i].name] = {
|
||||
edit: {min: Number.MAX_VALUE, sum: 0, count: 0, max: 0, time: null, period: PRECISION[i].val},
|
||||
view: {min: Number.MAX_VALUE, sum: 0, count: 0, max: 0}
|
||||
};
|
||||
output.connectionsStat[PRECISION[i].name] = {
|
||||
edit: {min: 0, avr: 0, max: 0},
|
||||
view: {min: 0, avr: 0, max: 0}
|
||||
};
|
||||
}
|
||||
var redisRes = yield utils.promiseRedis(redisClient, redisClient.lrange, redisKeyEditorConnections, 0, -1);
|
||||
const now = Date.now();
|
||||
var precisionIndex = 0;
|
||||
for (let i = redisRes.length - 1; i >= 1; i -= 2) {
|
||||
for (let j = precisionIndex; j < PRECISION.length; ++j) {
|
||||
let elem = JSON.parse(redisRes[i]);
|
||||
if (now - elem.time < PRECISION[j].val) {
|
||||
let precision = precisionSum[PRECISION[j].name];
|
||||
precision.edit.min = Math.min(precision.edit.min, elem.edit);
|
||||
precision.edit.max = Math.max(precision.edit.max, elem.edit);
|
||||
precision.edit.sum += elem.edit;
|
||||
precision.edit.count++;
|
||||
precision.edit.time = elem.time;
|
||||
precision.view.min = Math.min(precision.view.min, elem.view);
|
||||
precision.view.max = Math.max(precision.view.max, elem.view);
|
||||
precision.view.sum += elem.view;
|
||||
precision.view.count++;
|
||||
} else {
|
||||
precisionIndex = j + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (let i in precisionSum) {
|
||||
let precision = precisionSum[i];
|
||||
let precisionOut = output.connectionsStat[i];
|
||||
//scale compensates for the lack of points at server start
|
||||
let scale = (now - precision.edit.time) / precision.edit.period;
|
||||
if (precision.edit.count > 0) {
|
||||
precisionOut.edit.avr = Math.round((precision.edit.sum / precision.edit.count) * scale);
|
||||
precisionOut.edit.min = precision.edit.min;
|
||||
precisionOut.edit.max = precision.edit.max;
|
||||
}
|
||||
if (precision.view.count > 0) {
|
||||
precisionOut.view.avr = Math.round((precision.view.sum / precision.view.count) * scale);
|
||||
precisionOut.view.min = precision.view.min;
|
||||
precisionOut.view.max = precision.view.max;
|
||||
}
|
||||
}
|
||||
logger.debug('licenseInfo end');
|
||||
} catch (err) {
|
||||
isError = true;
|
||||
logger.error('licenseInfo error\r\n%s', err.stack);
|
||||
} finally {
|
||||
if (!isError) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify(output));
|
||||
} else {
|
||||
res.sendStatus(400);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
// Команда с сервера (в частности teamlab)
|
||||
exports.commandFromServer = function (req, res) {
|
||||
return co(function* () {
|
||||
|
||||
@ -53,7 +53,6 @@ var pubsubRedis = require('./pubsubRedis');
|
||||
|
||||
|
||||
var cfgTypesUpload = config_utils.get('limits_image_types_upload');
|
||||
var cfgTypesCopy = config_utils.get('limits_image_types_copy');
|
||||
var cfgImageSize = config_server.get('limits_image_size');
|
||||
var cfgImageDownloadTimeout = config_server.get('limits_image_download_timeout');
|
||||
var cfgRedisPrefix = config.get('services.CoAuthoring.redis.prefix');
|
||||
@ -262,7 +261,7 @@ function getUpdateResponse(cmd) {
|
||||
updateTask.status = taskResult.FileStatus.NeedParams;
|
||||
} else if (constants.CONVERT_DRM == statusInfo) {
|
||||
if (cfgOpenProtectedFile) {
|
||||
updateTask.status = taskResult.FileStatus.NeedPassword;
|
||||
updateTask.status = taskResult.FileStatus.NeedPassword;
|
||||
} else {
|
||||
updateTask.status = taskResult.FileStatus.Err;
|
||||
}
|
||||
@ -380,31 +379,31 @@ function* commandReopen(cmd) {
|
||||
let res = true;
|
||||
let isPassword = undefined !== cmd.getPassword();
|
||||
if (!isPassword || cfgOpenProtectedFile) {
|
||||
let updateMask = new taskResult.TaskResultData();
|
||||
updateMask.key = cmd.getDocId();
|
||||
let updateMask = new taskResult.TaskResultData();
|
||||
updateMask.key = cmd.getDocId();
|
||||
updateMask.status = isPassword ? taskResult.FileStatus.NeedPassword : taskResult.FileStatus.NeedParams;
|
||||
|
||||
var task = new taskResult.TaskResultData();
|
||||
task.key = cmd.getDocId();
|
||||
task.status = taskResult.FileStatus.WaitQueue;
|
||||
task.statusInfo = constants.NO_ERROR;
|
||||
var task = new taskResult.TaskResultData();
|
||||
task.key = cmd.getDocId();
|
||||
task.status = taskResult.FileStatus.WaitQueue;
|
||||
task.statusInfo = constants.NO_ERROR;
|
||||
|
||||
var upsertRes = yield taskResult.updateIf(task, updateMask);
|
||||
if (upsertRes.affectedRows > 0) {
|
||||
//add task
|
||||
cmd.setUrl(null);//url may expire
|
||||
cmd.setSaveKey(cmd.getDocId());
|
||||
cmd.setOutputFormat(constants.AVS_OFFICESTUDIO_FILE_CANVAS);
|
||||
cmd.setEmbeddedFonts(false);
|
||||
var dataQueue = new commonDefines.TaskQueueData();
|
||||
dataQueue.setCmd(cmd);
|
||||
dataQueue.setToFile('Editor.bin');
|
||||
dataQueue.setFromSettings(true);
|
||||
yield* docsCoServer.addTask(dataQueue, constants.QUEUE_PRIORITY_HIGH);
|
||||
}
|
||||
var upsertRes = yield taskResult.updateIf(task, updateMask);
|
||||
if (upsertRes.affectedRows > 0) {
|
||||
//add task
|
||||
cmd.setUrl(null);//url may expire
|
||||
cmd.setSaveKey(cmd.getDocId());
|
||||
cmd.setOutputFormat(constants.AVS_OFFICESTUDIO_FILE_CANVAS);
|
||||
cmd.setEmbeddedFonts(false);
|
||||
var dataQueue = new commonDefines.TaskQueueData();
|
||||
dataQueue.setCmd(cmd);
|
||||
dataQueue.setToFile('Editor.bin');
|
||||
dataQueue.setFromSettings(true);
|
||||
yield* docsCoServer.addTask(dataQueue, constants.QUEUE_PRIORITY_HIGH);
|
||||
}
|
||||
} else {
|
||||
res = false;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function* commandSave(cmd, outputData) {
|
||||
@ -475,20 +474,14 @@ function isDisplayedImage(strName) {
|
||||
return res;
|
||||
}
|
||||
function* commandImgurls(conn, cmd, outputData) {
|
||||
var supportedFormats;
|
||||
var supportedFormats = cfgTypesUpload || 'jpg';
|
||||
var urls;
|
||||
var docId = cmd.getDocId();
|
||||
var errorCode = constants.NO_ERROR;
|
||||
var outputUrls = [];
|
||||
var isImgUrl = 'imgurl' == cmd.getCommand();
|
||||
if (!conn.user.view && !conn.isCloseCoAuthoring) {
|
||||
if (isImgUrl) {
|
||||
urls = [cmd.getData()];
|
||||
supportedFormats = cfgTypesUpload || 'jpg';
|
||||
} else {
|
||||
urls = cmd.getData();
|
||||
supportedFormats = cfgTypesCopy || 'jpg';
|
||||
}
|
||||
urls = isImgUrl ? [cmd.getData()] : cmd.getData();
|
||||
//todo Promise.all()
|
||||
var displayedImageMap = {};//to make one imageIndex for ole object urls
|
||||
var imageCount = 0;
|
||||
@ -524,6 +517,10 @@ function* commandImgurls(conn, cmd, outputData) {
|
||||
formatStr = formatChecker.getStringFromFormat(format);
|
||||
if (formatStr && -1 !== supportedFormats.indexOf(formatStr)) {
|
||||
isAllow = true;
|
||||
} else if (!isImgUrl && 'svg' === formatStr && isDisplayedImage(pathModule.basename(urlParsed.pathname)) > 0) {
|
||||
//paste case
|
||||
//todo refactoring
|
||||
isAllow = true;
|
||||
}
|
||||
}
|
||||
if (!isAllow && urlParsed) {
|
||||
@ -937,8 +934,8 @@ exports.openDocument = function(conn, cmd, opt_upsertRes, opt_bIsRestore) {
|
||||
break;
|
||||
}
|
||||
if(!res){
|
||||
outputData.setStatus('err');
|
||||
outputData.setData(constants.UNKNOWN);
|
||||
outputData.setStatus('err');
|
||||
outputData.setData(constants.UNKNOWN);
|
||||
}
|
||||
if(clientStatsD) {
|
||||
clientStatsD.timing('coauth.openDocument.' + cmd.getCommand(), new Date() - startDate);
|
||||
@ -1016,6 +1013,7 @@ exports.downloadAs = function(req, res) {
|
||||
break;
|
||||
}
|
||||
var strRes = JSON.stringify(outputData);
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(strRes);
|
||||
logger.debug('End downloadAs: docId = %s %s', docId, strRes);
|
||||
if(clientStatsD) {
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
var config = require('config');
|
||||
var co = require('co');
|
||||
var taskResult = require('./taskresult');
|
||||
@ -59,7 +60,8 @@ function* getConvertStatus(cmd, selectRes, baseUrl, opt_fileTo) {
|
||||
case taskResult.FileStatus.Ok:
|
||||
status.end = true;
|
||||
if (opt_fileTo) {
|
||||
status.url = yield storage.getSignedUrl(baseUrl, docId + '/' + opt_fileTo, commonDefines.c_oAscUrlTypes.Temporary);
|
||||
status.url = yield storage.getSignedUrl(baseUrl, docId + '/' + opt_fileTo,
|
||||
commonDefines.c_oAscUrlTypes.Temporary, cmd.getTitle());
|
||||
}
|
||||
break;
|
||||
case taskResult.FileStatus.Err:
|
||||
@ -193,6 +195,7 @@ function convertRequest(req, res, isJson) {
|
||||
cmd.setEmbeddedFonts(false);//params.embeddedfonts'];
|
||||
cmd.setFormat(params.filetype);
|
||||
var outputtype = params.outputtype || '';
|
||||
let outputExt = outputtype;
|
||||
docId = 'conv_' + params.key + '_' + outputtype;
|
||||
cmd.setDocId(docId);
|
||||
var fileTo = constants.OUTPUT_NAME + '.' + outputtype;
|
||||
@ -227,9 +230,12 @@ function convertRequest(req, res, isJson) {
|
||||
cmd.setThumbnail(thumbnailData);
|
||||
cmd.setOutputFormat(constants.AVS_OFFICESTUDIO_FILE_IMAGE);
|
||||
if (false == thumbnailData.getFirst()) {
|
||||
cmd.setTitle(constants.OUTPUT_NAME + '.zip');
|
||||
outputExt = 'zip';
|
||||
}
|
||||
}
|
||||
if (params.title) {
|
||||
cmd.setTitle(path.basename(params.title, path.extname(params.title)) + '.' + outputExt);
|
||||
}
|
||||
var async = (typeof params.async === 'string') ? 'true' == params.async : params.async;
|
||||
|
||||
if (constants.AVS_OFFICESTUDIO_FILE_UNKNOWN !== cmd.getOutputFormat()) {
|
||||
|
||||
@ -174,6 +174,7 @@ exports.uploadImageFileOld = function(req, res) {
|
||||
output += '", "*"); }</script></head><body onload="load()"></body></html>';
|
||||
|
||||
//res.setHeader('Access-Control-Allow-Origin', '*');
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
res.send(output);
|
||||
logger.debug('End uploadImageFileOld: docId = %s %s', docId, output);
|
||||
}
|
||||
@ -246,6 +247,7 @@ exports.uploadImageFile = function(req, res) {
|
||||
} finally {
|
||||
try {
|
||||
if (!isError) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(JSON.stringify(output));
|
||||
} else {
|
||||
res.sendStatus(400);
|
||||
|
||||
@ -43,7 +43,7 @@ function init(pubsub, callback) {
|
||||
return co(function* () {
|
||||
var e = null;
|
||||
try {
|
||||
var conn = yield rabbitMQCore.connetPromise(function() {
|
||||
var conn = yield rabbitMQCore.connetPromise(true, function() {
|
||||
clear(pubsub);
|
||||
if (!pubsub.isClose) {
|
||||
init(pubsub, null);
|
||||
|
||||
@ -234,6 +234,7 @@ if (cluster.isMaster) {
|
||||
}
|
||||
converterService.builder(req, res);
|
||||
});
|
||||
app.get('/info/info.json', utils.checkClientIp, docsCoServer.licenseInfo);
|
||||
|
||||
const sendUserPlugins = (res, data) => {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
|
||||
@ -61,6 +61,10 @@ var cfgX2tPath = configConverter.get('x2tPath');
|
||||
var cfgDocbuilderPath = configConverter.get('docbuilderPath');
|
||||
var cfgDocbuilderAllFontsPath = configConverter.get('docbuilderAllFontsPath');
|
||||
var cfgArgs = configConverter.get('args');
|
||||
var cfgSpawnOptions = configConverter.get('spawnOptions');
|
||||
if (cfgSpawnOptions.env) {
|
||||
Object.assign(cfgSpawnOptions.env, process.env);
|
||||
}
|
||||
var cfgErrorFiles = configConverter.get('errorfiles');
|
||||
var cfgInputLimits = configConverter.get('inputLimits');
|
||||
const cfgStreamWriterBufferSize = configConverter.get('streamWriterBufferSize');
|
||||
@ -89,7 +93,12 @@ function TaskQueueDataConvert(task) {
|
||||
this.key = cmd.savekey ? cmd.savekey : cmd.id;
|
||||
this.fileFrom = null;
|
||||
this.fileTo = null;
|
||||
this.formatTo = cmd.outputformat;
|
||||
if(constants.AVS_OFFICESTUDIO_FILE_OTHER_PDFA !== cmd.outputformat){
|
||||
this.formatTo = cmd.outputformat;
|
||||
} else {
|
||||
this.formatTo = constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF;
|
||||
this.isPDFA = true;
|
||||
}
|
||||
this.csvTxtEncoding = cmd.getCodepage();
|
||||
this.csvDelimiter = cmd.getDelimiter();
|
||||
this.csvDelimiterChar = cmd.getDelimiterChar();
|
||||
@ -119,6 +128,7 @@ TaskQueueDataConvert.prototype = {
|
||||
xml += this.serializeXmlProp('m_sFileFrom', this.fileFrom);
|
||||
xml += this.serializeXmlProp('m_sFileTo', this.fileTo);
|
||||
xml += this.serializeXmlProp('m_nFormatTo', this.formatTo);
|
||||
xml += this.serializeXmlProp('m_bIsPDFA', this.isPDFA);
|
||||
xml += this.serializeXmlProp('m_nCsvTxtEncoding', this.csvTxtEncoding);
|
||||
xml += this.serializeXmlProp('m_nCsvDelimiter', this.csvDelimiter);
|
||||
xml += this.serializeXmlProp('m_nCsvDelimiterChar', this.csvDelimiterChar);
|
||||
@ -641,7 +651,7 @@ function* ExecuteTask(task) {
|
||||
}
|
||||
let timeoutId;
|
||||
try {
|
||||
let spawnAsyncPromise = spawnAsync(processPath, childArgs);
|
||||
let spawnAsyncPromise = spawnAsync(processPath, childArgs, cfgSpawnOptions);
|
||||
childRes = spawnAsyncPromise.child;
|
||||
let waitMS = task.getVisibilityTimeout() * 1000 - (new Date().getTime() - getTaskTime.getTime());
|
||||
timeoutId = setTimeout(function() {
|
||||
|
||||
55
Makefile
55
Makefile
@ -26,6 +26,7 @@ else
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
PLATFORM := linux
|
||||
SHARED_EXT := .so*
|
||||
LIB_PREFIX := lib
|
||||
endif
|
||||
UNAME_M := $(shell uname -m)
|
||||
ifeq ($(UNAME_M),x86_64)
|
||||
@ -39,7 +40,16 @@ endif
|
||||
TARGET := $(PLATFORM)_$(ARCHITECTURE)
|
||||
|
||||
FILE_CONVERTER = $(OUTPUT)/FileConverter/bin
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/*$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)DjVuFile$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)doctrenderer$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)graphics$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)HtmlFile$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)HtmlRenderer$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)kernel$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)PdfReader$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)PdfWriter$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)UnicodeConverter$(SHARED_EXT)
|
||||
FILE_CONVERTER_FILES += ../core/build/lib/$(TARGET)/$(LIB_PREFIX)XpsFile$(SHARED_EXT)
|
||||
|
||||
ifeq ($(PLATFORM),linux)
|
||||
FILE_CONVERTER_FILES += ../core/Common/3dParty/icu/$(TARGET)/build/libicudata$(SHARED_EXT)
|
||||
@ -83,6 +93,10 @@ WELCOME_DIR = welcome
|
||||
WELCOME_FILES = $(WELCOME_DIR)/**
|
||||
WELCOME = $(OUTPUT)/$(WELCOME_DIR)/
|
||||
|
||||
INFO_DIR = info
|
||||
INFO_FILES = $(INFO_DIR)/**
|
||||
INFO = $(OUTPUT)/$(INFO_DIR)/
|
||||
|
||||
CORE_FONTS_DIR = core-fonts
|
||||
CORE_FONTS_FILES = ../$(CORE_FONTS_DIR)/**
|
||||
CORE_FONTS = $(OUTPUT)/../$(CORE_FONTS_DIR)/
|
||||
@ -90,7 +104,7 @@ CORE_FONTS = $(OUTPUT)/../$(CORE_FONTS_DIR)/
|
||||
.PHONY: all clean install uninstall build-date htmlfileinternal docbuilder
|
||||
|
||||
.NOTPARALLEL:
|
||||
all: $(FILE_CONVERTER) $(SPELLCHECKER_DICTIONARIES) $(TOOLS) $(SCHEMA) $(CORE_FONTS) $(LICENSE) $(WELCOME) build-date
|
||||
all: $(FILE_CONVERTER) $(SPELLCHECKER_DICTIONARIES) $(TOOLS) $(SCHEMA) $(CORE_FONTS) $(LICENSE) $(WELCOME) $(INFO) build-date
|
||||
|
||||
ext: htmlfileinternal docbuilder
|
||||
|
||||
@ -137,6 +151,10 @@ $(WELCOME):
|
||||
mkdir -p $(WELCOME) && \
|
||||
cp -r -t $(WELCOME) $(WELCOME_FILES)
|
||||
|
||||
$(INFO):
|
||||
mkdir -p $(INFO) && \
|
||||
cp -r -t $(INFO) $(INFO_FILES)
|
||||
|
||||
$(CORE_FONTS):
|
||||
mkdir -p $(CORE_FONTS) && \
|
||||
cp -r -t $(CORE_FONTS) $(CORE_FONTS_FILES)
|
||||
@ -145,20 +163,21 @@ clean:
|
||||
rm -rf $(CORE_FONTS) $(OUTPUT) $(GRUNT_FILES)
|
||||
|
||||
install:
|
||||
sudo adduser --quiet --home /var/www/onlyoffice --system --group onlyoffice
|
||||
mkdir -pv /var/www/onlyoffice
|
||||
if ! id -u onlyoffice > /dev/null 2>&1; then useradd -m -d /var/www/onlyoffice -r -U onlyoffice; fi
|
||||
|
||||
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
|
||||
mkdir -p /var/www/onlyoffice/documentserver
|
||||
mkdir -p /var/www/onlyoffice/documentserver/fonts
|
||||
mkdir -p /var/log/onlyoffice/documentserver
|
||||
mkdir -p /var/lib/onlyoffice/documentserver/App_Data
|
||||
|
||||
sudo cp -fr -t /var/www/onlyoffice/documentserver build/* ../web-apps/deploy/*
|
||||
sudo mkdir -p /etc/onlyoffice/documentserver
|
||||
sudo mv /var/www/onlyoffice/documentserver/server/Common/config/* /etc/onlyoffice/documentserver
|
||||
cp -fr -t /var/www/onlyoffice/documentserver build/* ../web-apps/deploy/*
|
||||
mkdir -p /etc/onlyoffice/documentserver
|
||||
mv /var/www/onlyoffice/documentserver/server/Common/config/* /etc/onlyoffice/documentserver
|
||||
|
||||
sudo chown onlyoffice:onlyoffice -R /var/www/onlyoffice
|
||||
sudo chown onlyoffice:onlyoffice -R /var/log/onlyoffice
|
||||
sudo chown onlyoffice:onlyoffice -R /var/lib/onlyoffice
|
||||
chown onlyoffice:onlyoffice -R /var/www/onlyoffice
|
||||
chown onlyoffice:onlyoffice -R /var/log/onlyoffice
|
||||
chown onlyoffice:onlyoffice -R /var/lib/onlyoffice
|
||||
|
||||
# Make symlinks for shared libs
|
||||
find \
|
||||
@ -177,12 +196,12 @@ install:
|
||||
--use-system="true"
|
||||
|
||||
uninstall:
|
||||
sudo userdel onlyoffice
|
||||
userdel onlyoffice
|
||||
|
||||
# Unlink installed shared libs
|
||||
find /lib -type l | while IFS= read -r lnk; do if (readlink "$$lnk" | grep -q '^${DOCUMENT_ROOT}/server/FileConverter/bin/'); then rm "$$lnk"; fi; done
|
||||
|
||||
sudo rm -rf /var/www/onlyoffice/documentserver
|
||||
sudo rm -rf /var/log/onlyoffice/documentserver
|
||||
sudo rm -rf /var/lib/onlyoffice/documentserver
|
||||
sudo rm -rf /etc/onlyoffice/documentserver
|
||||
rm -rf /var/www/onlyoffice/documentserver
|
||||
rm -rf /var/log/onlyoffice/documentserver
|
||||
rm -rf /var/lib/onlyoffice/documentserver
|
||||
rm -rf /etc/onlyoffice/documentserver
|
||||
|
||||
@ -4,6 +4,6 @@
|
||||
"homepage": "http://www.onlyoffice.com",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"statsd": "^0.8.0"
|
||||
"statsd": "https://github.com/ONLYOFFICE/statsd/archive/v0.8.1.tar.gz"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
info/img/favicon.ico
Normal file
BIN
info/img/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
info/img/icon-cross.png
Normal file
BIN
info/img/icon-cross.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
info/img/logo.png
Normal file
BIN
info/img/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
274
info/index.html
Normal file
274
info/index.html
Normal file
@ -0,0 +1,274 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>ONLYOFFICE™</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8"/>
|
||||
<link href="img/favicon.ico" rel="icon" type="image/x-icon">
|
||||
|
||||
<style type="text/css">
|
||||
html {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
height: 100%;
|
||||
min-width: 600px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 12px;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
header {
|
||||
background: #3D4A6B;
|
||||
height: 80px;
|
||||
margin: 0 auto;
|
||||
min-width: 600px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
header img {
|
||||
margin: 20px 0 0 16px;
|
||||
}
|
||||
|
||||
table {
|
||||
table-layout: fixed;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
td {
|
||||
padding-left: 0;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.main-panel {
|
||||
margin: 80px auto 16px;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
.header0 {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.header1 {
|
||||
font-size: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.header2 {
|
||||
font-size: 16px;
|
||||
padding: 30px 0 5px 0;
|
||||
}
|
||||
|
||||
#doc-server-wait {
|
||||
text-align: center;
|
||||
}
|
||||
#doc-server-err > div {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#status-err-icon {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
text-align: left;
|
||||
width:48px;
|
||||
height: 48px;
|
||||
margin-right: 15px;
|
||||
background: url(img/icon-cross.png) center no-repeat;
|
||||
}
|
||||
|
||||
#status-err-help {
|
||||
font-size: 18px;
|
||||
font-weight: normal;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.hidden {
|
||||
display: none !important;
|
||||
visibility: hidden;
|
||||
}
|
||||
.critical {
|
||||
color: #ff0000;
|
||||
font-weight: bold;
|
||||
}
|
||||
.warning {
|
||||
color: #ff8a00;
|
||||
font-weight: bold;
|
||||
}
|
||||
.td-caption {
|
||||
font-weight: bold;
|
||||
}
|
||||
.td-center {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<img src="img/logo.png" alt="ONLYOFFICE">
|
||||
</header>
|
||||
<div class="main-panel">
|
||||
<div class="header0" id="doc-server-wait">Please, wait...</div>
|
||||
<div class="hidden" id="doc-server-ok">
|
||||
<div class="header1">Document Server information</div>
|
||||
<div class="header2">Build</div>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="120px" class="td-caption">Type:</td>
|
||||
<td width="500px" id="build-type"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td-caption">Date:</td>
|
||||
<td id="build-date"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td-caption">Version:</td>
|
||||
<td id="build-version"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="header2">License</div>
|
||||
<table>
|
||||
<tr>
|
||||
<td width="280px" class="td-caption" id="lic-valid-type">Valid:</td>
|
||||
<td width="500px">until <span id="lic-valid"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td-caption" id="limit-type">Concurrent users limit:</td>
|
||||
<td id="lic-limit"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="header2">Number Concurrent Connections</div>
|
||||
<table width="600px">
|
||||
<tr class="td-caption">
|
||||
<td></td>
|
||||
<td class="td-center">Last Hour</td>
|
||||
<td class="td-center">Last 24 Hours</td>
|
||||
<td class="td-center">Last Week</td>
|
||||
<td class="td-center">Last Month</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td-caption">Maximum:</td>
|
||||
<td id="cell-hour-max" class="td-center">0</td>
|
||||
<td id="cell-day-max" class="td-center">0</td>
|
||||
<td id="cell-week-max" class="td-center">0</td>
|
||||
<td id="cell-month-max" class="td-center">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td-caption">Minimum:</td>
|
||||
<td id="cell-hour-min" class="td-center">0</td>
|
||||
<td id="cell-day-min" class="td-center">0</td>
|
||||
<td id="cell-week-min" class="td-center">0</td>
|
||||
<td id="cell-month-min" class="td-center">0</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td-caption">Average:</td>
|
||||
<td id="cell-hour-avr" class="td-center">0</td>
|
||||
<td id="cell-day-avr" class="td-center">0</td>
|
||||
<td id="cell-week-avr" class="td-center">0</td>
|
||||
<td id="cell-month-avr" class="td-center">0</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="hidden header0" id="doc-server-err">
|
||||
<div id="status-err-icon"></div>
|
||||
<div>
|
||||
<div>Something went wrong during installation</div>
|
||||
<div id="status-err-help">Make sure that you have followed the <a href="http://helpcenter.onlyoffice.com/server/document.aspx" target="_blank">installation instructions</a></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var _createXMLHTTPObject = function() {
|
||||
var xmlhttp;
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
}
|
||||
catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
return xmlhttp;
|
||||
};
|
||||
function fillInfo(licenseInfo, serverInfo) {
|
||||
var elem = document.getElementById('build-type');
|
||||
elem.innerText = (licenseInfo.packageType == 0) ? 'Open source' : ((licenseInfo.packageType == 1) ? 'Integration' : 'Developer');
|
||||
|
||||
elem = document.getElementById('build-date');
|
||||
var builddate = new Date(licenseInfo.buildDate);
|
||||
elem.innerText = builddate.toLocaleDateString();
|
||||
|
||||
elem = document.getElementById('build-version');
|
||||
elem.innerText = serverInfo.buildVersion + '.' + serverInfo.buildNumber;
|
||||
|
||||
elem = document.getElementById('limit-type');
|
||||
elem.innerText = (licenseInfo.usersCount>0) ? 'Concurrent users limit:' : 'Concurrent connections limit:';
|
||||
|
||||
elem = document.getElementById('lic-limit');
|
||||
elem.innerText = (licenseInfo.usersCount || licenseInfo.connections);
|
||||
|
||||
elem = document.getElementById('lic-valid-type');
|
||||
elem.innerText = (licenseInfo.mode == 1) ? 'Valid:' : 'Updates available:';
|
||||
|
||||
var licdate = new Date(licenseInfo.endDate);
|
||||
elem = document.getElementById('lic-valid');
|
||||
elem.innerText = licdate.toLocaleDateString();
|
||||
if (Date.now() > licdate)
|
||||
elem.classList.add('critical');
|
||||
|
||||
return (licenseInfo.usersCount>0) ? 1000000 : licenseInfo.connections;
|
||||
}
|
||||
function fillConnections(info, limit) {
|
||||
for (var precision in info.connectionsStat) {
|
||||
for (var agregate in info.connectionsStat[precision].edit) {
|
||||
var value = info.connectionsStat[precision].edit[agregate];
|
||||
var elem = document.getElementById('cell-' + precision + '-' + agregate);
|
||||
elem.innerText = value;
|
||||
if (value >= limit) {
|
||||
elem.classList.add("critical");
|
||||
} else if (value >= limit * 0.7) {
|
||||
elem.classList.add("warning");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
(function(){
|
||||
try {
|
||||
var xhrObj = _createXMLHTTPObject();
|
||||
if (xhrObj) {
|
||||
var index_html = window["location"]["href"];
|
||||
var healthcheck_url = index_html.substring(0, index_html.lastIndexOf("/") + 1) + 'info.json';
|
||||
xhrObj.open('GET', healthcheck_url);
|
||||
xhrObj.onreadystatechange = function() {
|
||||
if (xhrObj.readyState == 4) {
|
||||
document.getElementById('doc-server-wait').classList.add("hidden");
|
||||
if (xhrObj.status == 200) {
|
||||
document.getElementById('doc-server-ok').classList.remove("hidden");
|
||||
var info = JSON.parse(xhrObj.responseText);
|
||||
fillConnections(info, fillInfo(info.licenseInfo, info.serverInfo));
|
||||
} else {
|
||||
document.getElementById('doc-server-err').classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
};
|
||||
xhrObj.send('');
|
||||
}
|
||||
}
|
||||
catch (e) {}
|
||||
})();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -32,35 +32,46 @@ RunCommand() {
|
||||
|
||||
CreateDir "$BASEDIR/App_Data"
|
||||
CreateDir "$BASEDIR/FileConverter/bin"
|
||||
CreateDir "$BASEDIR/FileConverter/bin/core"
|
||||
CreateDir "$BASEDIR/FileConverter/bin/HtmlFileInternal"
|
||||
|
||||
cd "$BASEDIR/FileConverter/bin"
|
||||
|
||||
cp -v "../../../core/build/bin/mac_64/icudtl_dat.S" "."
|
||||
cp -v "../../../core/build/bin/mac_64/x2t" "."
|
||||
cp -v "../../../core/build/bin/icu/mac_64/libicudata.55.1.dylib" "."
|
||||
cp -v "../../../core/build/bin/icu/mac_64/libicuuc.55.1.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libDjVuFile.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libHtmlFile.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libHtmlRenderer.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libPdfReader.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libPdfWriter.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libUnicodeConverter.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libXpsFile.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libascdocumentscore.dylib" "."
|
||||
cp -v "../../../core/build/lib/mac_64/libdoctrenderer.dylib" "."
|
||||
wget -N http://repo-doc-onlyoffice-com.s3.amazonaws.com/mac/core/origin/develop/latest/x64/core.tar.gz
|
||||
gunzip -c core.tar.gz | tar xopf - -C core
|
||||
|
||||
cp -v "core/build/bin/mac_64/icudtl_dat.S" "."
|
||||
cp -v "core/build/bin/mac_64/x2t" "."
|
||||
cp -v "core/Common/3dParty/icu/mac_64/build/libicudata.60.dylib" "."
|
||||
cp -v "core/Common/3dParty/icu/mac_64/build/libicuuc.60.dylib" "."
|
||||
cp -v "core/Common/3dParty/icu/mac_64/build/libicudata.60.2.dylib" "."
|
||||
cp -v "core/Common/3dParty/icu/mac_64/build/libicuuc.60.2.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libDjVuFile.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libHtmlFile.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libHtmlRenderer.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libPdfReader.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libPdfWriter.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libUnicodeConverter.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libXpsFile.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libascdocumentscore.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libdoctrenderer.dylib" "."
|
||||
cp -v "core/build/lib/mac_64/libkernel.dylib" "."
|
||||
|
||||
ln -sifv libicuuc.55.1.dylib libicuuc.55.dylib
|
||||
ln -sifv libicudata.55.1.dylib libicudata.55.dylib
|
||||
chmod -v +x x2t
|
||||
|
||||
SEARCH='..\/..\/OfficeWeb'
|
||||
REPLACE='..\/..\/..\/sdkjs'
|
||||
sed "s/$SEARCH/$REPLACE/g" "../../../core/build/lib/DoctRenderer.config" > "DoctRenderer.config"
|
||||
|
||||
echo "----------------------------------------"
|
||||
echo "Font generation "
|
||||
echo "----------------------------------------"
|
||||
|
||||
echo $BASEDIR
|
||||
chmod -v +x $BASEDIR/../core/build/bin/AllFontsGen/mac_64
|
||||
bash -cv "$BASEDIR/../core/build/bin/AllFontsGen/mac_64 '' '$BASEDIR/../sdkjs/Common/AllFonts.js' '$BASEDIR/../sdkjs/Common/Images' '$BASEDIR/FileConverter/bin/font_selection.bin'"
|
||||
cd "$BASEDIR/FileConverter/bin/core/build/bin"
|
||||
CreateDir "$BASEDIR/../fonts"
|
||||
chmod -v +x $BASEDIR/FileConverter/bin/core/build/bin/AllFontsGen/mac_64
|
||||
bash -cv "$BASEDIR/FileConverter/bin/core/build/bin/AllFontsGen/mac_64 '' '$BASEDIR/../sdkjs/Common/AllFonts.js' '$BASEDIR/../sdkjs/Common/Images' '$BASEDIR/FileConverter/bin/font_selection.bin' '$BASEDIR/../fonts'"
|
||||
|
||||
|
||||
echo "----------------------------------------"
|
||||
|
||||
@ -16,8 +16,10 @@ powershell -executionpolicy remotesigned -file update-core.ps1 "http://repo-doc-
|
||||
|
||||
cd /D "%~dp0\FileConverter\bin" || goto ERROR
|
||||
copy "core\Common\3dParty\v8\win_%OS%\release\icudt.dll" "."
|
||||
copy "core\Common\3dParty\icu\win_%OS%\build\icudt55.dll" "."
|
||||
copy "core\Common\3dParty\icu\win_%OS%\build\icuuc55.dll" "."
|
||||
copy "core\Common\3dParty\icu\win_%OS%\build\icudt*.dll" "."
|
||||
copy "core\Common\3dParty\icu\win_%OS%\build\icuuc*.dll" "."
|
||||
copy "core\build\lib\win_%OS%\kernel.dll" "."
|
||||
copy "core\build\lib\win_%OS%\graphics.dll" "."
|
||||
copy "core\build\lib\win_%OS%\doctrenderer.dll" "."
|
||||
copy "core\build\lib\win_%OS%\HtmlRenderer.dll" "."
|
||||
copy "core\build\lib\win_%OS%\DjVuFile.dll" "."
|
||||
|
||||
Reference in New Issue
Block a user