@readystack/nuget-commercial-license-gate 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/license.js +22 -2
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -50,7 +50,7 @@ Tools: `check_text` and `check_file` (free) · `check_dir` (licence). The agent
50
50
 
51
51
  The folder sweep, reports and CI mode need one licence — one payment, no subscription. Set `READYSTACK_LICENSE=<key>` or run `--license <key>` once.
52
52
 
53
- [Get a licence](https://buy.polar.sh/polar_cl_0EoTgOC5ad7T6P8ypXA6zD3NRFoYxlQfCOf1J3JpwzG)
53
+ [Get a licence](https://getreadystack.com/api/buy/cl/polar_cl_0EoTgOC5ad7T6P8ypXA6zD3NRFoYxlQfCOf1J3JpwzG)
54
54
 
55
55
 
56
56
  <!-- nuget license -->
package/license.js CHANGED
@@ -3,7 +3,7 @@
3
3
  const https = require('https'), fs = require('fs'), path = require('path'), os = require('os');
4
4
  const ORG_ID = 'a5cdf664-d8e7-4f87-8895-056717aaba17';
5
5
  const BENEFIT_ID = 'c93c790d-c92d-4c4a-b8e7-8c915999a1cf'; // s142 — this product's Polar benefit (s140 law: ask with benefit_id, or one key opens every product)
6
- const BUY_URL = 'https://buy.polar.sh/polar_cl_0EoTgOC5ad7T6P8ypXA6zD3NRFoYxlQfCOf1J3JpwzG';
6
+ const BUY_URL = 'https://getreadystack.com/api/buy/cl/polar_cl_0EoTgOC5ad7T6P8ypXA6zD3NRFoYxlQfCOf1J3JpwzG';
7
7
  const SLUG = 'nuget-commercial-license-gate';
8
8
  const GRACE_MS = 30 * 24 * 3600 * 1000; // after a successful check, 30 days work offline
9
9
  const RECHECK_MS = 7 * 24 * 3600 * 1000; // re-ask Polar every 7 days (refunds / cancellations)
@@ -11,8 +11,28 @@ function storePath() { return path.join(process.env.READYSTACK_HOME || path.join
11
11
  function load() { try { return JSON.parse(fs.readFileSync(storePath(), 'utf8')); } catch (e) { return {}; } }
12
12
  function save(o) { try { fs.mkdirSync(path.dirname(storePath()), { recursive: true }); fs.writeFileSync(storePath(), JSON.stringify(o)); } catch (e) { /* read-only home: still works for this run */ } }
13
13
  const ALL_BENEFIT_ID = '22692551-5203-4467-b1a3-e33cdba6589d'; // s149 2026-09-17 — 팀 키(전 린터 한 키 · Polar benefit) · 상품 benefit 다음에 한 번 더 묻는다
14
+ // s170 2026-09-29 — ask OUR worker first (/api/lic): keys bought on Whop open here (a price-tier key binds to the first tool it opens · the team key opens every tool). Then the old Polar check.
14
15
  function validate(key) {
15
- return validate1(key, BENEFIT_ID).then(function (r) { return (r.ok || r.offline || !/^[0-9a-f-]{36}$/.test(ALL_BENEFIT_ID)) ? r : validate1(key, ALL_BENEFIT_ID); });
16
+ return validateHub(key).then(function (h) {
17
+ if (h.ok) return h;
18
+ return validate1(key, BENEFIT_ID).then(function (r) { return (r.ok || r.offline || !/^[0-9a-f-]{36}$/.test(ALL_BENEFIT_ID)) ? r : validate1(key, ALL_BENEFIT_ID); })
19
+ .then(function (r) { return r.ok ? r : { ok: false, offline: !!(h.offline || r.offline) }; });
20
+ });
21
+ }
22
+ function validateHub(key) {
23
+ return new Promise(function (resolve) {
24
+ const req = https.request({ hostname: 'getreadystack.com', path: '/api/lic?key=' + encodeURIComponent(key) + '&slug=' + encodeURIComponent(SLUG),
25
+ method: 'GET', timeout: 8000, headers: { 'accept': 'application/json', 'user-agent': 'readystack-cli/' + SLUG } }, function (res) {
26
+ let buf = ''; res.on('data', function (d) { buf += d; });
27
+ res.on('end', function () {
28
+ if (res.statusCode !== 200) return resolve({ ok: false, offline: res.statusCode >= 500 });
29
+ try { const j = JSON.parse(buf); resolve({ ok: !!(j && j.ok), offline: false }); } catch (e) { resolve({ ok: false, offline: false }); }
30
+ });
31
+ });
32
+ req.on('timeout', function () { req.destroy(); resolve({ ok: false, offline: true }); });
33
+ req.on('error', function () { resolve({ ok: false, offline: true }); });
34
+ req.end();
35
+ });
16
36
  }
17
37
  function validate1(key, ben) {
18
38
  return new Promise(function (resolve) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readystack/nuget-commercial-license-gate",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Flags AutoMapper 15+, MediatR 13+, FluentAssertions 8+, MassTransit 9+ and other NuGet versions past their licence line, with the pin",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "publishConfig": {
@@ -18,7 +18,7 @@
18
18
  "dotnet"
19
19
  ],
20
20
  "homepage": "https://getreadystack.com",
21
- "funding": "https://buy.polar.sh/polar_cl_0EoTgOC5ad7T6P8ypXA6zD3NRFoYxlQfCOf1J3JpwzG",
21
+ "funding": "https://getreadystack.com/api/buy/cl/polar_cl_0EoTgOC5ad7T6P8ypXA6zD3NRFoYxlQfCOf1J3JpwzG",
22
22
  "bin": {
23
23
  "nuget-commercial-license-gate": "cli.js"
24
24
  },