Skip to content

Subscription Templates

RomanovCaesar edited this page Oct 8, 2026 · 1 revision

English | 简体中文

What is a subscription template?

Since v0.2.3 every subscription is a complete client profile, not just a list of nodes. A subscription template is the Mihomo skeleton of that profile: basic settings, policy groups and routing rules, without any nodes. When a client fetches a subscription, m-ui fills the user's own nodes into the template's groups and converts the result to that client's format.

Open Subscription Templates from the sidebar, right below Inbounds. The template selected there is used by every subscription, including cross-panel subscriptions (/isub).

Built-in default template

The built-in template has three country variants. They share the same settings, groups and proxy rules, and differ only in which country's traffic goes direct.

Variant Direct Group names
China GEOIP,cn, GEOSITE,cn, mainland public DNS servers 节点选择 / 自动选择
Russia GEOIP,ru, GEOSITE,category-ru, Yandex DNS Proxy / Auto
Iran GEOIP,ir, GEOSITE,category-ir, Shecan DNS Proxy / Auto

All variants also:

  • send Google, AI services (category-ai-!cn), Apple, Microsoft, TikTok and IP-leak test sites through the proxy;
  • send private addresses direct;
  • block QUIC (UDP 443), so browsers fall back to TCP through the proxy.

The first group is a selector with the automatic group, DIRECT and every node. The second is a url-test group of every node. Click a country in the default template's row to switch to that variant immediately. View shows the variant's YAML.

Import your own template

Click Import Template. Paste a Mihomo subscription or template, or click Load from file to read a text file (up to 2 MB). Give it a name, click Preview to check the cleaned result, then Save.

Both a full subscription and a template without nodes are accepted. The document must be Mihomo YAML with proxy-groups and rules. Before saving, m-ui cleans it:

  • Removes proxies, proxy-providers and all comments. Every subscriber receives the template, and an exported config's comments often name its source file or nodes.
  • Groups that held nodes become groups that receive each user's nodes. This includes groups that listed nodes, used use: providers, or had include-all.
  • Rules that pointed at a node are redirected to the first group that receives nodes.
  • Anchors and aliases are resolved first, so a removed node cannot survive through an alias.

The preview shows how many nodes and providers were removed, how many groups receive nodes, and how many rules were redirected.

In the stored template, groups that receive nodes are marked with Mihomo's own include-all-proxies: true, so a stored template is still a valid Mihomo config. When rendering, m-ui expands this into an explicit list, which also works on older clients. A group's filter, exclude-filter and exclude-type are respected. A group left with no members falls back to DIRECT.

Imported templates can be viewed, downloaded, renamed and deleted. Deleting the template in use switches subscriptions back to the default template. Up to 50 templates can be stored.

How each client receives the template

Client Suffix Output
Mihomo / Clash /clash The template with nodes; the template's own YAML order and formatting are kept
Stash /stash Same, with the nodes Stash supports (Stash supports GEOSITE and AND/OR/NOT)
sing-box /sing-box selector/urltest outbounds, route rules and remote rule sets
Surge, Surge Mac /surge, /surgemac Full profile with #!MANAGED-CONFIG auto-update
Surfboard /surfboard Full profile with #!MANAGED-CONFIG auto-update
Loon /loon Full profile; GEOSITE rules go to [Remote Rule]
Quantumult X /qx Full profile
Egern /egern Full profile
V2Box, V2RayNG, V2RayTun, Npv Tunnel, HApp, Shadowrocket, Streisand various Node list only; share-link formats cannot carry rules

GEOSITE rules

Only Mihomo and Stash have built-in GEOSITE data. For other clients, m-ui uses rule sets from MetaCubeX/meta-rules-dat, the same source as Mihomo's GeoSite.dat:

  • sing-box: .srs rule sets from the sing branch, downloaded through the profile's final proxy group (download_detour).
  • Surge, Surfboard, Loon, Egern: classical .list rule sets.
  • Quantumult X: these rule sets are not readable by Quantumult X, so GEOSITE rules are skipped. GEOIP rules still work.

GEOIP,private is turned into the private address ranges for clients whose GeoIP has no private entry. A rule a client cannot express is skipped. In text profiles it is left as a # m-ui: skipped … comment so you can see what was dropped.

Note

sing-box 1.14 logs a deprecation warning for download_detour. It is harmless. m-ui keeps it because the replacement field only exists in 1.14+, and older sing-box cores (common in mobile clients) reject unknown fields.

Notes for upgrading from v0.2.2 or earlier

  • Subscriptions change automatically: the China variant is selected by default, so /clash returns full groups and rules instead of "all nodes + MATCH,PROXY".
  • Surge, Surfboard, Loon, Quantumult X and Egern links now return complete profiles instead of node lists. If you imported them as a node or policy subscription inside your own profile, import them as a profile instead.

Backups and storage

Templates are stored in data/sub-templates.json and included in panel backups. A backup made before v0.2.3 has no templates, and restoring it leaves the current templates unchanged.

Clone this wiki locally