@bytesbrains/pi-telegram-bridge 1.2.0 → 1.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytesbrains/pi-telegram-bridge",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Telegram bot bridge for pi agents — send messages, ask questions, and listen for human replies via Telegram.",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/helpers.ts CHANGED
@@ -151,7 +151,7 @@ export async function sendPhoto(
151
151
  const token = getToken();
152
152
  const formData = new FormData();
153
153
  formData.set("chat_id", getChatId());
154
- const blob = new Blob([fileData] as any);
154
+ const blob = new Blob([fileData]);
155
155
  formData.set("photo", blob, filename);
156
156
  if (caption) {
157
157
  formData.set("caption", caption);
package/src/templates.ts CHANGED
@@ -12,10 +12,7 @@ const BAR = "━".repeat(20);
12
12
 
13
13
  /** Escape user text for safe embedding inside HTML tags. */
14
14
  function escapeHtml(s: string): string {
15
- return s
16
- .replace(/&/g, "&")
17
- .replace(/</g, "&lt;")
18
- .replace(/>/g, "&gt;");
15
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
19
16
  }
20
17
 
21
18
  function bold(s: string) {
@@ -31,7 +28,7 @@ function strike(s: string) {
31
28
  return `<s>${escapeHtml(s)}</s>`;
32
29
  }
33
30
  function labelValue(label: string, value: string) {
34
- return `${bold(label + ":")} ${escapeHtml(value)}`;
31
+ return `${bold(label + ":")} ${value}`;
35
32
  }
36
33
  function link(url: string, text: string) {
37
34
  return `<a href="${url}">${escapeHtml(text)}</a>`;
@@ -257,7 +254,7 @@ export function ciPipeline(p: CIPipeline): string {
257
254
  msg += `${BAR}\n`;
258
255
  msg += labelValue("Run", `#${p.runNumber}`) + "\n";
259
256
  msg += labelValue("Branch", code(p.branch)) + "\n";
260
- msg += labelValue("Trigger", p.event) + "\n";
257
+ msg += labelValue("Trigger", escapeHtml(p.event)) + "\n";
261
258
  if (p.triggeredBy) msg += labelValue("By", code(p.triggeredBy)) + "\n";
262
259
  msg += `${BAR}\n`;
263
260