mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
add new server settings
This commit is contained in:
@@ -40,6 +40,7 @@ class Config {
|
|||||||
required this.downloadTimeout,
|
required this.downloadTimeout,
|
||||||
required this.ffprobePath,
|
required this.ffprobePath,
|
||||||
required this.redirectToFlutter,
|
required this.redirectToFlutter,
|
||||||
|
required this.downloadTimeoutCheckInterval,
|
||||||
});
|
});
|
||||||
bool cookies;
|
bool cookies;
|
||||||
@JsonKey(name: 'db_path')
|
@JsonKey(name: 'db_path')
|
||||||
@@ -90,6 +91,8 @@ class Config {
|
|||||||
String ffprobePath;
|
String ffprobePath;
|
||||||
@JsonKey(name: 'redirect_to_flutter')
|
@JsonKey(name: 'redirect_to_flutter')
|
||||||
bool redirectToFlutter;
|
bool redirectToFlutter;
|
||||||
|
@JsonKey(name: 'download_timeout_check_interval')
|
||||||
|
int downloadTimeoutCheckInterval;
|
||||||
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);
|
||||||
}
|
}
|
||||||
@@ -137,6 +140,7 @@ class ConfigOptional {
|
|||||||
this.downloadTimeout,
|
this.downloadTimeout,
|
||||||
this.ffprobePath,
|
this.ffprobePath,
|
||||||
this.redirectToFlutter,
|
this.redirectToFlutter,
|
||||||
|
this.downloadTimeoutCheckInterval,
|
||||||
});
|
});
|
||||||
String? cookies;
|
String? cookies;
|
||||||
@JsonKey(name: 'db_path')
|
@JsonKey(name: 'db_path')
|
||||||
@@ -187,6 +191,8 @@ class ConfigOptional {
|
|||||||
String? ffprobePath;
|
String? ffprobePath;
|
||||||
@JsonKey(name: 'redirect_to_flutter')
|
@JsonKey(name: 'redirect_to_flutter')
|
||||||
bool? redirectToFlutter;
|
bool? redirectToFlutter;
|
||||||
|
@JsonKey(name: 'download_timeout_check_interval')
|
||||||
|
int? downloadTimeoutCheckInterval;
|
||||||
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);
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ Config _$ConfigFromJson(Map<String, dynamic> json) => Config(
|
|||||||
downloadTimeout: json['download_timeout'] as int,
|
downloadTimeout: json['download_timeout'] as int,
|
||||||
ffprobePath: json['ffprobe_path'] as String,
|
ffprobePath: json['ffprobe_path'] as String,
|
||||||
redirectToFlutter: json['redirect_to_flutter'] as bool,
|
redirectToFlutter: json['redirect_to_flutter'] as bool,
|
||||||
|
downloadTimeoutCheckInterval:
|
||||||
|
json['download_timeout_check_interval'] as int,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
||||||
@@ -71,6 +73,7 @@ Map<String, dynamic> _$ConfigToJson(Config instance) => <String, dynamic>{
|
|||||||
'download_timeout': instance.downloadTimeout,
|
'download_timeout': instance.downloadTimeout,
|
||||||
'ffprobe_path': instance.ffprobePath,
|
'ffprobe_path': instance.ffprobePath,
|
||||||
'redirect_to_flutter': instance.redirectToFlutter,
|
'redirect_to_flutter': instance.redirectToFlutter,
|
||||||
|
'download_timeout_check_interval': instance.downloadTimeoutCheckInterval,
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$ThumbnailMethodEnumMap = {
|
const _$ThumbnailMethodEnumMap = {
|
||||||
@@ -123,6 +126,8 @@ ConfigOptional _$ConfigOptionalFromJson(Map<String, dynamic> json) =>
|
|||||||
downloadTimeout: json['download_timeout'] as int?,
|
downloadTimeout: json['download_timeout'] as int?,
|
||||||
ffprobePath: json['ffprobe_path'] as String?,
|
ffprobePath: json['ffprobe_path'] as String?,
|
||||||
redirectToFlutter: json['redirect_to_flutter'] as bool?,
|
redirectToFlutter: json['redirect_to_flutter'] as bool?,
|
||||||
|
downloadTimeoutCheckInterval:
|
||||||
|
json['download_timeout_check_interval'] as int?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$ConfigOptionalToJson(ConfigOptional instance) =>
|
Map<String, dynamic> _$ConfigOptionalToJson(ConfigOptional instance) =>
|
||||||
@@ -155,4 +160,5 @@ Map<String, dynamic> _$ConfigOptionalToJson(ConfigOptional instance) =>
|
|||||||
'download_timeout': instance.downloadTimeout,
|
'download_timeout': instance.downloadTimeout,
|
||||||
'ffprobe_path': instance.ffprobePath,
|
'ffprobe_path': instance.ffprobePath,
|
||||||
'redirect_to_flutter': instance.redirectToFlutter,
|
'redirect_to_flutter': instance.redirectToFlutter,
|
||||||
|
'download_timeout_check_interval': instance.downloadTimeoutCheckInterval,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -140,5 +140,7 @@
|
|||||||
"meiliHostsHelp": "Requests from these domains will receive the corresponding Meilisearch server hostname.",
|
"meiliHostsHelp": "Requests from these domains will receive the corresponding Meilisearch server hostname.",
|
||||||
"keyIsEmpty": "Key is empty.",
|
"keyIsEmpty": "Key is empty.",
|
||||||
"keyIsExists": "Key is exists.",
|
"keyIsExists": "Key is exists.",
|
||||||
"redirectToFlutter": "Redirect to Flutter frontend when accessing the root URL."
|
"redirectToFlutter": "Redirect to Flutter frontend when accessing the root URL.",
|
||||||
|
"downloadTimeoutCheckInterval": "The interval of checking download timeout",
|
||||||
|
"downloadTimeoutCheckIntervalHelp": "The smaller the value, the more accurate the timeout detection, but the higher CPU usage."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,5 +140,7 @@
|
|||||||
"meiliHostsHelp": "来自这些域的请求将收到相应的 Meilisearch 服务器主机名。",
|
"meiliHostsHelp": "来自这些域的请求将收到相应的 Meilisearch 服务器主机名。",
|
||||||
"keyIsEmpty": "键不能为空。",
|
"keyIsEmpty": "键不能为空。",
|
||||||
"keyIsExists": "键已存在。",
|
"keyIsExists": "键已存在。",
|
||||||
"redirectToFlutter": "访问根 URL 时重定向到 flutter 前端。"
|
"redirectToFlutter": "访问根 URL 时重定向到 flutter 前端。",
|
||||||
|
"downloadTimeoutCheckInterval": "下载超时检测间隔",
|
||||||
|
"downloadTimeoutCheckIntervalHelp": "值越小,检测准确性越高,但是消耗更多的 CPU。"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -669,6 +669,24 @@ class _ServerSettingsPage extends State<ServerSettingsPage>
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
)),
|
)),
|
||||||
|
_buildWithVecticalPadding(NumberFormField(
|
||||||
|
min: 1,
|
||||||
|
initialValue: _now.downloadTimeoutCheckInterval ??
|
||||||
|
_config!.downloadTimeoutCheckInterval,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
labelText: i18n.downloadTimeoutCheckInterval,
|
||||||
|
suffixText: i18n.millisecond,
|
||||||
|
helperText: i18n.downloadTimeoutCheckIntervalHelp,
|
||||||
|
helperMaxLines: 3,
|
||||||
|
),
|
||||||
|
onChanged: (s) {
|
||||||
|
setState(() {
|
||||||
|
_now.downloadTimeoutCheckInterval = s;
|
||||||
|
_changed = true;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
)),
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user