181 lines
6.3 KiB
Diff
181 lines
6.3 KiB
Diff
From 39435fb1df8653303f6155927246408dcfe217a5 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Hofbauer <alex@derhofbauer.at>
|
|
Date: Wed, 28 Oct 2020 20:57:51 +0100
|
|
Subject: [PATCH] Patch for license
|
|
|
|
---
|
|
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(-)
|
|
|
|
diff --git a/Common/sources/commondefines.js b/Common/sources/commondefines.js
|
|
index 694a13a..89fbbec 100644
|
|
--- a/Common/sources/commondefines.js
|
|
+++ b/Common/sources/commondefines.js
|
|
@@ -975,8 +975,8 @@ const c_oAscUnlockRes = {
|
|
Empty: 2
|
|
};
|
|
|
|
-const buildVersion = '4.1.2';
|
|
-const buildNumber = 37;
|
|
+const buildVersion = '6.0.1';
|
|
+const buildNumber = 32;
|
|
|
|
exports.TaskQueueData = TaskQueueData;
|
|
exports.CMailMergeSendData = CMailMergeSendData;
|
|
diff --git a/Common/sources/license.js b/Common/sources/license.js
|
|
index 290d85d..b2b9163 100644
|
|
--- a/Common/sources/license.js
|
|
+++ b/Common/sources/license.js
|
|
@@ -32,53 +32,35 @@
|
|
|
|
'use strict';
|
|
|
|
-const config = require('config');
|
|
-const configL = config.get('license');
|
|
-const constants = require('./constants');
|
|
const logger = require('./logger');
|
|
-const editorDataStorage = require('./../../DocService/sources/' + config.get('services.CoAuthoring.server.editorDataStorage'));
|
|
+const constants = require('./constants');
|
|
|
|
-const buildDate = '6/29/2016';
|
|
-const oBuildDate = new Date(buildDate);
|
|
-const oPackageType = configL.get('packageType');
|
|
+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-28T15:51:00.000Z",
|
|
+ endDate: "2099-01-01T23:59:59.000Z"
|
|
+};
|
|
|
|
-const cfgRedisPrefix = config.get('services.CoAuthoring.redis.prefix');
|
|
-const redisKeyLicense = cfgRedisPrefix + constants.REDIS_KEY_LICENSE;
|
|
+function getLicense() {
|
|
+ logger.debug('Injecting fake license', LICENSE)
|
|
|
|
-let editorData = new editorDataStorage();
|
|
+ return { ...LICENSE };
|
|
+}
|
|
|
|
exports.readLicense = function*() {
|
|
- const c_LR = constants.LICENSE_RESULT;
|
|
- const res = {
|
|
- count: 1,
|
|
- type: c_LR.Error,
|
|
- light: false,
|
|
- packageType: oPackageType,
|
|
- mode: constants.LICENSE_MODE.None,
|
|
- branding: false,
|
|
- connections: constants.LICENSE_CONNECTIONS,
|
|
- customization: false,
|
|
- usersCount: 0,
|
|
- usersExpire: constants.LICENSE_EXPIRE_USERS_ONE_DAY,
|
|
- hasLicense: false,
|
|
- plugins: false,
|
|
- buildDate: oBuildDate,
|
|
- endDate: null
|
|
- };
|
|
-
|
|
- 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;
|
|
+ return getLicense();
|
|
};
|
|
-exports.packageType = oPackageType;
|
|
|
|
-function* _getFileState() {
|
|
- return yield editorData.getLicense(redisKeyLicense);
|
|
-}
|
|
+exports.getLicense = getLicense;
|
|
+exports.packageType = constants.PACKAGE_TYPE_I;
|
|
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');
|
|
diff --git a/Makefile b/Makefile
|
|
index 40bf93e..1df9c10 100644
|
|
--- 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
|
|
+all: $(SCHEMA) $(LICENSE) $(WELCOME) $(INFO) build-date
|
|
|
|
build-date: $(GRUNT_FILES)
|
|
sed "s|\(const buildVersion = \).*|\1'${PRODUCT_VERSION}';|" -i $(COMMON_DEFINES_JS)
|
|
--
|
|
2.29.1
|
|
|