mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 11:11:23 +00:00
fix(telegram): Allow ephemeral webhookPort
This commit is contained in:
@@ -15,7 +15,7 @@ describe("Telegram webhookPort config", () => {
|
|||||||
expect(res.ok).toBe(true);
|
expect(res.ok).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("rejects non-positive webhookPort", () => {
|
it("accepts webhookPort set to 0 for ephemeral port binding", () => {
|
||||||
const res = validateConfigObject({
|
const res = validateConfigObject({
|
||||||
channels: {
|
channels: {
|
||||||
telegram: {
|
telegram: {
|
||||||
@@ -25,6 +25,19 @@ describe("Telegram webhookPort config", () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
expect(res.ok).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("rejects negative webhookPort", () => {
|
||||||
|
const res = validateConfigObject({
|
||||||
|
channels: {
|
||||||
|
telegram: {
|
||||||
|
webhookUrl: "https://example.com/telegram-webhook",
|
||||||
|
webhookSecret: "secret",
|
||||||
|
webhookPort: -1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
expect(res.ok).toBe(false);
|
expect(res.ok).toBe(false);
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
expect(res.issues.some((issue) => issue.path === "channels.telegram.webhookPort")).toBe(true);
|
expect(res.issues.some((issue) => issue.path === "channels.telegram.webhookPort")).toBe(true);
|
||||||
|
|||||||
@@ -193,9 +193,11 @@ export const TelegramAccountSchemaBase = z
|
|||||||
webhookPort: z
|
webhookPort: z
|
||||||
.number()
|
.number()
|
||||||
.int()
|
.int()
|
||||||
.positive()
|
.nonnegative()
|
||||||
.optional()
|
.optional()
|
||||||
.describe("Local bind port for the webhook listener. Defaults to 8787."),
|
.describe(
|
||||||
|
"Local bind port for the webhook listener. Defaults to 8787; set to 0 to let the OS assign an ephemeral port.",
|
||||||
|
),
|
||||||
actions: z
|
actions: z
|
||||||
.object({
|
.object({
|
||||||
reactions: z.boolean().optional(),
|
reactions: z.boolean().optional(),
|
||||||
|
|||||||
Reference in New Issue
Block a user