




















@@ -1,4 +1,8 @@
1-import { buildChannelConfigSchema } from "openclaw/plugin-sdk/channel-config-schema";
1+import {
2+buildChannelConfigSchema,
3+requireOpenAllowFrom,
4+} from "openclaw/plugin-sdk/channel-config-schema";
5+import { requireChannelOpenAllowFrom } from "openclaw/plugin-sdk/extension-shared";
26import { z } from "openclaw/plugin-sdk/zod";
3748const DmPolicySchema = z.enum(["open", "allowlist", "pairing", "disabled"]);
@@ -15,7 +19,7 @@ const ThreadBindingsSchema = z
1519})
1620.strict();
172118-const LineCommonConfigSchema = z.object({
22+const LineCommonConfigSchemaBase = z.object({
1923enabled: z.boolean().optional(),
2024channelAccessToken: z.string().optional(),
2125channelSecret: z.string().optional(),
@@ -42,15 +46,35 @@ const LineGroupConfigSchema = z
4246})
4347.strict();
444845-const LineAccountConfigSchema = LineCommonConfigSchema.extend({
49+const LineAccountConfigSchema = LineCommonConfigSchemaBase.extend({
4650groups: z.record(z.string(), LineGroupConfigSchema.optional()).optional(),
47-}).strict();
51+})
52+.strict()
53+.superRefine((value, ctx) => {
54+requireChannelOpenAllowFrom({
55+channel: "line",
56+policy: value.dmPolicy,
57+allowFrom: value.allowFrom,
58+ ctx,
59+ requireOpenAllowFrom,
60+});
61+});
486249-export const LineConfigSchema = LineCommonConfigSchema.extend({
63+export const LineConfigSchema = LineCommonConfigSchemaBase.extend({
5064accounts: z.record(z.string(), LineAccountConfigSchema.optional()).optional(),
5165defaultAccount: z.string().optional(),
5266groups: z.record(z.string(), LineGroupConfigSchema.optional()).optional(),
53-}).strict();
67+})
68+.strict()
69+.superRefine((value, ctx) => {
70+requireChannelOpenAllowFrom({
71+channel: "line",
72+policy: value.dmPolicy,
73+allowFrom: value.allowFrom,
74+ ctx,
75+ requireOpenAllowFrom,
76+});
77+});
54785579export const LineChannelConfigSchema = buildChannelConfigSchema(LineConfigSchema);
5680此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。