mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-08 09:30:27 +00:00
feat: auto extract archives (#1212)
This commit is contained in:
1 parent
5515a1c48c
commit
0d5c4e8e7f
35 files changed
+950
-40
No files matched your search
@@ -10,6 +10,7 @@ class DownloaderConfig {
|
||||
ExtraConfig extra = ExtraConfig();
|
||||
ProxyConfig proxy = ProxyConfig();
|
||||
WebhookConfig webhook = WebhookConfig();
|
||||
ArchiveConfig archive = ArchiveConfig();
|
||||
|
||||
DownloaderConfig({
|
||||
this.downloadDir = '',
|
||||
@@ -226,3 +227,19 @@ class ExtraConfigGithubMirror {
|
||||
|
||||
Map<String, dynamic> toJson() => _$ExtraConfigGithubMirrorToJson(this);
|
||||
}
|
||||
|
||||
@JsonSerializable()
|
||||
class ArchiveConfig {
|
||||
bool autoExtract;
|
||||
bool deleteAfterExtract;
|
||||
|
||||
ArchiveConfig({
|
||||
this.autoExtract = true,
|
||||
this.deleteAfterExtract = true,
|
||||
});
|
||||
|
||||
factory ArchiveConfig.fromJson(Map<String, dynamic>? json) =>
|
||||
json == null ? ArchiveConfig() : _$ArchiveConfigFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ArchiveConfigToJson(this);
|
||||
}
|
||||
@@ -16,7 +16,9 @@ DownloaderConfig _$DownloaderConfigFromJson(Map<String, dynamic> json) =>
|
||||
..extra = ExtraConfig.fromJson(json['extra'] as Map<String, dynamic>?)
|
||||
..proxy = ProxyConfig.fromJson(json['proxy'] as Map<String, dynamic>)
|
||||
..webhook =
|
||||
WebhookConfig.fromJson(json['webhook'] as Map<String, dynamic>?);
|
||||
WebhookConfig.fromJson(json['webhook'] as Map<String, dynamic>?)
|
||||
..archive =
|
||||
ArchiveConfig.fromJson(json['archive'] as Map<String, dynamic>?);
|
||||
|
||||
Map<String, dynamic> _$DownloaderConfigToJson(DownloaderConfig instance) =>
|
||||
<String, dynamic>{
|
||||
@@ -26,6 +28,7 @@ Map<String, dynamic> _$DownloaderConfigToJson(DownloaderConfig instance) =>
|
||||
'extra': instance.extra.toJson(),
|
||||
'proxy': instance.proxy.toJson(),
|
||||
'webhook': instance.webhook.toJson(),
|
||||
'archive': instance.archive.toJson(),
|
||||
};
|
||||
|
||||
ProtocolConfig _$ProtocolConfigFromJson(Map<String, dynamic> json) =>
|
||||
@@ -232,3 +235,15 @@ Map<String, dynamic> _$ExtraConfigGithubMirrorToJson(
|
||||
'enabled': instance.enabled,
|
||||
'mirrors': instance.mirrors.map((e) => e.toJson()).toList(),
|
||||
};
|
||||
|
||||
ArchiveConfig _$ArchiveConfigFromJson(Map<String, dynamic> json) =>
|
||||
ArchiveConfig(
|
||||
autoExtract: json['autoExtract'] as bool? ?? true,
|
||||
deleteAfterExtract: json['deleteAfterExtract'] as bool? ?? true,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ArchiveConfigToJson(ArchiveConfig instance) =>
|
||||
<String, dynamic>{
|
||||
'autoExtract': instance.autoExtract,
|
||||
'deleteAfterExtract': instance.deleteAfterExtract,
|
||||
};
|
||||
@@ -26,10 +26,16 @@ class Options {
|
||||
class OptsExtraHttp {
|
||||
int connections;
|
||||
bool autoTorrent;
|
||||
bool autoExtract;
|
||||
String archivePassword;
|
||||
bool deleteAfterExtract;
|
||||
|
||||
OptsExtraHttp({
|
||||
this.connections = 0,
|
||||
this.autoTorrent = false,
|
||||
this.autoExtract = false,
|
||||
this.archivePassword = '',
|
||||
this.deleteAfterExtract = false,
|
||||
});
|
||||
|
||||
factory OptsExtraHttp.fromJson(Map<String, dynamic> json) =>
|
||||
|
||||
@@ -37,10 +37,16 @@ OptsExtraHttp _$OptsExtraHttpFromJson(Map<String, dynamic> json) =>
|
||||
OptsExtraHttp(
|
||||
connections: (json['connections'] as num?)?.toInt() ?? 0,
|
||||
autoTorrent: json['autoTorrent'] as bool? ?? false,
|
||||
autoExtract: json['autoExtract'] as bool? ?? false,
|
||||
archivePassword: json['archivePassword'] as String? ?? '',
|
||||
deleteAfterExtract: json['deleteAfterExtract'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$OptsExtraHttpToJson(OptsExtraHttp instance) =>
|
||||
<String, dynamic>{
|
||||
'connections': instance.connections,
|
||||
'autoTorrent': instance.autoTorrent,
|
||||
'autoExtract': instance.autoExtract,
|
||||
'archivePassword': instance.archivePassword,
|
||||
'deleteAfterExtract': instance.deleteAfterExtract,
|
||||
};
|
||||
Reference in new issue
Block a user