Update API URL in version fetcher and enhance logging
All checks were successful
Deploy to Production / deploy (push) Successful in 5s
All checks were successful
Deploy to Production / deploy (push) Successful in 5s
This commit is contained in:
parent
769a5e0a43
commit
7e1846276e
@ -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"
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user