diff --git a/lib/features/config_option/overview/config_options_page.dart b/lib/features/config_option/overview/config_options_page.dart index bab3d373..37154714 100644 --- a/lib/features/config_option/overview/config_options_page.dart +++ b/lib/features/config_option/overview/config_options_page.dart @@ -358,13 +358,14 @@ class ConfigOptionsPage extends HookConsumerWidget { digitsOnly: true, inputToValue: int.tryParse, ), - const Gap(24), + SwitchListTile( title: Text(experimental(t.config.useXrayCoreWhenPossible.Label)), subtitle: Text(t.config.useXrayCoreWhenPossible.Description), value: ref.watch(ConfigOptions.useXrayCoreWhenPossible), onChanged: ref.watch(ConfigOptions.useXrayCoreWhenPossible.notifier).update, ), + const Gap(24), ], ), ), diff --git a/lib/features/profile/data/profile_repository.dart b/lib/features/profile/data/profile_repository.dart index e6537017..af6816e0 100644 --- a/lib/features/profile/data/profile_repository.dart +++ b/lib/features/profile/data/profile_repository.dart @@ -177,7 +177,9 @@ class ProfileRepositoryImpl with ExceptionHandler, InfraLogger implements Profil bool debug, ) { return exceptionHandler( - () { + () async { + singbox.changeOptions(await configOptionRepository.getConfigOptions()).run(); + return singbox.validateConfigByPath(path, tempPath, debug).mapLeft(ProfileFailure.invalidConfig).run(); }, ProfileUnexpectedFailure.new, @@ -276,7 +278,7 @@ class ProfileRepositoryImpl with ExceptionHandler, InfraLogger implements Profil return TaskEither.Do( ($) async { final configFile = profilePathResolver.file(id); - // TODO pass options + final options = await configOptionRepository.getConfigOptions(); singbox.changeOptions(options).mapLeft(InvalidConfigOption.new).run(); @@ -394,10 +396,13 @@ class ProfileRepositoryImpl with ExceptionHandler, InfraLogger implements Profil final tempFile = profilePathResolver.tempFile(fileName); try { + final configs = await configOptionRepository.getConfigOptions(); + final response = await httpClient.download( url.trim(), tempFile.path, cancelToken: cancelToken, + userAgent: configs.useXrayCoreWhenPossible ? "v2rayNG/1.8.23" : null, ); final headers = await _populateHeaders(response.headers.map, tempFile.path); return await validateConfig(file.path, tempFile.path, false) diff --git a/libcore b/libcore index b389963a..3874832c 160000 --- a/libcore +++ b/libcore @@ -1 +1 @@ -Subproject commit b389963aa8a5a83e512b3ead9a84c2f1702f7cf8 +Subproject commit 3874832ccf0bf312f9310829a2b4043febf17f27