11import rootPackageJson from '../../../../package.json' ;
22
3- type App = "desktop" | "server" ;
3+ export type App = "desktop" | "server" ;
44
55export type Architecture = 'x64' | 'arm64' ;
66
77export type Platform = 'macos' | 'windows' | 'linux' ;
88
99let version = rootPackageJson . version ;
1010
11- export function buildDesktopDownloadUrl ( platform : Platform , format : string , architecture : Architecture ) : string {
12- return `https://github.com/TriliumNext/Notes/releases/download/v${ version } /TriliumNextNotes-v${ version } -${ platform } -${ architecture } .${ format } ` ;
13- }
14-
1511export interface DownloadInfo {
1612 recommended ?: boolean ;
1713 name : string ;
14+ url ?: string ;
1815}
1916
2017export interface DownloadMatrixEntry {
@@ -99,13 +96,16 @@ export const downloadMatrix: DownloadMatrix = {
9996 downloads : {
10097 docker : {
10198 recommended : true ,
102- name : "View on Docker Hub"
99+ name : "View on Docker Hub" ,
100+ url : "https://hub.docker.com/r/triliumnext/notes"
103101 } ,
104102 tarX64 : {
105- name : "x86 (.tar.xz)"
103+ name : "x86 (.tar.xz)" ,
104+ url : `https://github.com/TriliumNext/Notes/releases/download/v${ version } /TriliumNextNotes-Server-v${ version } -linux-x64.tar.xz`
106105 } ,
107106 tarArm64 : {
108- name : "ARM (.tar.xz)"
107+ name : "ARM (.tar.xz)" ,
108+ url : `https://github.com/TriliumNext/Notes/releases/download/v${ version } /TriliumNextNotes-Server-v${ version } -linux-arm64.tar.xz`
109109 } ,
110110 }
111111 } ,
@@ -115,16 +115,28 @@ export const downloadMatrix: DownloadMatrix = {
115115 downloads : {
116116 pikapod : {
117117 recommended : true ,
118- name : "Set up on PikaPods"
118+ name : "Set up on PikaPods" ,
119+ url : "https://www.pikapods.com/pods?run=trilium-next"
119120 } ,
120121 triliumcc : {
121- name : "Alternatively see trilium.cc"
122+ name : "Alternatively see trilium.cc" ,
123+ url : "https://trilium.cc/"
122124 }
123125 }
124126 }
125127 }
126128} ;
127129
130+ export function buildDownloadUrl ( app : App , platform : Platform , format : string , architecture : Architecture ) : string {
131+ if ( app === "desktop" ) {
132+ return `https://github.com/TriliumNext/Notes/releases/download/v${ version } /TriliumNextNotes-v${ version } -${ platform } -${ architecture } .${ format } ` ;
133+ } else if ( app === "server" ) {
134+ return downloadMatrix . server [ platform ] . downloads [ format ] . url ?? "#" ;
135+ } else {
136+ return "#" ;
137+ }
138+ }
139+
128140export function getArchitecture ( ) : Architecture {
129141 const userAgent = navigator . userAgent . toLowerCase ( ) ;
130142 if ( userAgent . includes ( 'arm64' ) || userAgent . includes ( 'aarch64' ) ) {
@@ -152,7 +164,7 @@ export function getRecommendedDownload() {
152164 const downloadInfo = downloadMatrix . desktop [ platform ] ?. downloads ;
153165 const recommendedDownload = Object . entries ( downloadInfo || { } ) . find ( d => d [ 1 ] . recommended ) ;
154166 const format = recommendedDownload ?. [ 0 ] ;
155- const url = buildDesktopDownloadUrl ( platform , format || 'zip' , architecture ) ;
167+ const url = buildDownloadUrl ( "desktop" , platform , format || 'zip' , architecture ) ;
156168
157169 return {
158170 architecture,
0 commit comments