forked from Berry-Dash/launcher
Settings, queue fixes, and more
This commit is contained in:
@@ -2,15 +2,31 @@ import { useEffect } from 'react'
|
||||
import axios from 'axios'
|
||||
import { InstallsProps } from '../types/InstallsProps'
|
||||
import { platform } from '@tauri-apps/plugin-os'
|
||||
import { readNormalConfig } from '../util/BazookaManager'
|
||||
|
||||
export default function Installs({ downloadProgress, showPopup, setShowPopup, setPopupMode, setFadeOut, setSelectedVersionList, setVersionList }: InstallsProps) {
|
||||
useEffect(() => {
|
||||
if (!showPopup) return
|
||||
setSelectedVersionList([]);
|
||||
setSelectedVersionList([])
|
||||
setVersionList(null)
|
||||
axios.get('https://berrydash.lncvrt.xyz/database/launcher/versions.php')
|
||||
.then(res => setVersionList(res.data.filter((d: { platforms: string[] }) => d.platforms.includes(platform()))))
|
||||
.catch(() => setVersionList([]))
|
||||
;(async () => {
|
||||
try {
|
||||
const config = await readNormalConfig()
|
||||
const useWine = config.settings.useWineOnUnixWhenNeeded
|
||||
const res = await axios.get('https://berrydash.lncvrt.xyz/database/launcher/versions.php')
|
||||
const p = platform()
|
||||
const filtered = res.data.filter((d: { platforms: string[] }) =>
|
||||
p === 'macos' || p === 'linux'
|
||||
? useWine
|
||||
? d.platforms.includes('windows') || d.platforms.includes(p)
|
||||
: d.platforms.includes(p)
|
||||
: d.platforms.includes(p)
|
||||
)
|
||||
setVersionList(filtered)
|
||||
} catch {
|
||||
setVersionList([])
|
||||
}
|
||||
})()
|
||||
}, [showPopup])
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user