feat: Move update check to alerts function
Some checks failed
Build Docker / Build Images (map[dockerfile:Dockerfile.hsd tag_suffix:-hsd target:hsd]) (push) Has been cancelled
Build Docker / Build Images (map[dockerfile:Dockerfile tag_suffix: target:default]) (push) Has been cancelled
Tests and Linting / Tests-Linting (3.10) (push) Has been cancelled
Tests and Linting / Tests-Linting (3.11) (push) Has been cancelled
Tests and Linting / Tests-Linting (3.13) (push) Has been cancelled

This commit is contained in:
2025-09-11 15:04:31 +10:00
parent 9f8daa8b88
commit eb6306bb83

23
main.py
View File

@@ -71,15 +71,6 @@ def index():
if not os.path.exists(".git"): if not os.path.exists(".git"):
return render_template("index.html", account=account, plugins=plugins) return render_template("index.html", account=account, plugins=plugins)
info = gitinfo.get_git_info()
if info is None:
return render_template("index.html", account=account, plugins=plugins)
branch = info['refs']
commit = info['commit']
if commit != latestVersion(branch):
logger.info("New version available")
plugins += render_template('components/dashboard-alert.html', name='Update', output='A new version of FireWallet is available')
alerts = get_alerts(account) alerts = get_alerts(account)
for alert in alerts: for alert in alerts:
output_html = alert['output'] output_html = alert['output']
@@ -1921,6 +1912,20 @@ def get_alerts(account:str) -> list:
alerts = [] alerts = []
info = gitinfo.get_git_info()
if info is not None:
branch = info['refs']
commit = info['commit']
if commit != latestVersion(branch):
logger.info("New version available")
alerts.append({
"name": "Update Available",
"output": f"A new version of FireWallet is available. <a href='https://git.woodburn.au/nathanwoodburn/firewalletbrowser/compare/{commit}...{branch}' target='_blank'>Changelog</a>."
})
# Check if the node is connected # Check if the node is connected
if not account_module.hsdConnected(): if not account_module.hsdConnected():
alerts.append({ alerts.append({