feat(groups): optional forge source label in message footers

- Group.forgeLabel (default off, editable per group in the console) shows the
  source forge on every message the group's routes dispatch
- Discord embed footer: forge name next to the repo + the site's favicon as
  icon_url (Gitea instance's own favicon from its origin)
- Telegram footer: hyperlinked site name (GitHub or Gitea hostname); custom
  webhooks render a plain 'Custom' label
- forgeInfo() derives branding from event.provider + repository.html_url;
  dispatch attaches it to the NeutralMessage like mentionRoleIds
- validateGroups accepts forgeLabel booleans; GroupEditor gains the toggle
- tests: forgeInfo unit, discord/telegram footer render, dispatch on/off
- docs: groups.md + message-format.md (en/zh), config.example.yaml, AGENTS.md
- fix: wrangler.jsonc compatibility_date was an incomplete '2026-'
This commit is contained in:
RhenCloud 2026-08-14 08:10:04 +08:00
parent a5324fb0ea
commit 3dce114cec
No known key found for this signature in database
GPG key ID: A574A617378C4E0B
19 changed files with 273 additions and 16 deletions

View file

@ -46,16 +46,27 @@
/>
<div class="hint">{{ t("groupEditor.langHint") }}</div>
</div>
<div class="field">
<label
>{{ t("groupEditor.emoji") }}
<span class="lbl-note">{{ t("groupEditor.emojiNote") }}</span></label
>
<label class="inline">
<input v-model="form.emoji" type="checkbox" />
<span>{{ t("groupEditor.emojiLabel") }}</span>
</label>
</div>
<div class="field">
<label
>{{ t("groupEditor.emoji") }}
<span class="lbl-note">{{ t("groupEditor.emojiNote") }}</span></label
>
<label class="inline">
<input v-model="form.emoji" type="checkbox" />
<span>{{ t("groupEditor.emojiLabel") }}</span>
</label>
</div>
<div class="field">
<label
>{{ t("groupEditor.forgeLabel") }}
<span class="lbl-note">{{ t("groupEditor.forgeLabelNote") }}</span></label
>
<label class="inline">
<input v-model="form.forgeLabel" type="checkbox" />
<span>{{ t("groupEditor.forgeLabelLabel") }}</span>
</label>
<div class="hint">{{ t("groupEditor.forgeLabelHint") }}</div>
</div>
</div>
<div class="field">
<label
@ -208,6 +219,7 @@ const form = reactive({
providers: [] as ("github" | "gitea")[],
installationId: "",
emoji: true,
forgeLabel: false,
lang: "",
logPlatform: "" as "" | "discord" | "telegram",
logChannelId: "",
@ -237,6 +249,7 @@ watch(
);
form.installationId = g?.installationId != null ? String(g.installationId) : "";
form.emoji = g?.emoji ?? true;
form.forgeLabel = g?.forgeLabel ?? false;
form.lang = g?.lang ?? "";
form.logPlatform = lt?.platform ?? "";
form.logChannelId = lt?.channelId ?? "";
@ -310,6 +323,7 @@ function save(): void {
providers: form.providers.length ? form.providers : undefined,
installationId,
emoji: form.emoji,
forgeLabel: form.forgeLabel,
lang: form.lang.trim() || undefined,
logTarget,
});

View file

@ -198,6 +198,11 @@ const en: Dict = {
"Bind this group to one GitHub App installation (the org/user that installed the app). Only events from that installation enter this group's routes; leave empty to allow any installation (still filtered by Owner scope).",
"groupEditor.errInstallationId": "Installation ID must be a positive integer",
"groupEditor.emoji": "Show emojis in messages",
"groupEditor.forgeLabel": "Show forge source",
"groupEditor.forgeLabelNote": "(optional)",
"groupEditor.forgeLabelLabel": "Show which forge (GitHub / Gitea / custom) produced each event",
"groupEditor.forgeLabelHint":
"Adds the forge icon and site name to the message footer so events from different forges can be told apart.",
"groupEditor.logTarget": "Webhook log channel",
"groupEditor.logTargetNote": "(optional)",
"groupEditor.logDisabled": "— Disabled —",
@ -448,6 +453,10 @@ const zh: Dict = {
"将本分组绑定到一个 GitHub App 安装(安装了 App 的组织/用户)。只有来自该安装的事件才会进入本分组的路由;留空表示接受任意安装(仍受来源限定过滤)。",
"groupEditor.errInstallationId": "安装 ID 必须为正整数",
"groupEditor.emoji": "消息中显示表情符号",
"groupEditor.forgeLabel": "显示来源平台",
"groupEditor.forgeLabelNote": "(可选)",
"groupEditor.forgeLabelLabel": "在消息中标识事件来源GitHub / Gitea / 自定义)",
"groupEditor.forgeLabelHint": "在消息底部显示来源平台的图标与站点名称,便于区分不同 forge 的事件。",
"groupEditor.logTarget": "Webhook 日志频道",
"groupEditor.logTargetNote": "(可选)",
"groupEditor.logDisabled": "— 未启用 —",

View file

@ -40,6 +40,7 @@ export interface Group {
providers?: ("github" | "gitea" | "gitlab")[];
installationId?: number;
emoji?: boolean;
forgeLabel?: boolean;
lang?: string;
logTarget?: RouteTarget;
}