leedab 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/license.js +3 -1
- package/package.json +1 -1
package/dist/license.js
CHANGED
|
@@ -4,6 +4,7 @@ import { STATE_DIR } from "./paths.js";
|
|
|
4
4
|
const LICENSE_PATH = resolve(STATE_DIR, "license.json");
|
|
5
5
|
const VERIFY_URL = "https://api.leedab.com/api/v1/licensing/verify";
|
|
6
6
|
const REVALIDATE_DAYS = 7;
|
|
7
|
+
const REVALIDATE_DAYS_TRIAL = 1;
|
|
7
8
|
/**
|
|
8
9
|
* Validate a license key against the API.
|
|
9
10
|
*/
|
|
@@ -63,7 +64,8 @@ function isStale(license) {
|
|
|
63
64
|
const validated = new Date(license.validatedAt).getTime();
|
|
64
65
|
const now = Date.now();
|
|
65
66
|
const daysSince = (now - validated) / (1000 * 60 * 60 * 24);
|
|
66
|
-
|
|
67
|
+
const maxDays = license.status === "trialing" ? REVALIDATE_DAYS_TRIAL : REVALIDATE_DAYS;
|
|
68
|
+
return daysSince > maxDays;
|
|
67
69
|
}
|
|
68
70
|
/**
|
|
69
71
|
* Ensure we have a valid license. Returns the license if valid.
|