2020-10-18 12:36:58 +00:00
From bfd54caaf3a89d1b2aea5c38ed42c78c113ac7c1 Mon Sep 17 00:00:00 2001
2020-04-19 11:07:33 +00:00
From: Alexander Hofbauer <alex@derhofbauer.at>
2020-10-18 12:36:58 +00:00
Date: Sun, 18 Oct 2020 15:17:44 +0200
Subject: [PATCH] Patch for license
2020-04-19 11:07:33 +00:00
---
2020-10-18 12:36:58 +00:00
Common/sources/commondefines.js | 4 +-
Common/sources/license.js | 66 +++++++++---------------
DocService/sources/DocsCoServer.js | 5 +-
DocService/sources/server.js | 1 -
FileConverter/sources/convertermaster.js | 1 -
Makefile | 2 +-
6 files changed, 30 insertions(+), 49 deletions(-)
2020-04-19 11:07:33 +00:00
2020-04-17 21:03:53 +00:00
diff --git a/Common/sources/commondefines.js b/Common/sources/commondefines.js
2020-10-18 12:36:58 +00:00
index 694a13a..6f8a07b 100644
2020-04-17 21:03:53 +00:00
--- a/Common/sources/commondefines.js
+++ b/Common/sources/commondefines.js
2020-10-18 12:36:58 +00:00
@@ -975,8 +975,8 @@ const c_oAscUnlockRes = {
2020-08-03 09:52:17 +00:00
Empty: 2
2020-04-17 21:03:53 +00:00
};
-const buildVersion = '4.1.2';
-const buildNumber = 37;
2020-10-18 12:36:58 +00:00
+const buildVersion = '6.0.0';
+const buildNumber = 105;
2020-04-17 21:03:53 +00:00
exports.TaskQueueData = TaskQueueData;
exports.CMailMergeSendData = CMailMergeSendData;
diff --git a/Common/sources/license.js b/Common/sources/license.js
2020-10-18 12:36:58 +00:00
index 290d85d..655df27 100644
2020-04-17 21:03:53 +00:00
--- a/Common/sources/license.js
+++ b/Common/sources/license.js
2020-10-18 12:36:58 +00:00
@@ -32,53 +32,35 @@
2020-04-17 21:03:53 +00:00
'use strict';
-const config = require('config');
-const configL = config.get('license');
2020-10-18 12:36:58 +00:00
-const constants = require('./constants');
const logger = require('./logger');
2020-04-17 21:03:53 +00:00
-const editorDataStorage = require('./../../DocService/sources/' + config.get('services.CoAuthoring.server.editorDataStorage'));
2020-10-18 12:36:58 +00:00
+const constants = require('./constants');
2020-04-19 11:07:33 +00:00
-const buildDate = '6/29/2016';
-const oBuildDate = new Date(buildDate);
2020-04-17 21:03:53 +00:00
-const oPackageType = configL.get('packageType');
2020-10-18 12:36:58 +00:00
+const LICENSE = {
+ count: 9999,
+ type: constants.LICENSE_RESULT.Success,
+ light: false,
+ packageType: constants.PACKAGE_TYPE_I,
+ mode: constants.LICENSE_MODE.None,
+ branding: false,
+ connections: 9999,
+ customization: false,
+ usersCount: 9999,
+ usersExpire: new Date("2099-01-01T23:59:59.000Z").getTime() / 1000,
+ hasLicense: true,
+ plugins: true,
+ buildDate: "2020-10-15T14:07:00.000Z",
+ endDate: "2099-01-01T23:59:59.000Z"
+};
2020-04-17 21:03:53 +00:00
-const cfgRedisPrefix = config.get('services.CoAuthoring.redis.prefix');
-const redisKeyLicense = cfgRedisPrefix + constants.REDIS_KEY_LICENSE;
2020-10-18 12:36:58 +00:00
+function getLicense() {
+ logger.debug('Injecting fake license', LICENSE)
2020-04-17 21:03:53 +00:00
-let editorData = new editorDataStorage();
2020-10-18 12:36:58 +00:00
+ return { ...LICENSE };
+}
2020-04-17 21:03:53 +00:00
exports.readLicense = function*() {
- const c_LR = constants.LICENSE_RESULT;
- const res = {
2020-10-18 12:36:58 +00:00
- count: 1,
2020-04-17 21:03:53 +00:00
- type: c_LR.Error,
2020-10-18 12:36:58 +00:00
- light: false,
2020-04-17 21:03:53 +00:00
- packageType: oPackageType,
2020-10-18 12:36:58 +00:00
- mode: constants.LICENSE_MODE.None,
- branding: false,
2020-04-17 21:03:53 +00:00
- connections: constants.LICENSE_CONNECTIONS,
2020-10-18 12:36:58 +00:00
- customization: false,
2020-04-17 21:03:53 +00:00
- usersCount: 0,
- usersExpire: constants.LICENSE_EXPIRE_USERS_ONE_DAY,
- hasLicense: false,
2020-04-19 11:07:33 +00:00
- plugins: false,
- buildDate: oBuildDate,
- endDate: null
2020-10-18 12:36:58 +00:00
- };
2020-04-17 21:03:53 +00:00
-
- if (yield* _getFileState()) {
- res.type = c_LR.ExpiredTrial;
- }
-
- if (res.type === c_LR.Expired || res.type === c_LR.ExpiredTrial) {
- res.count = 1;
- logger.error('License: License Expired!!!');
- }
-
- return res;
2020-10-18 12:36:58 +00:00
+ return getLicense();
2020-04-17 21:03:53 +00:00
};
-exports.packageType = oPackageType;
2020-10-18 12:36:58 +00:00
2020-04-17 21:03:53 +00:00
-function* _getFileState() {
- return yield editorData.getLicense(redisKeyLicense);
-}
2020-10-18 12:36:58 +00:00
+exports.getLicense = getLicense;
2020-04-17 21:03:53 +00:00
+exports.packageType = constants.PACKAGE_TYPE_I;
2020-10-18 12:36:58 +00:00
diff --git a/DocService/sources/DocsCoServer.js b/DocService/sources/DocsCoServer.js
index be22d80..fb19abe 100644
--- a/DocService/sources/DocsCoServer.js
+++ b/DocService/sources/DocsCoServer.js
@@ -103,6 +103,7 @@ const pubsubService = require('./pubsubRabbitMQ');
const queueService = require('./../../Common/sources/taskqueueRabbitMQ');
const rabbitMQCore = require('./../../Common/sources/rabbitMQCore');
const activeMQCore = require('./../../Common/sources/activeMQCore');
+const license = require('./../../Common/sources/license');
const editorDataStorage = require('./' + configCommon.get('services.CoAuthoring.server.editorDataStorage'));
let cfgEditor = JSON.parse(JSON.stringify(config.get('editor')));
@@ -162,7 +163,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, customization: false, plugins: false};
+let licenseInfo = license.getLicense();
let shutdownFlag = false;
const MIN_SAVE_EXPIRATION = 60000;
@@ -3013,7 +3014,7 @@ exports.install = function(server, callbackFunction) {
});
};
exports.setLicenseInfo = function(data) {
- licenseInfo = data;
+ logger.debug('Not updating license info', data)
};
exports.getLicenseInfo = function() {
return licenseInfo;
diff --git a/DocService/sources/server.js b/DocService/sources/server.js
index db085bb..7d76d34 100644
--- a/DocService/sources/server.js
+++ b/DocService/sources/server.js
@@ -129,7 +129,6 @@ try {
} catch (e) {
logger.warn('Failed to subscribe to plugin folder updates. When changing the list of plugins, you must restart the server. https://nodejs.org/docs/latest/api/fs.html#fs_availability');
}
-fs.watchFile(configCommon.get('license').get('license_file'), updateLicense);
setInterval(updateLicense, 86400000);
// Если захочется использовать 'development' и 'production',
diff --git a/FileConverter/sources/convertermaster.js b/FileConverter/sources/convertermaster.js
index c246bb8..9fe3d41 100644
--- a/FileConverter/sources/convertermaster.js
+++ b/FileConverter/sources/convertermaster.js
@@ -85,7 +85,6 @@ if (cluster.isMaster) {
updateLicense();
- fs.watchFile(configCommon.get('license').get('license_file'), updateLicense);
setInterval(updateLicense, 86400000);
} else {
const converter = require('./converter');
2020-04-17 21:03:53 +00:00
diff --git a/Makefile b/Makefile
2020-10-18 12:36:58 +00:00
index 40bf93e..1df9c10 100644
2020-04-17 21:03:53 +00:00
--- a/Makefile
+++ b/Makefile
@@ -83,7 +83,7 @@ DEBUG = $(BRANDING_DIR)/debug.js
.PHONY: all clean install uninstall build-date
.NOTPARALLEL:
-all: $(SPELLCHECKER_DICTIONARIES) $(TOOLS) $(SCHEMA) $(CORE_FONTS) $(LICENSE) $(WELCOME) $(INFO) build-date
2020-10-18 12:36:58 +00:00
+all: $(SCHEMA) $(LICENSE) $(WELCOME) $(INFO) build-date
2020-04-17 21:03:53 +00:00
build-date: $(GRUNT_FILES)
sed "s|\(const buildVersion = \).*|\1'${PRODUCT_VERSION}';|" -i $(COMMON_DEFINES_JS)
2020-04-19 11:07:33 +00:00
--
2020-08-03 09:52:17 +00:00
2.28.0
2020-04-19 11:07:33 +00:00