mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Add new server settings enableServerTiming
This commit is contained in:
@@ -74,6 +74,7 @@ class Config {
|
|||||||
required this.checkFileHash,
|
required this.checkFileHash,
|
||||||
required this.importMethod,
|
required this.importMethod,
|
||||||
required this.maxImportImgCount,
|
required this.maxImportImgCount,
|
||||||
|
required this.enableServerTiming,
|
||||||
});
|
});
|
||||||
bool cookies;
|
bool cookies;
|
||||||
@JsonKey(name: 'db_path')
|
@JsonKey(name: 'db_path')
|
||||||
@@ -138,6 +139,8 @@ class Config {
|
|||||||
ImportMethod importMethod;
|
ImportMethod importMethod;
|
||||||
@JsonKey(name: 'max_import_img_count')
|
@JsonKey(name: 'max_import_img_count')
|
||||||
int maxImportImgCount;
|
int maxImportImgCount;
|
||||||
|
@JsonKey(name: 'enable_server_timing')
|
||||||
|
bool enableServerTiming;
|
||||||
factory Config.fromJson(Map<String, dynamic> json) => _$ConfigFromJson(json);
|
factory Config.fromJson(Map<String, dynamic> json) => _$ConfigFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$ConfigToJson(this);
|
Map<String, dynamic> toJson() => _$ConfigToJson(this);
|
||||||
}
|
}
|
||||||
@@ -192,6 +195,7 @@ class ConfigOptional {
|
|||||||
this.checkFileHash,
|
this.checkFileHash,
|
||||||
this.importMethod,
|
this.importMethod,
|
||||||
this.maxImportImgCount,
|
this.maxImportImgCount,
|
||||||
|
this.enableServerTiming,
|
||||||
});
|
});
|
||||||
String? cookies;
|
String? cookies;
|
||||||
@JsonKey(name: 'db_path')
|
@JsonKey(name: 'db_path')
|
||||||
@@ -256,6 +260,8 @@ class ConfigOptional {
|
|||||||
ImportMethod? importMethod;
|
ImportMethod? importMethod;
|
||||||
@JsonKey(name: 'max_import_img_count')
|
@JsonKey(name: 'max_import_img_count')
|
||||||
int? maxImportImgCount;
|
int? maxImportImgCount;
|
||||||
|
@JsonKey(name: 'enable_server_timing')
|
||||||
|
bool? enableServerTiming;
|
||||||
factory ConfigOptional.fromJson(Map<String, dynamic> json) =>
|
factory ConfigOptional.fromJson(Map<String, dynamic> json) =>
|
||||||
_$ConfigOptionalFromJson(json);
|
_$ConfigOptionalFromJson(json);
|
||||||
Map<String, dynamic> toJson() => _$ConfigOptionalToJson(this);
|
Map<String, dynamic> toJson() => _$ConfigOptionalToJson(this);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config(
|
|||||||
checkFileHash: json['check_file_hash'] as bool,
|
checkFileHash: json['check_file_hash'] as bool,
|
||||||
importMethod: $enumDecode(_$ImportMethodEnumMap, json['import_method']),
|
importMethod: $enumDecode(_$ImportMethodEnumMap, json['import_method']),
|
||||||
maxImportImgCount: (json['max_import_img_count'] as num).toInt(),
|
maxImportImgCount: (json['max_import_img_count'] as num).toInt(),
|
||||||
|
enableServerTiming: json['enable_server_timing'] as bool,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
||||||
@@ -86,6 +87,7 @@ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
|||||||
'check_file_hash': instance.checkFileHash,
|
'check_file_hash': instance.checkFileHash,
|
||||||
'import_method': _$ImportMethodEnumMap[instance.importMethod]!,
|
'import_method': _$ImportMethodEnumMap[instance.importMethod]!,
|
||||||
'max_import_img_count': instance.maxImportImgCount,
|
'max_import_img_count': instance.maxImportImgCount,
|
||||||
|
'enable_server_timing': instance.enableServerTiming,
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$ThumbnailMethodEnumMap = {
|
const _$ThumbnailMethodEnumMap = {
|
||||||
@@ -154,6 +156,7 @@ ConfigOptional _$ConfigOptionalFromJson(Map<String, dynamic> json) =>
|
|||||||
importMethod:
|
importMethod:
|
||||||
$enumDecodeNullable(_$ImportMethodEnumMap, json['import_method']),
|
$enumDecodeNullable(_$ImportMethodEnumMap, json['import_method']),
|
||||||
maxImportImgCount: (json['max_import_img_count'] as num?)?.toInt(),
|
maxImportImgCount: (json['max_import_img_count'] as num?)?.toInt(),
|
||||||
|
enableServerTiming: json['enable_server_timing'] as bool?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$ConfigOptionalToJson(ConfigOptional instance) =>
|
Map<String, dynamic> _$ConfigOptionalToJson(ConfigOptional instance) =>
|
||||||
@@ -193,4 +196,5 @@ Map<String, dynamic> _$ConfigOptionalToJson(ConfigOptional instance) =>
|
|||||||
'check_file_hash': instance.checkFileHash,
|
'check_file_hash': instance.checkFileHash,
|
||||||
'import_method': _$ImportMethodEnumMap[instance.importMethod],
|
'import_method': _$ImportMethodEnumMap[instance.importMethod],
|
||||||
'max_import_img_count': instance.maxImportImgCount,
|
'max_import_img_count': instance.maxImportImgCount,
|
||||||
|
'enable_server_timing': instance.enableServerTiming,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -313,5 +313,6 @@
|
|||||||
"type": "String"
|
"type": "String"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"enableServerTiming": "Enable server time tracking"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,5 +313,6 @@
|
|||||||
"type": "String"
|
"type": "String"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"enableServerTiming": "测量服务器所用时间"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -317,6 +317,18 @@ class _ServerSettingsPage extends State<ServerSettingsPage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
label: Text(i18n.checkFileHash))),
|
label: Text(i18n.checkFileHash))),
|
||||||
|
_buildWithVecticalPadding(LabeledCheckbox(
|
||||||
|
value: _now.enableServerTiming ?? _config!.enableServerTiming,
|
||||||
|
onChanged: (b) {
|
||||||
|
if (b != null) {
|
||||||
|
setState(() {
|
||||||
|
_now.enableServerTiming = b;
|
||||||
|
_changed = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
label: Text(i18n.enableServerTiming),
|
||||||
|
)),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user