Proxy update checks through the panel to avoid CORS failures.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1425,19 +1425,14 @@
|
||||
downloadBtn.classList.add('hidden');
|
||||
|
||||
try {
|
||||
const response = await fetch('https://git.evilfox.cc/api/v1/repos/test2/Amnezia-Web-Panel-main/releases/latest');
|
||||
if (!response.ok) throw new Error('API Error');
|
||||
const data = await response.json();
|
||||
|
||||
const latestVersion = data.tag_name;
|
||||
const currentVersion = '{{ current_version }}';
|
||||
|
||||
const data = await apiCall('/api/settings/check_updates');
|
||||
const latestVersion = data.latest_version || '';
|
||||
statusDiv.classList.remove('hidden');
|
||||
|
||||
if (latestVersion !== currentVersion && latestVersion) {
|
||||
if (data.update_available && latestVersion) {
|
||||
statusDiv.innerHTML = `<span style="color: var(--success); font-weight: bold;">{{ _('update_available')|default('Update available') }}: ${latestVersion}</span>`;
|
||||
statusDiv.style.border = '1px solid var(--success)';
|
||||
downloadBtn.href = data.html_url || 'https://git.evilfox.cc/test2/Amnezia-Web-Panel-main/releases';
|
||||
downloadBtn.href = data.html_url || data.releases_url || 'https://git.evilfox.cc/test2/Amnezia-Web-Panel-main/releases';
|
||||
downloadBtn.classList.remove('hidden');
|
||||
} else {
|
||||
statusDiv.innerHTML = `<span style="color: var(--text-muted);">{{ _('up_to_date')|default('Up to date') }}</span>`;
|
||||
|
||||
Reference in New Issue
Block a user