Repository navigation
feat: add WebDAV sync of subscriptions from Clash Verge Rev backups - #886
Open
chen-xiaochen wants to merge 4 commits into
Open
chen-xiaochen wants to merge 4 commits into
chen-xiaochen wants to merge 4 commits into
Conversation
Add a WebDAV sync option under Settings that imports subscriptions from Clash Verge Rev desktop backups stored on a WebDAV server: - WebDavClient: minimal PROPFIND/GET client with basic auth on HttpURLConnection, no new dependencies - VergeBackup: parse profiles.yaml inside the backup zip and extract remote (subscription) entries - Settings entry + WebDavSettingsActivity/Design: configure server address/username/password, sync on demand - Profiles are matched by name: existing ones are updated with the new subscription URL, missing ones are created; per-profile failures are counted and reported without aborting the rest - Translations for en/zh/zh-rHK/zh-rTW/ja/ko/ru/vi
- Bind surface in WebDavSettingsDesign: the shared settings layout references surface.insets in padding expressions, a null surface throws NPE on inflation - Replace java.util.Base64 with android.util.Base64: the former requires API 26 and the project targets minSdk 21 without desugaring, so tapping Sync crashed on Android < 8.0
preferenceScreen builds its own view hierarchy; without binding.content.addView(screen.root) the page rendered empty (title bar only)
- Send PROPFIND over a raw socket: HttpURLConnection cannot carry WebDAV extension methods and the method-field reflection hack does not survive OEM implementations (request went out as GET on ColorOS 15, answered 403/501) - Strip whitespace from stored credentials (trailing newline in the username produced HTTP 401) - Fall back to Verge's 'clash-verge-rev-backup' subdirectory: Verge always creates and uploads under it (clash-verge-rev src-tauri/src/utils/dirs.rs BACKUP_DIR), so the configured URL is typically the bare server address - Return directory-relative paths from listBackupFiles so downloads resolve against the listed directory - Include the response body in HTTP error messages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an opt-in WebDAV sync feature that imports subscriptions (remote profiles) from Clash Verge Rev desktop backups stored on a WebDAV server.
Motivation
Many users run Clash Verge (Rev) on desktop and CMFA on Android with the same subscriptions. Today, keeping the phone in sync means re-copying subscription links through chat apps every time a subscription changes. Clash Verge Rev already supports automatic WebDAV backups, so CMFA can consume those backups directly and sync with one tap.
What it does
PROPFINDthe WebDAV directory, pick the newest*-backup-*.zip(Verge Rev's automatic backup naming)profiles.yamlinside the zip, keeptype: remoteentries (name + subscription URL)Urlprofiles and fetchedImplementation notes
WebDavClient(common): minimal PROPFIND/GET client with basic auth onHttpURLConnection— no new dependenciesVergeBackup(common): line-basedprofiles.yamlparser; only reads the metadata file, does not import Verge-specific merge/script/rules filespreferenceScreenDSL,UiStorestorage,withProfileIPC andProfileManagercreate/patch/commit APIs — no new architectureUiStore(SharedPreferences), same as other UI settingsTesting
assembleAlphaDebugbuilds successfully for all flavors/ABIsOut of scope (intentionally)