Files
WebHooker/app/composables/useI18n.ts
T
翅膀喵andRhenCloud 978c53eeb3 fix(security): harden webhook delivery pipeline and group storage (#11)
* fix(log): preserve structured error details

Error objects lose their useful details when serialized as plain JSON.
Keep the message, stack and cause in structured log output.

* fix(runtime): bound shared in-flight waits

A canceled request can leave its shared promise pending forever.
Bound joins and coordinate a single replacement so later requests
make progress without multiplying upstream work.

* fix(bot): reject oversized callback bodies

Reject declared oversized bot callbacks before reading their bodies.
This keeps unauthenticated requests from wasting worker resources.

* test(d1): exercise real sqlite transactions

Exercise real foreign keys, transactions and conditional statements
instead of mocks that cannot reproduce lost updates or cascades.

* fix(storage): preserve claims across kv fallback

Only missing tables justify KV fallback; other failures must surface.
Remember fallback writes so migration to D1 cannot forget claims
and replay completed work. Share marker checks without extra writes.

* fix(filter): use isolated linear-time patterns

Backtracking patterns can exhaust worker CPU on untrusted payloads.
Use linear-time matching and separate bounded cache namespaces so
glob and regex entries cannot corrupt each other.

* fix(filter): read each event branch correctly

Deployment and check branches live in event-specific nested fields.
Read those fields and remove only the actual leading ref prefix.

* fix(filter): read only own payload properties

Inherited object properties are not webhook payload data.
Read own properties only so JSONPath cannot traverse prototypes.

* fix(filter): validate executable condition trees

Malformed trees and unsupported patterns must not silently turn an
exclude rule into a pass. Validate the shape and only the patterns
the evaluator actually executes.

* fix(i18n): bound and cache translation loads

Repeated misses and simultaneous override loads spend KV reads for
the same language. Cache confirmed misses and share bounded loads
without caching read failures as missing translations.

* i18n(bot): explain command and account failures

Explain account linking, command failures and skipped delivery
outcomes consistently in both supported languages.

* fix(github): bound and reuse app token fetches

Repeated token exchanges waste requests and JWT work for every event.
Reuse valid installation tokens, share refreshes and back off briefly
after failures while keeping every shared wait bounded.

* fix(github): restrict enrichment request urls

Webhook-provided URLs must never receive an installation token on
another host. Restrict enrichment to GitHub repository API paths,
reject redirects and bound optional requests.

* fix(formatter): preserve invalid code points

Out-of-range numeric entities can throw while formatting a delivery.
Keep invalid code points verbatim instead of aborting the message.

* fix(formatter): preserve bounded markdown text

Code spans, fences, indentation and autolinks are Markdown content,
not HTML tags to strip. Preserve them while bounding cleanup input
and reusing results across routes for the same event.

* fix(formatter): strip only leading ref prefixes

A short branch or tag may itself contain refs/heads or refs/tags.
Strip one leading full-ref prefix at the caller and keep short names
unchanged when generating labels and links.

* fix(gitea): link push authors to their forge

A Gitea author is not the same-named GitHub account.
Build author profile links from the originating forge.

* fix(formatter): render deployment state values

The deployment status object stringifies as [object Object].
Render its actual state in the status field.

* fix(formatter): read security severity levels

The scanner severity is not the security severity of an alert.
Prefer the security level so critical and high alerts get the right
label and color.

* fix(formatter): hide actions on other forges

Action buttons call the GitHub API as the linked user.
Hide them for other forges to avoid operating on a same-named
GitHub repository.

* fix(check): isolate updates by check suite

Same-named checks from different suites must not edit one message.
Include the suite or app identity and retain the former key for
controlled adoption of existing tracked messages.

* fix(logs): scope queries before limiting results

Filter authorized groups in SQL before LIMIT and aggregate only
visible rows. Preserve current group attribution for late writes,
surface read failures and combine related totals in one scan.

* perf(d1): index pruning and failed send queries

Pruning and failure views should not scan all historical rows.
Index the high-value access paths without adding a write-heavy
index for infrequent delivery-detail lookups.

* fix(discord): bound individual api requests

An unbounded API request can outlive an update-chain lock.
Bound each request so another holder cannot race a late edit.

* fix(discord): defer long rate-limit waits

Long rate-limit sleeps block delivery progress inside a worker.
Return a retryable 429 for the queue when the wait exceeds the bound.

* fix(discord): encode channel path segments

Stored channel and message ids are path segments, not URL paths.
Encode them so aliases cannot address another Discord resource.

* fix(discord): reuse nonces after lost responses

A successful create may lose its response. Reuse a stable nonce
with enforce_nonce so retries recover that message instead of
posting duplicates or accepting an unreadable success.

* fix(discord): constrain embeds and role mentions

Respect combined embed and component limits as well as field caps.
Restrict allowed mentions to validated route roles so payload text
cannot notify everyone.

* fix(discord): resume bounded command syncs

Application changes, command rollbacks and large guild lists can
leave commands stale indefinitely. Track the current hash per app
and resume bounded paginated work without needless KV writes.

* fix(github): verify installation management

An installation id is user-controlled, and repository access is not
installation management. Verify the owning account or an active
organization admin using the user token and read:org scope.

* fix(github): resolve immutable member ids

A login can be renamed and reclaimed before its first sign-in.
Resolve the current immutable user id when membership is granted
so a future holder of the login cannot inherit access.

* fix(auth): revoke stale sessions and tokens

Revoked or rotated credentials must stop working despite stale KV
replicas. Track the live token and revocations in D1 and preserve
immutable identity bindings rather than trusting a recycled login.

* fix(auth): bind sessions and tokens to identity

Automatic retries can repeat non-idempotent user actions.
Disable those retries and expose a write hook so bot handlers can
record completion immediately before the GitHub write.

* fix(discord): defer and deduplicate interactions

Acknowledge slow actions before Discord times out and deduplicate
interaction writes. Preserve comment text and reject edits whose
source changed after the modal opened.

* fix(telegram): always verify webhook secrets

Webhook verification must not silently disable itself when the
optional secret is absent. Derive a stable secret from the bot
token and reject callbacks when verification is unavailable.

* fix(telegram): bound individual api requests

Bound individual platform calls so they cannot outlive the lock
protecting a message update or stall a whole delivery invocation.

* fix(telegram): honor nested rate-limit delays

Telegram places retry_after inside parameters, not at the top level.
Read that value and defer long waits to the delivery queue.

* fix(telegram): report unreadable send results

An unreadable successful response may already have sent the message.
Report an explicit uncertain result instead of retrying a create
without an idempotency key or pretending it succeeded.

* fix(telegram): keep editable messages as text

Guessing photo versus text from message content makes later edits
use the wrong API and a smaller caption budget. Always send text
and use the avatar as a link preview.

* fix(telegram): render hard breaks as newlines

Telegram HTML does not support br tags. Render Markdown hard breaks
as plain newlines so otherwise valid messages are accepted.

* fix(telegram): clamp visible html characters

Telegram counts visible characters, not HTML source bytes.
Truncate without splitting tags, entities or surrogate pairs.

* fix(telegram): honor the author emoji toggle

The author marker must obey the group emoji preference just like
formatter-added decoration.

* fix(telegram): keep completed commands claimed

Redelivery after a completed write must never post another comment.
Keep completion claims despite reply failures, scope updates per bot
and only issue account-login links in private chats.

* fix(feishu): bound individual api requests

Bound individual platform calls so they cannot outlive the lock
protecting a message update or stall a whole delivery invocation.

* fix(feishu): classify retryable api failures

Business error codes can be transient even in HTTP 200 responses.
Classify token and rate-limit errors for retry and defer long waits.

* fix(feishu): retry sends with stable uuids

An unreadable response does not prove a send failed.
Reuse the same uuid for retries so recovering the result cannot
create a second Feishu message.

* fix(feishu): refresh and evict tokens safely

Separate app token caches, stop reusing refused tokens and share
refreshes. Cache failures briefly and keep valid tokens in memory
when a best-effort KV cache write fails.

* fix(feishu): use the card update endpoint

Delayed card updates use the card update endpoint; the config
endpoint cannot update an interaction response.

* fix(feishu): neutralize untrusted mentions

Forge text is untrusted and can contain at-all tags.
Neutralize mentions in card bodies and footers before rendering.

* fix(feishu): authenticate and dedupe callbacks

Authenticate signed or token-verified callbacks before dispatching
commands. Decode encrypted envelopes and handle card actions using
the correct fields without claiming irrelevant chat events.

* fix(target): normalize actual destinations

Different target spellings can name the same actual destination.
Normalize channel, thread and topic identities for ownership checks
and per-route duplicate suppression.

* fix(config): transact per-group configuration

Whole-table writes and cached snapshots can overwrite other groups
or resurrect removed configuration. Use per-group guarded writes,
one-time identity migration and explicit unreadable-row failures.

* fix(group): preserve identity through lifecycle

Group names are mutable and reusable, so they cannot own durable
state. Preserve immutable identities across lifecycle operations and
commit invite use with membership under transaction-time guards.

* fix(oauth): confirm account links and installs

A login link or installation id is not proof of account ownership.
Verify installation management, bind browser state and require an
explicit account-link confirmation before granting chat access.

* fix(queue): fence leases and record target outcomes

Retries must remember completed targets and distinguish active
lease holders. Fence state updates, preserve permanent outcomes and
reject missing parked payloads instead of dispatching empty data.

* fix(dispatch): isolate and resume tenant sends

Check tenant sources before filters and never dispatch orphan routes.
Record each target outcome, isolate update chains by forge and group
identity, and keep stale events from overwriting newer messages.

* fix(queue): bound batches and resume deliveries

A queue invocation has shared query and subrequest limits.
Use a small batch and shared send budget, renew fenced leases and
resume only unfinished work without exhausting unstarted messages.

* fix(admin): guard revisions and tenant targets

Read-time authorization alone cannot protect concurrent edits.
Guard revisions, current roles and destination ownership in the
write transaction, and use per-group endpoints for isolated changes.

* fix(webhook): confirm only accepted deliveries

Acknowledging before queue acceptance permanently loses deliveries.
Confirm only accepted work, release failed claims, scope replay
identities and strip tenant-supplied installation authority.

* fix(storage): prune abandoned parked payloads

Oversized payloads can remain after interrupted enqueue attempts.
Prune objects beyond their retry lifetime without deleting payloads
that a current delivery may still need.

* fix(console): expose api conflict statuses

Callers need the HTTP status to distinguish stale edits from other
failures and reload current data after a conflict.

* refactor(console): model group revisions

Carry server revisions explicitly so console writes can reject
changes based on an outdated group snapshot.

* fix(console): send loaded route revisions

Send the revision actually loaded with the route list and adopt the
server response after a save. Reload on conflict instead of silently
overwriting another editor.

* fix(console): guard fragment saves by revision

Fragments share a group version with other configuration writes.
Submit the loaded revision and reload on conflict to preserve
concurrent edits.

* fix(console): save groups with guarded writes

Whole-list saves can overwrite unrelated groups. Use per-group
revision-aware writes, retain rename results and confirm deletion
on the exact group, routes and version shown to the user.

* fix(console): reject edits of stale routes

A conflict reload can leave an older route editor open.
Compare its original value before saving so it cannot overwrite
the newly loaded route.

* fix(console): show overview loading failures

Failed overview requests must not look like an empty dashboard or
a successful refresh. Show the reason while retaining prior data.

* fix(console): explain rejected install bindings

Explain why an installation binding was refused instead of silently
returning to the console with no visible outcome.

* fix(console): allow selecting a group named all

The all sentinel collides with a valid group id.
Use a value that cannot be a group id so that group stays selectable.

* fix(console): discard stale log detail responses

An older detail request can finish after a newer selection or close.
Discard it so the dialog never shows the previously clicked record.

* fix(console): retain legacy group owners

Groups predating member roles store owners in adminIds.
Load those as owners so adding a member never drops all old owners.

* fix(console): lock member edits during saves

Edits made during a save are overwritten by its result.
Disable member controls and guard handlers until the write settles.

* fix(console): show invite loading failures

Failed invite loads must not look like no pending invites.
Show the error and discard responses from a previously shown group.

* fix(console): retain legacy discord log targets

A stored log target without platform means Discord.
Keep that meaning in the editor instead of clearing the target.

* fix(console): retain undisplayed forge sources

An editor that only displays some providers must preserve the others.
Keep stored custom sources when saving unrelated group settings.

* fix(console): lock the group editor while saving

Prevent edits while a group save is in flight and make super-only
installation settings readonly instead of silently ignoring edits.

* fix(console): lock route edits and show failures

Lock the route editor while saving and show fragment load failures
with a retry action rather than presenting a false empty list.

* fix(config): expose the legal contact override

Declare the public runtime key so the documented environment
override reaches legal pages in deployed Nuxt builds.

* build(deploy): migrate d1 before deployment

Apply pending D1 migrations before deploying code that requires
them. Stop deployment when migration fails instead of running
against an incomplete schema.

* docs(worker): align guides with runtime behavior

Synchronize both language guides, API references and examples with
the implemented authorization, storage and delivery behavior.
Document migration requirements and accepted operational limits.

* fix(storage): repair orphaned KV routes

Repair orphaned KV routes before serving KV-only configuration.

* fix(security): fully escape forge HTML

---------

Co-authored-by: RhenCloud <i@rhen.cloud>
2026-10-24 16:19:06 +08:00

949 lines
42 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
export type Locale = "en" | "zh";
const STORAGE_KEY = "wh-locale";
type Dict = Record<string, string>;
const en: Dict = {
"app.tagline": "CONFIG CONSOLE",
"app.newRoute": "New Route",
"app.newGroup": "New Group",
"app.signOut": "Sign out",
"app.langToggle": "中文",
"login.title": "Config Console",
"login.forbidden": "Access denied — this GitHub account is not an admin or group admin.",
"login.prompt": "Sign in with GitHub to manage routes.",
"login.button": "Sign in with GitHub",
"tab.overview": "Overview",
"tab.groups": "Groups",
"tab.logs": "Send Logs",
"tab.audit": "Audit Log",
"tab.metrics": "Stats",
"metrics.title": "Delivery Stats",
"metrics.successRate": "Success rate",
"overview.routes": "Routes",
"overview.recent": "Recent deliveries",
"overview.viewAll": "View all",
"overview.refreshed": "Refreshed",
"overview.refreshFailed": "Refresh failed",
"overview.loadFailed":
"Some data could not be loaded; what is shown may be incomplete or out of date: {error}",
"overview.thRoute": "Route",
"overview.thGroup": "Group",
"overview.thEvents": "Events",
"overview.thTargets": "Targets",
"overview.thState": "State",
"metrics.refresh": "Refresh",
"metrics.total": "Total",
"metrics.ok": "OK",
"metrics.failed": "Failed",
"metrics.failureRate": "Failure rate",
"metrics.avgDuration": "Avg duration",
"metrics.avgAttempts": "Avg attempts",
"metrics.byPlatform": "By platform",
"metrics.byEvent": "By event",
"metrics.byStatus": "By status",
"metrics.recentFailures": "Recent failures",
"metrics.empty": "No delivery data yet",
"metrics.filterGroup": "Group",
"metrics.allGroups": "All groups",
"metrics.sortTotal": "By total",
"metrics.sortFailed": "By failures",
"metrics.sortRate": "By failure rate",
"metrics.retryRate": "Retry rate",
"event.push": "push",
"event.pull_request": "pull_request",
"event.pull_request_review": "pull_request_review",
"event.pull_request_review_comment": "pull_request_review_comment",
"event.issues": "issues",
"event.issue_comment": "issue_comment",
"event.workflow_run": "workflow_run",
"event.workflow_job": "workflow_job",
"event.status": "status",
"event.deployment": "deployment",
"event.deployment_status": "deployment_status",
"event.ping": "ping",
"event.release": "release",
"event.create": "create",
"event.delete": "delete",
"event.star": "star",
"event.fork": "fork",
"event.check_run": "check_run",
"event.check_suite": "check_suite",
"event.commit_comment": "commit_comment",
"event.member": "member",
"event.label": "label",
"event.milestone": "milestone",
"event.discussion": "discussion",
"event.discussion_comment": "discussion_comment",
"event.repository": "repository",
"event.code_scanning_alert": "code_scanning_alert",
"event.dependabot_alert": "dependabot_alert",
"event.custom": "custom",
"status.loading": "loading",
"status.connected": "connected",
"kpi.groups": "GROUPS",
"kpi.routes": "ROUTES",
"role.owner": "Owner",
"role.admin": "Admin",
"role.viewer": "Viewer",
"roles.owner": "Owner",
"roles.admin": "Admin",
"roles.viewer": "Viewer",
"members.title": "Members",
"members.note": "(role: owner = full control · admin = edit routes · viewer = read-only)",
"members.empty": "No members yet — add the first owner or share an invite link.",
"members.add": "Add member",
"members.addPlaceholder": "GitHub login",
"members.addBtn": "Add",
"members.role": "Role",
"members.you": "(you)",
"members.remove": "Remove",
"members.invites": "Invite links",
"members.inviteNote": "(single-use · expires in 7 days)",
"members.inviteRole": "Invite as",
"members.createInvite": "Create invite link",
"members.copyLink": "Copy",
"members.copied": "Copied!",
"members.revoke": "Revoke",
"members.noInvites": "No pending invites.",
"members.invitesFailed": "Could not load invites: {error}",
"members.errSelfOwner": "You must remain an owner of this group.",
"members.errOwner": "A group needs at least one owner.",
"members.errLastOwner": "Cannot remove the last owner.",
"members.inviteOk": "Invite accepted — welcome!",
"members.inviteBad": "This invite is invalid or expired.",
"install.ok":
"GitHub App installation registered — the group has been created and bound to this installation.",
"install.forbidden":
"Your GitHub account cannot manage this installation, so it was not bound. Sign in with an account that administers it.",
"webhook.title": "Webhook endpoint",
"webhook.note": "(per-group URL + secret)",
"webhook.empty": "Not configured. Generate a secret to enable the group's own webhook endpoint.",
"webhook.url": "URL",
"webhook.secret": "Secret",
"webhook.noSecret": "— no secret configured —",
"webhook.secretHidden":
"The secret is only shown once after generating/regenerating. Regenerate to reveal a new one.",
"webhook.copy": "Copy",
"webhook.copied": "Copied!",
"webhook.generate": "Generate secret",
"webhook.regenerate": "Regenerate",
"webhook.disable": "Disable",
"webhook.usageTitle": "How to use",
"webhook.usageGitHub":
"GitHub: repo/org Settings → Webhooks → Add webhook → payload URL = the URL above, Content type = application/json, Secret = the secret above.",
"webhook.usageGitea": "Gitea: repo Settings → Webhooks → Add Webhook → same URL + secret.",
"webhook.usageCustom":
"Custom: POST any JSON signed with X-WebHooker-Signature (sha256 HMAC). Create a route with event = custom to receive it:",
"groups.empty": "No groups yet. Groups scope routes by org/user and delegate access.",
"groups.createFirst": "Create your first group",
"groups.admins": "ADMINS",
"groups.owners": "OWNERS",
"groups.members": "MEMBERS",
"groups.myRole": "MY ROLE",
"groups.any": "any",
"groups.open": "Open",
"groups.delete": "Delete group",
"group.notFound": "This group does not exist, or you have no access to it",
"group.allGroups": "All groups",
"group.routeCount": "{count} routes",
"group.routesIn": "Routes in {name}",
"routes.emptyGroup": "No routes in this group yet.",
"routes.createFirst": "Create your first route",
"routes.reorder": "Reorder",
"routes.reorderHint": "Drag routes by their handle to change the evaluation order, then save.",
"routes.reorderKeyboardHint": "Press Arrow Up or Arrow Down to move this route.",
"routes.reorderSave": "Save order",
"routes.reorderCancel": "Cancel",
"routes.dragHandle": "Reorder {name}",
"routes.moved": "{name} moved to position {n}",
"routes.delete": "Delete route",
"route.untitled": "(untitled)",
"route.noFilters": "no filters",
"route.channel": "CHANNEL",
"route.thread": "THREAD",
"route.chat": "CHAT",
"route.topic": "TOPIC",
"route.feishu": "Feishu",
"route.fallback": "fallback",
"route.stop": "stop",
"route.moveUp": "Move up",
"route.moveDown": "Move down",
"filter.event": "Event",
"filter.repo": "Repo",
"filter.actor": "Actor",
"filter.action": "Action",
"filter.branch": "Branch",
"filter.keyword": "Keyword",
"filter.field": "Field",
"filterOp.eq": "equals",
"filterOp.ne": "not equals",
"filterOp.contains": "contains",
"filterOp.startsWith": "starts with",
"filterOp.endsWith": "ends with",
"filterOp.regex": "matches regex",
"filterOp.gt": "greater than",
"filterOp.gte": "greater or equal",
"filterOp.lt": "less than",
"filterOp.lte": "less or equal",
"filterOp.in": "in",
"filterOp.exists": "exists",
"filterNode.all": "All of",
"filterNode.any": "Any of",
"filterNode.not": "not",
"filterNode.is": "is",
"filterNode.matches": "matches",
"filterNode.and": "and",
"filterNode.or": "or",
"filterNode.unwrap": "unwrap",
"filterNode.empty": "No conditions",
"routeEditor.editTitle": "Edit route",
"routeEditor.newTitle": "New route",
"routeEditor.eyebrow": "Route",
"routeEditor.close": "Close",
"routeEditor.sectionBasic": "Basic",
"routeEditor.sectionOptions": "Options",
"routeEditor.sectionFilters": "Filters",
"routeEditor.sectionTargets": "Targets",
"routeEditor.templates": "Templates",
"routeEditor.templatesNote": "(click to prefill filters)",
"templates.push": "Push",
"templates.pullRequest": "Pull Request",
"templates.issues": "Issues",
"templates.release": "Release",
"templates.workflow": "Workflow",
"templates.checks": "Check Suite",
"templates.deployment": "Deployment",
"templates.comments": "Comments",
"templates.reviews": "Review",
"templates.starFork": "Star / Fork",
"templates.createDelete": "Create / Delete",
"templates.member": "Member",
"templates.commitComment": "Commit Comment",
"templates.customWebhook": "Custom Webhook",
"routeEditor.name": "Name",
"routeEditor.namePlaceholder": "My Route",
"routeEditor.id": "ID",
"routeEditor.idHint": "Unique, use a-z / 0-9 / dashes",
"routeEditor.enabled": "Route enabled",
"routeEditor.fallback": "Fallback route",
"routeEditor.fallbackHint":
"Only fires when no regular (non-fallback) route in this group matched; its filters still apply",
"routeEditor.stop": "Stop on match",
"routeEditor.stopHint":
"When matched, later routes in this group are not evaluated for this event",
"routeEditor.filters": "Filters",
"routeEditor.filtersNote": "(all must match · AND)",
"routeEditor.matchPlaceholder": "match value (* ? wildcards, /regex/)",
"routeEditor.not": "NOT",
"routeEditor.addFilter": "+ Add filter",
"routeEditor.discordRoles": "Discord role mentions",
"routeEditor.discordRolesNote": "(optional · comma-separated)",
"routeEditor.discordRolesPlaceholder": "123456789012345678, 987654321098765432",
"routeEditor.discordRolesHint":
"When this route fires, the listed roles are pinged in Discord targets.",
"routeEditor.channel": "Channel ID",
"routeEditor.channelPlaceholder": "Discord channel ID",
"routeEditor.thread": "Thread ID",
"routeEditor.threadNote": "(optional)",
"routeEditor.threadPlaceholder": "Optional thread ID",
"routeEditor.platform": "Platform",
"routeEditor.platformFeishu": "Feishu",
"routeEditor.chat": "Chat ID",
"routeEditor.chatPlaceholder": "Telegram group chat ID",
"routeEditor.topic": "Topic ID",
"routeEditor.topicNote": "(optional)",
"routeEditor.topicPlaceholder": "Optional topic (message_thread_id)",
"routeEditor.feishuChatPlaceholder": "Feishu chat ID (chat_id)",
"routeEditor.errChat": "Target {n} chat ID is required",
"routeEditor.targets": "Targets",
"routeEditor.targetsNote": "(one or more destinations)",
"routeEditor.addTarget": "+ Add target",
"routeEditor.errTargets": "Add at least one target",
"routeEditor.cancel": "Cancel",
"routeEditor.save": "Save route",
"routeEditor.errFilterMatch": "Filter {n} needs a match value",
"routeEditor.errAddFilter": "Add at least one filter",
"routeEditor.errIdFormat": "ID must be a-z / 0-9 / dashes",
"routeEditor.errName": "Name is required",
"routeEditor.errChannel": "Target {n} channel ID is required",
"routeEditor.addLeaf": "Add condition",
"routeEditor.addGroup": "Add group",
"routeEditor.addNot": "Add not",
"routeEditor.remove": "Remove",
"routeEditor.removeCondition": "Delete condition",
"routeEditor.removeGroup": "Delete condition group",
"routeEditor.removeTarget": "Remove target",
"routeEditor.path": "Field path",
"routeEditor.values": "Values",
"routeEditor.notHint": "Negate this condition",
"routeEditor.errDraft": "Add (press Enter) or clear the filter value still being typed",
"routeEditor.errInvalidValue": 'Invalid value "{value}": {reason}',
"routeEditor.op": "Operator",
"routeEditor.filterType": "Filter type",
"routeEditor.pathPlaceholder": "payload.path",
"routeEditor.valuesPlaceholder": "Type a value and press Enter",
"routeEditor.testMatch": "Test match",
"routeEditor.testEvent": "Event (optional)",
"routeEditor.testPayloadPlaceholder": "Paste a JSON webhook payload",
"routeEditor.testRun": "Run test",
"routeEditor.testMatched": "Matches",
"routeEditor.testNotMatched": "Does not match",
"routeEditor.testInvalidJson": "Invalid JSON",
"routeEditor.testEventInvalid": "Fix or clear the event type first",
"routeEditor.fragments": "Fragments",
"routeEditor.fragmentsPresets": "Presets",
"routeEditor.fragmentsEmpty": "No fragments yet",
"routeEditor.fragmentsLoadFailed": "Fragments could not be loaded: {error}",
"routeEditor.fragmentsRetry": "Retry",
"routeEditor.fragmentsInsert": "Insert",
"routeEditor.fragmentsDelete": "Delete",
"routeEditor.fragmentsSave": "Save as fragment",
"routeEditor.fragmentsNamePlaceholder": "Fragment name",
"routeEditor.fragmentsNameRequired": "Fragment name is required",
"routeEditor.fragmentsNotReady": "The group's fragments are still loading; try again in a moment",
"routeEditor.errPath": "Field filters need a path",
"routeEditor.errValues": "Add at least one value",
"routeEditor.errGroupEmpty": "Group needs at least one condition",
"combo.empty": "No matches",
"combo.typeToAdd": "Type a value to add it",
"combo.useValue": "Use “{value}”",
"combo.remove": "Remove {value}",
"combo.pending": 'Not added yet: press Enter to add "{value}"',
"valid.tooLong": "Patterns longer than 200 characters never match",
"valid.regex": "Invalid regular expression",
"valid.number": "Comparison operators need a number",
"valid.event": "Event names use letters, digits and _ (or * ? wildcards, /regex/)",
"valid.eventName": "Event names use letters, digits and _",
"valid.branch": "Branch names cannot contain spaces or ~ ^ : \\ [",
"valid.branchLiteral":
"This operator compares text as-is: branch names never contain * ? [ ~ ^ : \\ or spaces",
"fragmentPreset.prBot": "PR by a bot",
"fragmentPreset.dependabot": "Dependabot PR",
"fragmentPreset.releasePublished": "Release published",
"fragmentPreset.pushMain": "Push to main",
"fragmentPreset.issueBug": "Issue labeled bug",
"groupEditor.editTitle": "Edit group",
"groupEditor.newTitle": "New group",
"groupEditor.eyebrow": "Group",
"groupEditor.close": "Close",
"groupEditor.sectionBasic": "Basic",
"groupEditor.sectionPreferences": "Preferences",
"groupEditor.sectionAccess": "Access & members",
"groupEditor.sectionProviders": "Providers",
"groupEditor.sectionLog": "Logging",
"groupEditor.name": "Name",
"groupEditor.namePlaceholder": "My Team",
"groupEditor.id": "ID",
"groupEditor.idPlaceholder": "my-team",
"groupEditor.idHint": "Unique, use a-z / 0-9 / dashes",
"groupEditor.renameHint":
"Changing the id also updates routes, webhook secrets and invites that reference this group.",
"groupEditor.language": "Message language",
"groupEditor.langPlaceholder": "en",
"groupEditor.langHint": "en or zh; custom via KV i18n:<lang>",
"groupEditor.emojiNote": "(default on)",
"groupEditor.emojiLabel": "Show emojis in messages",
"groupEditor.admins": "Group admins",
"groupEditor.adminsNote": "(GitHub login or user id, comma-separated)",
"groupEditor.adminsPlaceholder": "octocat, 12345",
"groupEditor.adminsHint": "These users can view logs and edit this group's routes.",
"groupEditor.owners": "Owner scope",
"groupEditor.ownersNote": "(GitHub org / user logins, comma-separated)",
"groupEditor.ownersSuperOnly": "(only super admins may change)",
"groupEditor.ownersPlaceholder": "my-org, some-user",
"groupEditor.ownersHint":
"Only webhook events from these orgs/users enter this group's routes. Leave empty for no restriction.",
"groupEditor.membersNote": "Members",
"groupEditor.membersHint": "(owner / admin / viewer)",
"groupEditor.membersGoPanel": "Manage members and invite links from the group page.",
"groupEditor.providers": "Source platforms",
"groupEditor.providersNote": "(leave both unchecked = all)",
"groupEditor.providersHint":
"Only webhook events from the checked forges (GitHub / Gitea) enter this group's routes.",
"groupEditor.installationId": "GitHub App installation ID",
"groupEditor.installationIdNote": "(optional)",
"groupEditor.installationIdPlaceholder": "e.g. 12345678",
"groupEditor.installationIdHint":
"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.forgeSources": "Forge hosts",
"groupEditor.forgeSourcesNote": "(optional — label events by their host)",
"groupEditor.forgeSourcesHost": "git.example.com",
"groupEditor.forgeSourcesName": "Optional display name",
"groupEditor.forgeSourcesAdd": "+ Add host",
"groupEditor.forgeSourcesRemove": "Remove host",
"groupEditor.forgeSourcesHint":
"Events whose repository host matches an entry are labeled in the message footer with its display name (or the host when none is set) — e.g. git1.example.com and git2.example.com for two Gitea instances. GitHub events match github.com.",
"groupEditor.errForgeSourceHost": "Every forge host must be a valid hostname",
"groupEditor.logTarget": "Webhook log channel",
"groupEditor.logTargetNote": "(optional)",
"groupEditor.logDisabled": "— Disabled —",
"groupEditor.logFeishu": "Feishu",
"groupEditor.logTargetHint":
"A Discord channel/thread, Telegram chat/topic or Feishu chat that receives a summary of every webhook this group's routes dispatch.",
"groupEditor.errLogChannel": "Log channel ID is required when Discord is selected",
"groupEditor.errLogChat": "Log chat ID is required when Telegram is selected",
"groupEditor.errLogFeishuChat": "Log chat ID is required when Feishu is selected",
"groupEditor.cancel": "Cancel",
"groupEditor.save": "Save group",
"groupEditor.errIdFormat": "ID must be a-z / 0-9 / dashes",
"groupEditor.errName": "Name is required",
"logs.lastSends": "LAST {n} SENDS",
"logs.refresh": "⟳ Refresh",
"logs.empty": "No send records yet — trigger a webhook to see results.",
"logs.repo": "REPO",
"logs.target": "TARGET",
"logs.detailTitle": "Send Detail",
"logs.detailMissing": "Could not load this entry.",
"logs.id": "ID",
"logs.time": "Time",
"logs.route": "Route",
"logs.event": "Event",
"logs.action": "Action",
"logs.actor": "Actor",
"logs.deliveryId": "Delivery ID",
"logs.platform": "Platform",
"logs.status": "HTTP Status",
"logs.messageId": "Message ID",
"logs.errorCode": "Error Code",
"logs.duration": "Duration",
"logs.attempts": "Attempts",
"logs.ok": "Result",
"logs.yes": "OK",
"logs.no": "Failed",
"logs.error": "Error",
"logs.detail": "Extra Info",
"logs.filterGroup": "Group",
"logs.allGroups": "All groups",
"audit.title": "AUDIT LOG",
"audit.empty": "No audit entries yet.",
"audit.time": "Time",
"audit.actor": "Actor",
"audit.action": "Action",
"audit.target": "Target",
"audit.group": "Group",
"audit.detail": "Detail",
"audit.filterGroup": "Group",
"audit.allGroups": "All groups",
"audit.refresh": "⟳ Refresh",
"toast.routesSaved": "Routes saved",
"toast.groupsBusy": "Another group change is still saving; try again in a moment",
"toast.routesNotReady": "The routes are still loading or saving; try again in a moment",
"toast.routeDeleted": "Route deleted",
"toast.groupSaved": "Groups saved",
"toast.groupDeleted": "Group deleted",
"toast.routeIdExists": "Route ID already exists",
"toast.routeChanged":
"This route was changed by someone else since you opened it. Close the editor and open it again.",
"toast.groupIdExists": "Group ID already exists",
"toast.saveFailed": "Save failed: {msg}",
"toast.deleteFailed": "Delete failed: {msg}",
"toast.orderSaved": "Route order saved",
"confirm.deleteRoute": 'Delete route "{name}"?',
"confirm.deleteGroup": 'Delete group "{name}"?',
"confirm.deleteGroupWarn": " {n} route(s) reference it and will lose their group.",
"confirm.cancel": "Cancel",
"confirm.delete": "Delete",
"confirm.removeCondition": "Delete this condition?",
"confirm.removeFilterGroup": "Delete this condition group and everything in it?",
"confirm.removeTarget": "Remove target {n}?",
"confirm.deleteFragment": 'Delete fragment "{name}"?',
"confirm.removeMember": 'Remove member "{name}"?',
"confirm.revokeInvite": "Revoke this invite link?",
"confirm.disableWebhook": "Disable this group's webhook endpoint?",
"confirm.disableWebhookDetail": "The secret is deleted; senders still using it will be rejected.",
"confirm.removeForgeSource": 'Remove host "{name}"?',
"confirm.leaveUnsaved": "Leave this page?",
"confirm.leaveUnsavedDesc": "Your unsaved changes will be lost.",
"confirm.leave": "Leave",
"confirm.signOut": "Sign out of the console?",
};
const zh: Dict = {
"app.tagline": "配置控制台",
"app.newRoute": "新建路由",
"app.newGroup": "新建分组",
"app.signOut": "退出登录",
"app.langToggle": "EN",
"login.title": "配置控制台",
"login.forbidden": "访问被拒绝 —— 该 GitHub 账号不是超级管理员或分组管理员。",
"login.prompt": "使用 GitHub 登录以管理路由。",
"login.button": "使用 GitHub 登录",
"tab.overview": "概览",
"tab.groups": "分组",
"tab.logs": "发送日志",
"tab.audit": "审计日志",
"tab.metrics": "统计",
"metrics.title": "投递统计",
"metrics.successRate": "成功率",
"overview.routes": "路由",
"overview.recent": "最近投递",
"overview.viewAll": "查看全部",
"overview.refreshed": "已刷新",
"overview.refreshFailed": "刷新失败",
"overview.loadFailed": "部分数据加载失败,当前显示的内容可能不完整或已过期:{error}",
"overview.thRoute": "路由",
"overview.thGroup": "分组",
"overview.thEvents": "事件",
"overview.thTargets": "目标",
"overview.thState": "状态",
"metrics.refresh": "刷新",
"metrics.total": "总计",
"metrics.ok": "成功",
"metrics.failed": "失败",
"metrics.failureRate": "失败率",
"metrics.avgDuration": "平均耗时",
"metrics.avgAttempts": "平均尝试次数",
"metrics.byPlatform": "按平台",
"metrics.byEvent": "按事件",
"metrics.byStatus": "按状态",
"metrics.recentFailures": "最近失败",
"metrics.empty": "暂无投递数据",
"metrics.filterGroup": "分组",
"metrics.allGroups": "全部分组",
"metrics.sortTotal": "按总量",
"metrics.sortFailed": "按失败",
"metrics.sortRate": "按失败率",
"metrics.retryRate": "重试率",
"event.push": "推送",
"event.pull_request": "拉取请求",
"event.pull_request_review": "PR 审查",
"event.pull_request_review_comment": "PR 审查评论",
"event.issues": "议题",
"event.issue_comment": "议题评论",
"event.workflow_run": "工作流运行",
"event.workflow_job": "工作流任务",
"event.status": "提交状态",
"event.deployment": "部署",
"event.deployment_status": "部署状态",
"event.ping": "心跳",
"event.release": "发布",
"event.create": "创建",
"event.delete": "删除",
"event.star": "星标",
"event.fork": "复刻",
"event.check_run": "检查运行",
"event.check_suite": "检查套件",
"event.commit_comment": "提交评论",
"event.member": "成员",
"event.label": "标签",
"event.milestone": "里程碑",
"event.discussion": "讨论",
"event.discussion_comment": "讨论评论",
"event.repository": "仓库",
"event.code_scanning_alert": "代码扫描",
"event.dependabot_alert": "依赖告警",
"event.custom": "自定义",
"status.loading": "加载中",
"status.connected": "已连接",
"kpi.groups": "分组",
"kpi.routes": "路由",
"role.owner": "拥有者",
"role.admin": "管理员",
"role.viewer": "只读",
"roles.owner": "拥有者",
"roles.admin": "管理员",
"roles.viewer": "只读",
"members.title": "成员",
"members.note": "(角色:owner = 完全控制 · admin = 编辑路由 · viewer = 只读)",
"members.empty": "还没有成员 —— 添加第一位 owner 或分享邀请链接。",
"members.add": "添加成员",
"members.addPlaceholder": "GitHub 登录名",
"members.addBtn": "添加",
"members.role": "角色",
"members.you": "(我)",
"members.remove": "移除",
"members.invites": "邀请链接",
"members.inviteNote": "(一次性 · 7 天内有效)",
"members.inviteRole": "邀请为",
"members.createInvite": "生成邀请链接",
"members.copyLink": "复制",
"members.copied": "已复制!",
"members.revoke": "撤销",
"members.noInvites": "暂无待接受的邀请。",
"members.invitesFailed": "邀请列表加载失败:{error}",
"members.errSelfOwner": "你必须保留本组的 owner 身份。",
"members.errOwner": "分组至少需要一位 owner。",
"members.errLastOwner": "不能移除最后一位 owner。",
"members.inviteOk": "邀请已接受 —— 欢迎!",
"members.inviteBad": "该邀请无效或已过期。",
"install.ok": "GitHub App 安装已注册 —— 分组已创建并绑定到该安装。",
"install.forbidden": "你的 GitHub 账号无权管理该安装,未进行绑定。请使用该安装的管理员账号登录。",
"webhook.title": "Webhook 入口",
"webhook.note": "(分组独立的 URL + secret)",
"webhook.empty": "未配置。生成 secret 即可启用该分组的独立 webhook 入口。",
"webhook.url": "URL",
"webhook.secret": "Secret",
"webhook.noSecret": "—— 未配置 secret ——",
"webhook.secretHidden": "secret 仅在生成/重新生成时显示一次。如需查看请重新生成。",
"webhook.copy": "复制",
"webhook.copied": "已复制!",
"webhook.generate": "生成 secret",
"webhook.regenerate": "重新生成",
"webhook.disable": "停用",
"webhook.usageTitle": "使用方法",
"webhook.usageGitHub":
"GitHub:仓库/组织 Settings → Webhooks → Add webhook → Payload URL 填上面的 URL,Content type 选 application/json,Secret 填上面的 secret。",
"webhook.usageGitea": "Gitea:仓库 Settings → Webhooks → Add Webhook,填写同样的 URL 和 secret。",
"webhook.usageCustom":
"自定义:用 X-WebHooker-Signature(sha256 HMAC)签名任意 JSON 后 POST。创建一条 event = custom 的路由即可接收:",
"groups.empty": "暂无分组。分组可按组织或用户划分路由并分配管理权限。",
"groups.createFirst": "创建第一个分组",
"groups.admins": "管理员",
"groups.owners": "来源",
"groups.members": "成员",
"groups.myRole": "我的角色",
"groups.any": "任意",
"groups.open": "进入",
"groups.delete": "删除分组",
"group.notFound": "分组不存在,或你没有访问权限",
"group.allGroups": "全部分组",
"group.routeCount": "{count} 条路由",
"group.routesIn": "{name} 的路由",
"routes.emptyGroup": "该分组还没有路由。",
"routes.createFirst": "创建第一个路由",
"routes.reorder": "调整顺序",
"routes.reorderHint": "拖动手柄调整路由的评估顺序,完成后保存。",
"routes.reorderKeyboardHint": "按上下方向键移动该路由。",
"routes.reorderSave": "保存顺序",
"routes.reorderCancel": "取消",
"routes.dragHandle": "调整“{name}”的顺序",
"routes.moved": "“{name}”已移到第 {n} 位",
"routes.delete": "删除路由",
"route.untitled": "(未命名)",
"route.noFilters": "无过滤器",
"route.channel": "频道",
"route.thread": "子区",
"route.chat": "群组",
"route.topic": "话题",
"route.feishu": "飞书",
"route.fallback": "兜底",
"route.stop": "停止",
"route.moveUp": "上移",
"route.moveDown": "下移",
"filter.event": "事件",
"filter.repo": "仓库",
"filter.actor": "操作者",
"filter.action": "动作",
"filter.branch": "分支",
"filter.keyword": "关键词",
"filter.field": "字段",
"filterOp.eq": "等于",
"filterOp.ne": "不等于",
"filterOp.contains": "包含",
"filterOp.startsWith": "开头是",
"filterOp.endsWith": "结尾是",
"filterOp.regex": "正则匹配",
"filterOp.gt": "大于",
"filterOp.gte": "大于等于",
"filterOp.lt": "小于",
"filterOp.lte": "小于等于",
"filterOp.in": "属于",
"filterOp.exists": "存在",
"filterNode.all": "全部满足",
"filterNode.any": "任一满足",
"filterNode.not": "非",
"filterNode.is": "是",
"filterNode.matches": "匹配",
"filterNode.and": "且",
"filterNode.or": "或",
"filterNode.unwrap": "取消非",
"filterNode.empty": "暂无条件",
"routeEditor.editTitle": "编辑路由",
"routeEditor.newTitle": "新建路由",
"routeEditor.eyebrow": "路由",
"routeEditor.close": "关闭",
"routeEditor.sectionBasic": "基本信息",
"routeEditor.sectionOptions": "选项",
"routeEditor.sectionFilters": "过滤器",
"routeEditor.sectionTargets": "目标",
"routeEditor.templates": "模板",
"routeEditor.templatesNote": "(点击可预填过滤器)",
"templates.push": "推送",
"templates.pullRequest": "拉取请求",
"templates.issues": "议题",
"templates.release": "发布",
"templates.workflow": "工作流",
"templates.checks": "检查套件",
"templates.deployment": "部署",
"templates.comments": "评论",
"templates.reviews": "评审",
"templates.starFork": "星标 / 复刻",
"templates.createDelete": "创建 / 删除",
"templates.member": "协作者",
"templates.commitComment": "提交评论",
"templates.customWebhook": "自定义 Webhook",
"routeEditor.name": "名称",
"routeEditor.namePlaceholder": "我的路由",
"routeEditor.id": "ID",
"routeEditor.idHint": "唯一,使用 a-z / 0-9 / 短横线",
"routeEditor.enabled": "启用路由",
"routeEditor.fallback": "兜底路由",
"routeEditor.fallbackHint":
"仅当本分组没有普通(非兜底)路由匹配该事件时才发送,其过滤器仍会生效",
"routeEditor.stop": "匹配后停止",
"routeEditor.stopHint": "该路由匹配后,不再评估本分组的后续路由",
"routeEditor.filters": "过滤器",
"routeEditor.filtersNote": "(全部匹配 · AND)",
"routeEditor.matchPlaceholder": "匹配值(支持 * ? 通配符、/正则/)",
"routeEditor.not": "取反",
"routeEditor.addFilter": "+ 添加过滤器",
"routeEditor.discordRoles": "Discord 身份组提醒",
"routeEditor.discordRolesNote": "(可选 · 逗号分隔)",
"routeEditor.discordRolesPlaceholder": "123456789012345678, 987654321098765432",
"routeEditor.discordRolesHint": "当该路由触发时,会在 Discord 目标中提醒(@)这些身份组。",
"routeEditor.channel": "频道 ID",
"routeEditor.channelPlaceholder": "Discord 频道 ID",
"routeEditor.thread": "子区 ID",
"routeEditor.threadNote": "(可选)",
"routeEditor.threadPlaceholder": "可选的子区 ID",
"routeEditor.platform": "平台",
"routeEditor.platformFeishu": "飞书",
"routeEditor.chat": "群组 ID",
"routeEditor.chatPlaceholder": "Telegram 群组聊天 ID",
"routeEditor.topic": "话题 ID",
"routeEditor.topicNote": "(可选)",
"routeEditor.topicPlaceholder": "可选的话题 (message_thread_id)",
"routeEditor.feishuChatPlaceholder": "飞书群组 ID (chat_id)",
"routeEditor.errChat": "第 {n} 个目标群组 ID 为必填项",
"routeEditor.targets": "目标",
"routeEditor.targetsNote": "(一个或多个推送目标)",
"routeEditor.addTarget": "+ 添加目标",
"routeEditor.errTargets": "至少添加一个目标",
"routeEditor.cancel": "取消",
"routeEditor.save": "保存路由",
"routeEditor.errFilterMatch": "第 {n} 个过滤器需要匹配值",
"routeEditor.errAddFilter": "至少添加一个过滤器",
"routeEditor.errIdFormat": "ID 只能是 a-z / 0-9 / 短横线",
"routeEditor.errName": "名称为必填项",
"routeEditor.errChannel": "第 {n} 个目标频道 ID 为必填项",
"routeEditor.addLeaf": "添加条件",
"routeEditor.addGroup": "添加分组",
"routeEditor.addNot": "添加非",
"routeEditor.remove": "删除",
"routeEditor.removeCondition": "删除条件",
"routeEditor.removeGroup": "删除条件组",
"routeEditor.removeTarget": "删除目标",
"routeEditor.path": "字段路径",
"routeEditor.values": "匹配值",
"routeEditor.notHint": "对该条件取反",
"routeEditor.errDraft": "请先确认(回车)或清除尚未添加的过滤值",
"routeEditor.errInvalidValue": "无效的值“{value}”:{reason}",
"routeEditor.op": "操作符",
"routeEditor.filterType": "过滤类型",
"routeEditor.pathPlaceholder": "payload.path",
"routeEditor.valuesPlaceholder": "输入值后回车",
"routeEditor.testMatch": "测试匹配",
"routeEditor.testEvent": "事件类型(可选)",
"routeEditor.testPayloadPlaceholder": "粘贴 JSON webhook 事件样本",
"routeEditor.testRun": "运行测试",
"routeEditor.testMatched": "匹配",
"routeEditor.testNotMatched": "不匹配",
"routeEditor.testInvalidJson": "无效的 JSON",
"routeEditor.testEventInvalid": "请先修正或清空事件类型",
"routeEditor.fragments": "过滤器片段",
"routeEditor.fragmentsPresets": "预设",
"routeEditor.fragmentsEmpty": "暂无片段",
"routeEditor.fragmentsLoadFailed": "片段加载失败:{error}",
"routeEditor.fragmentsRetry": "重试",
"routeEditor.fragmentsInsert": "插入",
"routeEditor.fragmentsDelete": "删除",
"routeEditor.fragmentsSave": "存为片段",
"routeEditor.fragmentsNamePlaceholder": "片段名称",
"routeEditor.fragmentsNameRequired": "请填写片段名称",
"routeEditor.fragmentsNotReady": "分组的片段仍在加载,请稍后再试",
"routeEditor.errPath": "字段过滤需要路径",
"routeEditor.errValues": "至少需要一个值",
"routeEditor.errGroupEmpty": "分组至少需要一个条件",
"combo.empty": "无匹配项",
"combo.typeToAdd": "输入内容后即可添加",
"combo.useValue": "使用“{value}”",
"combo.remove": "移除 {value}",
"combo.pending": "尚未添加:按回车添加“{value}”",
"valid.tooLong": "超过 200 个字符的模式永远不会匹配",
"valid.regex": "无效的正则表达式",
"valid.number": "比较运算需要数字",
"valid.event": "事件名只能包含字母、数字和 _(也可用 * ? 通配符或 /正则/)",
"valid.eventName": "事件名只能包含字母、数字和 _",
"valid.branch": "分支名不能包含空格或 ~ ^ : \\ [",
"valid.branchLiteral": "该运算符按字面比较:分支名不会包含 * ? [ ~ ^ : \\ 或空格",
"fragmentPreset.prBot": "机器人提交的 PR",
"fragmentPreset.dependabot": "Dependabot PR",
"fragmentPreset.releasePublished": "发布 Release",
"fragmentPreset.pushMain": "推送到 main 分支",
"fragmentPreset.issueBug": "标记 bug 的 Issue",
"groupEditor.editTitle": "编辑分组",
"groupEditor.newTitle": "新建分组",
"groupEditor.eyebrow": "分组",
"groupEditor.close": "关闭",
"groupEditor.sectionBasic": "基本信息",
"groupEditor.sectionPreferences": "偏好",
"groupEditor.sectionAccess": "访问与成员",
"groupEditor.sectionProviders": "提供方",
"groupEditor.sectionLog": "日志",
"groupEditor.name": "名称",
"groupEditor.namePlaceholder": "我的团队",
"groupEditor.id": "ID",
"groupEditor.idPlaceholder": "my-team",
"groupEditor.idHint": "唯一,使用 a-z / 0-9 / 短横线",
"groupEditor.renameHint": "修改 id 会同步更新引用该分组的路由、webhook secret 与邀请链接。",
"groupEditor.language": "消息语言",
"groupEditor.langPlaceholder": "zh",
"groupEditor.langHint": "en 或 zh;可通过 KV i18n:<lang> 自定义",
"groupEditor.emojiNote": "(默认开启)",
"groupEditor.emojiLabel": "消息中显示表情符号",
"groupEditor.admins": "分组管理员",
"groupEditor.adminsNote": "(GitHub 登录名或用户 ID,逗号分隔)",
"groupEditor.adminsPlaceholder": "octocat, 12345",
"groupEditor.adminsHint": "这些用户可以查看日志并编辑本分组的路由。",
"groupEditor.owners": "来源限定",
"groupEditor.ownersNote": "(GitHub 组织 / 用户登录名,逗号分隔)",
"groupEditor.ownersSuperOnly": "(仅超级管理员可修改)",
"groupEditor.ownersPlaceholder": "my-org, some-user",
"groupEditor.ownersHint":
"只有来自这些组织/用户的 webhook 事件才会进入本分组的路由。留空表示不限制。",
"groupEditor.membersNote": "成员",
"groupEditor.membersHint": "(owner / admin / viewer)",
"groupEditor.membersGoPanel": "请在分组页面管理成员与邀请链接。",
"groupEditor.providers": "来源平台",
"groupEditor.providersNote": "(都不勾选 = 全部来源)",
"groupEditor.providersHint":
"只有来自所勾选 forge(GitHub / Gitea)的 webhook 事件才会进入本分组的路由。",
"groupEditor.installationId": "GitHub App 安装 ID",
"groupEditor.installationIdNote": "(可选)",
"groupEditor.installationIdPlaceholder": "如 12345678",
"groupEditor.installationIdHint":
"将本分组绑定到一个 GitHub App 安装(安装了 App 的组织/用户)。只有来自该安装的事件才会进入本分组的路由;留空表示接受任意安装(仍受来源限定过滤)。",
"groupEditor.errInstallationId": "安装 ID 必须为正整数",
"groupEditor.emoji": "消息中显示表情符号",
"groupEditor.forgeSources": "来源主机",
"groupEditor.forgeSourcesNote": "(可选 —— 按主机标识事件)",
"groupEditor.forgeSourcesHost": "git.example.com",
"groupEditor.forgeSourcesName": "可选显示名称",
"groupEditor.forgeSourcesAdd": "+ 添加主机",
"groupEditor.forgeSourcesRemove": "删除主机",
"groupEditor.forgeSourcesHint":
"仓库主机与条目匹配的事件,会在消息底部用该条目的显示名称标注(未填名称则用主机名)——例如两个 Gitea 实例可分别填 git1.example.com 和 git2.example.com。GitHub 事件匹配 github.com。",
"groupEditor.errForgeSourceHost": "每个来源主机必须是有效的主机名",
"groupEditor.logTarget": "Webhook 日志频道",
"groupEditor.logTargetNote": "(可选)",
"groupEditor.logDisabled": "— 未启用 —",
"groupEditor.logFeishu": "飞书",
"groupEditor.logTargetHint":
"一个 Discord 频道/子区、Telegram 群组/话题或飞书群组,本分组路由分发(dispatch)的每个 webhook 都会向其发送摘要。",
"groupEditor.errLogChannel": "选择 Discord 时必须填写日志频道 ID",
"groupEditor.errLogChat": "选择 Telegram 时必须填写日志群组 ID",
"groupEditor.errLogFeishuChat": "选择飞书时必须填写日志群组 ID",
"groupEditor.cancel": "取消",
"groupEditor.save": "保存分组",
"groupEditor.errIdFormat": "ID 只能是 a-z / 0-9 / 短横线",
"groupEditor.errName": "名称为必填项",
"logs.lastSends": "最近 {n} 条发送",
"logs.refresh": "⟳ 刷新",
"logs.empty": "还没有发送记录 —— 触发一次 webhook 即可查看结果。",
"logs.repo": "仓库",
"logs.target": "目标",
"logs.detailTitle": "发送详情",
"logs.detailMissing": "无法加载该条记录。",
"logs.id": "ID",
"logs.time": "时间",
"logs.route": "路由",
"logs.event": "事件",
"logs.action": "动作",
"logs.actor": "操作者",
"logs.deliveryId": "Delivery ID",
"logs.platform": "平台",
"logs.status": "HTTP 状态码",
"logs.messageId": "消息 ID",
"logs.errorCode": "错误码",
"logs.duration": "耗时",
"logs.attempts": "尝试次数",
"logs.ok": "结果",
"logs.yes": "成功",
"logs.no": "失败",
"logs.error": "错误信息",
"logs.detail": "附加信息",
"logs.filterGroup": "分组",
"logs.allGroups": "全部分组",
"audit.title": "审计日志",
"audit.empty": "暂无审计记录。",
"audit.time": "时间",
"audit.actor": "操作者",
"audit.action": "动作",
"audit.target": "对象",
"audit.group": "分组",
"audit.detail": "详情",
"audit.filterGroup": "分组",
"audit.allGroups": "全部分组",
"audit.refresh": "⟳ 刷新",
"toast.routesSaved": "路由已保存",
"toast.groupsBusy": "另一项分组修改仍在保存,请稍后再试",
"toast.routesNotReady": "路由仍在加载或保存中,请稍后再试",
"toast.routeDeleted": "路由已删除",
"toast.groupSaved": "分组已保存",
"toast.groupDeleted": "分组已删除",
"toast.routeIdExists": "路由 ID 已存在",
"toast.routeChanged": "该路由在你打开后已被他人修改。请关闭编辑器后重新打开。",
"toast.groupIdExists": "分组 ID 已存在",
"toast.saveFailed": "保存失败:{msg}",
"toast.deleteFailed": "删除失败:{msg}",
"toast.orderSaved": "路由顺序已保存",
"confirm.deleteRoute": "确定删除路由“{name}”吗?",
"confirm.deleteGroup": "确定删除分组“{name}”吗?",
"confirm.deleteGroupWarn": " 有 {n} 条路由引用它,将失去所属分组。",
"confirm.cancel": "取消",
"confirm.delete": "删除",
"confirm.removeCondition": "确定删除该条件吗?",
"confirm.removeFilterGroup": "确定删除该条件组及其中的全部条件吗?",
"confirm.removeTarget": "确定删除第 {n} 个目标吗?",
"confirm.deleteFragment": "确定删除片段“{name}”吗?",
"confirm.removeMember": "确定移除成员“{name}”吗?",
"confirm.revokeInvite": "确定撤销该邀请链接吗?",
"confirm.disableWebhook": "确定停用该分组的 webhook 入口吗?",
"confirm.disableWebhookDetail": "secret 将被删除,仍在使用它的发送方会被拒绝。",
"confirm.removeForgeSource": "确定删除来源主机“{name}”吗?",
"confirm.leaveUnsaved": "确定离开此页面吗?",
"confirm.leaveUnsavedDesc": "尚未保存的修改将会丢失。",
"confirm.leave": "离开",
"confirm.signOut": "确定退出登录吗?",
};
const messages: Record<Locale, Dict> = { en, zh };
function detectLocale(): Locale {
if (typeof window === "undefined") return "zh";
const stored = window.localStorage.getItem(STORAGE_KEY);
if (stored === "en" || stored === "zh") return stored;
const nav = (window.navigator.language || "").toLowerCase();
return nav.startsWith("zh") ? "zh" : "en";
}
export function useI18n() {
const locale = useState<Locale>("wh-locale", detectLocale);
function setLocale(next: Locale): void {
locale.value = next;
if (typeof window !== "undefined") window.localStorage.setItem(STORAGE_KEY, next);
}
function toggle(): void {
setLocale(locale.value === "zh" ? "en" : "zh");
}
function t(key: string, params?: Record<string, string | number>): string {
const dict = messages[locale.value] ?? en;
let str = dict[key] ?? en[key] ?? key;
if (params) {
for (const [k, v] of Object.entries(params)) {
str = str.replace(`{${k}}`, String(v));
}
}
return str;
}
return { locale, setLocale, toggle, t };
}