bunnyquery 1.5.2 → 1.5.3

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 (2) hide show
  1. package/bunnyquery.js +22 -12
  2. package/package.json +1 -1
package/bunnyquery.js CHANGED
@@ -2213,7 +2213,7 @@ ${options.inlineContentPlaceholder}
2213
2213
  (function() {
2214
2214
  var MCP_PROD = "https://mcp.broadwayinc.computer";
2215
2215
  var MCP_DEV = "https://mcp-dev.broadwayinc.computer";
2216
- var BQ_VERSION = "1.5.1" ;
2216
+ var BQ_VERSION = "1.5.3" ;
2217
2217
  var ATTACHMENT_URL_EXPIRES_SECONDS = 600;
2218
2218
  var GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth";
2219
2219
  var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
@@ -4201,7 +4201,7 @@ ${options.inlineContentPlaceholder}
4201
4201
  return (reindex ? "Reindexing: " : "Indexing: ") + nameLabel + (extras.length ? " \xB7 " + extras.join(" \xB7 ") : "");
4202
4202
  }
4203
4203
  function sanitizeStorageSegment(name) {
4204
- var n = String(name == null ? "file" : name).trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/_{2,}/g, "_").replace(/^[_]+/, "");
4204
+ var n = String(name == null ? "file" : name).normalize("NFC").trim().replace(/[^\p{L}\p{N}._ -]+/gu, "_").replace(/ {2,}/g, " ").replace(/_{2,}/g, "_").replace(/^[_ ]+/, "");
4205
4205
  return n || "file";
4206
4206
  }
4207
4207
  function attachmentStoragePath(relPath) {
@@ -4646,6 +4646,12 @@ ${options.inlineContentPlaceholder}
4646
4646
  row.appendChild(removeAll);
4647
4647
  }
4648
4648
  }
4649
+ function uploadsFrozenForUser() {
4650
+ var conf = S.service && S.service.conf || {};
4651
+ if (!conf.freeze_database) return false;
4652
+ var ag = S.user && typeof S.user.access_group === "number" ? S.user.access_group : 0;
4653
+ return ag < 99;
4654
+ }
4649
4655
  function updateComposerControls() {
4650
4656
  var uploading = CS.uploadingAttachments;
4651
4657
  if (CS.attachBtnEl) CS.attachBtnEl.disabled = uploading;
@@ -5069,15 +5075,19 @@ ${options.inlineContentPlaceholder}
5069
5075
  requestAnimationFrame(function() {
5070
5076
  autoGrowInput(input);
5071
5077
  });
5072
- var attachFileInput = h("input", { class: "bq-attach-input", type: "file", multiple: "multiple" });
5073
- attachFileInput.addEventListener("change", function() {
5074
- onAttachInputChange(attachFileInput);
5075
- });
5076
- var attachBtn = h("button", { class: "bq-attach-btn", type: "button", title: "Attach files", html: ATTACH_ICON_SVG });
5077
- attachBtn.addEventListener("click", function() {
5078
- attachFileInput.click();
5079
- });
5080
- CS.attachBtnEl = attachBtn;
5078
+ var attachDisabled = uploadsFrozenForUser();
5079
+ var attachFileInput = null, attachBtn = null;
5080
+ if (!attachDisabled) {
5081
+ attachFileInput = h("input", { class: "bq-attach-input", type: "file", multiple: "multiple" });
5082
+ attachFileInput.addEventListener("change", function() {
5083
+ onAttachInputChange(attachFileInput);
5084
+ });
5085
+ attachBtn = h("button", { class: "bq-attach-btn", type: "button", title: "Attach files", html: ATTACH_ICON_SVG });
5086
+ attachBtn.addEventListener("click", function() {
5087
+ attachFileInput.click();
5088
+ });
5089
+ CS.attachBtnEl = attachBtn;
5090
+ }
5081
5091
  var attachmentsRow = h("div", { class: "bq-attachments" });
5082
5092
  attachmentsRow.style.display = "none";
5083
5093
  CS.attachmentsRow = attachmentsRow;
@@ -5096,7 +5106,7 @@ ${options.inlineContentPlaceholder}
5096
5106
  chatArea = h("div", { class: "bq-chat" }, box, composer);
5097
5107
  CS.chatEl = chatArea;
5098
5108
  CS.composerEl = composer;
5099
- setupDragAndDrop(chatArea);
5109
+ if (!attachDisabled) setupDragAndDrop(chatArea);
5100
5110
  return h("div", { class: "bq-meta" }, header, chatArea);
5101
5111
  });
5102
5112
  if (S.aiPlatform === "none") return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunnyquery",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Embeddable BunnyQuery AI chat widget + its framework-agnostic chat engine",
5
5
  "main": "bunnyquery.js",
6
6
  "exports": {