feat(channels): add Nostr config compatibility

This commit is contained in:
晴天
2026-05-23 09:25:07 +08:00
parent dcc3751ded
commit 326c5597df
6 changed files with 357 additions and 6 deletions

View File

@@ -178,6 +178,18 @@ export default {
twitchRefreshTokenHint: _('可选;与 Client Secret 配合用于刷新 Access Token。', 'Optional; used with Client Secret to refresh the access token.'),
twitchExpiresInHint: _('Access Token 有效期,单位秒。', 'Access token lifetime in seconds.'),
twitchObtainmentTimestampHint: _('Token 获取时间戳;上游用于判断刷新时机。', 'Token obtainment timestamp; upstream uses it to decide refresh timing.'),
nostrDesc: _('接入 Nostr 私信网络,支持 Relay 列表、私信访问策略和公开 Profile 配置', 'Connect Nostr direct messages with relay lists, DM access policy, and public profile settings'),
nostrGuide1: _('准备机器人账号的 Nostr 私钥,支持 nsec 或 64 位 hex 格式', 'Prepare the bot account Nostr private key, using nsec or 64-character hex format'),
nostrGuide2: _('填写 Gateway 可访问的 Relay URL多个地址用逗号分隔', 'Fill relay URLs reachable by Gateway; separate multiple URLs with commas'),
nostrGuide3: _('按需设置 DM Policy 和 Allow From限制允许发起私信的 npub 或公钥', 'Set DM Policy and Allow From as needed to limit which npub or public keys can start DMs'),
nostrGuide4: _('保存后面板会启用 Nostr 插件并重载 Gateway连通性以 Gateway 日志或 channels status 为准', 'After saving, the panel enables the Nostr plugin and reloads Gateway; verify connectivity through Gateway logs or channels status'),
nostrGuideFooter: _('<div style="margin-top:8px;font-size:var(--font-size-xs);color:var(--text-tertiary)">Nostr 最小配置需要 Private KeyRelay 留空时上游会使用默认 Relay。</div>', '<div style="margin-top:8px;font-size:var(--font-size-xs);color:var(--text-tertiary)">Nostr minimally requires Private Key; upstream uses default relays when Relay URLs are empty.</div>'),
nostrPrivateKeyHint: _('生产环境建议使用 SecretRef明文私钥会写入 openclaw.json。', 'Prefer SecretRef in production; plain-text private keys are written to openclaw.json.'),
nostrRelaysHint: _('可填写 ws:// 或 wss:// Relay URL多个地址用逗号、分号或换行分隔。', 'Use ws:// or wss:// relay URLs; separate multiple values with commas, semicolons, or new lines.'),
nostrAllowFromHint: _('可选,逗号分隔允许发起私信的 npub 或 64 位公钥dmPolicy=allowlist 时生效。', 'Optional comma-separated npub or 64-character public keys allowed to start DMs; used when dmPolicy=allowlist.'),
nostrDefaultAccountHint: _('上游当前通过根节点配置生成隐式账号,通常保持 default 即可。', 'Upstream currently derives an implicit account from the root config; default is usually enough.'),
nostrProfileAboutPh: _('可选,展示在 Nostr Profile 中的机器人介绍', 'Optional bot introduction shown in the Nostr profile'),
nostrProfileUrlHint: _('上游 Profile URL 字段要求使用 https:// 地址。', 'Upstream profile URL fields require https:// URLs.'),
synologyChatDesc: _('接入群晖 Synology Chat适合 NAS 内网团队协作', 'Connect Synology Chat for NAS-hosted team messaging'),
synologyChatGuide1: _('在 Synology Chat 管理后台创建 Bot并复制 Token', 'Create a bot in Synology Chat administration and copy its Token'),
synologyChatGuide2: _('配置 Incoming Webhook 或机器人发消息 URL填入 Incoming URL', 'Configure an Incoming Webhook or bot post URL, then paste it as Incoming URL'),

View File

@@ -386,6 +386,38 @@ const PLATFORM_REGISTRY = {
pluginRequired: '@openclaw/twitch@latest',
pluginId: 'twitch',
},
nostr: {
label: 'Nostr',
iconName: 'message-square',
desc: t('channels.nostrDesc'),
guide: [
t('channels.nostrGuide1'),
t('channels.nostrGuide2'),
t('channels.nostrGuide3'),
t('channels.nostrGuide4'),
],
guideFooter: t('channels.nostrGuideFooter'),
fields: [
{ key: 'privateKey', label: 'Private Key', placeholder: 'nsec1...', secret: true, required: true, hint: t('channels.nostrPrivateKeyHint') },
{ key: 'relays', label: 'Relay URLs', placeholder: 'wss://relay.damus.io, wss://nos.lol', required: false, hint: t('channels.nostrRelaysHint') },
{ key: 'dmPolicy', label: t('channels.dmPolicy'), type: 'select', options: DM_POLICY_OPTIONS, required: false },
{ key: 'allowFrom', label: 'Allow From', placeholder: 'npub1..., 0123456789abcdef', required: false, hint: t('channels.nostrAllowFromHint') },
{ key: 'name', label: t('channels.accountName'), placeholder: t('channels.optionalEg', { example: 'nostr-bot' }), required: false },
{ key: 'defaultAccount', label: 'Default Account', placeholder: 'default', required: false, hint: t('channels.nostrDefaultAccountHint') },
{ key: 'profileName', label: 'Profile Name', placeholder: 'openclaw', required: false },
{ key: 'profileDisplayName', label: 'Profile Display Name', placeholder: 'OpenClaw Bot', required: false },
{ key: 'profileAbout', label: 'Profile About', placeholder: t('channels.nostrProfileAboutPh'), multiline: true, required: false },
{ key: 'profilePicture', label: 'Profile Picture URL', placeholder: 'https://example.com/avatar.png', required: false, hint: t('channels.nostrProfileUrlHint') },
{ key: 'profileBanner', label: 'Profile Banner URL', placeholder: 'https://example.com/banner.png', required: false, hint: t('channels.nostrProfileUrlHint') },
{ key: 'profileWebsite', label: 'Profile Website', placeholder: 'https://example.com', required: false, hint: t('channels.nostrProfileUrlHint') },
{ key: 'profileNip05', label: 'NIP-05', placeholder: 'openclaw@example.com', required: false },
{ key: 'profileLud16', label: 'LUD-16', placeholder: 'openclaw@example.com', required: false },
],
configKey: 'nostr',
pairingChannel: 'nostr',
pluginRequired: '@openclaw/nostr@latest',
pluginId: 'nostr',
},
'synology-chat': {
label: 'Synology Chat',
iconName: 'message-square',