mirror of
https://github.com/ReCloudStudio/WebHooker.git
synced 2026-09-22 16:11:29 +00:00
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:
parent
a5324fb0ea
commit
3dce114cec
19 changed files with 273 additions and 16 deletions
|
|
@ -126,6 +126,11 @@ export interface Group {
|
|||
* Defaults to true when omitted.
|
||||
*/
|
||||
emoji?: boolean;
|
||||
/**
|
||||
* Whether to show the forge source (GitHub / Gitea instance / custom) in the
|
||||
* footer of this group's messages. Defaults to false when omitted.
|
||||
*/
|
||||
forgeLabel?: boolean;
|
||||
/**
|
||||
* Message language for every route in this group (e.g. "en", "zh"; custom
|
||||
* via KV i18n:<lang>). Defaults to "en" when omitted.
|
||||
|
|
@ -165,6 +170,20 @@ export interface NeutralAuthor {
|
|||
url?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The forge (source platform) that produced an event: shown in the message
|
||||
* footer when the group enables `Group.forgeLabel` so recipients can tell
|
||||
* GitHub, a Gitea instance or a custom webhook apart at a glance.
|
||||
*/
|
||||
export interface NeutralForge {
|
||||
/** Display name, e.g. "GitHub" or the Gitea instance hostname. */
|
||||
name: string;
|
||||
/** Site URL for the hyperlink (Telegram) / brand context (Discord). */
|
||||
url?: string;
|
||||
/** Site favicon used as the Discord embed footer icon. */
|
||||
iconUrl?: string;
|
||||
}
|
||||
|
||||
export interface NeutralField {
|
||||
name: string;
|
||||
value: string;
|
||||
|
|
@ -189,6 +208,11 @@ export interface NeutralMessage {
|
|||
footer?: string;
|
||||
timestamp?: string;
|
||||
actions?: NeutralAction[];
|
||||
/**
|
||||
* Forge branding set by dispatch when `Group.forgeLabel` is enabled; drivers
|
||||
* render it in the footer (Discord icon + name, Telegram linked name).
|
||||
*/
|
||||
forge?: NeutralForge;
|
||||
/**
|
||||
* Stable key identifying a message chain that should be updated in place
|
||||
* (e.g. workflow run progress). When set, subsequent events edit the
|
||||
|
|
@ -215,7 +239,7 @@ export interface FormattedMessage {
|
|||
url?: string;
|
||||
};
|
||||
fields?: Array<{ name: string; value: string; inline?: boolean }>;
|
||||
footer?: { text: string };
|
||||
footer?: { text: string; icon_url?: string };
|
||||
timestamp?: string;
|
||||
}>;
|
||||
components?: Array<{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue