binary assets for frontend
This commit is contained in:
Generated
-30
@@ -891,9 +891,6 @@
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -911,9 +908,6 @@
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -931,9 +925,6 @@
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -951,9 +942,6 @@
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -971,9 +959,6 @@
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -991,9 +976,6 @@
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -3810,9 +3792,6 @@
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -3834,9 +3813,6 @@
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -3858,9 +3834,6 @@
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
@@ -3882,9 +3855,6 @@
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
|
||||
@@ -146,6 +146,16 @@ export default {
|
||||
play: '▶ Play',
|
||||
downloads: 'downloads',
|
||||
links: 'Links',
|
||||
binariesTitle: 'Download for desktop',
|
||||
binary: {
|
||||
win_x86: 'Windows (32-bit)',
|
||||
win_x64: 'Windows (64-bit)',
|
||||
linux_x86: 'Linux (32-bit)',
|
||||
linux_x64: 'Linux (64-bit)',
|
||||
mac_x64: 'macOS (Intel)',
|
||||
mac_arm64: 'macOS (Apple Silicon)',
|
||||
mac_universal: 'macOS',
|
||||
},
|
||||
},
|
||||
team: {
|
||||
title: 'Our Team',
|
||||
|
||||
@@ -146,6 +146,16 @@ export default {
|
||||
play: '▶ Játék',
|
||||
downloads: 'letöltés',
|
||||
links: 'Linkek',
|
||||
binariesTitle: 'Letöltés asztali gépre',
|
||||
binary: {
|
||||
win_x86: 'Windows (32 bit)',
|
||||
win_x64: 'Windows (64 bit)',
|
||||
linux_x86: 'Linux (32 bit)',
|
||||
linux_x64: 'Linux (64 bit)',
|
||||
mac_x64: 'macOS (Intel)',
|
||||
mac_arm64: 'macOS (Apple Silicon)',
|
||||
mac_universal: 'macOS',
|
||||
},
|
||||
},
|
||||
team: {
|
||||
title: 'Csapatunk',
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
export interface ReleaseAsset {
|
||||
kind: string
|
||||
path: string
|
||||
}
|
||||
|
||||
export interface Release {
|
||||
version: string
|
||||
htmlFolderPath?: string
|
||||
cartridgePath?: string
|
||||
sourcePath?: string
|
||||
docsFolderPath?: string
|
||||
assets?: ReleaseAsset[]
|
||||
downloadCount?: number
|
||||
UpdatedAt: string
|
||||
}
|
||||
|
||||
@@ -99,6 +99,21 @@
|
||||
<a v-if="latestStable.docsFolderPath" :href="latestStable.docsFolderPath" target="_blank" class="flex items-center justify-center py-3 px-4 bg-indigo-500/30 border border-indigo-400/30 text-white font-bold rounded-xl transition-all hover:bg-indigo-500/40 text-sm whitespace-nowrap">{{ t('catalogShow.docs') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="binaryAssets(latestStable).length" class="mt-6 pt-6 border-t border-white/15">
|
||||
<div class="text-[10px] font-black uppercase tracking-widest text-indigo-200 mb-3">{{ t('catalogShow.binariesTitle') }}</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<a
|
||||
v-for="asset in binaryAssets(latestStable)"
|
||||
:key="asset.kind"
|
||||
:href="downloadUrl(asset.path)"
|
||||
:class="['flex items-center justify-center py-2 px-4 font-bold rounded-xl transition-all text-sm whitespace-nowrap',
|
||||
asset.kind === primaryBinaryKind(latestStable)
|
||||
? 'bg-white text-indigo-900 hover:bg-indigo-50 shadow-lg shadow-black/10'
|
||||
: 'bg-indigo-500/30 border border-indigo-400/30 text-white hover:bg-indigo-500/40']"
|
||||
>💾 {{ t('catalogShow.binary.' + asset.kind) }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="bg-white rounded-3xl shadow-xl overflow-hidden border border-gray-100">
|
||||
@@ -127,6 +142,7 @@
|
||||
<a v-if="release.cartridgePath" :href="downloadUrl(release.cartridgePath)" class="text-blue-600 hover:text-blue-900 font-bold text-sm flex items-center gap-1">{{ t('catalogShow.download') }}</a>
|
||||
<a v-if="release.sourcePath" :href="downloadUrl(release.sourcePath)" class="text-green-600 hover:text-green-900 font-bold text-sm flex items-center gap-1">{{ t('catalogShow.source') }}</a>
|
||||
<a v-if="release.docsFolderPath" :href="release.docsFolderPath" target="_blank" class="text-yellow-600 hover:text-yellow-900 font-bold text-sm flex items-center gap-1">{{ t('catalogShow.docs') }}</a>
|
||||
<a v-for="asset in binaryAssets(release)" :key="asset.kind" :href="downloadUrl(asset.path)" class="text-indigo-600 hover:text-indigo-900 font-bold text-sm flex items-center gap-1">💾 {{ t('catalogShow.binary.' + asset.kind) }}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-8 py-4 text-gray-500 align-top pt-5">{{ formatDateTime(release.UpdatedAt) }}</td>
|
||||
@@ -142,6 +158,7 @@
|
||||
<div class="flex flex-wrap gap-4">
|
||||
<a v-if="release.htmlFolderPath" :href="release.htmlFolderPath" target="_blank" class="text-purple-600 hover:text-purple-900 font-bold text-sm flex items-center gap-1">{{ t('catalogShow.play') }}</a>
|
||||
<a v-if="release.cartridgePath" :href="downloadUrl(release.cartridgePath)" class="text-blue-600 hover:text-blue-900 font-bold text-sm flex items-center gap-1">{{ t('catalogShow.download') }}</a>
|
||||
<a v-for="asset in binaryAssets(release)" :key="asset.kind" :href="downloadUrl(asset.path)" class="text-indigo-600 hover:text-indigo-900 font-bold text-sm flex items-center gap-1">💾 {{ t('catalogShow.binary.' + asset.kind) }}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-8 py-4 text-gray-500 align-top pt-5">{{ formatDateTime(release.UpdatedAt) }}</td>
|
||||
@@ -169,6 +186,7 @@
|
||||
<a v-if="release.cartridgePath" :href="downloadUrl(release.cartridgePath)" class="flex items-center justify-center py-2 bg-blue-100 text-blue-700 font-bold rounded-lg text-sm">{{ t('catalogShow.download') }}</a>
|
||||
<a v-if="release.sourcePath" :href="downloadUrl(release.sourcePath)" class="flex items-center justify-center py-2 bg-green-100 text-green-700 font-bold rounded-lg text-sm">{{ t('catalogShow.source') }}</a>
|
||||
<a v-if="release.docsFolderPath" :href="release.docsFolderPath" target="_blank" class="flex items-center justify-center py-2 bg-yellow-100 text-yellow-700 font-bold rounded-lg text-sm">{{ t('catalogShow.docs') }}</a>
|
||||
<a v-for="asset in binaryAssets(release)" :key="asset.kind" :href="downloadUrl(asset.path)" class="flex items-center justify-center py-2 bg-indigo-100 text-indigo-700 font-bold rounded-lg text-sm">💾 {{ t('catalogShow.binary.' + asset.kind) }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -247,6 +265,37 @@ const latestStable = computed(() => stableReleases.value[0] ?? null)
|
||||
const downloadUrl = (path: string) =>
|
||||
`/api/download?path=${encodeURIComponent(path.replace('/file/', ''))}`
|
||||
|
||||
const BINARY_KINDS = ['win_x64', 'win_x86', 'linux_x64', 'linux_x86', 'mac_universal', 'mac_arm64', 'mac_x64']
|
||||
|
||||
// a látogató OS-éhez illő targetek, preferencia-sorrendben
|
||||
function osPreferredKinds(): string[] {
|
||||
const ua = navigator.userAgent
|
||||
if (/Windows/i.test(ua)) {
|
||||
return /WOW64|Win64|x64|amd64/i.test(ua) ? ['win_x64', 'win_x86'] : ['win_x86', 'win_x64']
|
||||
}
|
||||
if (/Macintosh|Mac OS X/i.test(ua)) return ['mac_universal', 'mac_arm64', 'mac_x64']
|
||||
if (/Linux/i.test(ua)) return ['linux_x64', 'linux_x86']
|
||||
return []
|
||||
}
|
||||
|
||||
const preferredKinds = osPreferredKinds()
|
||||
|
||||
const kindRank = (kind: string) => {
|
||||
const preferred = preferredKinds.indexOf(kind)
|
||||
return preferred >= 0 ? preferred : preferredKinds.length + BINARY_KINDS.indexOf(kind)
|
||||
}
|
||||
|
||||
const binaryAssets = (release: Release) =>
|
||||
(release.assets ?? [])
|
||||
.filter(a => BINARY_KINDS.includes(a.kind))
|
||||
.sort((a, b) => kindRank(a.kind) - kindRank(b.kind))
|
||||
|
||||
// a kiemelt gomb: a látogató OS-éhez legjobban illő elérhető bináris
|
||||
const primaryBinaryKind = (release: Release) => {
|
||||
const first = binaryAssets(release)[0]
|
||||
return first && preferredKinds.includes(first.kind) ? first.kind : null
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await store.fetchAll()
|
||||
|
||||
Reference in New Issue
Block a user