@jiggai/kitchen-plugin-marketing 0.3.0 → 0.3.1

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.
@@ -602,8 +602,51 @@ function getBackendSources(req, teamId) {
602
602
  const configPath5 = (0, import_path2.join)((0, import_os2.homedir)(), ".openclaw", "openclaw.json5");
603
603
  const actualPath = (0, import_fs2.existsSync)(configPath) ? configPath : (0, import_fs2.existsSync)(configPath5) ? configPath5 : null;
604
604
  if (actualPath) {
605
- const raw = (0, import_fs2.readFileSync)(actualPath, "utf8").replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
606
- const cfg = JSON.parse(raw);
605
+ const raw = (0, import_fs2.readFileSync)(actualPath, "utf8");
606
+ let cfg;
607
+ try {
608
+ cfg = JSON.parse(raw);
609
+ } catch {
610
+ let cleaned = "";
611
+ let inStr = false;
612
+ let escape = false;
613
+ for (let i = 0; i < raw.length; i++) {
614
+ const ch = raw[i];
615
+ if (escape) {
616
+ cleaned += ch;
617
+ escape = false;
618
+ continue;
619
+ }
620
+ if (inStr) {
621
+ if (ch === "\\") {
622
+ escape = true;
623
+ cleaned += ch;
624
+ continue;
625
+ }
626
+ if (ch === '"') inStr = false;
627
+ cleaned += ch;
628
+ continue;
629
+ }
630
+ if (ch === '"') {
631
+ inStr = true;
632
+ cleaned += ch;
633
+ continue;
634
+ }
635
+ if (ch === "/" && raw[i + 1] === "/") {
636
+ while (i < raw.length && raw[i] !== "\n") i++;
637
+ cleaned += "\n";
638
+ continue;
639
+ }
640
+ if (ch === "/" && raw[i + 1] === "*") {
641
+ i += 2;
642
+ while (i < raw.length && !(raw[i] === "*" && raw[i + 1] === "/")) i++;
643
+ i++;
644
+ continue;
645
+ }
646
+ cleaned += ch;
647
+ }
648
+ cfg = JSON.parse(cleaned);
649
+ }
607
650
  const plugins = cfg?.plugins?.entries || {};
608
651
  const channels = [];
609
652
  if (plugins.discord?.enabled) channels.push("discord");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jiggai/kitchen-plugin-marketing",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Marketing Suite plugin for ClawKitchen",
5
5
  "main": "dist/index.js",
6
6
  "files": [