From 556aacdf28a4e9017591db41453cde46ad0b81ee Mon Sep 17 00:00:00 2001 From: Alexander Trofimov Date: Wed, 14 Sep 2016 10:59:00 +0300 Subject: [PATCH 1/2] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index d004afe5eb..0843fac75f 100644 --- a/Readme.md +++ b/Readme.md @@ -1,5 +1,5 @@ -[![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.ru.html) ![Release](https://img.shields.io/badge/Release-v4.1.1-blue.svg?style=flat) +[![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](http://www.gnu.org/licenses/agpl-3.0.ru.html) ![Release](https://img.shields.io/badge/Release-v4.1.2-blue.svg?style=flat) ## Server From 62c02942856e6f20249811f0cc3ea6a9a179d434 Mon Sep 17 00:00:00 2001 From: "Alexander.Trofimov" Date: Mon, 19 Sep 2016 16:44:08 +0300 Subject: [PATCH 2/2] add trial (developer mode) --- Common/sources/license.js | 8 +++++--- DocService/sources/DocsCoServer.js | 9 ++++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Common/sources/license.js b/Common/sources/license.js index e195f9f143..5869587da4 100644 --- a/Common/sources/license.js +++ b/Common/sources/license.js @@ -53,7 +53,7 @@ const redisKeyLicense = cfgRedisPrefix + ((constants.PACKAGE_TYPE_OS === oPackag exports.readLicense = function*() { const c_LR = constants.LICENSE_RESULT; const resMax = {count: 999999, type: c_LR.Success}; - var res = {count: 1, type: c_LR.Error, light: false, packageType: oPackageType}; + var res = {count: 1, type: c_LR.Error, light: false, packageType: oPackageType, trial: false}; var checkFile = false; try { var oFile = fs.readFileSync(configL.get('license_file')).toString(); @@ -67,8 +67,8 @@ 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']); - const isTrial = (true === oLicense['trial'] || 'true' === oLicense['trial']); - const checkDate = isTrial ? new Date() : oBuildDate; // Someone who likes to put json string instead of bool + const isTrial = res.trial = (true === oLicense['trial'] || 'true' === oLicense['trial']); + const checkDate = (isTrial && constants.PACKAGE_TYPE_OS === oPackageType) ? new Date() : oBuildDate; // Someone who likes to put json string instead of bool if (endDate >= checkDate && 2 <= oLicense['version']) { res.count = Math.min(Math.max(res.count, oLicense['process'] >> 0), resMax.count); res.type = c_LR.Success; @@ -92,6 +92,8 @@ exports.readLicense = function*() { } else { res.type = (yield* _getFileState()) ? c_LR.Success : c_LR.ExpiredTrial; if (res.type === c_LR.Success) { + res.trial = true; + res.count = 2; return res; } } diff --git a/DocService/sources/DocsCoServer.js b/DocService/sources/DocsCoServer.js index 66d4ebfe5b..65c3737129 100644 --- a/DocService/sources/DocsCoServer.js +++ b/DocService/sources/DocsCoServer.js @@ -1922,7 +1922,14 @@ exports.install = function(server, callbackFunction) { } } } - sendData(conn, {type: 'license', license: {type: licenseType, light: licenseInfo.light}}); + sendData(conn, { + type: 'license', + license: { + type: licenseType, + light: licenseInfo.light, + trial: constants.PACKAGE_TYPE_OS === licenseInfo.packageType ? false : licenseInfo.trial + } + }); } catch (err) { logger.error('_checkLicense error:\r\n%s', err.stack); }