Fix the problem that the download of remote resources failed after GeodataMode was turned on, which caused the application to flash back.

Fix edit profile error
This commit is contained in:
chen08209
2024-06-06 10:13:03 +08:00
parent fea3c14608
commit 52d61b15fd
7 changed files with 15 additions and 17 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -40,7 +40,7 @@ class _EditProfileState extends State<EditProfile> {
_handleConfirm() {
if (!_formKey.currentState!.validate()) return;
final config = widget.context.read<Config>();
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<EditProfile> {
},
),
),
if (widget.profile.url != null)...[
if (widget.profile.url != null && widget.profile.url!.isNotEmpty == true)...[
ListItem(
title: TextFormField(
controller: urlController,

View File

@@ -139,9 +139,10 @@ class _ProfilesFragmentState extends State<ProfilesFragment> {
),
child: Selector2<AppState, Config, ProfilesSelectorState>(
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(

View File

@@ -95,9 +95,6 @@ class Profile {
}
Future<void> 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;

View File

@@ -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'