27 lines
901 B
Dart
27 lines
901 B
Dart
/// 全局配置。
|
|
///
|
|
/// [kSiteUrl] 是本应用唯一要加载的站点地址(DSH Web Manager 的 HTTPS 反代域名)。
|
|
/// 由 build.sh 通过 --dart-define 编译进 APK,不提供占位地址。
|
|
const String kSiteUrl = String.fromEnvironment('DSH_SITE_URL');
|
|
|
|
bool isValidSiteUrl(String value) {
|
|
if (value.isEmpty || RegExp(r'\s').hasMatch(value)) return false;
|
|
final uri = Uri.tryParse(value);
|
|
if (uri == null) return false;
|
|
try {
|
|
return uri.scheme == 'https' &&
|
|
uri.host.isNotEmpty &&
|
|
uri.userInfo.isEmpty &&
|
|
!uri.hasQuery &&
|
|
!uri.hasFragment &&
|
|
uri.port > 0 &&
|
|
uri.port <= 65535;
|
|
} on FormatException {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// 站点主题色,与 index.html 的 theme-color 保持一致(深蓝),
|
|
/// 用于启动背景、状态栏/导航栏衬底与加载/错误页。
|
|
const int kThemeColorValue = 0xFF152B36;
|