diff --git a/assets/translations/strings_en.i18n.json b/assets/translations/strings_en.i18n.json index 5fbc91489..05f3ecdb3 100644 --- a/assets/translations/strings_en.i18n.json +++ b/assets/translations/strings_en.i18n.json @@ -327,6 +327,10 @@ "reconnectMsg": "Reconnecting for taking into account the changes..." }, "config": { + "useXrayCoreWhenPossible":{ + "Label":"Use Xray-core When Possible", + "Description":"Use Xray-core during parsing sub links. You need to reimport the sub link to enable this option." + }, "resetBtn": "Reset Options", "serviceMode": "Service Mode", "quickSettings": "Quick Settings", diff --git a/assets/translations/strings_fa.i18n.json b/assets/translations/strings_fa.i18n.json index 08321d44b..6e9c1b92c 100644 --- a/assets/translations/strings_fa.i18n.json +++ b/assets/translations/strings_fa.i18n.json @@ -327,6 +327,10 @@ "reconnectMsg": "در حال اتصال مجدد برای اعمال تغییرات..." }, "config": { + "useXrayCoreWhenPossible":{ + "Label":"استفاده از Xray-core در صورت ممکن", + "Description":"برای استفاده از Xray-core باید دوباره لینک ساب را وارد کنید تا این گزینه فعال شود." + }, "resetBtn": "بازنشانی تنظیمات", "serviceMode": "حالت سرویس", "quickSettings": "تنظیمات سریع", diff --git a/lib/features/config_option/data/config_option_repository.dart b/lib/features/config_option/data/config_option_repository.dart index 08c7d1426..7484f12f2 100644 --- a/lib/features/config_option/data/config_option_repository.dart +++ b/lib/features/config_option/data/config_option_repository.dart @@ -31,7 +31,10 @@ abstract class ConfigOptions { mapFrom: Region.values.byName, mapTo: (value) => value.name, ); - + static final useXrayCoreWhenPossible = PreferencesNotifier.create( + "use-xray-core-when-possible", + false, + ); static final blockAds = PreferencesNotifier.create( "block-ads", false, @@ -329,6 +332,7 @@ abstract class ConfigOptions { static final Map> preferences = { "region": region, "block-ads": blockAds, + "use-xray-core-when-possible": useXrayCoreWhenPossible, "service-mode": serviceMode, "log-level": logLevel, "resolve-destination": resolveDestination, @@ -432,6 +436,7 @@ abstract class ConfigOptions { return SingboxConfigOption( region: ref.watch(region).name, blockAds: ref.watch(blockAds), + useXrayCoreWhenPossible: ref.watch(useXrayCoreWhenPossible), executeConfigAsIs: false, logLevel: ref.watch(logLevel), resolveDestination: ref.watch(resolveDestination), diff --git a/lib/features/config_option/overview/config_options_page.dart b/lib/features/config_option/overview/config_options_page.dart index 221aac530..bab3d3736 100644 --- a/lib/features/config_option/overview/config_options_page.dart +++ b/lib/features/config_option/overview/config_options_page.dart @@ -138,6 +138,7 @@ class ConfigOptionsPage extends HookConsumerWidget { title: t.config.logLevel, presentChoice: (value) => value.name.toUpperCase(), ), + const SettingsDivider(), SettingsSection(t.config.section.route), ChoicePreferenceWidget( @@ -358,6 +359,12 @@ class ConfigOptionsPage extends HookConsumerWidget { 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, + ), ], ), ), diff --git a/lib/singbox/model/singbox_config_option.dart b/lib/singbox/model/singbox_config_option.dart index aefe9a70e..0a96538ee 100644 --- a/lib/singbox/model/singbox_config_option.dart +++ b/lib/singbox/model/singbox_config_option.dart @@ -18,6 +18,7 @@ class SingboxConfigOption with _$SingboxConfigOption { const factory SingboxConfigOption({ required String region, required bool blockAds, + required bool useXrayCoreWhenPossible, required bool executeConfigAsIs, required LogLevel logLevel, required bool resolveDestination, diff --git a/libcore b/libcore index cfb37888d..b389963aa 160000 --- a/libcore +++ b/libcore @@ -1 +1 @@ -Subproject commit cfb37888d420d9ae495c9e2fa3050dc051e12218 +Subproject commit b389963aa8a5a83e512b3ead9a84c2f1702f7cf8