Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e02275c29
|
||
|
|
dbaac6a6a6
|
||
|
|
68525f161e
|
||
|
|
d386454e91
|
||
|
|
6e05aac871
|
||
|
|
fbe3feec9d
|
||
|
|
1c540ad35b
|
||
|
|
4ec597967a
|
No files matched your search
+2
-1
@@ -11,7 +11,8 @@ const eslintConfig = defineConfig([
|
|||||||
'.next/**',
|
'.next/**',
|
||||||
'out/**',
|
'out/**',
|
||||||
'build/**',
|
'build/**',
|
||||||
'next-env.d.ts'
|
'next-env.d.ts',
|
||||||
|
'src-tauri/**'
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "lncvrt-games-launcher",
|
"name": "lncvrt-games-launcher",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.5.3",
|
"version": "1.5.5",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "lncvrt-games-launcher"
|
name = "lncvrt-games-launcher"
|
||||||
version = "1.5.3"
|
version = "1.5.5"
|
||||||
authors = ["Lncvrt"]
|
authors = ["Lncvrt"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Lncvrt Games Launcher",
|
"productName": "Lncvrt Games Launcher",
|
||||||
"version": "1.5.3",
|
"version": "1.5.5",
|
||||||
"identifier": "xyz.lncvrt.games-launcher",
|
"identifier": "xyz.lncvrt.games-launcher",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "next dev",
|
"beforeDevCommand": "next dev",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Lncvrt Games Launcher",
|
"productName": "Lncvrt Games Launcher",
|
||||||
"version": "1.5.3",
|
"version": "1.5.5",
|
||||||
"identifier": "xyz.lncvrt.games-launcher",
|
"identifier": "xyz.lncvrt.games-launcher",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "next dev",
|
"beforeDevCommand": "next dev",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Lncvrt Games Launcher",
|
"productName": "Lncvrt Games Launcher",
|
||||||
"version": "1.5.3",
|
"version": "1.5.5",
|
||||||
"identifier": "xyz.lncvrt.games-launcher",
|
"identifier": "xyz.lncvrt.games-launcher",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "next dev",
|
"beforeDevCommand": "next dev",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://schema.tauri.app/config/2",
|
"$schema": "https://schema.tauri.app/config/2",
|
||||||
"productName": "Lncvrt Games Launcher",
|
"productName": "Lncvrt Games Launcher",
|
||||||
"version": "1.5.3",
|
"version": "1.5.5",
|
||||||
"identifier": "xyz.lncvrt.games-launcher",
|
"identifier": "xyz.lncvrt.games-launcher",
|
||||||
"build": {
|
"build": {
|
||||||
"beforeDevCommand": "next dev",
|
"beforeDevCommand": "next dev",
|
||||||
|
|||||||
@@ -28,18 +28,6 @@ body {
|
|||||||
--col8: rgb(152, 128, 128);
|
--col8: rgb(152, 128, 128);
|
||||||
}
|
}
|
||||||
|
|
||||||
.green-theme {
|
|
||||||
--col0: rgb(8, 32, 8);
|
|
||||||
--col1: rgb(16, 40, 16);
|
|
||||||
--col2: rgb(32, 56, 32);
|
|
||||||
--col3: rgb(48, 72, 48);
|
|
||||||
--col4: rgb(64, 88, 64);
|
|
||||||
--col5: rgb(80, 104, 80);
|
|
||||||
--col6: rgb(96, 120, 96);
|
|
||||||
--col7: rgb(112, 136, 112);
|
|
||||||
--col8: rgb(128, 152, 128);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blue-theme {
|
.blue-theme {
|
||||||
--col0: rgb(8, 8, 32);
|
--col0: rgb(8, 8, 32);
|
||||||
--col1: rgb(16, 16, 40);
|
--col1: rgb(16, 16, 40);
|
||||||
@@ -64,18 +52,6 @@ body {
|
|||||||
--col8: rgb(140, 128, 152);
|
--col8: rgb(140, 128, 152);
|
||||||
}
|
}
|
||||||
|
|
||||||
.mint-theme {
|
|
||||||
--col0: rgb(8, 32, 16);
|
|
||||||
--col1: rgb(16, 48, 32);
|
|
||||||
--col2: rgb(32, 56, 40);
|
|
||||||
--col3: rgb(48, 72, 48);
|
|
||||||
--col4: rgb(64, 88, 66);
|
|
||||||
--col5: rgb(80, 104, 65);
|
|
||||||
--col6: rgb(96, 120, 80);
|
|
||||||
--col7: rgb(112, 136, 85);
|
|
||||||
--col8: rgb(128, 152, 95);
|
|
||||||
}
|
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
@apply rounded-md cursor-pointer text-[16px] py-1 px-2 transition-colors border;
|
@apply rounded-md cursor-pointer text-[16px] py-1 px-2 transition-colors border;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,9 +43,11 @@ export default function Sidebar () {
|
|||||||
hidden={platform() != 'macos'}
|
hidden={platform() != 'macos'}
|
||||||
onMouseDown={e => {
|
onMouseDown={e => {
|
||||||
if (e.buttons === 1) {
|
if (e.buttons === 1) {
|
||||||
e.detail === 2
|
if (e.detail === 2) {
|
||||||
? getCurrentWindow().toggleMaximize()
|
getCurrentWindow().toggleMaximize()
|
||||||
: getCurrentWindow().startDragging()
|
} else {
|
||||||
|
getCurrentWindow().startDragging()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
></div>
|
></div>
|
||||||
@@ -62,9 +64,11 @@ export default function Sidebar () {
|
|||||||
onMouseDown={e => {
|
onMouseDown={e => {
|
||||||
if (platform() != 'macos') return
|
if (platform() != 'macos') return
|
||||||
if (e.buttons === 1) {
|
if (e.buttons === 1) {
|
||||||
e.detail === 2
|
if (e.detail === 2) {
|
||||||
? getCurrentWindow().toggleMaximize()
|
getCurrentWindow().toggleMaximize()
|
||||||
: getCurrentWindow().startDragging()
|
} else {
|
||||||
|
getCurrentWindow().startDragging()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -23,10 +23,6 @@ export default function VersionInfo () {
|
|||||||
viewingInfoFromDownloads,
|
viewingInfoFromDownloads,
|
||||||
setPopupMode
|
setPopupMode
|
||||||
} = useGlobal()
|
} = useGlobal()
|
||||||
if (!managingVersion || !downloadedVersionsConfig) return <></>
|
|
||||||
|
|
||||||
const versionInfo = getVersionInfo(managingVersion)
|
|
||||||
const gameInfo = getGameInfo(versionInfo?.game)
|
|
||||||
const [versionSize, setVersionSize] = useState<number | null>(null)
|
const [versionSize, setVersionSize] = useState<number | null>(null)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -37,6 +33,11 @@ export default function VersionInfo () {
|
|||||||
})
|
})
|
||||||
}, [managingVersion, setVersionSize])
|
}, [managingVersion, setVersionSize])
|
||||||
|
|
||||||
|
if (!managingVersion || !downloadedVersionsConfig) return <></>
|
||||||
|
|
||||||
|
const versionInfo = getVersionInfo(managingVersion)
|
||||||
|
const gameInfo = getGameInfo(versionInfo?.game)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p className='text-xl text-center'>
|
<p className='text-xl text-center'>
|
||||||
|
|||||||
+106
-63
@@ -26,18 +26,25 @@ export default function Installs () {
|
|||||||
} = useGlobal()
|
} = useGlobal()
|
||||||
|
|
||||||
const params = useSearchParams()
|
const params = useSearchParams()
|
||||||
const [category, setCategory] = useState<number>(-1)
|
|
||||||
|
|
||||||
const id = Number(params.get('id') || 0)
|
const id = Number(params.get('id') || 0)
|
||||||
if (!id) return <p>Invalid game</p>
|
|
||||||
const game = serverVersionList?.games.find(g => g.id === id)
|
const game = serverVersionList?.games.find(g => g.id === id)
|
||||||
if (!game) return <p>Invalid game</p>
|
|
||||||
|
const [category, setCategory] = useState<number>(-1)
|
||||||
|
const [lastId, setLastId] = useState(id)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!showPopup) return
|
if (!showPopup) return
|
||||||
setSelectedVersionList([])
|
setSelectedVersionList([])
|
||||||
}, [normalConfig, setSelectedVersionList, showPopup])
|
}, [normalConfig, setSelectedVersionList, showPopup])
|
||||||
|
|
||||||
|
if (!id || !game) return <p>Invalid game</p>
|
||||||
|
|
||||||
|
if (lastId !== id) {
|
||||||
|
setLastId(id)
|
||||||
|
setCategory(-1)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='mx-4 mt-4'>
|
<div className='mx-4 mt-4'>
|
||||||
<div className='flex justify-between items-center mb-4'>
|
<div className='flex justify-between items-center mb-4'>
|
||||||
@@ -76,68 +83,94 @@ export default function Installs () {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{category == -1 &&
|
{category == -1 &&
|
||||||
Object.entries(game.categoryNames).map(([key, value]) => {
|
Object.entries(game.categoryNames)
|
||||||
return (
|
.sort(([a], [b]) => Number(b) - Number(a))
|
||||||
<div
|
.filter(([key]) => {
|
||||||
key={crypto.randomUUID()}
|
const count = Object.keys(
|
||||||
className={`downloads-entry ${
|
downloadedVersionsConfig?.list ?? {}
|
||||||
normalConfig?.settings.useLegacyInteractButtons
|
).filter(v => {
|
||||||
? ''
|
const info = getVersionInfo(v)
|
||||||
: 'cursor-pointer'
|
if (!info) return false
|
||||||
}`}
|
|
||||||
title={
|
|
||||||
normalConfig?.settings.useLegacyInteractButtons
|
|
||||||
? ''
|
|
||||||
: 'Click to view category'
|
|
||||||
}
|
|
||||||
onClick={() => {
|
|
||||||
if (normalConfig?.settings.useLegacyInteractButtons) return
|
|
||||||
setCategory(Number(key))
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className='h-18 w-screen relative'>
|
|
||||||
<p className='text-2xl'>{value}</p>
|
|
||||||
|
|
||||||
<div
|
if (
|
||||||
className='entry-info-item flex absolute left-0 bottom-0'
|
platform() === 'linux' &&
|
||||||
title='The amount of versions installed of this game in installed/installable format.'
|
info.wine &&
|
||||||
onClick={e => e.stopPropagation()}
|
!normalConfig?.settings.useWineOnUnixWhenNeeded
|
||||||
>
|
)
|
||||||
<p>
|
return false
|
||||||
{(() => {
|
|
||||||
const count =
|
return info.game === id && info.category === Number(key)
|
||||||
Object.keys(
|
}).length
|
||||||
downloadedVersionsConfig?.list ?? []
|
|
||||||
).filter(v => {
|
return count >= 1
|
||||||
const info = getVersionInfo(v)
|
})
|
||||||
if (!info) return false
|
.map(([key, value]) => {
|
||||||
if (
|
return (
|
||||||
platform() === 'linux' &&
|
<div
|
||||||
info.wine &&
|
key={value}
|
||||||
!normalConfig?.settings.useWineOnUnixWhenNeeded
|
className={`downloads-entry ${
|
||||||
)
|
normalConfig?.settings.useLegacyInteractButtons
|
||||||
return false
|
? ''
|
||||||
return (
|
: 'cursor-pointer'
|
||||||
info.game === id && info.category == Number(key)
|
}`}
|
||||||
)
|
title={
|
||||||
}).length ?? 0
|
normalConfig?.settings.useLegacyInteractButtons
|
||||||
return `${count} install${count === 1 ? '' : 's'}`
|
? ''
|
||||||
})()}
|
: 'Click to view category'
|
||||||
</p>
|
}
|
||||||
|
onClick={() => {
|
||||||
|
if (normalConfig?.settings.useLegacyInteractButtons)
|
||||||
|
return
|
||||||
|
setCategory(Number(key))
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div className='h-18 w-screen relative'>
|
||||||
|
<p className='text-2xl'>{value}</p>
|
||||||
|
|
||||||
|
<div
|
||||||
|
className='entry-info-item flex absolute left-0 bottom-0'
|
||||||
|
title='The amount of versions installed of this game in installed/installable format.'
|
||||||
|
onClick={e => e.stopPropagation()}
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
{(() => {
|
||||||
|
const count =
|
||||||
|
Object.keys(
|
||||||
|
downloadedVersionsConfig?.list ?? []
|
||||||
|
).filter(v => {
|
||||||
|
const info = getVersionInfo(v)
|
||||||
|
if (!info) return false
|
||||||
|
if (
|
||||||
|
platform() === 'linux' &&
|
||||||
|
info.wine &&
|
||||||
|
!normalConfig?.settings
|
||||||
|
.useWineOnUnixWhenNeeded
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
return (
|
||||||
|
info.game === id &&
|
||||||
|
info.category == Number(key)
|
||||||
|
)
|
||||||
|
}).length ?? 0
|
||||||
|
return `${count} install${count === 1 ? '' : 's'}`
|
||||||
|
})()}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className='button absolute right-0 bottom-0'
|
||||||
|
hidden={
|
||||||
|
!normalConfig?.settings.useLegacyInteractButtons
|
||||||
|
}
|
||||||
|
title='Click to view category'
|
||||||
|
onClick={() => setCategory(Number(key))}
|
||||||
|
>
|
||||||
|
Installs
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button
|
|
||||||
className='button absolute right-0 bottom-0'
|
|
||||||
hidden={!normalConfig?.settings.useLegacyInteractButtons}
|
|
||||||
title='Click to view category'
|
|
||||||
onClick={() => setCategory(Number(key))}
|
|
||||||
>
|
|
||||||
Installs
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
)
|
||||||
)
|
})}
|
||||||
})}
|
|
||||||
{Object.keys(downloadedVersionsConfig?.list ?? []).filter(v => {
|
{Object.keys(downloadedVersionsConfig?.list ?? []).filter(v => {
|
||||||
const info = getVersionInfo(v)
|
const info = getVersionInfo(v)
|
||||||
if (!info) return false
|
if (!info) return false
|
||||||
@@ -277,9 +310,19 @@ export default function Installs () {
|
|||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
const verInfo = getVersionInfo(entry)
|
const verInfo = getVersionInfo(entry)
|
||||||
if (verInfo == undefined) return
|
if (verInfo == undefined) return
|
||||||
|
const gameInfo = getGameInfo(verInfo.game)
|
||||||
|
if (gameInfo == undefined) return
|
||||||
invoke('launch_game', {
|
invoke('launch_game', {
|
||||||
name: verInfo.id,
|
name: verInfo.id,
|
||||||
executable: verInfo.executable
|
executable: verInfo.executable,
|
||||||
|
displayName: verInfo.displayName,
|
||||||
|
useWine: !!(
|
||||||
|
platform() === 'linux' &&
|
||||||
|
verInfo.wine &&
|
||||||
|
normalConfig?.settings.useWineOnUnixWhenNeeded
|
||||||
|
),
|
||||||
|
wineCommand:
|
||||||
|
normalConfig?.settings.wineOnUnixCommand
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
hidden={
|
hidden={
|
||||||
|
|||||||
+223
-162
@@ -1,6 +1,6 @@
|
|||||||
'use client'
|
'use client'
|
||||||
|
|
||||||
import { useEffect, useRef, useState } from 'react'
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import Sidebar from './componets/Sidebar'
|
import Sidebar from './componets/Sidebar'
|
||||||
import './Globals.css'
|
import './Globals.css'
|
||||||
import { DownloadProgress } from './types/DownloadProgress'
|
import { DownloadProgress } from './types/DownloadProgress'
|
||||||
@@ -111,15 +111,21 @@ export default function RootLayout ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVersionInfo (id: string | undefined): GameVersion | undefined {
|
const getVersionInfo = useCallback(
|
||||||
if (!id) return undefined
|
(id: string | undefined): GameVersion | undefined => {
|
||||||
return serverVersionList?.versions.find(v => v.id === id)
|
if (!id) return undefined
|
||||||
}
|
return serverVersionList?.versions.find(v => v.id === id)
|
||||||
|
},
|
||||||
|
[serverVersionList]
|
||||||
|
)
|
||||||
|
|
||||||
function getGameInfo (game: number | undefined): Game | undefined {
|
const getGameInfo = useCallback(
|
||||||
if (!game) return undefined
|
(game: number | undefined): Game | undefined => {
|
||||||
return serverVersionList?.games.find(g => g.id === game)
|
if (!game) return undefined
|
||||||
}
|
return serverVersionList?.games.find(g => g.id === game)
|
||||||
|
},
|
||||||
|
[serverVersionList]
|
||||||
|
)
|
||||||
|
|
||||||
function getListOfGames (): Game[] {
|
function getListOfGames (): Game[] {
|
||||||
if (!downloadedVersionsConfig?.list) return []
|
if (!downloadedVersionsConfig?.list) return []
|
||||||
@@ -292,89 +298,96 @@ export default function RootLayout ({
|
|||||||
return () => document.removeEventListener('contextmenu', handler)
|
return () => document.removeEventListener('contextmenu', handler)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
async function downloadVersions (
|
const downloadVersions = useCallback(
|
||||||
list: string[],
|
async (list: string[]): Promise<void> => {
|
||||||
currentConfig: VersionsConfig
|
if (list.length === 0) return
|
||||||
): Promise<void> {
|
setSelectedVersionList([])
|
||||||
if (list.length === 0) return
|
|
||||||
setSelectedVersionList([])
|
|
||||||
|
|
||||||
const newDownloads = list.map(
|
const newDownloads = list.map(
|
||||||
version =>
|
version =>
|
||||||
new DownloadProgress(version, 0, 0, false, true, false, false, 0, 0)
|
new DownloadProgress(version, 0, 0, false, true, false, false, 0, 0)
|
||||||
)
|
|
||||||
|
|
||||||
setDownloadProgress(newDownloads)
|
|
||||||
|
|
||||||
for (const download of newDownloads) {
|
|
||||||
const info = getVersionInfo(download.version)
|
|
||||||
if (!info) {
|
|
||||||
setDownloadProgress(prev =>
|
|
||||||
prev.filter(d => d.version !== download.version)
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
const gameInfo = getGameInfo(info.game)
|
|
||||||
if (!gameInfo) {
|
|
||||||
setDownloadProgress(prev =>
|
|
||||||
prev.filter(d => d.version !== download.version)
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
setDownloadProgress(prev =>
|
|
||||||
prev.map(d =>
|
|
||||||
d.version === download.version ? { ...d, queued: false } : d
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
try {
|
setDownloadProgress(newDownloads)
|
||||||
await axios.get(
|
|
||||||
'https://games.lncvrt.xyz/api/launcher/download?id=' + info.id
|
|
||||||
)
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
const res = await invoke<string>('download', {
|
for (const download of newDownloads) {
|
||||||
url: info.downloadUrl,
|
const info = getVersionInfo(download.version)
|
||||||
name: info.id,
|
if (!info) {
|
||||||
executable: info.executable,
|
setDownloadProgress(prev =>
|
||||||
hash: info.sha512sum
|
prev.filter(d => d.version !== download.version)
|
||||||
})
|
)
|
||||||
|
continue
|
||||||
if (res === '1') {
|
|
||||||
setDownloadProgress(prev =>
|
|
||||||
prev.filter(d => d.version !== download.version)
|
|
||||||
)
|
|
||||||
const date = Date.now()
|
|
||||||
const newConfig = {
|
|
||||||
...currentConfig,
|
|
||||||
list: { ...currentConfig.list, [download.version]: date }
|
|
||||||
}
|
}
|
||||||
setDownloadedVersionsConfig(newConfig)
|
|
||||||
writeVersionsConfig(newConfig)
|
const gameInfo = getGameInfo(info.game)
|
||||||
} else {
|
if (!gameInfo) {
|
||||||
|
setDownloadProgress(prev =>
|
||||||
|
prev.filter(d => d.version !== download.version)
|
||||||
|
)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
setDownloadProgress(prev =>
|
setDownloadProgress(prev =>
|
||||||
prev.map(d =>
|
prev.map(d =>
|
||||||
d.version === download.version
|
d.version === download.version ? { ...d, queued: false } : d
|
||||||
? { ...d, queued: false, failed: true, progress: 0 }
|
|
||||||
: d
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if (normalConfig?.settings.allowNotifications)
|
|
||||||
await notifyUser(
|
try {
|
||||||
'Download Failed',
|
await axios.get(
|
||||||
`The download for version ${info.displayName} has failed.`
|
'https://games.lncvrt.xyz/api/launcher/download?id=' + info.id
|
||||||
)
|
)
|
||||||
|
} catch {}
|
||||||
|
|
||||||
|
const res = await invoke<string>('download', {
|
||||||
|
url: info.downloadUrl,
|
||||||
|
name: info.id,
|
||||||
|
executable: info.executable,
|
||||||
|
hash: info.sha512sum
|
||||||
|
})
|
||||||
|
|
||||||
|
if (res === '1') {
|
||||||
|
setDownloadProgress(prev =>
|
||||||
|
prev.filter(d => d.version !== download.version)
|
||||||
|
)
|
||||||
|
setDownloadedVersionsConfig(prev => {
|
||||||
|
if (!prev) return prev
|
||||||
|
|
||||||
|
const updated = {
|
||||||
|
...prev,
|
||||||
|
list: {
|
||||||
|
...prev.list,
|
||||||
|
[download.version]: Date.now()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writeVersionsConfig(updated)
|
||||||
|
return updated
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
setDownloadProgress(prev =>
|
||||||
|
prev.map(d =>
|
||||||
|
d.version === download.version
|
||||||
|
? { ...d, queued: false, failed: true, progress: 0 }
|
||||||
|
: d
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if (normalConfig?.settings.allowNotifications)
|
||||||
|
await notifyUser(
|
||||||
|
'Download Failed',
|
||||||
|
`The download for version ${info.displayName} has failed.`
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (normalConfig?.settings.allowNotifications)
|
if (normalConfig?.settings.allowNotifications)
|
||||||
await notifyUser('Downloads Finished', 'All downloads have finished.')
|
await notifyUser('Downloads Finished', 'All downloads have finished.')
|
||||||
|
|
||||||
setFadeOut(true)
|
setFadeOut(true)
|
||||||
setTimeout(() => setShowPopup(false), 200)
|
setTimeout(() => setShowPopup(false), 200)
|
||||||
}
|
},
|
||||||
|
[getGameInfo, getVersionInfo, normalConfig]
|
||||||
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (revisionCheck.current) return
|
if (revisionCheck.current) return
|
||||||
@@ -402,9 +415,9 @@ export default function RootLayout ({
|
|||||||
writeVersionsConfig(newConfig)
|
writeVersionsConfig(newConfig)
|
||||||
setSelectedVersionList(prev => [...prev, ...versionsToSelect])
|
setSelectedVersionList(prev => [...prev, ...versionsToSelect])
|
||||||
|
|
||||||
await downloadVersions(versionsToSelect, newConfig)
|
await downloadVersions(versionsToSelect)
|
||||||
})()
|
})()
|
||||||
}, [serverVersionList, downloadedVersionsConfig])
|
}, [serverVersionList, downloadedVersionsConfig, downloadVersions])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@@ -414,13 +427,9 @@ export default function RootLayout ({
|
|||||||
normalConfig?.settings.theme === 1
|
normalConfig?.settings.theme === 1
|
||||||
? 'red-theme'
|
? 'red-theme'
|
||||||
: normalConfig?.settings.theme === 2
|
: normalConfig?.settings.theme === 2
|
||||||
? 'green-theme'
|
|
||||||
: normalConfig?.settings.theme === 3
|
|
||||||
? 'blue-theme'
|
? 'blue-theme'
|
||||||
: normalConfig?.settings.theme === 4
|
: normalConfig?.settings.theme === 3
|
||||||
? 'purple-theme'
|
? 'purple-theme'
|
||||||
: normalConfig?.settings.theme === 5
|
|
||||||
? 'mint-theme'
|
|
||||||
: 'dark-theme'
|
: 'dark-theme'
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@@ -591,81 +600,93 @@ export default function RootLayout ({
|
|||||||
Select a game to download
|
Select a game to download
|
||||||
</p>
|
</p>
|
||||||
<div className='popup-content'>
|
<div className='popup-content'>
|
||||||
{serverVersionList?.games.map((v, i) => (
|
{serverVersionList?.games
|
||||||
<div key={i} className='popup-entry'>
|
.filter(v => {
|
||||||
<p className='text-2xl'>{v.name}</p>
|
const data = getVersionsAmountData(v.id)
|
||||||
<div className='flex gap-2'>
|
if (!data) return false
|
||||||
<div
|
if (data.total > 0) return true
|
||||||
className='entry-info-item btntheme3'
|
})
|
||||||
title='The amount of versions installed of this game in installed/installable format.'
|
.map((v, i) => (
|
||||||
>
|
<div key={i} className='popup-entry'>
|
||||||
<p>
|
<p className='text-2xl'>{v.name}</p>
|
||||||
{(() => {
|
<div className='flex gap-2'>
|
||||||
const data = getVersionsAmountData(v.id)
|
<div
|
||||||
if (!data) return 'N/A'
|
className='entry-info-item btntheme3'
|
||||||
return `${data.installed}/${data.total}`
|
title='The amount of versions installed of this game in installed/installable format.'
|
||||||
})()}{' '}
|
>
|
||||||
versions installed
|
<p>
|
||||||
</p>
|
{(() => {
|
||||||
</div>
|
const data = getVersionsAmountData(
|
||||||
<div
|
v.id
|
||||||
className='entry-info-item btntheme3'
|
)
|
||||||
hidden={!v.official}
|
if (!data) return 'N/A'
|
||||||
title='This game is official.'
|
return `${data.installed}/${data.total}`
|
||||||
>
|
})()}{' '}
|
||||||
<FontAwesomeIcon
|
versions installed
|
||||||
icon={faCheck}
|
</p>
|
||||||
color='#19c84b'
|
</div>
|
||||||
/>
|
<div
|
||||||
<p>Official</p>
|
className='entry-info-item btntheme3'
|
||||||
</div>
|
hidden={!v.official}
|
||||||
<div
|
title='This game is official.'
|
||||||
className='entry-info-item btntheme3'
|
>
|
||||||
hidden={v.official}
|
<FontAwesomeIcon
|
||||||
title={
|
icon={faCheck}
|
||||||
v.verified
|
color='#19c84b'
|
||||||
? 'This game is verified to be safe'
|
/>
|
||||||
: 'This game is NOT verified to be save. Proceed with caution.'
|
<p>Official</p>
|
||||||
}
|
</div>
|
||||||
>
|
<div
|
||||||
<FontAwesomeIcon
|
className='entry-info-item btntheme3'
|
||||||
icon={
|
hidden={v.official}
|
||||||
v.verified ? faShieldHalved : faWarning
|
title={
|
||||||
|
v.verified
|
||||||
|
? 'This game is verified to be safe'
|
||||||
|
: 'This game is NOT verified to be save. Proceed with caution.'
|
||||||
}
|
}
|
||||||
color={v.verified ? '#19c84b' : '#ffc800'}
|
>
|
||||||
/>
|
<FontAwesomeIcon
|
||||||
<p>
|
icon={
|
||||||
{v.verified ? 'Verified' : 'Unverified'}
|
v.verified
|
||||||
</p>
|
? faShieldHalved
|
||||||
|
: faWarning
|
||||||
|
}
|
||||||
|
color={
|
||||||
|
v.verified ? '#19c84b' : '#ffc800'
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<p>
|
||||||
|
{v.verified ? 'Verified' : 'Unverified'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
className='entry-info-item btntheme3 mt-2'
|
||||||
|
hidden={v.developer == null}
|
||||||
|
title={`The developer of ${v.name} is ${v.developer}.`}
|
||||||
|
>
|
||||||
|
<FontAwesomeIcon
|
||||||
|
icon={faCode}
|
||||||
|
color='lightgray'
|
||||||
|
/>
|
||||||
|
<p>Developer: {v.developer}</p>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
className='button btntheme3 right-2 bottom-2'
|
||||||
|
onClick={() => setSelectedGame(v.id)}
|
||||||
|
title={`Click to download specific versions of the game. You have ${(() => {
|
||||||
|
const data = getVersionsAmountData(v.id)
|
||||||
|
if (!data) return 'N/A'
|
||||||
|
return `${data.installed} of ${data.total}`
|
||||||
|
})()} versions downloaded.`}
|
||||||
|
>
|
||||||
|
<>
|
||||||
|
<FontAwesomeIcon icon={faDownload} />{' '}
|
||||||
|
Download
|
||||||
|
</>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div
|
))}
|
||||||
className='entry-info-item btntheme3 mt-2'
|
|
||||||
hidden={v.developer == null}
|
|
||||||
title={`The developer of ${v.name} is ${v.developer}.`}
|
|
||||||
>
|
|
||||||
<FontAwesomeIcon
|
|
||||||
icon={faCode}
|
|
||||||
color='lightgray'
|
|
||||||
/>
|
|
||||||
<p>Developer: {v.developer}</p>
|
|
||||||
</div>
|
|
||||||
<button
|
|
||||||
className='button btntheme3 right-2 bottom-2'
|
|
||||||
onClick={() => setSelectedGame(v.id)}
|
|
||||||
title={`Click to download specific versions of the game. You have ${(() => {
|
|
||||||
const data = getVersionsAmountData(v.id)
|
|
||||||
if (!data) return 'N/A'
|
|
||||||
return `${data.installed} of ${data.total}`
|
|
||||||
})()} versions downloaded.`}
|
|
||||||
>
|
|
||||||
<>
|
|
||||||
<FontAwesomeIcon icon={faDownload} />{' '}
|
|
||||||
Download
|
|
||||||
</>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
) : popupMode === 1 ? (
|
) : popupMode === 1 ? (
|
||||||
@@ -799,6 +820,49 @@ export default function RootLayout ({
|
|||||||
>
|
>
|
||||||
Uninstall
|
Uninstall
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
className='button btntheme2'
|
||||||
|
disabled={downloadProgress.length != 0}
|
||||||
|
onClick={async () => {
|
||||||
|
//uninstall
|
||||||
|
closePopup()
|
||||||
|
|
||||||
|
setDownloadedVersionsConfig(prev => {
|
||||||
|
if (!prev) return prev
|
||||||
|
const updatedList = Object.fromEntries(
|
||||||
|
Object.entries(prev.list).filter(
|
||||||
|
([k]) => k !== managingVersion
|
||||||
|
)
|
||||||
|
)
|
||||||
|
const updatedConfig = {
|
||||||
|
...prev,
|
||||||
|
list: updatedList
|
||||||
|
}
|
||||||
|
writeVersionsConfig(updatedConfig)
|
||||||
|
setManagingVersion(null)
|
||||||
|
setFadeOut(true)
|
||||||
|
setTimeout(() => setShowPopup(false), 200)
|
||||||
|
return updatedConfig
|
||||||
|
})
|
||||||
|
|
||||||
|
if (
|
||||||
|
await exists('game/' + managingVersion, {
|
||||||
|
baseDir: BaseDirectory.AppLocalData
|
||||||
|
})
|
||||||
|
)
|
||||||
|
await remove('game/' + managingVersion, {
|
||||||
|
baseDir: BaseDirectory.AppLocalData,
|
||||||
|
recursive: true
|
||||||
|
})
|
||||||
|
|
||||||
|
//reinstall
|
||||||
|
setSelectedVersionList([managingVersion])
|
||||||
|
downloadVersions([managingVersion])
|
||||||
|
}}
|
||||||
|
title="Click to reinstall this game. This will NOT remove any progress or any save files. This WILL uninstall any modifications to the game's executable files."
|
||||||
|
>
|
||||||
|
Reinstall
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
className='button btntheme2'
|
className='button btntheme2'
|
||||||
onClick={async () =>
|
onClick={async () =>
|
||||||
@@ -844,10 +908,7 @@ export default function RootLayout ({
|
|||||||
setFadeOut(true)
|
setFadeOut(true)
|
||||||
setTimeout(() => setShowPopup(false), 200)
|
setTimeout(() => setShowPopup(false), 200)
|
||||||
if (downloadedVersionsConfig)
|
if (downloadedVersionsConfig)
|
||||||
downloadVersions(
|
downloadVersions(selectedVersionList)
|
||||||
selectedVersionList,
|
|
||||||
downloadedVersionsConfig
|
|
||||||
)
|
|
||||||
}}
|
}}
|
||||||
disabled={downloadProgress.length != 0}
|
disabled={downloadProgress.length != 0}
|
||||||
title={
|
title={
|
||||||
|
|||||||
+98
-89
@@ -50,24 +50,22 @@ export default function Settings () {
|
|||||||
label='Allow sending notifications'
|
label='Allow sending notifications'
|
||||||
value={allowNotifications}
|
value={allowNotifications}
|
||||||
onChange={async () => {
|
onChange={async () => {
|
||||||
while (normalConfig != null) {
|
if (!normalConfig) return
|
||||||
setAllowNotifications(!allowNotifications)
|
setAllowNotifications(!allowNotifications)
|
||||||
setNormalConfig({
|
setNormalConfig({
|
||||||
...normalConfig,
|
...normalConfig,
|
||||||
settings: {
|
settings: {
|
||||||
...normalConfig.settings,
|
...normalConfig.settings,
|
||||||
allowNotifications: !allowNotifications
|
allowNotifications: !allowNotifications
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
writeNormalConfig({
|
await writeNormalConfig({
|
||||||
...normalConfig,
|
...normalConfig,
|
||||||
settings: {
|
settings: {
|
||||||
...normalConfig.settings,
|
...normalConfig.settings,
|
||||||
allowNotifications: !allowNotifications
|
allowNotifications: !allowNotifications
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
break
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
title='This setting does as you expect, allow the launcher to send notifications for when stuff like downloading is done.'
|
title='This setting does as you expect, allow the launcher to send notifications for when stuff like downloading is done.'
|
||||||
/>
|
/>
|
||||||
@@ -75,24 +73,22 @@ export default function Settings () {
|
|||||||
label='Always show games in sidebar'
|
label='Always show games in sidebar'
|
||||||
value={alwaysShowGamesInSidebar}
|
value={alwaysShowGamesInSidebar}
|
||||||
onChange={async () => {
|
onChange={async () => {
|
||||||
while (normalConfig != null) {
|
if (!normalConfig) return
|
||||||
setAlwaysShowGamesInSidebar(!alwaysShowGamesInSidebar)
|
setAlwaysShowGamesInSidebar(!alwaysShowGamesInSidebar)
|
||||||
setNormalConfig({
|
setNormalConfig({
|
||||||
...normalConfig,
|
...normalConfig,
|
||||||
settings: {
|
settings: {
|
||||||
...normalConfig.settings,
|
...normalConfig.settings,
|
||||||
alwaysShowGamesInSidebar: !alwaysShowGamesInSidebar
|
alwaysShowGamesInSidebar: !alwaysShowGamesInSidebar
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
writeNormalConfig({
|
await writeNormalConfig({
|
||||||
...normalConfig,
|
...normalConfig,
|
||||||
settings: {
|
settings: {
|
||||||
...normalConfig.settings,
|
...normalConfig.settings,
|
||||||
alwaysShowGamesInSidebar: !alwaysShowGamesInSidebar
|
alwaysShowGamesInSidebar: !alwaysShowGamesInSidebar
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
break
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
title="This setting will make it so when you are on a page like this, the games won't disappear."
|
title="This setting will make it so when you are on a page like this, the games won't disappear."
|
||||||
/>
|
/>
|
||||||
@@ -100,24 +96,22 @@ export default function Settings () {
|
|||||||
label='Show Installs/Launch/Manage Buttons'
|
label='Show Installs/Launch/Manage Buttons'
|
||||||
value={useLegacyInteractButtons}
|
value={useLegacyInteractButtons}
|
||||||
onChange={async () => {
|
onChange={async () => {
|
||||||
while (normalConfig != null) {
|
if (!normalConfig) return
|
||||||
setUseLegacyInteractButtons(!useLegacyInteractButtons)
|
setUseLegacyInteractButtons(!useLegacyInteractButtons)
|
||||||
setNormalConfig({
|
setNormalConfig({
|
||||||
...normalConfig,
|
...normalConfig,
|
||||||
settings: {
|
settings: {
|
||||||
...normalConfig.settings,
|
...normalConfig.settings,
|
||||||
useLegacyInteractButtons: !useLegacyInteractButtons
|
useLegacyInteractButtons: !useLegacyInteractButtons
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
writeNormalConfig({
|
await writeNormalConfig({
|
||||||
...normalConfig,
|
...normalConfig,
|
||||||
settings: {
|
settings: {
|
||||||
...normalConfig.settings,
|
...normalConfig.settings,
|
||||||
useLegacyInteractButtons: !useLegacyInteractButtons
|
useLegacyInteractButtons: !useLegacyInteractButtons
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
break
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
title='Enable the legacy method of using the installs/launch/manage buttons. In the future this setting may be removed so try and get used to the new method.'
|
title='Enable the legacy method of using the installs/launch/manage buttons. In the future this setting may be removed so try and get used to the new method.'
|
||||||
/>
|
/>
|
||||||
@@ -125,13 +119,22 @@ export default function Settings () {
|
|||||||
label='Use wine when needed to launch games'
|
label='Use wine when needed to launch games'
|
||||||
value={useWineOnUnixWhenNeeded}
|
value={useWineOnUnixWhenNeeded}
|
||||||
onChange={async () => {
|
onChange={async () => {
|
||||||
while (normalConfig != null) {
|
if (!normalConfig) return
|
||||||
setUseWineOnUnixWhenNeeded(!useWineOnUnixWhenNeeded)
|
setUseWineOnUnixWhenNeeded(!useWineOnUnixWhenNeeded)
|
||||||
normalConfig.settings.useWineOnUnixWhenNeeded =
|
setNormalConfig({
|
||||||
!useWineOnUnixWhenNeeded
|
...normalConfig,
|
||||||
await writeNormalConfig(normalConfig)
|
settings: {
|
||||||
break
|
...normalConfig.settings,
|
||||||
}
|
useWineOnUnixWhenNeeded: !useWineOnUnixWhenNeeded
|
||||||
|
}
|
||||||
|
})
|
||||||
|
await writeNormalConfig({
|
||||||
|
...normalConfig,
|
||||||
|
settings: {
|
||||||
|
...normalConfig.settings,
|
||||||
|
useWineOnUnixWhenNeeded: !useWineOnUnixWhenNeeded
|
||||||
|
}
|
||||||
|
})
|
||||||
}}
|
}}
|
||||||
className={platform() == 'linux' ? '' : 'hidden'}
|
className={platform() == 'linux' ? '' : 'hidden'}
|
||||||
/>
|
/>
|
||||||
@@ -142,12 +145,22 @@ export default function Settings () {
|
|||||||
type='text'
|
type='text'
|
||||||
value={wineOnUnixCommand}
|
value={wineOnUnixCommand}
|
||||||
onChange={async e => {
|
onChange={async e => {
|
||||||
while (normalConfig != null) {
|
if (!normalConfig) return
|
||||||
setWineOnUnixCommand(e.target.value)
|
setWineOnUnixCommand(e.target.value)
|
||||||
normalConfig.settings.wineOnUnixCommand = e.target.value
|
setNormalConfig({
|
||||||
await writeNormalConfig(normalConfig)
|
...normalConfig,
|
||||||
break
|
settings: {
|
||||||
}
|
...normalConfig.settings,
|
||||||
|
wineOnUnixCommand: e.target.value
|
||||||
|
}
|
||||||
|
})
|
||||||
|
await writeNormalConfig({
|
||||||
|
...normalConfig,
|
||||||
|
settings: {
|
||||||
|
...normalConfig.settings,
|
||||||
|
wineOnUnixCommand: e.target.value
|
||||||
|
}
|
||||||
|
})
|
||||||
}}
|
}}
|
||||||
className={`input-field my-1 ${
|
className={`input-field my-1 ${
|
||||||
platform() == 'linux' && useWineOnUnixWhenNeeded ? '' : 'hidden'
|
platform() == 'linux' && useWineOnUnixWhenNeeded ? '' : 'hidden'
|
||||||
@@ -159,33 +172,29 @@ export default function Settings () {
|
|||||||
className='ml-2 bg-(--col2) border border-(--col4) rounded-md'
|
className='ml-2 bg-(--col2) border border-(--col4) rounded-md'
|
||||||
value={theme}
|
value={theme}
|
||||||
onChange={async e => {
|
onChange={async e => {
|
||||||
|
if (!normalConfig) return
|
||||||
const newTheme = parseInt(e.target.value)
|
const newTheme = parseInt(e.target.value)
|
||||||
while (normalConfig != null) {
|
setTheme(newTheme)
|
||||||
setTheme(newTheme)
|
setNormalConfig({
|
||||||
setNormalConfig({
|
...normalConfig,
|
||||||
...normalConfig,
|
settings: {
|
||||||
settings: {
|
...normalConfig.settings,
|
||||||
...normalConfig.settings,
|
theme: newTheme
|
||||||
theme: newTheme
|
}
|
||||||
}
|
})
|
||||||
})
|
await writeNormalConfig({
|
||||||
writeNormalConfig({
|
...normalConfig,
|
||||||
...normalConfig,
|
settings: {
|
||||||
settings: {
|
...normalConfig.settings,
|
||||||
...normalConfig.settings,
|
theme: newTheme
|
||||||
theme: newTheme
|
}
|
||||||
}
|
})
|
||||||
})
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<option value={0}>Dark (default)</option>
|
<option value={0}>Dark (default)</option>
|
||||||
<option value={1}>Red</option>
|
<option value={1}>Red</option>
|
||||||
<option value={2}>Green</option>
|
<option value={2}>Blue</option>
|
||||||
<option value={3}>Blue</option>
|
<option value={3}>Purple</option>
|
||||||
<option value={4}>Purple</option>
|
|
||||||
<option value={5}>Mint</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -32,7 +32,31 @@ export async function readNormalConfig (): Promise<NormalConfig> {
|
|||||||
return new NormalConfig(version)
|
return new NormalConfig(version)
|
||||||
}
|
}
|
||||||
const config = await readTextFile('config.json', options)
|
const config = await readTextFile('config.json', options)
|
||||||
return NormalConfig.import(JSON.parse(config))
|
const raw = JSON.parse(config)
|
||||||
|
if (
|
||||||
|
raw.settings &&
|
||||||
|
raw.settings.theme &&
|
||||||
|
(raw.version == '1.0.0' ||
|
||||||
|
raw.version == '1.1.0' ||
|
||||||
|
raw.version == '1.1.1' ||
|
||||||
|
raw.version == '1.2.0' ||
|
||||||
|
raw.version == '1.3.0' ||
|
||||||
|
raw.version == '1.3.1' ||
|
||||||
|
raw.version == '1.4.0' ||
|
||||||
|
raw.version == '1.5.0' ||
|
||||||
|
raw.version == '1.5.1' ||
|
||||||
|
raw.version == '1.5.2' ||
|
||||||
|
raw.version == '1.5.3' ||
|
||||||
|
raw.version == '1.5.4')
|
||||||
|
) {
|
||||||
|
const parsed = Number(raw.settings.theme)
|
||||||
|
if (parsed == 3) raw.settings.theme = 2
|
||||||
|
if (parsed == 4) raw.settings.theme = 3
|
||||||
|
else if (parsed != 0 && parsed != 1) raw.settings.theme = 0
|
||||||
|
}
|
||||||
|
raw.version = version
|
||||||
|
writeNormalConfig(raw)
|
||||||
|
return NormalConfig.import(raw)
|
||||||
} catch {
|
} catch {
|
||||||
return new NormalConfig(version)
|
return new NormalConfig(version)
|
||||||
}
|
}
|
||||||
@@ -83,8 +107,7 @@ export async function readVersionsConfig (): Promise<VersionsConfig> {
|
|||||||
}
|
}
|
||||||
const config = await readTextFile('versions.json', options)
|
const config = await readTextFile('versions.json', options)
|
||||||
const raw = JSON.parse(config)
|
const raw = JSON.parse(config)
|
||||||
if (raw.version && raw.list && raw.timestamps) {
|
if (raw.list && raw.timestamps) {
|
||||||
raw.version = version
|
|
||||||
raw.list = raw.timestamps
|
raw.list = raw.timestamps
|
||||||
delete raw.timestamps
|
delete raw.timestamps
|
||||||
|
|
||||||
@@ -94,6 +117,8 @@ export async function readVersionsConfig (): Promise<VersionsConfig> {
|
|||||||
options
|
options
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
raw.version = version
|
||||||
|
writeVersionsConfig(raw)
|
||||||
return VersionsConfig.import(raw)
|
return VersionsConfig.import(raw)
|
||||||
} catch {
|
} catch {
|
||||||
return new VersionsConfig(version)
|
return new VersionsConfig(version)
|
||||||
|
|||||||
Reference in new issue
Block a user