This commit is contained in:
xkeyC 2024-02-15 21:24:39 +08:00
parent dae1e8f039
commit 04e19a7311
16 changed files with 106 additions and 56 deletions

View File

@ -17,7 +17,7 @@ import 'package:uuid/uuid.dart';
import 'package:window_manager/window_manager.dart';
class AppConf {
static const String appVersion = "2.10.4 Beta";
static const String appVersion = "2.10.5 Beta";
static const int appVersionCode = 39;
static const String appVersionDate = "2024-02-03";

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

View File

@ -12,7 +12,7 @@ part of 'downloader.dart';
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models');
/// @nodoc
mixin _$MyDownloaderStatus {

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field
@ -54,7 +54,7 @@ class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
kDefaultExternalLibraryLoaderConfig;
@override
String get codegenVersion => '2.0.0-dev.23';
String get codegenVersion => '2.0.0-dev.24';
static const kDefaultExternalLibraryLoaderConfig =
ExternalLibraryLoaderConfig(
@ -173,7 +173,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
},
codec: SseCodec(
decodeSuccessData: sse_decode_list_String,
decodeErrorData: null,
decodeErrorData: sse_decode_AnyhowException,
),
constMeta: kDnsLookupTxtConstMeta,
argValues: [host],
@ -206,7 +206,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
},
codec: SseCodec(
decodeSuccessData: sse_decode_rust_http_response,
decodeErrorData: null,
decodeErrorData: sse_decode_AnyhowException,
),
constMeta: kFetchConstMeta,
argValues: [method, url, headers, inputData],
@ -254,6 +254,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
get rust_arc_decrement_strong_count_ReqwestVersion => wire
.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion;
@protected
AnyhowException dco_decode_AnyhowException(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
return AnyhowException(raw as String);
}
@protected
ReqwestVersion
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
@ -333,9 +339,9 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
// Codec=Dco (DartCObject based), see doc to use other codecs
switch (raw[0]) {
case 0:
return MyDownloaderStatus_NoStart();
return const MyDownloaderStatus_NoStart();
case 1:
return MyDownloaderStatus_Running();
return const MyDownloaderStatus_Running();
case 2:
return MyDownloaderStatus_Pending(
dco_decode_my_network_item_pending_type(raw[1]),
@ -345,7 +351,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
dco_decode_String(raw[1]),
);
case 4:
return MyDownloaderStatus_Finished();
return const MyDownloaderStatus_Finished();
default:
throw Exception("unreachable");
}
@ -444,6 +450,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return dcoDecodeI64OrU64(raw);
}
@protected
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
var inner = sse_decode_String(deserializer);
return AnyhowException(inner);
}
@protected
ReqwestVersion
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
@ -546,9 +559,9 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
var tag_ = sse_decode_i_32(deserializer);
switch (tag_) {
case 0:
return MyDownloaderStatus_NoStart();
return const MyDownloaderStatus_NoStart();
case 1:
return MyDownloaderStatus_Running();
return const MyDownloaderStatus_Running();
case 2:
var var_field0 = sse_decode_my_network_item_pending_type(deserializer);
return MyDownloaderStatus_Pending(var_field0);
@ -556,7 +569,7 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
var var_field0 = sse_decode_String(deserializer);
return MyDownloaderStatus_Error(var_field0);
case 4:
return MyDownloaderStatus_Finished();
return const MyDownloaderStatus_Finished();
default:
throw UnimplementedError('');
}
@ -677,6 +690,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
return deserializer.buffer.getUint8() != 0;
}
@protected
void sse_encode_AnyhowException(
AnyhowException self, SseSerializer serializer) {
// Codec=Sse (Serialization based), see doc to use other codecs
throw UnimplementedError('Unreachable ((');
}
@protected
void
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field
@ -25,6 +25,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
get rust_arc_decrement_strong_count_ReqwestVersionPtr => wire
._rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersionPtr;
@protected
AnyhowException dco_decode_AnyhowException(dynamic raw);
@protected
ReqwestVersion
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
@ -98,6 +101,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int dco_decode_usize(dynamic raw);
@protected
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);
@protected
ReqwestVersion
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
@ -181,6 +187,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
bool sse_decode_bool(SseDeserializer deserializer);
@protected
void sse_encode_AnyhowException(
AnyhowException self, SseSerializer serializer);
@protected
void
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field
@ -24,6 +24,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
get rust_arc_decrement_strong_count_ReqwestVersionPtr => wire
.rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion;
@protected
AnyhowException dco_decode_AnyhowException(dynamic raw);
@protected
ReqwestVersion
dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
@ -97,6 +100,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
int dco_decode_usize(dynamic raw);
@protected
AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer);
@protected
ReqwestVersion
sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(
@ -180,6 +186,10 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl<RustLibWire> {
@protected
bool sse_decode_bool(SseDeserializer deserializer);
@protected
void sse_encode_AnyhowException(
AnyhowException self, SseSerializer serializer);
@protected
void
sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedrust_asyncRwLockreqwestVersion(

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// ignore_for_file: invalid_use_of_internal_member, unused_import, unnecessary_import

View File

@ -17,7 +17,11 @@ class SplashUIModel extends BaseUIModel {
Future<void> _initApp() async {
AnalyticsApi.touch("launch");
try {
await URLConf.checkHost();
} catch (e) {
dPrint("checkHost Error:$e");
}
step = 1;
notifyListeners();
await AppConf.checkUpdate();

View File

@ -32,7 +32,7 @@ dependencies:
sdk: flutter
flutter_riverpod: ^2.3.6
window_manager: ^0.3.2
fluent_ui: ^4.8.5
fluent_ui: 4.8.5
flutter_staggered_grid_view: ^0.7.0
flutter_acrylic: ^1.1.0
url_launcher: ^6.1.10
@ -55,7 +55,7 @@ dependencies:
flutter_tilt: ^2.0.10
card_swiper: ^3.0.1
ffi: ^2.1.0
flutter_rust_bridge: 2.0.0-dev.23
flutter_rust_bridge: 2.0.0-dev.24
freezed_annotation: ^2.4.1
meta: ^1.9.1
win32: ^5.0.9

View File

@ -37,10 +37,10 @@ pub fn set_default_header(headers: HashMap<String, String>) {
pub async fn fetch(method: MyMethod,
url: String,
headers: Option<HashMap<String, String>>,
input_data: Option<Vec<u8>>) -> RustHttpResponse {
http_package::fetch(_my_method_to_hyper_method(method), url, headers, input_data).await.unwrap()
input_data: Option<Vec<u8>>) -> anyhow::Result<RustHttpResponse> {
http_package::fetch(_my_method_to_hyper_method(method), url, headers, input_data).await
}
pub async fn dns_lookup_txt(host: String) -> Vec<String> {
http_package::dns_lookup_txt(host).await.unwrap()
pub async fn dns_lookup_txt(host: String) -> anyhow::Result<Vec<String>> {
http_package::dns_lookup_txt(host).await
}

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// Section: imports

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
#![allow(
non_camel_case_types,
@ -31,7 +31,7 @@ flutter_rust_bridge::frb_generated_boilerplate!(
default_rust_opaque = RustOpaqueMoi,
default_rust_auto_opaque = RustAutoOpaqueMoi,
);
const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0-dev.23";
const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0-dev.24";
// Section: executor
@ -120,9 +120,7 @@ fn wire_dns_lookup_txt_impl(
deserializer.end();
move |context| async move {
transform_result_sse(
(move || async move {
Result::<_, ()>::Ok(crate::api::http_api::dns_lookup_txt(api_host).await)
})()
(move || async move { crate::api::http_api::dns_lookup_txt(api_host).await })()
.await,
)
}
@ -160,15 +158,13 @@ fn wire_fetch_impl(
move |context| async move {
transform_result_sse(
(move || async move {
Result::<_, ()>::Ok(
crate::api::http_api::fetch(
api_method,
api_url,
api_headers,
api_input_data,
)
.await,
)
.await
})()
.await,
)
@ -218,6 +214,13 @@ flutter_rust_bridge::frb_generated_moi_arc_impl_value!(
// Section: dart2rust
impl SseDecode for flutter_rust_bridge::for_generated::anyhow::Error {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
unreachable!("");
}
}
impl SseDecode for reqwest::Version {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self {
@ -673,6 +676,13 @@ impl flutter_rust_bridge::IntoIntoDart<crate::http_package::RustHttpResponse>
}
}
impl SseEncode for flutter_rust_bridge::for_generated::anyhow::Error {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {
<String>::sse_encode(format!("{:?}", self), serializer);
}
}
impl SseEncode for reqwest::Version {
// Codec=Sse (Serialization based), see doc to use other codecs
fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) {

View File

@ -1,5 +1,5 @@
// This file is automatically generated, so please do not edit it.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.23.
// Generated by `flutter_rust_bridge`@ 2.0.0-dev.24.
// Section: imports

View File

@ -1,9 +1,9 @@
use hickory_resolver::config::{NameServerConfigGroup, ResolverConfig, ResolverOpts};
use hickory_resolver::{lookup_ip::LookupIpIntoIter, TokioAsyncResolver};
use std::io;
use hickory_resolver::{lookup_ip::LookupIpIntoIter, system_conf, TokioAsyncResolver};
use hyper::client::connect::dns::Name;
use once_cell::sync::OnceCell;
use reqwest::dns::{Addrs, Resolve, Resolving};
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
use std::net::SocketAddr;
use std::sync::Arc;
/// Wrapper around an `AsyncResolver`, which implements the `Resolve` trait.
@ -52,16 +52,12 @@ impl Iterator for SocketAddrs {
}
}
fn new_resolver() -> anyhow::Result<TokioAsyncResolver> {
let ali_ips: &[IpAddr] = &[
IpAddr::V4(Ipv4Addr::new(223, 5, 5, 5)),
IpAddr::V4(Ipv4Addr::new(223, 6, 6, 6)),
IpAddr::V6("2400:3200::1".parse::<Ipv6Addr>()?),
IpAddr::V6("2400:3200:baba::1".parse::<Ipv6Addr>()?),
];
let group =
NameServerConfigGroup::from_ips_https(ali_ips, 443, "dns.alidns.com".to_string(), true);
let cfg = ResolverConfig::from_parts(None, vec![], group);
Ok(TokioAsyncResolver::tokio(cfg, ResolverOpts::default()))
fn new_resolver() -> io::Result<TokioAsyncResolver> {
let (config, opts) = system_conf::read_system_conf().map_err(|e| {
io::Error::new(
io::ErrorKind::Other,
format!("error reading DNS system conf: {}", e),
)
})?;
Ok(TokioAsyncResolver::tokio(config, opts))
}