Add new server settings

This commit is contained in:
2024-02-17 21:47:24 +08:00
parent 7cec3fd320
commit f9e920cc57
5 changed files with 32 additions and 2 deletions

View File

@@ -41,6 +41,7 @@ class Config {
required this.ffprobePath,
required this.redirectToFlutter,
required this.downloadTimeoutCheckInterval,
required this.ehMetadataCacheTime,
});
bool cookies;
@JsonKey(name: 'db_path')
@@ -93,6 +94,8 @@ class Config {
bool redirectToFlutter;
@JsonKey(name: 'download_timeout_check_interval')
int downloadTimeoutCheckInterval;
@JsonKey(name: "eh_metadata_cache_time")
int ehMetadataCacheTime;
factory Config.fromJson(Map<String, dynamic> json) => _$ConfigFromJson(json);
Map<String, dynamic> toJson() => _$ConfigToJson(this);
}
@@ -141,6 +144,7 @@ class ConfigOptional {
this.ffprobePath,
this.redirectToFlutter,
this.downloadTimeoutCheckInterval,
this.ehMetadataCacheTime,
});
String? cookies;
@JsonKey(name: 'db_path')
@@ -193,6 +197,8 @@ class ConfigOptional {
bool? redirectToFlutter;
@JsonKey(name: 'download_timeout_check_interval')
int? downloadTimeoutCheckInterval;
@JsonKey(name: "eh_metadata_cache_time")
int? ehMetadataCacheTime;
factory ConfigOptional.fromJson(Map<String, dynamic> json) =>
_$ConfigOptionalFromJson(json);
Map<String, dynamic> toJson() => _$ConfigOptionalToJson(this);

View File

@@ -42,6 +42,7 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config(
redirectToFlutter: json['redirect_to_flutter'] as bool,
downloadTimeoutCheckInterval:
json['download_timeout_check_interval'] as int,
ehMetadataCacheTime: json['eh_metadata_cache_time'] as int,
);
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
@@ -74,6 +75,7 @@ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
'ffprobe_path': instance.ffprobePath,
'redirect_to_flutter': instance.redirectToFlutter,
'download_timeout_check_interval': instance.downloadTimeoutCheckInterval,
'eh_metadata_cache_time': instance.ehMetadataCacheTime,
};
const _$ThumbnailMethodEnumMap = {
@@ -128,6 +130,7 @@ ConfigOptional _$ConfigOptionalFromJson(Map<String, dynamic> json) =>
redirectToFlutter: json['redirect_to_flutter'] as bool?,
downloadTimeoutCheckInterval:
json['download_timeout_check_interval'] as int?,
ehMetadataCacheTime: json['eh_metadata_cache_time'] as int?,
);
Map<String, dynamic> _$ConfigOptionalToJson(ConfigOptional instance) =>
@@ -161,4 +164,5 @@ Map<String, dynamic> _$ConfigOptionalToJson(ConfigOptional instance) =>
'ffprobe_path': instance.ffprobePath,
'redirect_to_flutter': instance.redirectToFlutter,
'download_timeout_check_interval': instance.downloadTimeoutCheckInterval,
'eh_metadata_cache_time': instance.ehMetadataCacheTime,
};

View File

@@ -149,5 +149,7 @@
"running": "Running",
"finished": "Finished",
"failed": "Failed",
"allTasks": "All Tasks"
"allTasks": "All Tasks",
"ehMetadataCacheTime": "The time to cache the metadata of the gallery from E-Hentai",
"hour": "hour"
}

View File

@@ -149,5 +149,7 @@
"running": "运行中",
"finished": "已完成",
"failed": "已失败",
"allTasks": "所有任务"
"allTasks": "所有任务",
"ehMetadataCacheTime": "E-Hentai 画廊元数据缓存时间",
"hour": "小时"
}

View File

@@ -692,6 +692,22 @@ class _ServerSettingsPage extends State<ServerSettingsPage>
});
},
)),
_buildWithVecticalPadding(NumberFormField(
min: 1,
initialValue:
_now.ehMetadataCacheTime ?? _config!.ehMetadataCacheTime,
decoration: InputDecoration(
border: const OutlineInputBorder(),
labelText: i18n.ehMetadataCacheTime,
suffixText: i18n.hour,
),
onChanged: (s) {
setState(() {
_now.ehMetadataCacheTime = s;
_changed = true;
});
},
)),
]));
}