Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(website/download): fix URLs for download
Elian Dorancef832fda4f8
diff --git a/apps/website/src/lib/download-helper.ts b/apps/website/src/lib/download-helper.tsindex d7e184ddad..61b6e7ef9e 100644--- a/apps/website/src/lib/download-helper.ts+++ b/apps/website/src/lib/download-helper.ts@@ -9,7 +9,7 @@ export type Platform = 'macos' | 'windows' | 'linux';let version = rootPackageJson.version;export function buildDesktopDownloadUrl(platform: Platform, format: string, architecture: Architecture): string {- return `https://github.com/TriliumNext/Notes/releases/download/${version}/TriliumNextNotes-${version}-${platform}-${architecture}.${format}`;+ return `https://github.com/TriliumNext/Notes/releases/download/v${version}/TriliumNextNotes-v${version}-${platform}-${architecture}.${format}`;}export interface DownloadInfo {@@ -145,28 +145,18 @@ function getPlatform(): Platform {}}-function getDownloadLink(platform: Platform, architecture: Architecture) {- const baseUrl = 'https://example.com/downloads';- let url;- if (platform === 'mac') {- url = `${baseUrl}/mac-${architecture}.dmg`;- } else if (platform === 'windows') {- url = `${baseUrl}/windows-${architecture}.exe`;- } else if (platform === 'linux') {- url = `${baseUrl}/linux-${architecture}.tar.gz`;- } else {- url = `${baseUrl}/other-${architecture}.zip`;- }-- return {- url: url,- platform: platform,- architecture: architecture- };-}-export function getRecommendedDownload() {const architecture = getArchitecture();const platform = getPlatform();- return getDownloadLink(platform, architecture);++ const downloadInfo = downloadMatrix.desktop[platform]?.downloads;+ const recommendedDownload = Object.entries(downloadInfo || {}).find(d => d[1].recommended);+ const format = recommendedDownload?.[0];+ const url = buildDesktopDownloadUrl(platform, format || 'zip', architecture);++ return {+ architecture,+ platform,+ url+ }}diff --git a/apps/website/src/routes/download-now.svelte b/apps/website/src/routes/download-now.svelteindex 8762ed9f82..c0ca6244b0 100644--- a/apps/website/src/routes/download-now.svelte+++ b/apps/website/src/routes/download-now.svelte@@ -1,14 +1,14 @@<script>import { getRecommendedDownload } from "$lib/download-helper";- let recommendedDownload = getRecommendedDownload();+ const { url, platform, architecture } = getRecommendedDownload();</script>-{#if recommendedDownload}- <a href="#" class="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">+{#if url}+ <a href="{url}" class="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">Download now<span class="text-sm text-gray-300">- ({recommendedDownload.platform} {recommendedDownload.architecture})+ ({platform} {architecture})</span></a>{/if}\ No newline at end of file