@oxbit/cli 0.3.3 → 0.4.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxbit/cli",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "description": "The oxbit command: runs the Oxbit runtime and opens the editor in a browser",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10955,6 +10955,9 @@ async function createRuntime(options2) {
10955
10955
  };
10956
10956
  await persist();
10957
10957
  const pairingCode = options2.pairingCode ?? randomBytes(6).toString("hex");
10958
+ const pairingAttemptsPerMinute = options2.pairingAttemptsPerMinute ?? 10;
10959
+ if (!Number.isInteger(pairingAttemptsPerMinute) || pairingAttemptsPerMinute < 1)
10960
+ throw new Error("Pairing attempts per minute must be a positive whole number");
10958
10961
  let port2 = options2.port ?? 9277;
10959
10962
  const allowedOrigins = () => /* @__PURE__ */ new Set([
10960
10963
  "tauri://localhost",
@@ -11186,7 +11189,7 @@ async function createRuntime(options2) {
11186
11189
  entry.count = 0;
11187
11190
  entry.reset = Date.now() + 6e4;
11188
11191
  }
11189
- if (++entry.count > 10) {
11192
+ if (++entry.count > pairingAttemptsPerMinute) {
11190
11193
  httpJson(response, 429, { error: "Pairing rate limit reached" });
11191
11194
  return;
11192
11195
  }
@@ -12299,6 +12302,7 @@ async function serve(invocation, target, dataDir, env) {
12299
12302
  host,
12300
12303
  dataDir,
12301
12304
  pairingCode: setting("PAIRING_CODE", env),
12305
+ pairingAttemptsPerMinute: setting("PAIRING_ATTEMPTS_PER_MINUTE", env) === void 0 ? void 0 : Number(setting("PAIRING_ATTEMPTS_PER_MINUTE", env)),
12302
12306
  origins: setting("ORIGINS", env)?.split(",").filter(Boolean),
12303
12307
  webRoot: setting("WEB_ROOT", env)
12304
12308
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxbit/runtime",
3
- "version": "0.3.3",
3
+ "version": "0.4.0",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }