From 91b30d59a91bbd2274be883e91d42b97a9bb1979 Mon Sep 17 00:00:00 2001 From: hiddify-com <114227601+hiddify-com@users.noreply.github.com> Date: Fri, 19 Jul 2024 15:47:54 +0200 Subject: [PATCH] new: add10000 to all ports for prevenging permission error. add warp from github repository except for china --- .../config_option/data/config_option_repository.dart | 8 ++++---- lib/features/profile/add/add_profile_modal.dart | 7 ++++++- lib/features/profile/notifier/profile_notifier.dart | 3 +-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/features/config_option/data/config_option_repository.dart b/lib/features/config_option/data/config_option_repository.dart index cccebbbd..85a3cb80 100644 --- a/lib/features/config_option/data/config_option_repository.dart +++ b/lib/features/config_option/data/config_option_repository.dart @@ -83,19 +83,19 @@ abstract class ConfigOptions { static final mixedPort = PreferencesNotifier.create( "mixed-port", - 2334, + 12334, validator: (value) => isPort(value.toString()), ); static final tproxyPort = PreferencesNotifier.create( "tproxy-port", - 2335, + 12335, validator: (value) => isPort(value.toString()), ); static final localDnsPort = PreferencesNotifier.create( "local-dns-port", - 6450, + 16450, validator: (value) => isPort(value.toString()), ); @@ -130,7 +130,7 @@ abstract class ConfigOptions { static final clashApiPort = PreferencesNotifier.create( "clash-api-port", - 6756, + 16756, validator: (value) => isPort(value.toString()), ); diff --git a/lib/features/profile/add/add_profile_modal.dart b/lib/features/profile/add/add_profile_modal.dart index 4b2175dd..ae42ffee 100644 --- a/lib/features/profile/add/add_profile_modal.dart +++ b/lib/features/profile/add/add_profile_modal.dart @@ -10,6 +10,7 @@ import 'package:hiddify/core/notification/in_app_notification_controller.dart'; import 'package:hiddify/core/preferences/preferences_provider.dart'; import 'package:hiddify/core/router/router.dart'; import 'package:hiddify/features/common/qr_code_scanner_screen.dart'; +import 'package:hiddify/features/config_option/data/config_option_repository.dart'; import 'package:hiddify/features/config_option/notifier/warp_option_notifier.dart'; import 'package:hiddify/features/config_option/overview/warp_options_widgets.dart'; @@ -275,7 +276,11 @@ class AddProfileModal extends HookConsumerWidget { await _warp.generateWarp2Config(); toast?.start(); // } - await _profile.add("#profile-title: Hiddify WARP\nwarp://p1@auto#National&&detour=warp://p2@auto#WoW"); // + if (ref.read(ConfigOptions.region.notifier).raw() == "cn") { + await _profile.add("#profile-title: Hiddify WARP\nwarp://p1@auto#National&&detour=warp://p2@auto#WoW"); // + } else { + await _profile.add("https://raw.githubusercontent.com/hiddify/hiddify-next/main/test.configs/warp"); // + } } } diff --git a/lib/features/profile/notifier/profile_notifier.dart b/lib/features/profile/notifier/profile_notifier.dart index f0d6d886..9a6304ee 100644 --- a/lib/features/profile/notifier/profile_notifier.dart +++ b/lib/features/profile/notifier/profile_notifier.dart @@ -78,8 +78,7 @@ class AddProfile extends _$AddProfile with AppLogger { var name = parsed.name; var oldItem = await _profilesRepo.getByName(name); if (name == "Hiddify WARP" && oldItem != null) { - _profilesRepo.setAsActive(oldItem.id).run(); - return unit; + _profilesRepo.deleteById(oldItem.id).run(); } while (await _profilesRepo.getByName(name) != null) { name += '${randomInt(0, 9).run()}';