@solongate/proxy 0.58.0 → 0.59.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.
@@ -6531,7 +6531,7 @@ var init_src = __esm({
6531
6531
 
6532
6532
  // hooks/guard.mjs
6533
6533
  import { readFileSync, existsSync, statSync, writeFileSync, mkdirSync, chmodSync, renameSync, appendFileSync } from "node:fs";
6534
- import { resolve, join, dirname } from "node:path";
6534
+ import { resolve, join, dirname, isAbsolute } from "node:path";
6535
6535
  import { homedir } from "node:os";
6536
6536
  import { gunzipSync } from "node:zlib";
6537
6537
  import { createHash } from "node:crypto";
@@ -6540,12 +6540,31 @@ function localLogsOnly(security) {
6540
6540
  const l = security && security.localLogs;
6541
6541
  return !!(l && l.enabled && typeof l.path === "string" && l.path.trim());
6542
6542
  }
6543
+ function resolveLocalLogDir(rawPath) {
6544
+ const dir = String(rawPath || "").trim().replace(/[\\/]+$/, "");
6545
+ if (!dir)
6546
+ return null;
6547
+ if (isAbsolute(dir))
6548
+ return dir;
6549
+ const fallback = resolve(homedir(), ".solongate", "local-logs");
6550
+ try {
6551
+ mkdirSync(resolve(homedir(), ".solongate"), { recursive: true });
6552
+ writeFileSync(
6553
+ resolve(homedir(), ".solongate", ".local-logs-invalid-path"),
6554
+ JSON.stringify({ configured: dir, fallback, ts: Date.now() })
6555
+ );
6556
+ } catch {
6557
+ }
6558
+ return fallback;
6559
+ }
6543
6560
  function writeLocalLog(security, entry) {
6544
6561
  try {
6545
6562
  const l = security && security.localLogs;
6546
6563
  if (!l || !l.enabled || typeof l.path !== "string" || !l.path.trim())
6547
6564
  return;
6548
- const dir = l.path.trim().replace(/[\\/]+$/, "");
6565
+ const dir = resolveLocalLogDir(l.path);
6566
+ if (!dir)
6567
+ return;
6549
6568
  try {
6550
6569
  mkdirSync(dir, { recursive: true });
6551
6570
  } catch {