Read the Arx version from the Hub API, not latest.json
Browse filesPage visits no longer request a file from Devseis/endpoint-auditor-releases, so that dataset's download count reflects installs, updates and installer downloads only.
- site/site.js +10 -4
site/site.js
CHANGED
|
@@ -6,7 +6,6 @@ import { Library, findingTemplate, summaryTemplate } from '../app/renderer/audit
|
|
| 6 |
|
| 7 |
const $ = id => document.getElementById(id);
|
| 8 |
const esc = s => String(s ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
| 9 |
-
const RELEASES = 'https://huggingface.co/datasets/Devseis/endpoint-auditor-releases/resolve/main/';
|
| 10 |
const DESKTOP = ['windows', 'macos', 'linux'];
|
| 11 |
const OS_LABEL = { mac: 'macOS', windows: 'Windows', linux: 'Linux' };
|
| 12 |
const FAMILY = { mac: 'macos', windows: 'windows', linux: 'linux' };
|
|
@@ -97,11 +96,18 @@ $('copyLink').addEventListener('click', async () => {
|
|
| 97 |
});
|
| 98 |
|
| 99 |
// ---------- version shown on the page ----------
|
|
|
|
|
|
|
|
|
|
| 100 |
async function initDownloads() {
|
| 101 |
try {
|
| 102 |
-
const
|
| 103 |
-
|
| 104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 105 |
} catch { /* keep the version written in the page */ }
|
| 106 |
}
|
| 107 |
|
|
|
|
| 6 |
|
| 7 |
const $ = id => document.getElementById(id);
|
| 8 |
const esc = s => String(s ?? '').replace(/[&<>"']/g, c => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
|
|
| 9 |
const DESKTOP = ['windows', 'macos', 'linux'];
|
| 10 |
const OS_LABEL = { mac: 'macOS', windows: 'Windows', linux: 'Linux' };
|
| 11 |
const FAMILY = { mac: 'macos', windows: 'windows', linux: 'linux' };
|
|
|
|
| 96 |
});
|
| 97 |
|
| 98 |
// ---------- version shown on the page ----------
|
| 99 |
+
// Current version, from the release file names (Arx-<version>-…) listed by the Hub API. The page reads no file from the
|
| 100 |
+
// releases dataset, because Hugging Face counts every file request there as a download: the dataset's download count
|
| 101 |
+
// then reflects installs, updates and installer downloads only, not visits to this page.
|
| 102 |
async function initDownloads() {
|
| 103 |
try {
|
| 104 |
+
const r = await fetch('https://huggingface.co/api/datasets/Devseis/endpoint-auditor-releases/tree/main', { cache: 'no-cache' });
|
| 105 |
+
if (!r.ok) throw new Error(`releases: HTTP ${r.status}`);
|
| 106 |
+
const versions = (await r.json()).map(f => /^Arx-(\d+)\.(\d+)\.(\d+)-/.exec(f.path)).filter(Boolean).map(m => m.slice(1).map(Number));
|
| 107 |
+
if (!versions.length) return;
|
| 108 |
+
const version = versions.sort((x, y) => y[0] - x[0] || y[1] - x[1] || y[2] - x[2])[0].join('.');
|
| 109 |
+
$('dlVersion').textContent = `Version ${version}`;
|
| 110 |
+
$('heroMeta').textContent = `Free · open source · version ${version}`;
|
| 111 |
} catch { /* keep the version written in the page */ }
|
| 112 |
}
|
| 113 |
|