mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
- Replace plain textarea with CodeMirror editor (YAML syntax highlighting, line numbers, auto-indent) for Clash subscription template - Fix confAlerts crash when subClashURI/subURI/subJsonURI is null/undefined (prevented save button from enabling) - Add yaml.js CodeMirror mode asset - Include docs and .gitignore cleanup
2.6 KiB
2.6 KiB
Pre-release Install/Update Selection
Summary
Add interactive prompts to install.sh and update.sh so users can choose between the latest Stable release or the latest Pre-release when installing or updating 3x-ui.
Current State
install.shandupdate.shboth hardcodeGET /repos/Sora39831/3x-ui/releases/latest, which only returns stable releases.- No mechanism exists to install or update to a pre-release version through the automated flow.
Design
1. GitHub API Fetch Helper
A shared function (duplicated in both install.sh and update.sh, matching existing script conventions) that:
- Calls
GET https://api.github.com/repos/Sora39831/3x-ui/releases(returns all releases) - Parses the JSON response to extract:
latest_stable_tag— first entry with"prerelease": falselatest_prerelease_tag— first entry with"prerelease": true(empty if none exists)
- Uses
grep/sed/awk(nojqdependency, consistent with existing parsing patterns) - Falls back to
curl -4on IPv6 failure, matching existing retry pattern
2. Interactive Prompt
Both scripts display a menu after fetching release info:
Which version do you want to install/update?
1) Latest Stable: v2.x.x
2) Latest Pre-release: v2.x.x-beta
Please enter your choice [1-2]:
Behavior:
- Show actual version tags so the user knows what they're selecting
- If no pre-release exists: skip prompt, use stable automatically
- If no stable release exists (edge case): skip prompt, use pre-release automatically
- Invalid input re-prompts
3. install.sh Changes
In install_x-ui(), the no-argument path (line ~879):
Before: Calls /releases/latest, parses single tag, downloads.
After:
- Call fetch helper to get both tags
- Show interactive prompt
- Set
tag_versionfrom user choice - Download as before (existing logic unchanged)
The specific-version path ($1 argument) is unchanged.
4. update.sh Changes
In update_x-ui(), same pattern:
Before: Calls /releases/latest, parses single tag, downloads.
After:
- Call fetch helper to get both tags
- Show interactive prompt
- Set
tag_versionfrom user choice - Continue existing update logic (unchanged)
x-ui.sh is not modified — it delegates to update.sh already.
Files Modified
install.sh— add fetch helper + prompt ininstall_x-ui()update.sh— add fetch helper + prompt inupdate_x-ui()
Out of Scope
- Persisting user's choice across updates (always prompt each time)
- CLI flags like
--pre-releasefor non-interactive use - Changes to
x-ui.sh(delegation is already in place)