fix(website/download): use proper download links

This commit is contained in:
Elian Doran 2025-06-14 14:33:17 +03:00
parent 668706a6d9
commit 6e97b08256
No known key found for this signature in database
2 changed files with 23 additions and 33 deletions

View File

@ -1,8 +1,12 @@
export type Architecture = 'x64' | 'arm64'; export type Architecture = 'x64' | 'arm64';
type Platform = 'mac' | 'windows' | 'linux'; export type Platform = 'mac' | 'windows' | 'linux';
type Apps = 'desktop'; let version = "v0.94.1";
export function buildDesktopDownloadUrl(platform: Platform, format: string, architecture: Architecture): string {
return `https://github.com/TriliumNext/Notes/releases/download/${version}/TriliumNextNotes-${version}-${platform}-${architecture}.${format}`;
}
export const downloadMatrix = { export const downloadMatrix = {
desktop: { desktop: {
@ -11,14 +15,10 @@ export const downloadMatrix = {
downloads: { downloads: {
exe: { exe: {
recommended: true, recommended: true,
name: "Installer (.exe)", name: "Installer (.exe)"
x64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-windows-x64.exe",
arm64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-windows-arm64.exe"
}, },
zip: { zip: {
name: "Portable (.zip)", name: "Portable (.zip)"
x64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-windows-x64.zip",
arm64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-windows-arm64.zip"
} }
} }
}, },
@ -26,40 +26,28 @@ export const downloadMatrix = {
title: "Linux", title: "Linux",
downloads: { downloads: {
deb: { deb: {
name: "Debian/Ubuntu (.deb)", name: "Debian/Ubuntu (.deb)"
x64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-linux-x64.deb",
arm64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-linux-arm64.deb"
}, },
rpm: { rpm: {
name: "Red Hat-based distributions (.rpm)", name: "Red Hat-based distributions (.rpm)"
x64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-linux-x64.rpm",
arm64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-linux-arm64.rpm"
}, },
flatpak: { flatpak: {
name: "Flatpak (.flatpak)", name: "Flatpak (.flatpak)"
x64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-linux-x64.flatpak",
arm64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-linux-arm64.flatpak"
}, },
zip: { zip: {
name: "Portable (.zip)", name: "Portable (.zip)"
x64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-linux-x64.zip",
arm64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-linux-arm64.zip"
} }
} }
}, },
mac: { macos: {
title: "macOS", title: "macOS",
downloads: { downloads: {
dmg: { dmg: {
recommended: true, recommended: true,
name: "Installer (.dmg)", name: "Installer (.dmg)"
x64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-macos-x64.dmg",
arm64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-macos-arm64.dmg"
}, },
zip: { zip: {
name: "Portable (.zip)", name: "Portable (.zip)"
x64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-macos-x64.zip",
arm64: "https://github.com/TriliumNext/Notes/releases/download/nightly/TriliumNextNotes-develop-macos-arm64.zip"
} }
} }
} }

View File

@ -1,6 +1,8 @@
<script> <script lang="ts">
import { downloadMatrix, getArchitecture } from "$lib/download-helper"; import type { Platform } from "$lib/download-helper";
import { buildDesktopDownloadUrl, downloadMatrix, getArchitecture } from "$lib/download-helper";
let architectures = ["x64", "arm64"];
let architecture = getArchitecture(); let architecture = getArchitecture();
</script> </script>
@ -11,7 +13,7 @@
<div class="col-span-3 flex justify-center items-center gap-3 mb-6"> <div class="col-span-3 flex justify-center items-center gap-3 mb-6">
<span class="text-gray-600 font-medium mr-2">Architecture:</span> <span class="text-gray-600 font-medium mr-2">Architecture:</span>
<div class="inline-flex bg-violet-100 rounded-full shadow p-1"> <div class="inline-flex bg-violet-100 rounded-full shadow p-1">
{#each ["x64", "arm64"] as arch} {#each architectures as arch}
<button class="py-2 px-6 rounded-full font-semibold focus:outline-none transition <button class="py-2 px-6 rounded-full font-semibold focus:outline-none transition
text-violet-700 border-violet-700 text-violet-700 border-violet-700
aria-pressed:bg-violet-700 aria-pressed:text-violet-100 aria-pressed:bg-violet-700 aria-pressed:text-violet-100
@ -23,13 +25,13 @@
</div> </div>
<div class="grid md:grid-cols-3 gap-10"> <div class="grid md:grid-cols-3 gap-10">
{#each Object.values(downloadMatrix.desktop) as platform} {#each Object.entries(downloadMatrix.desktop) as [platformId, platform]}
<div class="bg-white rounded-xl shadow overflow-hidden"> <div class="bg-white rounded-xl shadow overflow-hidden">
<div class="p-6"> <div class="p-6">
<h3 class="text-xl font-semibold mb-2">{platform.title} ({architecture})</h3> <h3 class="text-xl font-semibold mb-2">{platform.title} ({architecture})</h3>
<div class="flex flex-wrap gap-y-2"> <div class="flex flex-wrap gap-y-2">
{#each Object.values(platform.downloads) as download} {#each Object.entries(platform.downloads) as [format, download]}
<a href={download[architecture]} class={ <a href={buildDesktopDownloadUrl(platformId as Platform, format, architecture)} class={
download.recommended download.recommended
? "py-2 px-5 bg-violet-600 text-white font-semibold rounded-full shadow-md hover:bg-violet-700 focus:outline-none focus:ring focus:ring-violet-400 focus:ring-opacity-75 grow" ? "py-2 px-5 bg-violet-600 text-white font-semibold rounded-full shadow-md hover:bg-violet-700 focus:outline-none focus:ring focus:ring-violet-400 focus:ring-opacity-75 grow"
: "py-2 px-5 border-1 border-gray-500 text-gray-500 font-semibold rounded-full shadow-md grow" : "py-2 px-5 border-1 border-gray-500 text-gray-500 font-semibold rounded-full shadow-md grow"