Use onlyoffice spreadsheets without ooserver
This commit is contained in:
parent
b2b23446e8
commit
1e672c4a6b
@ -258,7 +258,7 @@ app.use(function (req, res, next) {
|
|||||||
var httpServer = httpsOpts ? Https.createServer(httpsOpts, app) : Http.createServer(app);
|
var httpServer = httpsOpts ? Https.createServer(httpsOpts, app) : Http.createServer(app);
|
||||||
|
|
||||||
/* Install sockjs websocket server */
|
/* Install sockjs websocket server */
|
||||||
OOServer.install(httpServer, config.httpPort, () => {
|
//OOServer.install(httpServer, config.httpPort, () => {
|
||||||
httpServer.listen(config.httpPort,config.httpAddress,function(){
|
httpServer.listen(config.httpPort,config.httpAddress,function(){
|
||||||
var host = config.httpAddress;
|
var host = config.httpAddress;
|
||||||
var hostName = !host.indexOf(':') ? '[' + host + ']' : host;
|
var hostName = !host.indexOf(':') ? '[' + host + ']' : host;
|
||||||
@ -268,11 +268,11 @@ OOServer.install(httpServer, config.httpPort, () => {
|
|||||||
|
|
||||||
console.log('\n[%s] server available http://%s%s', new Date().toISOString(), hostName, ps);
|
console.log('\n[%s] server available http://%s%s', new Date().toISOString(), hostName, ps);
|
||||||
});
|
});
|
||||||
});
|
//});
|
||||||
if (config.httpSafePort) {
|
if (config.httpSafePort) {
|
||||||
var safeHttpServer = Http.createServer(app).listen(config.httpSafePort, config.httpAddress);
|
var safeHttpServer = Http.createServer(app).listen(config.httpSafePort, config.httpAddress);
|
||||||
OOServer.install(safeHttpServer, config.httpSafePort, () => {
|
//OOServer.install(safeHttpServer, config.httpSafePort, () => {
|
||||||
});
|
//});
|
||||||
}
|
}
|
||||||
|
|
||||||
var wsConfig = { server: httpServer };
|
var wsConfig = { server: httpServer };
|
||||||
|
|||||||
242
www/common/onlyoffice/sdkjs/cell/sdk-all-min.js
vendored
242
www/common/onlyoffice/sdkjs/cell/sdk-all-min.js
vendored
@ -3174,6 +3174,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
DocsCoApi.prototype._send = function(data) {
|
DocsCoApi.prototype._send = function(data) {
|
||||||
if (data !== null && typeof data === "object") {
|
if (data !== null && typeof data === "object") {
|
||||||
if (this._state > 0) {
|
if (this._state > 0) {
|
||||||
|
console.log(data);
|
||||||
this.sockjs.send(JSON.stringify(data));
|
this.sockjs.send(JSON.stringify(data));
|
||||||
} else {
|
} else {
|
||||||
this._msgBuffer.push(JSON.stringify(data));
|
this._msgBuffer.push(JSON.stringify(data));
|
||||||
@ -3184,6 +3185,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
DocsCoApi.prototype._sendRaw = function(data) {
|
DocsCoApi.prototype._sendRaw = function(data) {
|
||||||
if (data !== null && typeof data === "string") {
|
if (data !== null && typeof data === "string") {
|
||||||
if (this._state > 0) {
|
if (this._state > 0) {
|
||||||
|
console.log(data);
|
||||||
this.sockjs.send(data);
|
this.sockjs.send(data);
|
||||||
} else {
|
} else {
|
||||||
this._msgBuffer.push(data);
|
this._msgBuffer.push(data);
|
||||||
@ -3755,6 +3757,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
var t = this;
|
var t = this;
|
||||||
|
|
||||||
var sockjs;
|
var sockjs;
|
||||||
|
/*
|
||||||
if (window['IS_NATIVE_EDITOR']) {
|
if (window['IS_NATIVE_EDITOR']) {
|
||||||
sockjs = this.sockjs = window['SockJS'];
|
sockjs = this.sockjs = window['SockJS'];
|
||||||
sockjs.open();
|
sockjs.open();
|
||||||
@ -3763,21 +3766,27 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
|
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
|
||||||
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
|
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
|
||||||
sockjs = this.sockjs = new (this._getSockJs())(this.sockjs_url, null, {transports: ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
|
sockjs = this.sockjs = new (this._getSockJs())(this.sockjs_url, null, {transports: ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
|
||||||
}
|
}*/
|
||||||
|
sockjs = this.sockjs = {};
|
||||||
|
//t._state = true;
|
||||||
|
|
||||||
sockjs.onopen = function() {
|
sockjs.onopen = function() {
|
||||||
|
/*
|
||||||
if (t.reconnectTimeout) {
|
if (t.reconnectTimeout) {
|
||||||
clearTimeout(t.reconnectTimeout);
|
clearTimeout(t.reconnectTimeout);
|
||||||
t.reconnectTimeout = null;
|
t.reconnectTimeout = null;
|
||||||
t.attemptCount = 0;
|
t.attemptCount = 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
t._state = ConnectionState.WaitAuth;
|
t._state = ConnectionState.WaitAuth;
|
||||||
t.onFirstConnect();
|
t.onFirstConnect();
|
||||||
};
|
};
|
||||||
|
sockjs.onopen();
|
||||||
sockjs.onmessage = function(e) {
|
sockjs.onmessage = function(e) {
|
||||||
//TODO: add checks and error handling
|
//TODO: add checks and error handling
|
||||||
//Get data type
|
//Get data type
|
||||||
|
console.log(e.data);
|
||||||
var dataObject = JSON.parse(e.data);
|
var dataObject = JSON.parse(e.data);
|
||||||
switch (dataObject['type']) {
|
switch (dataObject['type']) {
|
||||||
case 'auth' :
|
case 'auth' :
|
||||||
@ -3847,6 +3856,68 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sockjs.close = function () {
|
||||||
|
console.error('Close realtime');
|
||||||
|
};
|
||||||
|
|
||||||
|
var send = function (data) {
|
||||||
|
setTimeout(function () {
|
||||||
|
console.log(data);
|
||||||
|
sockjs.onmessage({
|
||||||
|
data: JSON.stringify(data)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
sockjs.send = function (data) {
|
||||||
|
console.log(data);
|
||||||
|
try {
|
||||||
|
var obj = JSON.parse(data);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var msg, msg2;
|
||||||
|
switch (obj.type) {
|
||||||
|
case 'auth':
|
||||||
|
msg = {
|
||||||
|
"type":"auth",
|
||||||
|
"result":1,
|
||||||
|
"sessionId":"08e77705-dc5c-477d-b73a-b1a7cbca1e9b",
|
||||||
|
"sessionTimeConnect":+new Date(),
|
||||||
|
"participants":[]
|
||||||
|
};
|
||||||
|
msg2 = {
|
||||||
|
"type":"documentOpen",
|
||||||
|
"data":{"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}}
|
||||||
|
};
|
||||||
|
send(msg);
|
||||||
|
send(msg2);
|
||||||
|
break;
|
||||||
|
case 'getMessages':
|
||||||
|
msg = {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var license = {
|
||||||
|
type: 'license',
|
||||||
|
license: {
|
||||||
|
type: 3,
|
||||||
|
light: false,
|
||||||
|
trial: false,
|
||||||
|
rights: 1,
|
||||||
|
buildVersion: "4.3.3",
|
||||||
|
buildNumber: 4,
|
||||||
|
branding: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
send(license);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
sockjs.onclose = function(evt) {
|
sockjs.onclose = function(evt) {
|
||||||
if (ConnectionState.SaveChanges === t._state) {
|
if (ConnectionState.SaveChanges === t._state) {
|
||||||
// Мы сохраняли изменения и разорвалось соединение
|
// Мы сохраняли изменения и разорвалось соединение
|
||||||
@ -3871,6 +3942,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
t._tryReconnect();
|
t._tryReconnect();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
return sockjs;
|
return sockjs;
|
||||||
};
|
};
|
||||||
@ -3917,7 +3989,8 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
//----------------------------------------------------------export----------------------------------------------------
|
//----------------------------------------------------------export----------------------------------------------------
|
||||||
window['AscCommon'] = window['AscCommon'] || {};
|
window['AscCommon'] = window['AscCommon'] || {};
|
||||||
window['AscCommon'].CDocsCoApi = CDocsCoApi;
|
window['AscCommon'].CDocsCoApi = CDocsCoApi;
|
||||||
})(window);
|
})(window);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) Copyright Ascensio System SIA 2010-2017
|
* (c) Copyright Ascensio System SIA 2010-2017
|
||||||
*
|
*
|
||||||
@ -9205,7 +9278,6 @@ function saveWithParts(fSendCommand, fCallback, fCallbackRequest, oAdditionalDat
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadFileContent(url, callback) {
|
function loadFileContent(url, callback) {
|
||||||
console.error(url);
|
|
||||||
asc_ajax({
|
asc_ajax({
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "text",
|
dataType: "text",
|
||||||
@ -9228,90 +9300,86 @@ function getImageFromChanges (name) {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
function openFileCommand(binUrl, changesUrl, Signature, callback) {
|
||||||
var bError = false, oResult = new OpenFileResult(), bEndLoadFile = false, bEndLoadChanges = false;
|
var bError = false, oResult = new OpenFileResult(), bEndLoadFile = false, bEndLoadChanges = false;
|
||||||
var onEndOpen = function() {
|
var onEndOpen = function() {
|
||||||
console.error("this is where we should decrypt");
|
if (bEndLoadFile && bEndLoadChanges) {
|
||||||
if (bEndLoadFile && bEndLoadChanges) {
|
if (callback) {
|
||||||
if (callback) {
|
callback(bError, oResult);
|
||||||
callback(bError, oResult);
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
var sFileUrl = binUrl;
|
||||||
var sFileUrl = binUrl;
|
sFileUrl = sFileUrl.replace(/\\/g, "/");
|
||||||
sFileUrl = sFileUrl.replace(/\\/g, "/");
|
|
||||||
|
if (!window['IS_NATIVE_EDITOR']) {
|
||||||
if (!window['IS_NATIVE_EDITOR']) {
|
asc_ajax({
|
||||||
asc_ajax({
|
url: sFileUrl,
|
||||||
url: sFileUrl,
|
dataType: "text",
|
||||||
dataType: "text",
|
success: function(result) {
|
||||||
success: function(result) {
|
//получаем url к папке с файлом
|
||||||
//получаем url к папке с файлом
|
var url;
|
||||||
var url;
|
var nIndex = sFileUrl.lastIndexOf("/");
|
||||||
var nIndex = sFileUrl.lastIndexOf("/");
|
url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl;
|
||||||
url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl;
|
if (0 < result.length) {
|
||||||
if (0 < result.length) {
|
oResult.bSerFormat = Signature === result.substring(0, Signature.length);
|
||||||
oResult.bSerFormat = Signature === result.substring(0, Signature.length);
|
oResult.data = result;
|
||||||
oResult.data = result;
|
oResult.url = url;
|
||||||
oResult.url = url;
|
} else {
|
||||||
} else {
|
bError = true;
|
||||||
bError = true;
|
}
|
||||||
}
|
bEndLoadFile = true;
|
||||||
bEndLoadFile = true;
|
onEndOpen();
|
||||||
onEndOpen();
|
},
|
||||||
console.error(oResult); // XXX
|
error: function() {
|
||||||
},
|
bEndLoadFile = true;
|
||||||
error: function() {
|
bError = true;
|
||||||
bEndLoadFile = true;
|
onEndOpen();
|
||||||
bError = true;
|
}
|
||||||
onEndOpen();
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
if (null != changesUrl) {
|
||||||
|
getJSZipUtils().getBinaryContent(changesUrl, function(err, data) {
|
||||||
if (null != changesUrl) {
|
bEndLoadChanges = true;
|
||||||
console.error("null changesUrl"); // XXX
|
if (err) {
|
||||||
getJSZipUtils().getBinaryContent(changesUrl, function(err, data) {
|
bError = true;
|
||||||
bEndLoadChanges = true;
|
onEndOpen();
|
||||||
if (err) {
|
return;
|
||||||
bError = true;
|
}
|
||||||
onEndOpen();
|
|
||||||
return;
|
oZipChanges = new (require('jszip'))(data);
|
||||||
}
|
oResult.changes = [];
|
||||||
|
for (var i in oZipChanges.files) {
|
||||||
oZipChanges = new (require('jszip'))(data);
|
if (i.endsWith('.json')) {
|
||||||
oResult.changes = [];
|
// Заглушка на имя файла (стоило его начинать с цифры)
|
||||||
for (var i in oZipChanges.files) {
|
oResult.changes[parseInt(i.slice('changes'.length))] = JSON.parse(oZipChanges.files[i].asText());
|
||||||
if (i.endsWith('.json')) {
|
}
|
||||||
// Заглушка на имя файла (стоило его начинать с цифры)
|
}
|
||||||
oResult.changes[parseInt(i.slice('changes'.length))] =
|
onEndOpen();
|
||||||
JSON.parse(oZipChanges.files[i].asText());
|
});
|
||||||
}
|
} else {
|
||||||
}
|
bEndLoadChanges = true;
|
||||||
onEndOpen();
|
}
|
||||||
});
|
|
||||||
} else {
|
if (window['IS_NATIVE_EDITOR']) {
|
||||||
bEndLoadChanges = true;
|
var result = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
||||||
}
|
|
||||||
|
var url;
|
||||||
if (window['IS_NATIVE_EDITOR']) {
|
var nIndex = sFileUrl.lastIndexOf("/");
|
||||||
console.error("is native editor");
|
url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl;
|
||||||
var result = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
|
if (0 < result.length) {
|
||||||
|
oResult.bSerFormat = Signature === result.substring(0, Signature.length);
|
||||||
var url;
|
oResult.data = result;
|
||||||
var nIndex = sFileUrl.lastIndexOf("/");
|
oResult.url = url;
|
||||||
url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl;
|
} else {
|
||||||
if (0 < result.length) {
|
bError = true;
|
||||||
oResult.bSerFormat = Signature === result.substring(0, Signature.length);
|
}
|
||||||
oResult.data = result;
|
|
||||||
oResult.url = url;
|
bEndLoadFile = true;
|
||||||
} else {
|
onEndOpen();
|
||||||
bError = true;
|
}
|
||||||
}
|
}
|
||||||
bEndLoadFile = true;
|
|
||||||
onEndOpen();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function sendCommand(editor, fCallback, rdata, dataContainer) {
|
function sendCommand(editor, fCallback, rdata, dataContainer) {
|
||||||
//json не должен превышать размера 2097152, иначе при его чтении будет exception
|
//json не должен превышать размера 2097152, иначе при его чтении будет exception
|
||||||
var docConnectionId = editor.CoAuthoringApi.getDocId();
|
var docConnectionId = editor.CoAuthoringApi.getDocId();
|
||||||
|
|||||||
72
www/common/onlyoffice/sdkjs/slide/sdk-all-min.js
vendored
72
www/common/onlyoffice/sdkjs/slide/sdk-all-min.js
vendored
@ -3755,6 +3755,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
var t = this;
|
var t = this;
|
||||||
|
|
||||||
var sockjs;
|
var sockjs;
|
||||||
|
/*
|
||||||
if (window['IS_NATIVE_EDITOR']) {
|
if (window['IS_NATIVE_EDITOR']) {
|
||||||
sockjs = this.sockjs = window['SockJS'];
|
sockjs = this.sockjs = window['SockJS'];
|
||||||
sockjs.open();
|
sockjs.open();
|
||||||
@ -3763,8 +3764,11 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
|
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
|
||||||
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
|
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
|
||||||
sockjs = this.sockjs = new (this._getSockJs())(this.sockjs_url, null, {transports: ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
|
sockjs = this.sockjs = new (this._getSockJs())(this.sockjs_url, null, {transports: ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
|
||||||
}
|
}*/
|
||||||
|
sockjs = {};
|
||||||
|
t._state = true;
|
||||||
|
|
||||||
|
/*
|
||||||
sockjs.onopen = function() {
|
sockjs.onopen = function() {
|
||||||
if (t.reconnectTimeout) {
|
if (t.reconnectTimeout) {
|
||||||
clearTimeout(t.reconnectTimeout);
|
clearTimeout(t.reconnectTimeout);
|
||||||
@ -3775,6 +3779,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
t._state = ConnectionState.WaitAuth;
|
t._state = ConnectionState.WaitAuth;
|
||||||
t.onFirstConnect();
|
t.onFirstConnect();
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
sockjs.onmessage = function(e) {
|
sockjs.onmessage = function(e) {
|
||||||
//TODO: add checks and error handling
|
//TODO: add checks and error handling
|
||||||
//Get data type
|
//Get data type
|
||||||
@ -3847,6 +3852,67 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sockjs.close = function () {
|
||||||
|
console.error('Close realtime');
|
||||||
|
};
|
||||||
|
|
||||||
|
var send = function (data) {
|
||||||
|
setTimeout(function () {
|
||||||
|
this.onmessage(JSON.stringify(data));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
sockjs.send = function (data) {
|
||||||
|
try {
|
||||||
|
var obj = JSON.parse(data);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(data);
|
||||||
|
console.error(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var msg, msg2;
|
||||||
|
switch (obj.type) {
|
||||||
|
case 'auth':
|
||||||
|
msg = {
|
||||||
|
"type":"auth",
|
||||||
|
"result":1,
|
||||||
|
"sessionId":"08e77705-dc5c-477d-b73a-b1a7cbca1e9b",
|
||||||
|
"sessionTimeConnect":+new Date(),
|
||||||
|
"participants":[]
|
||||||
|
};
|
||||||
|
msg2 = {
|
||||||
|
"type":"documentOpen",
|
||||||
|
"data":{"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}}
|
||||||
|
};
|
||||||
|
send(msg);
|
||||||
|
send(msg2);
|
||||||
|
break;
|
||||||
|
case 'getMessages':
|
||||||
|
msg = {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var license = {
|
||||||
|
type: 'license',
|
||||||
|
license: {
|
||||||
|
type: 3,
|
||||||
|
light: false,
|
||||||
|
trial: false,
|
||||||
|
rights: 1,
|
||||||
|
buildVersion: "4.3.3",
|
||||||
|
buildNumber: 4,
|
||||||
|
branding: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
sockjs.onmessage({
|
||||||
|
data: JSON.stringify(license)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
sockjs.onclose = function(evt) {
|
sockjs.onclose = function(evt) {
|
||||||
if (ConnectionState.SaveChanges === t._state) {
|
if (ConnectionState.SaveChanges === t._state) {
|
||||||
// Мы сохраняли изменения и разорвалось соединение
|
// Мы сохраняли изменения и разорвалось соединение
|
||||||
@ -3871,6 +3937,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
t._tryReconnect();
|
t._tryReconnect();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
return sockjs;
|
return sockjs;
|
||||||
};
|
};
|
||||||
@ -3917,7 +3984,8 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
//----------------------------------------------------------export----------------------------------------------------
|
//----------------------------------------------------------export----------------------------------------------------
|
||||||
window['AscCommon'] = window['AscCommon'] || {};
|
window['AscCommon'] = window['AscCommon'] || {};
|
||||||
window['AscCommon'].CDocsCoApi = CDocsCoApi;
|
window['AscCommon'].CDocsCoApi = CDocsCoApi;
|
||||||
})(window);
|
})(window);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) Copyright Ascensio System SIA 2010-2017
|
* (c) Copyright Ascensio System SIA 2010-2017
|
||||||
*
|
*
|
||||||
|
|||||||
72
www/common/onlyoffice/sdkjs/word/sdk-all-min.js
vendored
72
www/common/onlyoffice/sdkjs/word/sdk-all-min.js
vendored
@ -3755,6 +3755,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
var t = this;
|
var t = this;
|
||||||
|
|
||||||
var sockjs;
|
var sockjs;
|
||||||
|
/*
|
||||||
if (window['IS_NATIVE_EDITOR']) {
|
if (window['IS_NATIVE_EDITOR']) {
|
||||||
sockjs = this.sockjs = window['SockJS'];
|
sockjs = this.sockjs = window['SockJS'];
|
||||||
sockjs.open();
|
sockjs.open();
|
||||||
@ -3763,8 +3764,11 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
|
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
|
||||||
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
|
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
|
||||||
sockjs = this.sockjs = new (this._getSockJs())(this.sockjs_url, null, {transports: ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
|
sockjs = this.sockjs = new (this._getSockJs())(this.sockjs_url, null, {transports: ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
|
||||||
}
|
}*/
|
||||||
|
sockjs = {};
|
||||||
|
t._state = true;
|
||||||
|
|
||||||
|
/*
|
||||||
sockjs.onopen = function() {
|
sockjs.onopen = function() {
|
||||||
if (t.reconnectTimeout) {
|
if (t.reconnectTimeout) {
|
||||||
clearTimeout(t.reconnectTimeout);
|
clearTimeout(t.reconnectTimeout);
|
||||||
@ -3775,6 +3779,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
t._state = ConnectionState.WaitAuth;
|
t._state = ConnectionState.WaitAuth;
|
||||||
t.onFirstConnect();
|
t.onFirstConnect();
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
sockjs.onmessage = function(e) {
|
sockjs.onmessage = function(e) {
|
||||||
//TODO: add checks and error handling
|
//TODO: add checks and error handling
|
||||||
//Get data type
|
//Get data type
|
||||||
@ -3847,6 +3852,67 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
sockjs.close = function () {
|
||||||
|
console.error('Close realtime');
|
||||||
|
};
|
||||||
|
|
||||||
|
var send = function (data) {
|
||||||
|
setTimeout(function () {
|
||||||
|
this.onmessage(JSON.stringify(data));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
sockjs.send = function (data) {
|
||||||
|
try {
|
||||||
|
var obj = JSON.parse(data);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(data);
|
||||||
|
console.error(e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var msg, msg2;
|
||||||
|
switch (obj.type) {
|
||||||
|
case 'auth':
|
||||||
|
msg = {
|
||||||
|
"type":"auth",
|
||||||
|
"result":1,
|
||||||
|
"sessionId":"08e77705-dc5c-477d-b73a-b1a7cbca1e9b",
|
||||||
|
"sessionTimeConnect":+new Date(),
|
||||||
|
"participants":[]
|
||||||
|
};
|
||||||
|
msg2 = {
|
||||||
|
"type":"documentOpen",
|
||||||
|
"data":{"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}}
|
||||||
|
};
|
||||||
|
send(msg);
|
||||||
|
send(msg2);
|
||||||
|
break;
|
||||||
|
case 'getMessages':
|
||||||
|
msg = {};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var license = {
|
||||||
|
type: 'license',
|
||||||
|
license: {
|
||||||
|
type: 3,
|
||||||
|
light: false,
|
||||||
|
trial: false,
|
||||||
|
rights: 1,
|
||||||
|
buildVersion: "4.3.3",
|
||||||
|
buildNumber: 4,
|
||||||
|
branding: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
sockjs.onmessage({
|
||||||
|
data: JSON.stringify(license)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
sockjs.onclose = function(evt) {
|
sockjs.onclose = function(evt) {
|
||||||
if (ConnectionState.SaveChanges === t._state) {
|
if (ConnectionState.SaveChanges === t._state) {
|
||||||
// Мы сохраняли изменения и разорвалось соединение
|
// Мы сохраняли изменения и разорвалось соединение
|
||||||
@ -3871,6 +3937,7 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
t._tryReconnect();
|
t._tryReconnect();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
|
||||||
return sockjs;
|
return sockjs;
|
||||||
};
|
};
|
||||||
@ -3917,7 +3984,8 @@ AscBrowser.convertToRetinaValue = function(value, isScale)
|
|||||||
//----------------------------------------------------------export----------------------------------------------------
|
//----------------------------------------------------------export----------------------------------------------------
|
||||||
window['AscCommon'] = window['AscCommon'] || {};
|
window['AscCommon'] = window['AscCommon'] || {};
|
||||||
window['AscCommon'].CDocsCoApi = CDocsCoApi;
|
window['AscCommon'].CDocsCoApi = CDocsCoApi;
|
||||||
})(window);
|
})(window);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) Copyright Ascensio System SIA 2010-2017
|
* (c) Copyright Ascensio System SIA 2010-2017
|
||||||
*
|
*
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user