()
| 22140 | |
| 22141 | @app.route('/api/update/check', methods=['POST']) |
| 22142 | def update_check(): |
| 22143 | try: |
| 22144 | slug = _resolve_github_repo_slug() |
| 22145 | if not slug: |
| 22146 | return jsonify({"error": "Repository GitHub non configurato. Imposta INTELOSINT_GITHUB_REPO=owner/repo."}), 400 |
| 22147 | url = f"https://api.github.com/repos/{slug}/releases/latest" |
| 22148 | r = requests.get(url, timeout=10) |
| 22149 | if r.status_code != 200: |
| 22150 | return jsonify({"error": f"GitHub API HTTP {r.status_code}", "repo": slug}), 502 |
| 22151 | j = r.json() if isinstance(r.json(), dict) else {} |
| 22152 | latest = (j.get("tag_name") or j.get("name") or "").strip() or "v0.0.0" |
| 22153 | local_v = f"v{APP_VERSION}" |
| 22154 | update_available = _parse_semver(latest) > _parse_semver(local_v) |
| 22155 | return jsonify({ |
| 22156 | "repo": slug, |
| 22157 | "local_version": local_v, |
| 22158 | "latest_version": latest, |
| 22159 | "update_available": update_available, |
| 22160 | "release_url": j.get("html_url", "") |
| 22161 | }) |
| 22162 | except Exception as e: |
| 22163 | return jsonify({"error": f"Errore verifica aggiornamenti: {e}"}), 500 |
| 22164 | |
| 22165 | if __name__ == '__main__': |
| 22166 | threading.Thread(target=lambda: (time.sleep(2), webbrowser.open(f"http://127.0.0.1:{PORT_NUMBER}/"))).start() |
nothing calls this directly
no test coverage detected