include app configs before validaing proxies
This commit is contained in:
@@ -358,13 +358,14 @@ class ConfigOptionsPage extends HookConsumerWidget {
|
|||||||
digitsOnly: true,
|
digitsOnly: true,
|
||||||
inputToValue: int.tryParse,
|
inputToValue: int.tryParse,
|
||||||
),
|
),
|
||||||
const Gap(24),
|
|
||||||
SwitchListTile(
|
SwitchListTile(
|
||||||
title: Text(experimental(t.config.useXrayCoreWhenPossible.Label)),
|
title: Text(experimental(t.config.useXrayCoreWhenPossible.Label)),
|
||||||
subtitle: Text(t.config.useXrayCoreWhenPossible.Description),
|
subtitle: Text(t.config.useXrayCoreWhenPossible.Description),
|
||||||
value: ref.watch(ConfigOptions.useXrayCoreWhenPossible),
|
value: ref.watch(ConfigOptions.useXrayCoreWhenPossible),
|
||||||
onChanged: ref.watch(ConfigOptions.useXrayCoreWhenPossible.notifier).update,
|
onChanged: ref.watch(ConfigOptions.useXrayCoreWhenPossible.notifier).update,
|
||||||
),
|
),
|
||||||
|
const Gap(24),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -177,7 +177,9 @@ class ProfileRepositoryImpl with ExceptionHandler, InfraLogger implements Profil
|
|||||||
bool debug,
|
bool debug,
|
||||||
) {
|
) {
|
||||||
return exceptionHandler(
|
return exceptionHandler(
|
||||||
() {
|
() async {
|
||||||
|
singbox.changeOptions(await configOptionRepository.getConfigOptions()).run();
|
||||||
|
|
||||||
return singbox.validateConfigByPath(path, tempPath, debug).mapLeft(ProfileFailure.invalidConfig).run();
|
return singbox.validateConfigByPath(path, tempPath, debug).mapLeft(ProfileFailure.invalidConfig).run();
|
||||||
},
|
},
|
||||||
ProfileUnexpectedFailure.new,
|
ProfileUnexpectedFailure.new,
|
||||||
@@ -276,7 +278,7 @@ class ProfileRepositoryImpl with ExceptionHandler, InfraLogger implements Profil
|
|||||||
return TaskEither<ProfileFailure, String>.Do(
|
return TaskEither<ProfileFailure, String>.Do(
|
||||||
($) async {
|
($) async {
|
||||||
final configFile = profilePathResolver.file(id);
|
final configFile = profilePathResolver.file(id);
|
||||||
// TODO pass options
|
|
||||||
final options = await configOptionRepository.getConfigOptions();
|
final options = await configOptionRepository.getConfigOptions();
|
||||||
|
|
||||||
singbox.changeOptions(options).mapLeft(InvalidConfigOption.new).run();
|
singbox.changeOptions(options).mapLeft(InvalidConfigOption.new).run();
|
||||||
@@ -394,10 +396,13 @@ class ProfileRepositoryImpl with ExceptionHandler, InfraLogger implements Profil
|
|||||||
final tempFile = profilePathResolver.tempFile(fileName);
|
final tempFile = profilePathResolver.tempFile(fileName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
final configs = await configOptionRepository.getConfigOptions();
|
||||||
|
|
||||||
final response = await httpClient.download(
|
final response = await httpClient.download(
|
||||||
url.trim(),
|
url.trim(),
|
||||||
tempFile.path,
|
tempFile.path,
|
||||||
cancelToken: cancelToken,
|
cancelToken: cancelToken,
|
||||||
|
userAgent: configs.useXrayCoreWhenPossible ? "v2rayNG/1.8.23" : null,
|
||||||
);
|
);
|
||||||
final headers = await _populateHeaders(response.headers.map, tempFile.path);
|
final headers = await _populateHeaders(response.headers.map, tempFile.path);
|
||||||
return await validateConfig(file.path, tempFile.path, false)
|
return await validateConfig(file.path, tempFile.path, false)
|
||||||
|
|||||||
2
libcore
2
libcore
Submodule libcore updated: b389963aa8...3874832ccf
Reference in New Issue
Block a user