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
|
- type: routing
|
||||||
config:
|
config:
|
||||||
regex_locations:
|
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)$":
|
"~*\\.(css)$":
|
||||||
root: "./docs"
|
root: "./docs"
|
||||||
cache_control: "public, max-age=3600"
|
cache_control: "public, max-age=3600"
|
||||||
|
|
||||||
|
"~*\\.(js)$":
|
||||||
|
root: "./docs"
|
||||||
|
cache_control: "public, max-age=1800"
|
||||||
|
|
||||||
"__default__":
|
"__default__":
|
||||||
root: "./docs"
|
root: "./docs"
|
||||||
index_file: "index.html"
|
index_file: "index.html"
|
||||||
|
|||||||
@ -5,10 +5,11 @@
|
|||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'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 VERSION_ELEMENT_ID = 'current-version';
|
||||||
const CACHE_KEY = 'pyserve_version_cache';
|
const CACHE_KEY = 'pyserve_version_cache';
|
||||||
const CACHE_DURATION = 3600000;
|
const CACHE_DURATION = 3600000; // 1 hour
|
||||||
const FALLBACK_VERSION = '0.9.10';
|
const FALLBACK_VERSION = '0.9.10';
|
||||||
|
|
||||||
async function fetchLatestVersion() {
|
async function fetchLatestVersion() {
|
||||||
@ -29,7 +30,7 @@
|
|||||||
|
|
||||||
if (data.tag_name) {
|
if (data.tag_name) {
|
||||||
const version = data.tag_name.replace(/^v/, '');
|
const version = data.tag_name.replace(/^v/, '');
|
||||||
console.log(`✓ Version fetched from Gitea API: ${version}`);
|
console.log(`✓ Version fetched from API: ${version}`);
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +38,7 @@
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('API fetch error:', error.message);
|
console.error('API fetch error:', error.message);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user