feat: allow explicit download of pre-release UI versions

This commit is contained in:
Matthias
2025-04-03 20:28:25 +02:00
parent 26c7752b7c
commit 627eee5fcf
4 changed files with 15 additions and 4 deletions

View File

@@ -191,7 +191,7 @@ ARGS_PLOT_PROFIT = [
ARGS_CONVERT_DB = ["db_url", "db_url_from"]
ARGS_INSTALL_UI = ["erase_ui_only", "ui_version"]
ARGS_INSTALL_UI = ["erase_ui_only", "ui_prerelease", "ui_version"]
ARGS_SHOW_TRADES = ["db_url", "trade_ids", "print_json"]

View File

@@ -527,6 +527,15 @@ AVAILABLE_CLI_OPTIONS = {
),
type=str,
),
"ui_prerelease": Arg(
"--prerelease",
help=(
"Install the latest pre-release version of FreqUI. "
"This is not recommended for production use."
),
action="store_true",
default=False,
),
# Templating options
"template": Arg(
"--template",

View File

@@ -116,7 +116,9 @@ def start_install_ui(args: dict[str, Any]) -> None:
dest_folder = Path(__file__).parents[1] / "rpc/api_server/ui/installed/"
# First make sure the assets are removed.
dl_url, latest_version = get_ui_download_url(args.get("ui_version"))
dl_url, latest_version = get_ui_download_url(
args.get("ui_version"), args.get("ui_prerelease", False)
)
curr_version = read_ui_version(dest_folder)
if curr_version == latest_version and not args.get("erase_ui_only"):

View File

@@ -51,7 +51,7 @@ def download_and_install_ui(dest_folder: Path, dl_url: str, version: str):
f.write(version)
def get_ui_download_url(version: str | None = None) -> tuple[str, str]:
def get_ui_download_url(version: str | None, prerelease: bool) -> tuple[str, str]:
base_url = "https://api.github.com/repos/freqtrade/frequi/"
# Get base UI Repo path
@@ -62,7 +62,7 @@ def get_ui_download_url(version: str | None = None) -> tuple[str, str]:
if version:
tmp = [x for x in r if x["name"] == version]
else:
tmp = [x for x in r if not x.get("prerelease")]
tmp = [x for x in r if prerelease or not x.get("prerelease")]
if tmp:
# Ensure we have the latest version