mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[feature] License expiration notification changed
This commit is contained in:
@ -37,13 +37,13 @@
|
||||
"notification": {
|
||||
"enable": false,
|
||||
"rules": {
|
||||
"licenseExpired": {
|
||||
"licenseExpirationWarning": {
|
||||
"transportType": [
|
||||
"email"
|
||||
],
|
||||
"template": {
|
||||
"title": "License",
|
||||
"body": "%s license expires in %s!!!"
|
||||
"title": "License expiration",
|
||||
"body": "%s license %s on %s!!!"
|
||||
},
|
||||
"policies": {
|
||||
"repeatInterval": "1d"
|
||||
@ -426,7 +426,7 @@
|
||||
"license_file": "",
|
||||
"warning_limit_percents": 70,
|
||||
"packageType": 0,
|
||||
"startNotifyFrom": "30d"
|
||||
"warning_license_expiration": "30d"
|
||||
},
|
||||
"FileConverter": {
|
||||
"converter": {
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
|
||||
}
|
||||
5
Common/npm-shrinkwrap.json
generated
5
Common/npm-shrinkwrap.json
generated
@ -1986,11 +1986,6 @@
|
||||
"requires-port": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"uuid": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA=="
|
||||
},
|
||||
"verror": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
|
||||
|
||||
@ -18,14 +18,13 @@
|
||||
"log4js": "6.4.1",
|
||||
"mime": "2.3.1",
|
||||
"ms": "2.1.1",
|
||||
"nodemailer": "6.9.13",
|
||||
"node-cache": "4.2.1",
|
||||
"node-statsd": "0.1.1",
|
||||
"nodemailer": "6.9.13",
|
||||
"request": "2.88.0",
|
||||
"request-filtering-agent": "1.0.5",
|
||||
"rhea": "1.0.24",
|
||||
"uri-js": "4.2.2",
|
||||
"uuid": "9.0.1",
|
||||
"win-ca": "3.5.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ exports.readLicense = async function () {
|
||||
plugins: false,
|
||||
buildDate: oBuildDate,
|
||||
startDate: startDate,
|
||||
endDate: '2024-06-29T04:13:00.000Z',
|
||||
endDate: null,
|
||||
customerId: "",
|
||||
alias: ""
|
||||
}, null];
|
||||
|
||||
@ -41,11 +41,11 @@ const cfgMailServer = config.get('email.smtpServerConfiguration');
|
||||
const cfgMailMessageDefaults = config.get('email.contactDefaults');
|
||||
const cfgNotificationEnable = config.get('notification.enable');
|
||||
|
||||
const defaultRepeatInterval = 1000 * 60 * 60 * 24;
|
||||
const infiniteRepeatInterval = Infinity;
|
||||
const repeatIntervalsExpired = new Map();
|
||||
const notificationTypes = {
|
||||
LICENSE_EXPIRED: "licenseExpired",
|
||||
LICENSE_LIMIT: "licenseLimit"
|
||||
LICENSE_EXPIRATION_WARNING: 'licenseExpirationWarning',
|
||||
LICENSE_LIMIT: 'licenseLimit'
|
||||
};
|
||||
|
||||
class TransportInterface {
|
||||
@ -118,7 +118,7 @@ async function notify(ctx, notificationType, messageParams) {
|
||||
|
||||
function checkRulePolicies(ctx, notificationType, tenRule) {
|
||||
const { repeatInterval } = tenRule.policies;
|
||||
const intervalMilliseconds = ms(repeatInterval) ?? defaultRepeatInterval;
|
||||
const intervalMilliseconds = repeatInterval ? ms(repeatInterval) : infiniteRepeatInterval;
|
||||
const cacheKey = `${notificationType}_${ctx.tenant}`;
|
||||
const expired = repeatIntervalsExpired.get(cacheKey);
|
||||
|
||||
@ -127,7 +127,7 @@ function checkRulePolicies(ctx, notificationType, tenRule) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ctx.logger.debug(`Notification service: skip rule "%s" due to repeat interval %s`, notificationType, repeatInterval);
|
||||
ctx.logger.debug(`Notification service: skip rule "%s" due to repeat interval = %s`, notificationType, repeatInterval ?? "infinite");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user