Add auto updater to the launcher

This commit is contained in:
Lncvrt committed 2026-04-02 17:11:25 -07:00
1 parent dfd99ab12e
commit 04d1f2822b
19 files changed
+170 -39

No files matched your search

File renamed without changes.
@@ -1,10 +1,10 @@
'use client'
import './styles.css'
import { useCallback, useEffect, useState } from 'react'
import { BirdColor } from '@/types/BerryDash/BirdColor'
import { GetIconForUser } from '@/lib/berrydashutil'
import Image from 'next/image'
import './styles.css'
import { useRouter } from 'next/navigation'
import { platform } from '@tauri-apps/plugin-os'
import { fetch } from '@tauri-apps/plugin-http'
@@ -174,7 +174,7 @@ export default function BerryDashLeaderboards () {
<button
className='button btntheme1'
onClick={() => {
if (selected == -1) router.push('/game?id=1')
if (selected == -1) router.push('/main/game?id=1')
else {
setSelected(-1)
setSelectedBerryOption(0)
@@ -1,7 +1,7 @@
'use client'
import '../Installs.css'
import { useEffect } from 'react'
import '@/app/Installs.css'
import { invoke } from '@tauri-apps/api/core'
import { useGlobal } from '@/providers/GlobalProvider'
import { useRouter, useSearchParams } from 'next/navigation'
@@ -75,7 +75,7 @@ export default function Installs () {
<button
className='button btntheme1'
onClick={() => {
router.push('/game/berrydash/leaderboards')
router.push('/main/game/berrydash/leaderboards')
}}
title='View the leaderboards for this game.'
hidden={game.id != 1}
@@ -6,7 +6,7 @@ import Sidebar from '@/components/Sidebar'
import { DownloadProgress } from '@/types/DownloadProgress'
import { app } from '@tauri-apps/api'
import { openUrl } from '@tauri-apps/plugin-opener'
import { GlobalProvider } from '../providers/GlobalProvider'
import { GlobalProvider } from '@/providers/GlobalProvider'
import { Roboto } from 'next/font/google'
import { ServerVersionsResponse } from '@/types/ServerVersionsResponse'
import { listen } from '@tauri-apps/api/event'
+3 -3
View File
@@ -1,8 +1,8 @@
'use client'
import { useEffect } from 'react'
import './Installs.css'
import { useGlobal } from '../providers/GlobalProvider'
import { useEffect } from 'react'
import { useGlobal } from '@/providers/GlobalProvider'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import {
faCheck,
@@ -70,7 +70,7 @@ export default function Installs () {
title={'Click to view game installs'}
onClick={() => {
setCategory(-1)
router.push('/game?id=' + i.id)
router.push('/main/game?id=' + i.id)
}}
>
<div className='h-18 w-screen relative'>
File renamed without changes.
+5
View File
@@ -0,0 +1,5 @@
'use client'
export default function UpdateCheckingPage () {
return <p className='text-5xl text-center'>Checking for updates</p>
}
+42
View File
@@ -0,0 +1,42 @@
'use client'
import '@/styles/globals.css'
import { platform } from '@tauri-apps/plugin-os'
import { Roboto } from 'next/font/google'
import { useEffect, useState } from 'react'
const roboto = Roboto({
subsets: ['latin']
})
export default function RootLayout ({
children
}: {
children: React.ReactNode
}) {
const [platformName, setPlatformName] = useState<string | null>(null)
useEffect(() => {
setTimeout(() => setPlatformName(platform()), 0)
}, [])
return (
<>
<html lang='en' className={roboto.className}>
<body className='dark-theme'>
<div
className='relative z-2 w-screen border-b border-b-(--col3) h-8.25 bg-(--col1)'
hidden={platformName != 'windows'}
/>
<div
className={`w-screen ${
platformName == 'windows' ? 'h-[calc(100vh-64px)]' : 'h-screen'
} flex items-center justify-center`}
>
{children}
</div>
</body>
</html>
</>
)
}
+5
View File
@@ -0,0 +1,5 @@
'use client'
export default function UpdateCheckingPage () {
return <p className='text-5xl text-center'>Updating launcher</p>
}
+15 -12
View File
@@ -82,9 +82,11 @@ export default function Sidebar () {
<nav className='nav-links overflow-auto pt-2'>
<Link
draggable={false}
href='/'
href='/main'
className={`link relative flex items-center ${
pathname === '/' || pathname.startsWith('/game') ? 'active' : ''
pathname === '/main' || pathname.startsWith('/main/game')
? 'active'
: ''
}`}
>
<FontAwesomeIcon icon={faHexagonNodes} className='mr-2' /> Games
@@ -100,21 +102,22 @@ export default function Sidebar () {
<div
draggable={false}
className={`link ${
(pathname === '/game' &&
(pathname === '/main/game' &&
Number(params.get('id') || 0) == i.id) ||
(i.id == 1 && pathname === '/game/berrydash/leaderboards')
(i.id == 1 &&
pathname === '/main/game/berrydash/leaderboards')
? 'active'
: ''
} ml-auto w-50 ${
sidebarAlwaysShowGames ||
pathname === '/' ||
pathname.startsWith('/game')
pathname.startsWith('/main/game')
? ''
: 'hidden'
}`}
onClick={() => {
setCategory(-1)
router.push('/game?id=' + i.id)
router.push('/main/game?id=' + i.id)
}}
>
<div className='flex items-center'>
@@ -151,23 +154,23 @@ export default function Sidebar () {
key={`${i.id}-${key}`}
draggable={false}
className={`link ${
((pathname === '/game' &&
((pathname === '/main/game' &&
Number(params.get('id') || 0) == i.id) ||
(i.id == 1 &&
pathname === '/game/berrydash/leaderboards')) &&
pathname === '/main/game/berrydash/leaderboards')) &&
category == Number(key)
? 'active'
: ''
} ml-auto w-47.5 ${
sidebarAlwaysShowGames ||
pathname === '/' ||
pathname.startsWith('/game')
pathname.startsWith('/main/game')
? ''
: 'hidden'
}`}
onClick={() => {
setCategory(Number(key))
router.push('/game?id=' + i.id)
router.push('/main/game?id=' + i.id)
}}
>
<div className='flex items-center'>
@@ -180,8 +183,8 @@ export default function Sidebar () {
))}
<Link
draggable={false}
href='/settings'
className={`link ${pathname === '/settings' ? 'active' : ''}`}
href='/main/settings'
className={`link ${pathname === '/main/settings' ? 'active' : ''}`}
>
<FontAwesomeIcon icon={faCog} className='mr-1' /> Settings
</Link>