use own cached templates release

This commit is contained in:
Khaleel Al-Adhami 2024-12-03 18:41:19 -08:00
parent c721227a06
commit 0883426197
2 changed files with 8 additions and 3 deletions

View File

@ -78,7 +78,8 @@ class Reflex(SimpleNamespace):
# The root directory of the reflex library.
ROOT_DIR = Path(__file__).parents[2]
RELEASES_URL = "https://api.github.com/repos/reflex-dev/templates/releases"
RELEASES_URL = "https://templates-releases.reflex.dev"
RELEASES_URL_FALLBACK = "https://api.github.com/repos/reflex-dev/templates/releases"
class ReflexHostingCLI(SimpleNamespace):

View File

@ -1258,8 +1258,12 @@ def fetch_app_templates(version: str) -> dict[str, Template]:
"""
def get_release_by_tag(tag: str) -> dict | None:
response = net.get(constants.Reflex.RELEASES_URL)
response.raise_for_status()
try:
response = net.get(constants.Reflex.RELEASES_URL)
response.raise_for_status()
except Exception:
response = net.get(constants.Reflex.RELEASES_URL_FALLBACK)
response.raise_for_status()
releases = response.json()
for release in releases:
if release["tag_name"] == f"v{tag}":