diff --git a/scripts/version-fetcher.js b/scripts/version-fetcher.js index a1b263f..cfe82e3 100644 --- a/scripts/version-fetcher.js +++ b/scripts/version-fetcher.js @@ -5,49 +5,39 @@ (function() { 'use strict'; - const RELEASES_URL = 'https://git.pyserve.org/Shifty/pyserveX/releases/latest'; + const API_URL = 'https://git.pyserve.org/api/v1/repos/Shifty/pyserveX/releases/latest'; const VERSION_ELEMENT_ID = 'current-version'; const CACHE_KEY = 'pyserve_version_cache'; const CACHE_DURATION = 3600000; // 1 hour - const FALLBACK_VERSION = 'offline'; - + const FALLBACK_VERSION = '0.9.10'; + async function fetchLatestVersion() { try { - const response = await fetch(RELEASES_URL, { + const response = await fetch(API_URL, { method: 'GET', - mode: 'cors', headers: { - 'Accept': 'text/html' + 'Accept': 'application/json' } }); if (!response.ok) { - console.warn(`Failed to fetch: ${response.status}`); + console.warn(`API request failed: ${response.status}`); return null; } - const html = await response.text(); - - const patterns = [ - /