new: add use xray core option

This commit is contained in:
hiddify-com
2024-08-06 16:14:00 -04:00
parent aa99fabb8d
commit 27a1374dbc
6 changed files with 23 additions and 2 deletions

View File

@@ -327,6 +327,10 @@
"reconnectMsg": "Reconnecting for taking into account the changes..." "reconnectMsg": "Reconnecting for taking into account the changes..."
}, },
"config": { "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", "resetBtn": "Reset Options",
"serviceMode": "Service Mode", "serviceMode": "Service Mode",
"quickSettings": "Quick Settings", "quickSettings": "Quick Settings",

View File

@@ -327,6 +327,10 @@
"reconnectMsg": "در حال اتصال مجدد برای اعمال تغییرات..." "reconnectMsg": "در حال اتصال مجدد برای اعمال تغییرات..."
}, },
"config": { "config": {
"useXrayCoreWhenPossible":{
"Label":"استفاده از Xray-core در صورت ممکن",
"Description":"برای استفاده از Xray-core باید دوباره لینک ساب را وارد کنید تا این گزینه فعال شود."
},
"resetBtn": "بازنشانی تنظیمات", "resetBtn": "بازنشانی تنظیمات",
"serviceMode": "حالت سرویس", "serviceMode": "حالت سرویس",
"quickSettings": "تنظیمات سریع", "quickSettings": "تنظیمات سریع",

View File

@@ -31,7 +31,10 @@ abstract class ConfigOptions {
mapFrom: Region.values.byName, mapFrom: Region.values.byName,
mapTo: (value) => value.name, mapTo: (value) => value.name,
); );
static final useXrayCoreWhenPossible = PreferencesNotifier.create<bool, bool>(
"use-xray-core-when-possible",
false,
);
static final blockAds = PreferencesNotifier.create<bool, bool>( static final blockAds = PreferencesNotifier.create<bool, bool>(
"block-ads", "block-ads",
false, false,
@@ -329,6 +332,7 @@ abstract class ConfigOptions {
static final Map<String, StateNotifierProvider<PreferencesNotifier, dynamic>> preferences = { static final Map<String, StateNotifierProvider<PreferencesNotifier, dynamic>> preferences = {
"region": region, "region": region,
"block-ads": blockAds, "block-ads": blockAds,
"use-xray-core-when-possible": useXrayCoreWhenPossible,
"service-mode": serviceMode, "service-mode": serviceMode,
"log-level": logLevel, "log-level": logLevel,
"resolve-destination": resolveDestination, "resolve-destination": resolveDestination,
@@ -432,6 +436,7 @@ abstract class ConfigOptions {
return SingboxConfigOption( return SingboxConfigOption(
region: ref.watch(region).name, region: ref.watch(region).name,
blockAds: ref.watch(blockAds), blockAds: ref.watch(blockAds),
useXrayCoreWhenPossible: ref.watch(useXrayCoreWhenPossible),
executeConfigAsIs: false, executeConfigAsIs: false,
logLevel: ref.watch(logLevel), logLevel: ref.watch(logLevel),
resolveDestination: ref.watch(resolveDestination), resolveDestination: ref.watch(resolveDestination),

View File

@@ -138,6 +138,7 @@ class ConfigOptionsPage extends HookConsumerWidget {
title: t.config.logLevel, title: t.config.logLevel,
presentChoice: (value) => value.name.toUpperCase(), presentChoice: (value) => value.name.toUpperCase(),
), ),
const SettingsDivider(), const SettingsDivider(),
SettingsSection(t.config.section.route), SettingsSection(t.config.section.route),
ChoicePreferenceWidget( ChoicePreferenceWidget(
@@ -358,6 +359,12 @@ class ConfigOptionsPage extends HookConsumerWidget {
inputToValue: int.tryParse, inputToValue: int.tryParse,
), ),
const Gap(24), 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,
),
], ],
), ),
), ),

View File

@@ -18,6 +18,7 @@ class SingboxConfigOption with _$SingboxConfigOption {
const factory SingboxConfigOption({ const factory SingboxConfigOption({
required String region, required String region,
required bool blockAds, required bool blockAds,
required bool useXrayCoreWhenPossible,
required bool executeConfigAsIs, required bool executeConfigAsIs,
required LogLevel logLevel, required LogLevel logLevel,
required bool resolveDestination, required bool resolveDestination,

Submodule libcore updated: cfb37888d4...b389963aa8