Skip to content

Commit

Permalink
style: run prettier on pages/download/[[os]].vue
Browse files Browse the repository at this point in the history
  • Loading branch information
plvzfq-rit committed Jan 12, 2025
1 parent c779276 commit 2db0a21
Showing 1 changed file with 52 additions and 36 deletions.
88 changes: 52 additions & 36 deletions pages/download/[[os]].vue
Original file line number Diff line number Diff line change
@@ -1,46 +1,62 @@
<template>
<NuxtLayout name="bare">
<template #side>
<img class="w-11/12 mx-auto" src="~/assets/undraw_right_direction_tge8.svg" />
</template>
<div class="text-lg">
<Title>Download JabRef - The Free Reference Manager</Title>
If you are not redirected automatically in a few seconds, then please
<t-nuxtlink :href="downloadUrl">click here</t-nuxtlink>
to download JabRef.
</div>
</NuxtLayout>
<NuxtLayout name="bare">
<template #side>
<img
class="w-11/12 mx-auto"
src="~/assets/undraw_right_direction_tge8.svg"
/>
</template>
<div class="text-lg">
<Title>Download JabRef - The Free Reference Manager</Title>
If you are not redirected automatically in a few seconds, then please
<t-nuxtlink :href="downloadUrl">click here</t-nuxtlink>
to download JabRef.
</div>
</NuxtLayout>
</template>

<script lang="ts" setup>
definePageMeta({
layout: false,
layout: false,
middleware: async (to) => {
const os = to.params.os as string | undefined
let downloadUrl = `https://github.com/JabRef/jabref/releases/download/`
if (os && ['win_msi', 'win_zip', 'mac_arm64_dmg', 'mac_arm64_pkg', 'mac_x86_64_dmg', 'mac_x86_64_pkg', 'linux_deb', 'linux_rpm', 'linux_tar_gz'].includes(os)) {
const { data } = await useFetch('/api/getLatestRelease')
const latestRelease = data.value?.version
downloadUrl += `v${latestRelease}`
if (latestRelease) {
downloadUrl +=
{
win_msi: `/JabRef-${latestRelease}.msi`,
win_zip: `/JabRef-${latestRelease}-portable_windows.zip`,
mac_arm64_dmg: `/JabRef-${latestRelease}-arm64.dmg`,
mac_arm64_pkg: `/JabRef-${latestRelease}-arm64.pkg`,
mac_x86_64_dmg: `/JabRef-${latestRelease}.dmg`,
mac_x86_64_pkg: `/JabRef-${latestRelease}.pkg`,
linux_deb: `/jabref_${latestRelease}_amd64.deb`,
linux_rpm: `/jabref-${latestRelease}-1.x86_64.rpm`,
linux_tar_gz: `/JabRef-${latestRelease}-portable_linux.tar.gz`,
}[os] ?? ''
}
}
middleware: async (to) => {
const os = to.params.os as string | undefined
let downloadUrl = `https://github.com/JabRef/jabref/releases/download/`
if (
os &&
[
'win_msi',
'win_zip',
'mac_arm64_dmg',
'mac_arm64_pkg',
'mac_x86_64_dmg',
'mac_x86_64_pkg',
'linux_deb',
'linux_rpm',
'linux_tar_gz',
].includes(os)
) {
const { data } = await useFetch('/api/getLatestRelease')
const latestRelease = data.value?.version
downloadUrl += `v${latestRelease}`
if (latestRelease) {
downloadUrl +=
{
win_msi: `/JabRef-${latestRelease}.msi`,
win_zip: `/JabRef-${latestRelease}-portable_windows.zip`,
mac_arm64_dmg: `/JabRef-${latestRelease}-arm64.dmg`,
mac_arm64_pkg: `/JabRef-${latestRelease}-arm64.pkg`,
mac_x86_64_dmg: `/JabRef-${latestRelease}.dmg`,
mac_x86_64_pkg: `/JabRef-${latestRelease}.pkg`,
linux_deb: `/jabref_${latestRelease}_amd64.deb`,
linux_rpm: `/jabref-${latestRelease}-1.x86_64.rpm`,
linux_tar_gz: `/JabRef-${latestRelease}-portable_linux.tar.gz`,
}[os] ?? ''
}
}
return await navigateTo(downloadUrl, { external: true })
},
return await navigateTo(downloadUrl, { external: true })
},
})
const downloadUrl = `https://github.com/JabRef/jabref/releases/download/`
</script>

0 comments on commit 2db0a21

Please sign in to comment.