Mobile support report server

This commit is contained in:
wanghongenpin
2025-10-25 02:18:57 +08:00
parent aa49bb6226
commit 258c21721e
12 changed files with 398 additions and 19 deletions

View File

@@ -96,9 +96,6 @@ class ReportServer {
/// 压缩方式none/gzip默认 none
final String? compression;
/// 额外请求头(可选)
final Map<String, String>? headers;
RegExp _urlReg;
ReportServer({
@@ -107,7 +104,6 @@ class ReportServer {
required this.serverUrl,
this.enabled = true,
this.compression,
this.headers,
}) : _urlReg = RegExp(matchUrl.replaceAll("*", ".*").replaceFirst('?', '\\?'));
bool match(String url) {
@@ -136,19 +132,16 @@ class ReportServer {
serverUrl: serverUrl ?? this.serverUrl,
enabled: enabled ?? this.enabled,
compression: compression ?? this.compression,
headers: headers ?? this.headers,
);
}
factory ReportServer.fromJson(Map<String, dynamic> json) {
final headers = json['headers'];
return ReportServer(
name: json['name'] ?? '',
matchUrl: json['matchUrl'] ?? '',
serverUrl: json['serverUrl'] ?? '',
enabled: json['enabled'] ?? true,
compression: (json['compression'] ?? 'none') as String,
headers: headers == null ? null : Map<String, String>.from(headers as Map),
);
}