feat(happ): add routing editor, optional ad blocking, and LAN bypass preset (#6545)

* feat(happ): make ad blocking optional in routing presets

Add an independent AdBlock toggle for Iran, China, and global presets, applied only when generating routing rules. Update the China preset to Bypass-CN and cover preset behavior and localized controls.

* feat: add visual routing editor with JSON support and localization updates

- Implemented a new modal for editing routing profiles with basic and advanced tabs.
- Added functionality to load, parse, and generate routing profiles in JSON format.
- Enhanced user experience with validation and error handling for JSON input.
- Updated translations for Russian, Turkish, Ukrainian, Vietnamese, Chinese (Simplified and Traditional) to include new routing editor terms.
- Created helper functions for managing routing profiles and generating deep links.
- Added unit tests for routing editor functionalities and JSON handling.

* feat: update routing editor to preserve null lists in profiles and enhance validation messages
This commit is contained in:
NgaiYeanCoi
2026-09-27 04:57:01 +08:00
committed by GitHub
parent 94fa317e76
commit 5e15120cec
22 changed files with 1363 additions and 209 deletions
+16
View File
@@ -0,0 +1,16 @@
import { z } from 'zod';
// Extensions belong to the Happ client and must survive a trip through this editor.
export const HappRoutingProfileSchema = z
.object({
// The backend treats null lists as absent; preserve them until explicitly edited.
DirectSites: z.array(z.string()).nullish(),
DirectIp: z.array(z.string()).nullish(),
ProxySites: z.array(z.string()).nullish(),
ProxyIp: z.array(z.string()).nullish(),
BlockSites: z.array(z.string()).nullish(),
BlockIp: z.array(z.string()).nullish(),
})
.catchall(z.unknown());
export type HappRoutingProfile = z.infer<typeof HappRoutingProfileSchema>;