halbot 1995.1.50 → 1995.1.52

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/package.json +7 -7
  2. package/web/turn.mjs +8 -2
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "halbot",
3
3
  "description": "Just another AI powered Telegram bot, which is simple design, easy to use, extendable and fun.",
4
- "version": "1995.1.50",
4
+ "version": "1995.1.52",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/Leask/halbot",
7
7
  "type": "module",
@@ -32,23 +32,23 @@
32
32
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
33
33
  "@ffprobe-installer/ffprobe": "^2.1.2",
34
34
  "@google-cloud/discoveryengine": "^2.5.2",
35
- "@google/genai": "^1.40.0",
35
+ "@google/genai": "^1.42.0",
36
36
  "@mozilla/readability": "^0.6.0",
37
37
  "fluent-ffmpeg": "^2.1.3",
38
38
  "google-gax": "^5.0.6",
39
- "ioredis": "^5.9.2",
40
- "jsdom": "^28.0.0",
39
+ "ioredis": "^5.9.3",
40
+ "jsdom": "^28.1.0",
41
41
  "lorem-ipsum": "^2.0.8",
42
42
  "mime": "^4.1.0",
43
- "mysql2": "^3.16.3",
43
+ "mysql2": "^3.17.3",
44
44
  "office-text-extractor": "^4.0.0",
45
- "openai": "^6.18.0",
45
+ "openai": "^6.22.0",
46
46
  "pg": "^8.18.0",
47
47
  "pgvector": "^0.2.1",
48
48
  "telegraf": "^4.16.3",
49
49
  "tellegram": "^1.1.18",
50
50
  "tesseract.js": "^7.0.0",
51
- "webjam": "^1995.3.6",
51
+ "webjam": "^1995.3.7",
52
52
  "youtube-transcript": "^1.2.1"
53
53
  }
54
54
  }
package/web/turn.mjs CHANGED
@@ -3,7 +3,13 @@ import { readFile } from 'fs/promises';
3
3
 
4
4
  const getPath = (subPath) => utilitas.__(import.meta.url, subPath);
5
5
  const getHtml = async () => await readFile(getPath('turn.html'), 'utf-8');
6
- const renderHtml = async (data) => await getHtml().then((html) => html.replace("'{{data}}'", data));
6
+ const safeStringify = (obj) => JSON.stringify(obj)
7
+ .replace(/</g, '\\u003c')
8
+ .replace(/>/g, '\\u003e')
9
+ .replace(/&/g, '\\u0026')
10
+ .replace(/\u2028/g, '\\u2028')
11
+ .replace(/\u2029/g, '\\u2029');
12
+ const renderHtml = async (data) => await getHtml().then((html) => html.replace("'{{data}}'", () => data));
7
13
 
8
14
  const file = async (ctx) => {
9
15
  try {
@@ -100,7 +106,7 @@ const process = async (ctx, next) => {
100
106
  });
101
107
  }
102
108
  });
103
- ctx.body = await renderHtml(JSON.stringify({
109
+ ctx.body = await renderHtml(safeStringify({
104
110
  bot_id: result.bot_id, chat_id: result.chat_id,
105
111
  chat_type: result.chat_type, messages, prompt_count,
106
112
  }));