Skip to content

Fix custom Geo resource URLs - #2226

Open
imzihuailin wants to merge 1 commit into
chen08209:mainfrom
imzihuailin:agent/fix-geo-url-keys
Open

Fix custom Geo resource URLs#2226
imzihuailin wants to merge 1 commit into
chen08209:mainfrom
imzihuailin:agent/fix-geo-url-keys

Conversation

@imzihuailin

Copy link
Copy Markdown

Summary

  • restore the custom Geo URL keys emitted for Mihomo from geo-ip/geo-site to geoip/geosite
  • keep deserialization compatible with both the hyphenated and non-hyphenated forms
  • update the existing model assertions for the corrected serialized output

Impact

The field-name regression caused custom GEOIP and GEOSITE URLs to be written under keys Mihomo does not consume, so first-time Geo resource downloads could fall back to the default URLs instead of using the user's configured sources. This change restores the expected keys without changing MMDB or ASN handling.

This PR is intentionally limited to the custom Geo URL mapping and does not change the startup-stage Geo auto-update flow.

Validation

  • Flutter 3.44.4 / Dart 3.12.2
  • dart format lib/enum/enum.dart test/models/config_test.dart
  • flutter analyze --no-fatal-infos (passes with 10 pre-existing withOpacity info diagnostics)
  • flutter test test/models/config_test.dart (33 tests passed)
  • flutter test --reporter expanded (417 tests passed)

Fixes #2215

@imzihuailin

Copy link
Copy Markdown
Author

Additional manual validation completed:

  • Ran the PR build in an isolated user-data directory with separate ports and system proxy, TUN, LAN access, and external controller disabled. The existing FlClash instance and proxy remained online.
  • Entered custom GeoIP and GeoSite URLs through the UI. Preferences and the generated runtime config used geoip and geosite; neither hyphenated key was emitted.
  • Exercised the same core sequence used by the updater: initClash, setupConfig, then updateGeoData for both resources. The isolated HTTP server received both requests, and the downloaded files matched the source SHA-256 hashes.
  • Before/after hashes confirmed that the active installation preferences, runtime config, and Geo files were unchanged.
  • Relevant logs were sanitized; raw logs and temporary test data were deleted.

One separate startup-timing behavior remains out of scope for this PR: if the Geo files are deleted immediately before an app restart, startup can recreate the defaults before the scheduled custom updater runs. The explicit updater path itself consumed both corrected custom URL fields successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] v0.8.94启动时自动更新geoip/geosite不使用自定义资源

1 participant