diff --git a/core/common.go b/core/common.go index 058ae78..7a68c48 100644 --- a/core/common.go +++ b/core/common.go @@ -325,11 +325,14 @@ func overwriteConfig(targetConfig *config.RawConfig, patchConfig config.RawConfi targetConfig.ExternalUI = "" targetConfig.Interface = "" targetConfig.ExternalUIURL = "" + targetConfig.GeodataMode = false //targetConfig.IPv6 = patchConfig.IPv6 targetConfig.LogLevel = patchConfig.LogLevel + targetConfig.Port = 0 + targetConfig.SocksPort = 0 + targetConfig.MixedPort = patchConfig.MixedPort targetConfig.FindProcessMode = process.FindProcessAlways targetConfig.AllowLan = patchConfig.AllowLan - targetConfig.MixedPort = patchConfig.MixedPort targetConfig.Mode = patchConfig.Mode targetConfig.Tun.Enable = patchConfig.Tun.Enable targetConfig.Tun.Device = patchConfig.Tun.Device diff --git a/core/hub.go b/core/hub.go index 913af81..d1bd84b 100644 --- a/core/hub.go +++ b/core/hub.go @@ -65,12 +65,7 @@ func validateConfig(s *C.char, port C.longlong) { i := int64(port) go func() { bytes := []byte(C.GoString(s)) - rawConfig, err := config.UnmarshalRawConfig(bytes) - if err != nil { - bridge.SendToPort(i, err.Error()) - return - } - _, err = config.ParseRawConfig(rawConfig) + _, err := config.UnmarshalRawConfig(bytes) if err != nil { bridge.SendToPort(i, err.Error()) return diff --git a/lib/controller.dart b/lib/controller.dart index e65bf4c..9a8bf73 100644 --- a/lib/controller.dart +++ b/lib/controller.dart @@ -101,7 +101,9 @@ class AppController { updateProfile(String id) async { final profile = config.getCurrentProfileForId(id); if (profile != null) { - await profile.update(); + final tempProfile = profile.copyWith(); + await tempProfile.update(); + config.setProfile(tempProfile); } } diff --git a/lib/fragments/profiles/edit_profile.dart b/lib/fragments/profiles/edit_profile.dart index 44ca1b1..8d92d0a 100644 --- a/lib/fragments/profiles/edit_profile.dart +++ b/lib/fragments/profiles/edit_profile.dart @@ -40,7 +40,7 @@ class _EditProfileState extends State { _handleConfirm() { if (!_formKey.currentState!.validate()) return; final config = widget.context.read(); - final hasUpdate = widget.profile.url != urlController.text; + final hasUpdate = urlController.text.isNotEmpty && widget.profile.url != urlController.text; widget.profile.url = urlController.text; widget.profile.label = labelController.text; widget.profile.autoUpdate = autoUpdate; @@ -82,7 +82,7 @@ class _EditProfileState extends State { }, ), ), - if (widget.profile.url != null)...[ + if (widget.profile.url != null && widget.profile.url!.isNotEmpty == true)...[ ListItem( title: TextFormField( controller: urlController, diff --git a/lib/fragments/profiles/profiles.dart b/lib/fragments/profiles/profiles.dart index f833d03..a5054fc 100644 --- a/lib/fragments/profiles/profiles.dart +++ b/lib/fragments/profiles/profiles.dart @@ -139,9 +139,10 @@ class _ProfilesFragmentState extends State { ), child: Selector2( selector: (_, appState, config) => ProfilesSelectorState( - profiles: config.profiles, - currentProfileId: config.currentProfileId, - viewMode: appState.viewMode), + profiles: config.profiles, + currentProfileId: config.currentProfileId, + viewMode: appState.viewMode, + ), builder: (context, state, child) { if (state.profiles.isEmpty) { return NullStatus( diff --git a/lib/models/profile.dart b/lib/models/profile.dart index 0af023b..15ccb26 100644 --- a/lib/models/profile.dart +++ b/lib/models/profile.dart @@ -95,9 +95,6 @@ class Profile { } Future update() async { - if (url == null) { - throw appLocalizations.unableToUpdateCurrentProfileDesc; - } final response = await request.getFileResponseForUrl(url!); final disposition = response.headers.value("content-disposition"); label ??= other.getFileNameForDisposition(disposition) ?? id; diff --git a/pubspec.yaml b/pubspec.yaml index b94fd1d..84b0a14 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: fl_clash description: A multi-platform proxy client based on ClashMeta, simple and easy to use, open-source and ad-free. publish_to: 'none' -version: 0.8.11 +version: 0.8.12 environment: sdk: '>=3.1.0 <4.0.0'