Skip to content

Commit f497e8d

Browse files
linhayclaude
andcommitted
feat: direct download links for macOS DMG assets
Download buttons now resolve to direct DMG download URLs from the latest GitHub release instead of linking to the releases page. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent d6a53d8 commit f497e8d

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

docs/index.html

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,11 @@ <h2 style="margin-bottom: 14px;">
498498
<span class="version-badge" id="version-badge">v0.0.0</span>
499499
</p>
500500
<div class="platforms">
501-
<a class="platform" href="https://github.com/AxApp/GetTokens/releases" target="_blank" rel="noopener">
501+
<a class="platform download-btn" id="dl-mac-arm64" href="https://github.com/AxApp/GetTokens/releases" target="_blank" rel="noopener">
502502
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M17.5 12.6c0-2.4 2-3.6 2.1-3.6-1.1-1.7-2.9-1.9-3.5-1.9-1.5-.2-2.9.9-3.6.9-.8 0-1.9-.9-3.1-.8-1.6 0-3.1.9-3.9 2.4-1.7 2.9-.4 7.2 1.2 9.5.8 1.1 1.7 2.4 2.9 2.4 1.2 0 1.6-.7 3-.7 1.4 0 1.8.7 3 .7 1.3 0 2.1-1.2 2.9-2.3.9-1.3 1.3-2.6 1.3-2.7 0 0-2.4-1-2.4-3.9zm-2.4-7c.6-.8 1.1-1.9 1-3-.9 0-2 .6-2.7 1.4-.6.7-1.1 1.8-1 2.9 1 .1 2-.5 2.7-1.3z"/></svg>
503503
macOS <span class="arch">Apple Silicon</span>
504504
</a>
505-
<a class="platform" href="https://github.com/AxApp/GetTokens/releases" target="_blank" rel="noopener">
505+
<a class="platform download-btn" id="dl-mac-x64" href="https://github.com/AxApp/GetTokens/releases" target="_blank" rel="noopener">
506506
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M17.5 12.6c0-2.4 2-3.6 2.1-3.6-1.1-1.7-2.9-1.9-3.5-1.9-1.5-.2-2.9.9-3.6.9-.8 0-1.9-.9-3.1-.8-1.6 0-3.1.9-3.9 2.4-1.7 2.9-.4 7.2 1.2 9.5.8 1.1 1.7 2.4 2.9 2.4 1.2 0 1.6-.7 3-.7 1.4 0 1.8.7 3 .7 1.3 0 2.1-1.2 2.9-2.3.9-1.3 1.3-2.6 1.3-2.7 0 0-2.4-1-2.4-3.9zm-2.4-7c.6-.8 1.1-1.9 1-3-.9 0-2 .6-2.7 1.4-.6.7-1.1 1.8-1 2.9 1 .1 2-.5 2.7-1.3z"/></svg>
507507
macOS <span class="arch">Intel</span>
508508
</a>
@@ -545,7 +545,7 @@ <h2 style="margin-bottom: 14px;">
545545
document.documentElement.lang = isZh ? 'en' : 'zh-CN';
546546
});
547547

548-
// GitHub stars + version (silent fail)
548+
// GitHub stars + version + direct download links
549549
Promise.all([
550550
fetch('https://api.github.com/repos/AxApp/GetTokens').then(r => r.ok ? r.json() : null),
551551
fetch('https://api.github.com/repos/AxApp/GetTokens/releases/latest').then(r => r.ok ? r.json() : null),
@@ -555,6 +555,17 @@ <h2 style="margin-bottom: 14px;">
555555
}
556556
if (release && release.tag_name) {
557557
document.getElementById('version-badge').textContent = release.tag_name;
558+
// Set direct download links from release assets
559+
if (release.assets) {
560+
for (const asset of release.assets) {
561+
const name = asset.name.toLowerCase();
562+
if (name.includes('applesilicon') && name.endsWith('.dmg')) {
563+
document.getElementById('dl-mac-arm64').href = asset.browser_download_url;
564+
} else if (name.includes('intel') && name.endsWith('.dmg')) {
565+
document.getElementById('dl-mac-x64').href = asset.browser_download_url;
566+
}
567+
}
568+
}
558569
}
559570
}).catch(() => {});
560571

0 commit comments

Comments
 (0)