mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-04-24 16:00:53 +08:00
fix: Fixes to license validation.
This commit is contained in:
parent
542892e4dd
commit
111fc20636
packages
@ -27,7 +27,7 @@ let license;
|
||||
async function validateLicense() {
|
||||
if (license) {
|
||||
// Check cached license every 24 hours
|
||||
if (license?.timestamp.valueOf?.() > Date.now() - 1000 * 60 * 60 * 24) {
|
||||
if (license?.timestamp?.valueOf?.() > Date.now() - 1000 * 60 * 60 * 24) {
|
||||
return license;
|
||||
}
|
||||
}
|
||||
|
@ -22,12 +22,18 @@ async function keygenValidateLicense({ config }) {
|
||||
const licenseKey = process.env.LOWDEFY_LICENSE_KEY;
|
||||
let entitlements = [];
|
||||
|
||||
if (!config) {
|
||||
throw new Error('License server config is not defined.');
|
||||
}
|
||||
|
||||
// TODO: Return this or undefined/null?
|
||||
if (!licenseKey) {
|
||||
return {
|
||||
id: 'NO_LICENSE',
|
||||
code: 'NO_LICENSE',
|
||||
entitlements,
|
||||
metadata: {},
|
||||
timestamp: new Date(),
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user