From 0440bf1251c6cdc26c0fa38c9526ada42f6e547c Mon Sep 17 00:00:00 2001 From: Booker Date: Sat, 6 Jun 2026 17:33:34 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E5=92=8C=E9=85=8D=E7=BD=AE=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20H5=20=E7=BA=BF=E8=B7=AF=E7=94=9F=E6=88=90=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/config/app_config.dart | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/config/app_config.dart b/lib/config/app_config.dart index 36218d4..bc8ebe9 100644 --- a/lib/config/app_config.dart +++ b/lib/config/app_config.dart @@ -12,6 +12,12 @@ class H5Line { Uri get uri => Uri.parse(url); } +enum Environment { + development, + staging, + production, +} + class AppConfig { static const String appName = '本地打包'; static const String appLogo = ''; @@ -23,6 +29,16 @@ class AppConfig { '*.zdyswvnt.vip', '*.gxifpxcr.vip', ]; + static const Environment currentEnvironment = Environment.production; + + // Kept for the packaging service's legacy domain rewrite step. + static final Map> _environmentHosts = { + Environment.production: [ + '*.albzyuxq.vip', + '*.zdyswvnt.vip', + '*.gxifpxcr.vip', + ], + }; static final Random _random = Random.secure(); @@ -32,8 +48,8 @@ class AppConfig { int attempt = 0, String Function()? wildcardFactory, }) { - final template = wildcardH5DomainTemplates[ - attempt.abs() % wildcardH5DomainTemplates.length]; + final templates = _h5DomainTemplatesForCurrentEnvironment; + final template = templates[attempt.abs() % templates.length]; return h5LineFromUrl( _buildFlutterShellHomeUrl( _replaceWildcardHost(template, wildcardFactory: wildcardFactory), @@ -41,6 +57,14 @@ class AppConfig { ); } + static List get _h5DomainTemplatesForCurrentEnvironment { + final environmentHosts = _environmentHosts[currentEnvironment]; + if (environmentHosts == null || environmentHosts.isEmpty) { + return wildcardH5DomainTemplates; + } + return environmentHosts; + } + static H5Line h5LineFromUrl(String value) { return H5Line(label: '线路1', url: _normalizeHomeUrl(value)); }