diff --git a/config.docs.yaml b/config.docs.yaml index b1f0cf9..f4b59b9 100644 --- a/config.docs.yaml +++ b/config.docs.yaml @@ -21,10 +21,20 @@ extensions: - type: routing config: regex_locations: + "=/api/version": + proxy_pass: "https://git.pyserve.org/api/v1/repos/Shifty/pyserveX/releases/latest" + headers: + - "X-Forwarded-For: $remote_addr" + - "X-Real-IP: $remote_addr" + "~*\\.(css)$": root: "./docs" cache_control: "public, max-age=3600" + "~*\\.(js)$": + root: "./docs" + cache_control: "public, max-age=1800" + "__default__": root: "./docs" index_file: "index.html" diff --git a/scripts/version-fetcher.js b/scripts/version-fetcher.js index 30eeb1f..748adbd 100644 --- a/scripts/version-fetcher.js +++ b/scripts/version-fetcher.js @@ -5,10 +5,11 @@ (function() { 'use strict'; - const API_URL = 'https://git.pyserve.org/api/v1/repos/Shifty/pyserveX/releases/latest'; + + const API_URL = '/api/version'; const VERSION_ELEMENT_ID = 'current-version'; const CACHE_KEY = 'pyserve_version_cache'; - const CACHE_DURATION = 3600000; + const CACHE_DURATION = 3600000; // 1 hour const FALLBACK_VERSION = '0.9.10'; async function fetchLatestVersion() { @@ -29,7 +30,7 @@ if (data.tag_name) { const version = data.tag_name.replace(/^v/, ''); - console.log(`✓ Version fetched from Gitea API: ${version}`); + console.log(`✓ Version fetched from API: ${version}`); return version; } @@ -37,7 +38,7 @@ return null; } catch (error) { - console.warn('API fetch error:', error.message); + console.error('API fetch error:', error.message); return null; } }