@solongate/proxy 0.81.54 → 0.81.55

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/index.js CHANGED
@@ -10211,22 +10211,29 @@ function SettingsPanel({
10211
10211
  const enabled = (local?.enabled ?? false) && v.length > 0;
10212
10212
  run12(v ? `path saved${enabled ? "" : " (press enter on enabled to turn on)"}` : "path cleared (local logs off)", () => api.settings.setLocalLogs({ enabled, path: v }), localQ.reload);
10213
10213
  } else if (which === "wh-url") {
10214
- if (!v) return;
10215
- run12("webhook added", () => api.settings.createWebhook({ url: v, events: "denials" }), whQ.reload);
10214
+ const url = v.replace(/^["'<]+|["'>]+$/g, "").trim();
10215
+ if (!url) return;
10216
+ if (!/^https?:\/\/\S+$/i.test(url)) {
10217
+ setMsg({ text: "\u2717 webhook url must start with http:// or https://", level: "bad" });
10218
+ return;
10219
+ }
10220
+ run12("webhook added", () => api.settings.createWebhook({ url, events: "denials" }), whQ.reload);
10216
10221
  } else if (which === "alert-email") {
10217
10222
  if (!v) return;
10218
- if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v)) {
10223
+ const email = v.replace(/^mailto:/i, "").replace(/^["'<]+|["'>]+$/g, "").replace(/[.,;:]+$/, "").replace(/\s+/g, "").trim();
10224
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
10219
10225
  setMsg({ text: "\u2717 that does not look like an e-mail address", level: "bad" });
10220
10226
  return;
10221
10227
  }
10222
- run12("email alert added", () => api.settings.createAlert({ ...ALERT_BASE, emails: [v] }), alertQ.reload);
10228
+ run12("email alert added", () => api.settings.createAlert({ ...ALERT_BASE, emails: [email] }), alertQ.reload);
10223
10229
  } else if (which === "alert-tg") {
10224
10230
  if (!v) return;
10225
- if (!/^-?\d{5,}$/.test(v)) {
10231
+ const tg = v.replace(/^@/, "").replace(/^(chat[\s_-]*)?id[:=\s]*/i, "").replace(/\s+/g, "").trim();
10232
+ if (!/^-?\d{5,}$/.test(tg)) {
10226
10233
  setMsg({ text: "\u2717 a telegram chat id is a number \u2014 get yours from @userinfobot", level: "bad" });
10227
10234
  return;
10228
10235
  }
10229
- run12("telegram alert added", () => api.settings.createAlert({ ...ALERT_BASE, telegram: [v] }), alertQ.reload);
10236
+ run12("telegram alert added", () => api.settings.createAlert({ ...ALERT_BASE, telegram: [tg] }), alertQ.reload);
10230
10237
  }
10231
10238
  };
10232
10239
  useInput6(
package/dist/tui/index.js CHANGED
@@ -3326,22 +3326,29 @@ function SettingsPanel({
3326
3326
  const enabled = (local?.enabled ?? false) && v.length > 0;
3327
3327
  run(v ? `path saved${enabled ? "" : " (press enter on enabled to turn on)"}` : "path cleared (local logs off)", () => api.settings.setLocalLogs({ enabled, path: v }), localQ.reload);
3328
3328
  } else if (which === "wh-url") {
3329
- if (!v) return;
3330
- run("webhook added", () => api.settings.createWebhook({ url: v, events: "denials" }), whQ.reload);
3329
+ const url = v.replace(/^["'<]+|["'>]+$/g, "").trim();
3330
+ if (!url) return;
3331
+ if (!/^https?:\/\/\S+$/i.test(url)) {
3332
+ setMsg({ text: "\u2717 webhook url must start with http:// or https://", level: "bad" });
3333
+ return;
3334
+ }
3335
+ run("webhook added", () => api.settings.createWebhook({ url, events: "denials" }), whQ.reload);
3331
3336
  } else if (which === "alert-email") {
3332
3337
  if (!v) return;
3333
- if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(v)) {
3338
+ const email = v.replace(/^mailto:/i, "").replace(/^["'<]+|["'>]+$/g, "").replace(/[.,;:]+$/, "").replace(/\s+/g, "").trim();
3339
+ if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
3334
3340
  setMsg({ text: "\u2717 that does not look like an e-mail address", level: "bad" });
3335
3341
  return;
3336
3342
  }
3337
- run("email alert added", () => api.settings.createAlert({ ...ALERT_BASE, emails: [v] }), alertQ.reload);
3343
+ run("email alert added", () => api.settings.createAlert({ ...ALERT_BASE, emails: [email] }), alertQ.reload);
3338
3344
  } else if (which === "alert-tg") {
3339
3345
  if (!v) return;
3340
- if (!/^-?\d{5,}$/.test(v)) {
3346
+ const tg = v.replace(/^@/, "").replace(/^(chat[\s_-]*)?id[:=\s]*/i, "").replace(/\s+/g, "").trim();
3347
+ if (!/^-?\d{5,}$/.test(tg)) {
3341
3348
  setMsg({ text: "\u2717 a telegram chat id is a number \u2014 get yours from @userinfobot", level: "bad" });
3342
3349
  return;
3343
3350
  }
3344
- run("telegram alert added", () => api.settings.createAlert({ ...ALERT_BASE, telegram: [v] }), alertQ.reload);
3351
+ run("telegram alert added", () => api.settings.createAlert({ ...ALERT_BASE, telegram: [tg] }), alertQ.reload);
3345
3352
  }
3346
3353
  };
3347
3354
  useInput6(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.81.54",
3
+ "version": "0.81.55",
4
4
  "description": "AI tool security proxy: protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. No code changes required.",
5
5
  "type": "module",
6
6
  "bin": {