From 3b76f32cd24d899c9ca54306f5bbef268347075e Mon Sep 17 00:00:00 2001 From: Chris Tsang Date: Sat, 8 Aug 2026 22:10:30 +0100 Subject: [PATCH] update web app --- docs/index.html | 159 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 151 insertions(+), 8 deletions(-) diff --git a/docs/index.html b/docs/index.html index 4e9903b..4b5ff72 100644 --- a/docs/index.html +++ b/docs/index.html @@ -11,12 +11,14 @@ - + @@ -142,13 +173,21 @@ / VTracer
- Article -    GitHub    Download as SVG
+
+
+
+

Try the latest VTracer Desktop App for native speed, curve simplification, and higher tracing quality.

+
+ + Download Desktop App + +
+
@@ -314,6 +353,110 @@ document.body.classList.remove('uk-dark'); document.body.classList.add('uk-light'); } + + (function() { + var releasesUrl = 'https://github.com/visioncortex/vtracer/releases/latest'; + var manifestUrl = 'https://raw.githubusercontent.com/visioncortex/vtracer/desktop-updates/latest.json'; + var downloadLink = document.getElementById('desktop-download'); + var bannerCopy = document.getElementById('desktop-banner-copy'); + + function detectPlatform() { + var platform = navigator.userAgentData && navigator.userAgentData.platform + ? navigator.userAgentData.platform + : navigator.platform || ''; + var userAgent = navigator.userAgent || ''; + var platformText = platform + ' ' + userAgent; + + if (/Windows/i.test(platformText)) { + return { + label: 'Windows', + manifestKeys: ['windows-x86_64'] + }; + } + + if (/Mac|Darwin/i.test(platformText) && !/iPhone|iPad|iPod/i.test(userAgent)) { + return { + label: 'macOS', + manifestKeys: ['macos-universal', 'darwin-universal', 'darwin-aarch64', 'darwin-x86_64'] + }; + } + + if (/Linux|X11/i.test(platformText) && !/Android/i.test(userAgent)) { + return { + label: 'Linux', + manifestKeys: ['linux-x86_64'] + }; + } + + return { + label: '', + manifestKeys: [] + }; + } + + function setFallback(platform) { + downloadLink.href = releasesUrl; + downloadLink.textContent = platform.label ? 'Download for ' + platform.label : 'View latest downloads'; + bannerCopy.textContent = platform.label + ? 'Try the latest VTracer Desktop App for ' + platform.label + ' with native speed, curve simplification, and higher tracing quality.' + : 'Try the latest VTracer Desktop App for native speed, curve simplification, and higher tracing quality.'; + } + + function findPlatformDownload(platforms, platform) { + var keys = platform.manifestKeys || []; + + for (var i = 0; i < keys.length; i++) { + if (platforms[keys[i]] && platforms[keys[i]].url) { + return platforms[keys[i]].url; + } + } + + return ''; + } + + var platform = detectPlatform(); + setFallback(platform); + + downloadLink.addEventListener('click', function() { + if (typeof gtag !== 'function') { + return; + } + + gtag('event', 'desktop_download_click', { + platform: platform.label || 'unknown', + source: 'docs_banner', + download_url: downloadLink.href, + transport_type: 'beacon' + }); + }); + + if (!window.fetch) { + return; + } + + fetch(manifestUrl) + .then(function(response) { + if (!response.ok) { + throw new Error('Desktop manifest lookup failed'); + } + return response.json(); + }) + .then(function(manifest) { + var downloadUrl = findPlatformDownload(manifest.platforms || {}, platform); + + if (!downloadUrl) { + return; + } + + downloadLink.href = downloadUrl; + downloadLink.textContent = 'Download for ' + platform.label; + + bannerCopy.textContent = 'Try the latest VTracer Desktop App for ' + platform.label + ' with native speed, curve simplification, and higher tracing quality.'; + }) + .catch(function() { + setFallback(platform); + }); + })();