Commit fa5a3462 authored by Sergey Luzyanin's avatar Sergey Luzyanin Committed by GitHub

Merge pull request #49 from ONLYOFFICE/release/v4.1.0

Release/v4.1.0
parents 326d50b3 9b563181
...@@ -882,6 +882,7 @@ ...@@ -882,6 +882,7 @@
} }
} }
this.handlers.trigger("asc_onSelectionChanged", info); this.handlers.trigger("asc_onSelectionChanged", info);
this.handlers.trigger("asc_onSelectionEnd");
}; };
......
...@@ -3689,7 +3689,7 @@ CShape.prototype.hitInTextRectWord = function(x, y) ...@@ -3689,7 +3689,7 @@ CShape.prototype.hitInTextRectWord = function(x, y)
{ {
var content = this.getDocContent && this.getDocContent(); var content = this.getDocContent && this.getDocContent();
if (content) if (content && this.invertTransform)
{ {
var t_x, t_y; var t_x, t_y;
t_x = this.invertTransform.TransformPointX(x, y); t_x = this.invertTransform.TransformPointX(x, y);
...@@ -4806,7 +4806,7 @@ CShape.prototype.hitToAdjustment = function (x, y) { ...@@ -4806,7 +4806,7 @@ CShape.prototype.hitToAdjustment = function (x, y) {
return ret; return ret;
} }
} }
if(this.recalcInfo.warpGeometry) if(this.recalcInfo.warpGeometry && this.invertTransformTextWordArt)
{ {
invert_transform = this.invertTransformTextWordArt; invert_transform = this.invertTransformTextWordArt;
t_x = invert_transform.TransformPointX(x, y); t_x = invert_transform.TransformPointX(x, y);
......
...@@ -37,8 +37,8 @@ AscCommon.baseEditorsApi.prototype._onEndPermissions = function() ...@@ -37,8 +37,8 @@ AscCommon.baseEditorsApi.prototype._onEndPermissions = function()
if (this.isOnFirstConnectEnd && this.isOnLoadLicense) if (this.isOnFirstConnectEnd && this.isOnLoadLicense)
{ {
var oResult = new AscCommon.asc_CAscEditorPermissions(); var oResult = new AscCommon.asc_CAscEditorPermissions();
oResult.asc_setCanLicense(true); oResult.setCanLicense(true);
oResult.asc_setCanBranding(true); oResult.setCanBranding(true);
this.sendEvent('asc_onGetEditorPermissions', oResult); this.sendEvent('asc_onGetEditorPermissions', oResult);
} }
}; };
\ No newline at end of file
...@@ -32,96 +32,15 @@ ...@@ -32,96 +32,15 @@
"use strict"; "use strict";
var g_oLicenseResult = {
Error : 1,
Expired : 2,
Success : 3,
UnknownUser : 4,
Connections : 5
};
var g_sLicenseDefaultUrl = "/license";
var g_sPublicRSAKey = '-----BEGIN CERTIFICATE-----MIIBvTCCASYCCQD55fNzc0WF7TANBgkqhkiG9w0BAQUFADAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwHhcNMTAwNTI4MDIwODUxWhcNMjAwNTI1MDIwODUxWjAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANGEYXtfgDRlWUSDn3haY4NVVQiKI9CzThoua9+DxJuiseyzmBBe7Roh1RPqdvmtOHmEPbJ+kXZYhbozzPRbFGHCJyBfCLzQfVos9/qUQ88u83b0SFA2MGmQWQAlRtLy66EkR4rDRwTj2DzR4EEXgEKpIvo8VBs/3+sHLF3ESgAhAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAEZ6mXFFq3AzfaqWHmCy1ARjlauYAa8ZmUFnLm0emg9dkVBJ63aEqARhtok6bDQDzSJxiLpCEF6G4b/Nv/M/MLyhP+OoOTmETMegAVQMq71choVJyOFE5BtQa6M/lCHEOya5QUfoRF2HF9EjRF44K3OK+u3ivTSj3zwjtpudY5Xo=-----END CERTIFICATE-----';
function CheckLicense(licenseUrl, customerId, userId, userFirstName, userLastName, callback) {
callback(true, g_oLicenseResult.Success);
return;
licenseUrl = licenseUrl ? licenseUrl : g_sLicenseDefaultUrl;
g_fGetJSZipUtils().getBinaryContent(licenseUrl, function(err, data) {
if (err) {
callback(true, g_oLicenseResult.Error);
return;
}
try {
var tmpSize;
var maxSize = 0x4000;
var sTextData = '';
for (var i = 0; i < data.byteLength; i += maxSize) {
tmpSize = data.byteLength - i;
sTextData += String.fromCharCode.apply(null, new Uint8Array(data, i, (tmpSize < maxSize) ? tmpSize : maxSize));
}
var oLicense = JSON.parse(sTextData);
var hSig = oLicense['signature'];
delete oLicense['signature'];
var x509 = new X509();
x509.readCertPEM(g_sPublicRSAKey);
var isValid = x509.subjectPublicKeyRSA.verifyString(JSON.stringify(oLicense), hSig);
callback(false, isValid ? CheckUserInLicense(customerId, userId, userFirstName, userLastName, oLicense) : g_oLicenseResult.Error);
} catch (e) {
callback(true, g_oLicenseResult.Error);
}
});
}
/**
*
* @param customerId
* @param userId
* @param userFirstName
* @param userLastName
* @param oLicense
* @returns {boolean}
*/
function CheckUserInLicense(customerId, userId, userFirstName, userLastName, oLicense) {
var res = g_oLicenseResult.Error;
var superuser = 'onlyoffice';
try {
if (oLicense['users']) {
var userName = (null == userFirstName ? '' : userFirstName) + (null == userLastName ? '' : userLastName);
var sUserHash = CryptoJS.SHA256(userId + userName).toString(CryptoJS.enc.Hex).toLowerCase();
var checkUserHash = false;
if (customerId === oLicense['customer_id'] || oLicense['customer_id'] === (sUserHash = superuser)) {
// users для новой версии - массив
checkUserHash = (-1 !== oLicense['users'].indexOf(sUserHash));
res = g_oLicenseResult.UnknownUser;
}
if (checkUserHash) {
var endDate = new Date(oLicense['end_date']);
res = (endDate >= new Date()) ? g_oLicenseResult.Success : g_oLicenseResult.Expired;
}
}
} catch (e) {
res = g_oLicenseResult.Error;
}
return res;
}
AscCommon.baseEditorsApi.prototype._onCheckLicenseEnd = function(err, res) {
this.licenseResult = {err: err, res: res};
this._onEndPermissions();
};
AscCommon.baseEditorsApi.prototype._onEndPermissions = function () { AscCommon.baseEditorsApi.prototype._onEndPermissions = function () {
if (this.isOnFirstConnectEnd && this.isOnLoadLicense) { if (this.isOnFirstConnectEnd && this.isOnLoadLicense) {
var oResult = new AscCommon.asc_CAscEditorPermissions(); var oResult = new AscCommon.asc_CAscEditorPermissions();
if (null !== this.licenseResult) { if (null !== this.licenseResult) {
var type = this.licenseResult['type']; var type = this.licenseResult['type'];
oResult.asc_setCanLicense(g_oLicenseResult.Success === type); oResult.setLicenseType(type);
oResult.asc_setCanBranding(g_oLicenseResult.Error !== type); // Для тех, у кого есть лицензия, branding доступен oResult.setCanLicense(Asc.c_oLicenseResult.Success === type);
oResult.asc_setCanBranding(g_oLicenseResult.Error !== type); // Для тех, у кого есть лицензия, branding доступен oResult.setCanBranding(Asc.c_oLicenseResult.Error !== type); // Для тех, у кого есть лицензия, branding доступен
oResult.asc_setIsLight(this.licenseResult['light']); oResult.setIsLight(this.licenseResult['light']);
} }
this.sendEvent('asc_onGetEditorPermissions', oResult); this.sendEvent('asc_onGetEditorPermissions', oResult);
} }
......
This diff is collapsed.
...@@ -854,7 +854,7 @@ CShape.prototype.checkPosTransformText = function() ...@@ -854,7 +854,7 @@ CShape.prototype.checkPosTransformText = function()
}; };
CShape.prototype.getNearestPos = function(x, y, pageIndex) CShape.prototype.getNearestPos = function(x, y, pageIndex)
{ {
if(isRealObject(this.textBoxContent)) if(isRealObject(this.textBoxContent) && this.invertTransformText)
{ {
var t_x = this.invertTransformText.TransformPointX(x, y); var t_x = this.invertTransformText.TransformPointX(x, y);
var t_y = this.invertTransformText.TransformPointY(x, y); var t_y = this.invertTransformText.TransformPointY(x, y);
...@@ -883,7 +883,7 @@ CShape.prototype.cursorGetPos = function() ...@@ -883,7 +883,7 @@ CShape.prototype.cursorGetPos = function()
CShape.prototype.cursorMoveAt = function( X, Y, AddToSelect ) CShape.prototype.cursorMoveAt = function( X, Y, AddToSelect )
{ {
var content = this.getDocContent(); var content = this.getDocContent();
if(isRealObject(content)) if(isRealObject(content) && this.invertTransformText)
{ {
var t_x = this.invertTransformText.TransformPointX(X, Y); var t_x = this.invertTransformText.TransformPointX(X, Y);
var t_y = this.invertTransformText.TransformPointY(X, Y); var t_y = this.invertTransformText.TransformPointY(X, Y);
......
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