Skip to content

Add custom URL support with mirror selection#17328

Open
dejavui wants to merge 16 commits into
keiyoushi:mainfrom
dejavui:Add-custom-URL-support-with-mirror-selection
Open

Add custom URL support with mirror selection#17328
dejavui wants to merge 16 commits into
keiyoushi:mainfrom
dejavui:Add-custom-URL-support-with-mirror-selection

Conversation

@dejavui

@dejavui dejavui commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Introduce CustomAndMirrorPreferences, allowing extensions to combine predefined mirrors with a custom base URL option.

This generalizes the existing MoeTruyen implementation into a reusable framework component, so extensions no longer need to implement their own mirror/custom URL preference logic.

Changes

  • Added CustomAndMirrorPreferences to handle mirror selection and custom base URLs in a single preference component.
  • Extended BaseUrlSpec.Mirrors with optional entries, values, and withCustom support for declarative mirror configuration.
  • Updated SourceProcessor to generate CustomAndMirrorPreferences when custom URLs are enabled, while preserving the existing MirrorPreferences path for regular mirror-only sources.
  • Migrated the MoeTruyen extension to the new declarative @Source configuration.
  • Removed the manual mirror/custom URL preference implementation from MoeTruyen, as it is now generated by the framework.

Review needed 👉゚ヮ゚👉 from @AwkwardPeak7, @vetleledaal, and @FourTOne5. Thanks!

Checklist:

  • Updated versionCode value in build.gradle.kts
  • Updated baseVersionCode in build.gradle.kts (if updated multisrc theme code)
  • Referenced all related issues in the PR body (e.g. "Closes #xyz")
  • Set the contentWarning configuration in build.gradle.kts appropriately
  • Have not changed source names
  • Have explicitly kept the id if a source's name or language were changed
  • Have tested the modifications by compiling and running the extension through Android Studio
  • Have removed web_hi_res_512.png when adding a new extension
  • This PR is AI-assisted, I have reviewed the changes manually and confirmed they are not slop

dejavui added 5 commits July 4, 2026 15:49
Introduce CustomAndMirrorPreferences class to allow extensions to offer both predefined mirror URLs and a custom URL input option. This enables better flexibility for sources with multiple mirrors or alternative domains.

Changes include:
- New CustomAndMirrorPreferences class for managing mirror + custom URL preferences
- Enhanced BaseUrlSpec.Mirrors to support entries, values, and withCustom flag
- Updated SourceProcessor to conditionally use CustomAndMirrorPreferences when custom URLs are enabled
- Migrated MoeTruyen extension to use new @source annotation with declarative mirror configuration
- Removed manual preference handling code from MoeTruyen, now generated by framework
@AwkwardPeak7

AwkwardPeak7 commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

I feel like mirrors and custom urls should remain mutually exclusive.

@dejavui

dejavui commented Jul 5, 2026

Copy link
Copy Markdown
Contributor Author

I feel like mirrors and custom urls should remain mutually exclusive.

I understand the concern. My intention isn't to merge two unrelated features, but to model different ways of resolving the effective base URL \(〇_o)/

MoeTruyen has been using this workflow for a time: users choose either the default domain, one of the predefined mirrors, or a custom URL. Only one option is active at a time, so they're still mutually exclusive from the user's perspective.

@dejavui
dejavui marked this pull request as draft July 8, 2026 07:23
@FourTOne5

Copy link
Copy Markdown
Contributor

if this were to be considered i would expect the custom and mirrors option to be merged

@dejavui
dejavui marked this pull request as ready for review July 8, 2026 11:12
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.

3 participants