Commit 5f8b00fa authored by konovalovsergey's avatar konovalovsergey

jwt token on open

parent e087ecad
......@@ -665,7 +665,6 @@ var editor;
"id": this.documentId,
"userid": this.documentUserId,
"format": this.documentFormat,
"vkey": this.documentVKey,
"c": "reopen",
"url": this.documentUrl,
"title": this.documentTitle,
......@@ -687,7 +686,6 @@ var editor;
"id": this.documentId,
"userid": this.documentUserId,
"format": this.documentFormat,
"vkey": this.documentVKey,
"c": "reopen",
"url": this.documentUrl,
"title": this.documentTitle,
......@@ -767,7 +765,7 @@ var editor;
oAdditionalData["c"] = "sfct";
oAdditionalData["id"] = this.documentId;
oAdditionalData["userid"] = this.documentUserId;
oAdditionalData["vkey"] = this.documentVKey;
oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt();
oAdditionalData["outputformat"] = filetype;
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype));
oAdditionalData["savetype"] = AscCommon.c_oAscSaveTypes.CompleteAll;
......@@ -811,7 +809,7 @@ var editor;
oAdditionalData["c"] = command;
oAdditionalData["id"] = this.documentId;
oAdditionalData["userid"] = this.documentUserId;
oAdditionalData["vkey"] = this.documentVKey;
oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt();
oAdditionalData["outputformat"] = sFormat;
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(sFormat));
if (DownloadType.Print === options.downloadType) {
......@@ -2199,7 +2197,6 @@ var editor;
var rData = {
"id": this.documentId,
"userid": this.documentUserId,
"vkey": this.documentVKey,
"c": "imgurl",
"saveindex": g_oDocumentUrls.getMaxIndex(),
"data": imageUrl};
......@@ -2489,7 +2486,6 @@ var editor;
var rData = {
"id": this.documentId,
"userid": this.documentUserId,
"vkey": this.documentVKey,
"c": "imgurl",
"saveindex": g_oDocumentUrls.getMaxIndex(),
"data": sImageUrl};
......
......@@ -3909,8 +3909,7 @@ function OfflineEditor () {
"vkey" : undefined,
"url" : this.documentUrl,
"title" : this.documentTitle,
"embeddedfonts" : false,
"viewmode" : t.initSettings.viewmode};
"embeddedfonts" : false};
_api.CoAuthoringApi.auth(t.initSettings.viewmode, rData);
});
......
......@@ -65,7 +65,6 @@
this.LoadedObject = null;
this.DocumentType = 0; // 0 - empty, 1 - test, 2 - document (from json)
this.DocInfo = null;
this.documentVKey = null;
this.documentId = undefined;
this.documentUserId = undefined;
this.documentUrl = "null";
......@@ -237,13 +236,14 @@
this.documentTitle = this.DocInfo.get_Title();
this.documentFormat = this.DocInfo.get_Format();
this.documentCallbackUrl = this.DocInfo.get_CallbackUrl();
this.documentVKey = this.DocInfo.get_VKey();
this.documentOpenOptions = this.DocInfo.asc_getOptions();
this.User = new AscCommon.asc_CUser();
this.User.setId(this.DocInfo.get_UserId());
this.User.setUserName(this.DocInfo.get_UserName());
this.User.setFirstName(this.DocInfo.get_FirstName());
this.User.setLastName(this.DocInfo.get_LastName());
//чтобы в versionHistory был один documentId для auth и open
this.CoAuthoringApi.setDocId(this.documentId);
......@@ -396,11 +396,9 @@
"id" : this.documentId,
"userid" : this.documentUserId,
"format" : this.documentFormat,
"vkey" : this.documentVKey,
"url" : this.documentUrl,
"title" : this.documentTitle,
"embeddedfonts" : this.isUseEmbeddedCutFonts,
"viewmode" : this.getViewMode()
"embeddedfonts" : this.isUseEmbeddedCutFonts
};
if (isVersionHistory)
{
......@@ -711,7 +709,7 @@
};
this._coAuthoringInitEnd();
this.CoAuthoringApi.init(this.User, this.documentId, this.documentCallbackUrl, 'fghhfgsjdgfjs', this.editorId, this.documentFormatSave);
this.CoAuthoringApi.init(this.User, this.documentId, this.documentCallbackUrl, 'fghhfgsjdgfjs', this.editorId, this.documentFormatSave, this.DocInfo);
};
baseEditorsApi.prototype._coAuthoringInitEnd = function()
{
......@@ -781,7 +779,7 @@
baseEditorsApi.prototype.asc_addImage = function()
{
var t = this;
AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, function(error, files)
AscCommon.ShowImageFileDialog(this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), function(error, files)
{
t._uploadCallback(error, files);
}, function(error)
......@@ -803,7 +801,7 @@
else
{
this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
AscCommon.UploadImageFiles(files, this.documentId, this.documentUserId, function(error, url)
AscCommon.UploadImageFiles(files, this.documentId, this.documentUserId, this.CoAuthoringApi.get_jwt(), function(error, url)
{
if (c_oAscError.ID.No !== error)
{
......
......@@ -2563,6 +2563,12 @@
asc_CDocInfo.prototype.get_UserName = asc_CDocInfo.prototype.asc_getUserName = function () {
return (this.UserInfo ? this.UserInfo.get_FullName() : null );
};
asc_CDocInfo.prototype.get_FirstName = asc_CDocInfo.prototype.asc_getFirstName = function () {
return (this.UserInfo ? this.UserInfo.get_FirstName() : null );
};
asc_CDocInfo.prototype.get_LastName = asc_CDocInfo.prototype.asc_getLastName = function () {
return (this.UserInfo ? this.UserInfo.get_LastName() : null );
};
asc_CDocInfo.prototype.get_Options = asc_CDocInfo.prototype.asc_getOptions = function () {
return this.Options;
};
......@@ -2587,6 +2593,24 @@
asc_CDocInfo.prototype.put_UserInfo = asc_CDocInfo.prototype.asc_putUserInfo = function (v) {
this.UserInfo = v;
};
asc_CDocInfo.prototype.get_Mode = asc_CDocInfo.prototype.asc_getMode = function () {
return this.Mode;
};
asc_CDocInfo.prototype.put_Mode = asc_CDocInfo.prototype.asc_putMode = function (v) {
this.Mode = v;
};
asc_CDocInfo.prototype.get_Permissions = asc_CDocInfo.prototype.asc_getPermissions = function () {
return this.Permissions;
};
asc_CDocInfo.prototype.put_Permissions = asc_CDocInfo.prototype.asc_putPermissions = function (v) {
this.Permissions = v;
};
asc_CDocInfo.prototype.get_Lang = asc_CDocInfo.prototype.asc_getLang = function () {
return this.Lang;
};
asc_CDocInfo.prototype.put_Lang = asc_CDocInfo.prototype.asc_putLang = function (v) {
this.Lang = v;
};
function COpenProgress() {
this.Type = Asc.c_oAscAsyncAction.Open;
......
......@@ -72,7 +72,7 @@
}
}
CDocsCoApi.prototype.init = function(user, docid, documentCallbackUrl, token, editorType, documentFormatSave) {
CDocsCoApi.prototype.init = function(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo) {
if (this._CoAuthoringApi && this._CoAuthoringApi.isRightURL()) {
var t = this;
this._CoAuthoringApi.onAuthParticipantsChanged = function(e, count) {
......@@ -146,7 +146,7 @@
t.callback_OnLicense(res);
};
this._CoAuthoringApi.init(user, docid, documentCallbackUrl, token, editorType, documentFormatSave);
this._CoAuthoringApi.init(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo);
this._onlineWork = true;
} else {
// Фиктивные вызовы
......@@ -315,6 +315,13 @@
}
return null;
};
CDocsCoApi.prototype.get_jwt = function() {
if (this._CoAuthoringApi && this._onlineWork) {
return this._CoAuthoringApi.get_jwt();
}
return null;
};
CDocsCoApi.prototype.releaseLocks = function(blockId) {
if (this._CoAuthoringApi && this._onlineWork) {
......@@ -517,6 +524,7 @@
this.saveLockCallbackErrorTimeOutId = null;
this.saveCallbackErrorTimeOutId = null;
this.unSaveLockCallbackErrorTimeOutId = null;
this.jwtTimeOutId = null;
this._id = null;
this._sessionTimeConnect = null;
this._indexUser = -1;
......@@ -562,6 +570,10 @@
this._isPresentation = false;
this._isAuth = false;
this._documentFormatSave = 0;
this.mode = undefined;
this.permissions = undefined;
this.lang = undefined;
this.jwt = undefined;
this._isViewer = false;
this._isReSaveAfterAuth = false; // Флаг для сохранения после повторной авторизации (для разрыва соединения во время сохранения)
this._lockBuffer = [];
......@@ -584,7 +596,11 @@
};
DocsCoApi.prototype.get_isAuth = function() {
return this._isAuth
return this._isAuth;
};
DocsCoApi.prototype.get_jwt = function() {
return this.jwt;
};
DocsCoApi.prototype.getSessionId = function() {
......@@ -871,6 +887,22 @@
}
};
DocsCoApi.prototype._onRefreshToken = function(jwt) {
var t = this;
if (jwt) {
t.jwt = jwt.token;
if (null !== t.jwtTimeOutId) {
clearTimeout(t.jwtTimeOutId);
t.jwtTimeOutId = null;
}
var timeout = Math.max(0, jwt.expires - t.maxAttemptCount * t.reconnectInterval);
t.jwtTimeOutId = setTimeout(function(){
t.jwtTimeOutId = null;
t._send({'type': 'refreshToken', 'jwt': t.jwt});
}, timeout);
}
};
DocsCoApi.prototype._onGetLock = function(data) {
if (data["locks"]) {
for (var key in data["locks"]) {
......@@ -1178,6 +1210,7 @@
DocsCoApi.prototype._onAuth = function(data) {
var t = this;
this._onRefreshToken(data.jwt);
if (true === this._isAuth) {
this._state = ConnectionState.Authorized;
// Мы должны только соединиться для получения файла. Совместное редактирование уже было отключено.
......@@ -1247,7 +1280,7 @@
//TODO: Add errors
};
DocsCoApi.prototype.init = function(user, docid, documentCallbackUrl, token, editorType, documentFormatSave) {
DocsCoApi.prototype.init = function(user, docid, documentCallbackUrl, token, editorType, documentFormatSave, docInfo) {
this._user = user;
this._docid = null;
this._documentCallbackUrl = documentCallbackUrl;
......@@ -1259,6 +1292,10 @@
this._isPresentation = c_oEditorId.Presentation === editorType;
this._isAuth = false;
this._documentFormatSave = documentFormatSave;
this.mode = docInfo.get_Mode();
this.permissions = docInfo.get_Permissions();
this.lang = docInfo.get_Lang();
this.jwt = docInfo.get_VKey();
this.setDocId(docid);
this._initSocksJs();
......@@ -1294,6 +1331,8 @@
'user': {
'id': this._user.asc_getId(),
'username': this._user.asc_getUserName(),
'firstname': this._user.asc_getFirstName(),
'lastname': this._user.asc_getLastName(),
'indexUser': this._indexUser
},
'editorType': this.editorType,
......@@ -1306,6 +1345,10 @@
'view': this._isViewer,
'isCloseCoAuthoring': this.isCloseCoAuthoring,
'openCmd': opt_openCmd,
'lang': this.lang,
'mode': this.mode,
'permissions': this.permissions,
'jwt': this.jwt,
'version': asc_coAuthV
});
};
......@@ -1391,6 +1434,9 @@
case 'session' :
t._onSession(dataObject);
break;
case 'refreshToken' :
t._onRefreshToken(dataObject["messages"]);
break;
}
};
sockjs.onclose = function(evt) {
......@@ -1403,8 +1449,7 @@
}
}
t._state = ConnectionState.Reconnect;
var bIsDisconnectAtAll = (c_oCloseCode.serverShutdown === evt.code || c_oCloseCode.sessionIdle === evt.code ||
c_oCloseCode.sessionAbsolute === evt.code || t.attemptCount >= t.maxAttemptCount);
var bIsDisconnectAtAll = ((c_oCloseCode.serverShutdown <= evt.code && evt.code <= c_oCloseCode.jwtError) || t.attemptCount >= t.maxAttemptCount);
var errorCode = null;
if (bIsDisconnectAtAll) {
t._state = ConnectionState.ClosedAll;
......@@ -1443,9 +1488,17 @@
DocsCoApi.prototype._getDisconnectErrorCode = function(opt_closeCode) {
if(c_oCloseCode.serverShutdown === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.sessionIdle === opt_closeCode){
} else if(c_oCloseCode.sessionIdle === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.sessionAbsolute === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.accessDeny === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.jwtEmptySecret === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.jwtExpired === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.sessionAbsolute === opt_closeCode){
} else if(c_oCloseCode.jwtError === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
}
return this.isCloseCoAuthoring ? Asc.c_oAscError.ID.UserDrop : Asc.c_oAscError.ID.CoAuthoringDisconnect;
......
/* * (c) Copyright Ascensio System SIA 2010-2016 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * that Ascensio System SIA expressly excludes the warranty of non-infringement * of any third-party rights. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, * EU, LV-1021. * * The interactive user interfaces in modified source and object code versions * of the Program must display Appropriate Legal Notices, as required under * Section 5 of the GNU AGPL version 3. * * Pursuant to Section 7(b) of the License you must retain the original Product * logo when distributing the program. Pursuant to Section 7(e) we decline to * grant you any rights under trademark law for use of our trademarks. * * All the Product's GUI elements, including illustrations and icon sets, as * well as technical writing content are licensed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International. See the License * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ "use strict"; (/** * @param {Window} window * @param {undefined} undefined */ function(window, undefined) { /** * Класс user для совместного редактирования/просмотра документа * ----------------------------------------------------------------------------- * * @constructor * @memberOf Asc */ function asc_CUser(val) { this.id = null; // уникальный id - пользователя this.idOriginal = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.state = undefined; // состояние (true - подключен, false - отключился) this.indexUser = -1; // Индекс пользователя (фактически равно числу заходов в документ на сервере) this.color = null; // цвет пользователя this.view = false; // просмотр(true), редактор(false) this._setUser(val); return this; } asc_CUser.prototype._setUser = function(val) { if (val) { this.id = val['id']; this.idOriginal = val['idOriginal']; this.userName = val['username']; this.indexUser = val['indexUser']; this.color = AscCommon.getUserColorById(this.idOriginal, this.userName, false, true); this.view = val['view']; } }; asc_CUser.prototype.asc_getId = function() { return this.id; }; asc_CUser.prototype.asc_getUserName = function() { return this.userName; }; asc_CUser.prototype.asc_getState = function() { return this.state; }; asc_CUser.prototype.asc_getColor = function() { return '#' + ('000000' + this.color.toString(16)).substr(-6); }; asc_CUser.prototype.asc_getView = function() { return this.view; }; asc_CUser.prototype.setId = function(val) { this.id = val; }; asc_CUser.prototype.setUserName = function(val) { this.userName = val; }; asc_CUser.prototype.setState = function(val) { this.state = val; }; var ConnectionState = { Reconnect: -1, // reconnect state None: 0, // not initialized WaitAuth: 1, // waiting session id Authorized: 2, // authorized ClosedCoAuth: 3, // closed coauthoring ClosedAll: 4, // closed all SaveChanges: 10 // save }; var c_oEditorId = { Word:0, Spreadsheet:1, Presentation:2 }; var c_oCloseCode = { serverShutdown: 4001, sessionIdle: 4002, sessionAbsolute: 4003 }; /* * Export * ----------------------------------------------------------------------------- */ var prot; window['AscCommon'] = window['AscCommon'] || {}; window["AscCommon"].asc_CUser = asc_CUser; prot = asc_CUser.prototype; prot["asc_getId"] = prot.asc_getId; prot["asc_getUserName"] = prot.asc_getUserName; prot["asc_getState"] = prot.asc_getState; prot["asc_getColor"] = prot.asc_getColor; prot["asc_getView"] = prot.asc_getView; window["AscCommon"].ConnectionState = ConnectionState; window["AscCommon"].c_oEditorId = c_oEditorId; window["AscCommon"].c_oCloseCode = c_oCloseCode; })(window);
\ No newline at end of file
/* * (c) Copyright Ascensio System SIA 2010-2016 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL) * version 3 as published by the Free Software Foundation. In accordance with * Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect * that Ascensio System SIA expressly excludes the warranty of non-infringement * of any third-party rights. * * This program is distributed WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For * details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, * EU, LV-1021. * * The interactive user interfaces in modified source and object code versions * of the Program must display Appropriate Legal Notices, as required under * Section 5 of the GNU AGPL version 3. * * Pursuant to Section 7(b) of the License you must retain the original Product * logo when distributing the program. Pursuant to Section 7(e) we decline to * grant you any rights under trademark law for use of our trademarks. * * All the Product's GUI elements, including illustrations and icon sets, as * well as technical writing content are licensed under the terms of the * Creative Commons Attribution-ShareAlike 4.0 International. See the License * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * */ "use strict"; (/** * @param {Window} window * @param {undefined} undefined */ function(window, undefined) { /** * Класс user для совместного редактирования/просмотра документа * ----------------------------------------------------------------------------- * * @constructor * @memberOf Asc */ function asc_CUser(val) { this.id = null; // уникальный id - пользователя this.idOriginal = null; // уникальный id - пользователя this.userName = null; // имя пользователя this.state = undefined; // состояние (true - подключен, false - отключился) this.indexUser = -1; // Индекс пользователя (фактически равно числу заходов в документ на сервере) this.color = null; // цвет пользователя this.view = false; // просмотр(true), редактор(false) this._setUser(val); return this; } asc_CUser.prototype._setUser = function(val) { if (val) { this.id = val['id']; this.idOriginal = val['idOriginal']; this.userName = val['username']; this.indexUser = val['indexUser']; this.color = AscCommon.getUserColorById(this.idOriginal, this.userName, false, true); this.view = val['view']; } }; asc_CUser.prototype.asc_getId = function() { return this.id; }; asc_CUser.prototype.asc_getUserName = function() { return this.userName; }; asc_CUser.prototype.asc_getFirstName = function() { return this.firstName; }; asc_CUser.prototype.asc_getLastName = function() { return this.lastName; }; asc_CUser.prototype.asc_getState = function() { return this.state; }; asc_CUser.prototype.asc_getColor = function() { return '#' + ('000000' + this.color.toString(16)).substr(-6); }; asc_CUser.prototype.asc_getView = function() { return this.view; }; asc_CUser.prototype.setId = function(val) { this.id = val; }; asc_CUser.prototype.setUserName = function(val) { this.userName = val; }; asc_CUser.prototype.setFirstName = function(val) { this.firstName = val; }; asc_CUser.prototype.setLastName = function(val) { this.lastName = val; }; asc_CUser.prototype.setState = function(val) { this.state = val; }; var ConnectionState = { Reconnect: -1, // reconnect state None: 0, // not initialized WaitAuth: 1, // waiting session id Authorized: 2, // authorized ClosedCoAuth: 3, // closed coauthoring ClosedAll: 4, // closed all SaveChanges: 10 // save }; var c_oEditorId = { Word:0, Spreadsheet:1, Presentation:2 }; var c_oCloseCode = { serverShutdown: 4001, sessionIdle: 4002, sessionAbsolute: 4003, accessDeny: 4004, jwtEmptySecret: 4005, jwtExpired: 4006, jwtError: 4007 }; /* * Export * ----------------------------------------------------------------------------- */ var prot; window['AscCommon'] = window['AscCommon'] || {}; window["AscCommon"].asc_CUser = asc_CUser; prot = asc_CUser.prototype; prot["asc_getId"] = prot.asc_getId; prot["asc_getUserName"] = prot.asc_getUserName; prot["asc_getState"] = prot.asc_getState; prot["asc_getColor"] = prot.asc_getColor; prot["asc_getView"] = prot.asc_getView; window["AscCommon"].ConnectionState = ConnectionState; window["AscCommon"].c_oEditorId = c_oEditorId; window["AscCommon"].c_oCloseCode = c_oCloseCode; })(window);
\ No newline at end of file
......
......@@ -886,7 +886,7 @@ function InitOnMessage (callback) {
}, false);
}
}
function ShowImageFileDialog (documentId, documentUserId, callback, callbackOld) {
function ShowImageFileDialog (documentId, documentUserId, jwt, callback, callbackOld) {
var fileName;
if ("undefined" != typeof(FileReader)) {
fileName = GetUploadInput(function (e) {
......@@ -899,7 +899,11 @@ function ShowImageFileDialog (documentId, documentUserId, callback, callbackOld)
});
} else {
var frameWindow = GetUploadIFrame();
var content = '<html><head></head><body><form action="'+sUploadServiceLocalUrlOld+'/'+documentId+'/'+documentUserId+'/'+g_oDocumentUrls.getMaxIndex()+'" method="POST" enctype="multipart/form-data"><input id="apiiuFile" name="apiiuFile" type="file" accept="image/*" size="1"><input id="apiiuSubmit" name="apiiuSubmit" type="submit" style="display:none;"></form></body></html>';
var url = sUploadServiceLocalUrlOld+'/'+documentId+'/'+documentUserId+'/'+g_oDocumentUrls.getMaxIndex();
if (jwt) {
url += '/' + jwt;
}
var content = '<html><head></head><body><form action="'+url+'" method="POST" enctype="multipart/form-data"><input id="apiiuFile" name="apiiuFile" type="file" accept="image/*" size="1"><input id="apiiuSubmit" name="apiiuSubmit" type="submit" style="display:none;"></form></body></html>';
frameWindow.document.open();
frameWindow.document.write(content);
frameWindow.document.close();
......@@ -941,11 +945,15 @@ function InitDragAndDrop (oHtmlElement, callback) {
};
}
}
function UploadImageFiles (files, documentId, documentUserId, callback) {
function UploadImageFiles (files, documentId, documentUserId, jwt, callback) {
if (files.length > 0) {
var file = files[0];
var url = sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex();
if (jwt) {
url += '/' + jwt;
}
var xhr = new XMLHttpRequest();
xhr.open('POST', sUploadServiceLocalUrl + '/' + documentId + '/' + documentUserId + '/' + g_oDocumentUrls.getMaxIndex(), true);
xhr.open('POST', url, true);
xhr.setRequestHeader('Content-Type', file.type || 'application/octet-stream');
xhr.onreadystatechange = function() {
if (4 == this.readyState) {
......
......@@ -1796,7 +1796,7 @@ function sendImgUrls(api, images, callback, bExcel) {
}
}
var rData = {"id": api.documentId, "c": "imgurls", "vkey": api.documentVKey, "userid": api.documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": images};
var rData = {"id": api.documentId, "c": "imgurls", "userid": api.documentUserId, "saveindex": g_oDocumentUrls.getMaxIndex(), "data": images};
api.sync_StartAction(Asc.c_oAscAsyncActionType.BlockInteraction, Asc.c_oAscAsyncAction.LoadImage);
api.fCurCallback = function (input) {
......
......@@ -2085,7 +2085,6 @@ background-repeat: no-repeat;\
"id": this.documentId,
"userid": this.documentUserId,
"format": this.documentFormat,
"vkey": this.documentVKey,
"c": "reopen",
"url": this.documentUrl,
"title": this.documentTitle,
......@@ -2794,7 +2793,6 @@ background-repeat: no-repeat;\
var rData = {
"id" : this.documentId,
"userid" : this.documentUserId,
"vkey" : this.documentVKey,
"c" : "imgurl",
"saveindex" : g_oDocumentUrls.getMaxIndex(),
"data" : sImageUrl
......@@ -3751,7 +3749,6 @@ background-repeat: no-repeat;\
var rData = {
"id" : this.documentId,
"userid" : this.documentUserId,
"vkey" : this.documentVKey,
"c" : "imgurl",
"saveindex" : g_oDocumentUrls.getMaxIndex(),
"data" : url
......@@ -4018,7 +4015,6 @@ background-repeat: no-repeat;\
var rData = {
"id" : this.documentId,
"userid" : this.documentUserId,
"vkey" : this.documentVKey,
"c" : "imgurl",
"saveindex" : g_oDocumentUrls.getMaxIndex(),
"data" : sImageUrl
......@@ -6116,7 +6112,7 @@ background-repeat: no-repeat;\
oAdditionalData["c"] = command;
oAdditionalData["id"] = this.documentId;
oAdditionalData["userid"] = this.documentUserId;
oAdditionalData["vkey"] = this.documentVKey;
oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt();
oAdditionalData["outputformat"] = filetype;
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype));
oAdditionalData["savetype"] = AscCommon.c_oAscSaveTypes.CompleteAll;
......
......@@ -2204,7 +2204,6 @@ background-repeat: no-repeat;\
"id" : this.documentId,
"userid" : this.documentUserId,
"format" : this.documentFormat,
"vkey" : this.documentVKey,
"c" : "reopen",
"url" : this.documentUrl,
"title" : this.documentTitle,
......@@ -2226,7 +2225,6 @@ background-repeat: no-repeat;\
"id": this.documentId,
"userid": this.documentUserId,
"format": this.documentFormat,
"vkey": this.documentVKey,
"c": "reopen",
"url": this.documentUrl,
"title": this.documentTitle,
......@@ -5045,7 +5043,6 @@ background-repeat: no-repeat;\
var rData = {
"id" : this.documentId,
"userid" : this.documentUserId,
"vkey" : this.documentVKey,
"c" : "imgurl",
"saveindex" : g_oDocumentUrls.getMaxIndex(),
"data" : url
......@@ -5408,7 +5405,6 @@ background-repeat: no-repeat;\
var rData = {
"id" : this.documentId,
"userid" : this.documentUserId,
"vkey" : this.documentVKey,
"c" : "imgurl",
"saveindex" : g_oDocumentUrls.getMaxIndex(),
"data" : sImageToDownLoad
......@@ -7514,7 +7510,7 @@ background-repeat: no-repeat;\
oAdditionalData["c"] = command;
oAdditionalData["id"] = this.documentId;
oAdditionalData["userid"] = this.documentUserId;
oAdditionalData["vkey"] = this.documentVKey;
oAdditionalData["jwt"] = this.CoAuthoringApi.get_jwt();
oAdditionalData["outputformat"] = filetype;
oAdditionalData["title"] = AscCommon.changeFileExtention(this.documentTitle, AscCommon.getExtentionByFormat(filetype));
oAdditionalData["savetype"] = AscCommon.c_oAscSaveTypes.CompleteAll;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment