feat(sub): refine Happ routing presets, serverDescription escaping, and auto-detect placement (#6488)

* feat(sub): refine Happ routing presets, serverDescription escaping, and auto-detect placement

* fix(sub): address PR review findings on routing parity, agent regex, and i18n
This commit is contained in:
Pejman Yousefi
2026-09-13 14:23:57 +03:30
committed by GitHub
parent c7518c4038
commit cba8f0672f
10 changed files with 306 additions and 166 deletions
+36 -60
View File
@@ -25,24 +25,15 @@ export function buildHappPresetDeeplink(preset: string): string {
'happ://routing/onadd/' +
toBase64Utf8(
JSON.stringify({
rules: [
{
type: 'field',
outboundTag: 'direct',
domain: ['domain:ir', 'regexp:.*\\.ir$'],
ip: ['geoip:ir', 'geoip:private'],
},
{
type: 'field',
outboundTag: 'block',
domain: ['geosite:category-ads-all'],
},
{
type: 'field',
outboundTag: 'proxy',
network: 'tcp,udp',
},
],
Name: 'Iran Bypass',
GlobalProxy: 'true',
DirectSites: ['domain:ir', 'regexp:.*\\.ir$'],
DirectIp: ['geoip:ir', '10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'],
BlockSites: ['geosite:category-ads-all'],
BlockIp: [],
ProxySites: [],
ProxyIp: [],
DomainStrategy: 'IPIfNonMatch',
}),
)
);
@@ -51,24 +42,15 @@ export function buildHappPresetDeeplink(preset: string): string {
'happ://routing/onadd/' +
toBase64Utf8(
JSON.stringify({
rules: [
{
type: 'field',
outboundTag: 'direct',
domain: ['domain:cn', 'geosite:cn'],
ip: ['geoip:cn', 'geoip:private'],
},
{
type: 'field',
outboundTag: 'block',
domain: ['geosite:category-ads-all'],
},
{
type: 'field',
outboundTag: 'proxy',
network: 'tcp,udp',
},
],
Name: 'China Direct',
GlobalProxy: 'true',
DirectSites: ['geosite:cn', 'geosite:geolocation-cn'],
DirectIp: ['geoip:cn', '10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'],
BlockSites: ['geosite:category-ads-all'],
BlockIp: [],
ProxySites: [],
ProxyIp: [],
DomainStrategy: 'IPIfNonMatch',
}),
)
);
@@ -77,23 +59,15 @@ export function buildHappPresetDeeplink(preset: string): string {
'happ://routing/onadd/' +
toBase64Utf8(
JSON.stringify({
rules: [
{
type: 'field',
outboundTag: 'block',
domain: ['geosite:category-ads-all'],
},
{
type: 'field',
outboundTag: 'direct',
ip: ['geoip:private'],
},
{
type: 'field',
outboundTag: 'proxy',
network: 'tcp,udp',
},
],
Name: 'AdBlock',
GlobalProxy: 'true',
DirectSites: [],
DirectIp: ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'],
BlockSites: ['geosite:category-ads-all'],
BlockIp: [],
ProxySites: [],
ProxyIp: [],
DomainStrategy: 'IPIfNonMatch',
}),
)
);
@@ -102,13 +76,15 @@ export function buildHappPresetDeeplink(preset: string): string {
'happ://routing/onadd/' +
toBase64Utf8(
JSON.stringify({
rules: [
{
type: 'field',
outboundTag: 'proxy',
network: 'tcp,udp',
},
],
Name: 'Global Proxy',
GlobalProxy: 'true',
DirectSites: [],
DirectIp: [],
BlockSites: [],
BlockIp: [],
ProxySites: [],
ProxyIp: [],
DomainStrategy: 'AsIs',
}),
)
);