Skip to content

feat(hosts): add per-host client template overrides#349

Merged
x0sina merged 1 commit intodevfrom
feat/host-client-template-overrides
Apr 2, 2026
Merged

feat(hosts): add per-host client template overrides#349
x0sina merged 1 commit intodevfrom
feat/host-client-template-overrides

Conversation

@x0sina
Copy link
Copy Markdown
Collaborator

@x0sina x0sina commented Apr 2, 2026

Summary

This PR adds per-host client template overrides so each host can choose custom client templates by output type while preserving existing default fallback behavior.

It introduces a single host-side client_template_ids field to store optional overrides for:

  • Clash / Clash Meta subscription template
  • Xray subscription template
  • Sing-box subscription template
  • HTTP User-Agent template
  • gRPC User-Agent template

When an override is not set, invalid, deleted, or not consistently applicable for the rendered request, subscription generation falls back to the existing default template behavior.

Backend Changes

  • Added client_template_ids JSON storage on hosts with migration support.
  • Exposed the override structure in host API models and cached subscription host data.
  • Added backend validation to ensure each configured host override points to a client template of the correct type.
  • Extended client-template cache/catalog loading to support lookup by template id as well as by default template type.
  • Updated subscription rendering to resolve host-level template overrides per request and fall back safely to defaults.

Dashboard Changes

  • Added host form support for per-type client template overrides.
  • Updated host create/edit/duplicate/reorder flows to preserve client_template_ids.
  • Added a compact host modal section under Routing for managing overrides.
  • Excluded default templates from override dropdowns to avoid showing the same default choice twice.
  • Added translations for the new host template UI in English, Persian, Russian, and Chinese.

Notes

  • Storage uses a single JSON host column instead of one database column per template type.
  • I did not complete a full automated test pass in this environment.

@x0sina x0sina added enhancement New feature or request Backend Frontend labels Apr 2, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 2, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 222f6791-1335-4219-ac7a-578c5e5d3e30

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/host-client-template-overrides

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@x0sina x0sina merged commit 84bbc29 into dev Apr 2, 2026
18 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant