Add downloading mod manager
This commit is contained in:
4 files changed
+53
-19
No files matched your search
+26
-1
@@ -360,7 +360,32 @@ export default function Installs () {
|
||||
<button
|
||||
className='absolute right-0 bottom-0 button'
|
||||
title='Click to manage mods for this game!'
|
||||
onClick={e => e.stopPropagation()}
|
||||
onClick={async e => {
|
||||
e.stopPropagation()
|
||||
|
||||
if (
|
||||
!(await exists('game/' + entry + '/BepInEx', {
|
||||
baseDir: BaseDirectory.AppLocalData
|
||||
}))
|
||||
) {
|
||||
if (
|
||||
await ask(
|
||||
"You don't have BepInEx (the mod loader for Unity Games), would you like to install it now? It is about 1MB in size. If you choose yes, it will download the recommended BepInEx version for " +
|
||||
getVersionInfo(entry)?.displayName +
|
||||
'.',
|
||||
{ title: 'BepInEx not found!', kind: 'error' }
|
||||
)
|
||||
) {
|
||||
downloadVersions([
|
||||
{
|
||||
id: entry,
|
||||
type: 1
|
||||
}
|
||||
])
|
||||
}
|
||||
return
|
||||
}
|
||||
}}
|
||||
hidden={!getVersionInfo(entry)?.modSupportDownload}
|
||||
>
|
||||
Mod Manager
|
||||
|
||||
+11
-7
@@ -411,6 +411,8 @@ export default function RootLayout ({
|
||||
setIsProcessingQueue(true)
|
||||
|
||||
const versionId = downloadQueue[0]
|
||||
const downloadInfo = downloadProgress.find(d => d.version == versionId)
|
||||
if (!downloadInfo) return
|
||||
const info = getVersionInfo(versionId)
|
||||
|
||||
if (!info) {
|
||||
@@ -433,10 +435,11 @@ export default function RootLayout ({
|
||||
)
|
||||
|
||||
const downloadInfoRequest = await fetch(
|
||||
'https://games.lncvrt.xyz/api/launcher/download?gameId=' +
|
||||
info.id +
|
||||
'&downloadId=' +
|
||||
info.download
|
||||
'https://games.lncvrt.xyz/api/launcher/download' +
|
||||
(downloadInfo.type == 0
|
||||
? '?gameId=' + info.id + '&downloadId=' + info.download
|
||||
: '?downloadId=' +
|
||||
(downloadInfo.type == 1 ? info.modSupportDownload : ''))
|
||||
)
|
||||
const signature = downloadInfoRequest.headers.get('x-signature') ?? ''
|
||||
const data = await downloadInfoRequest.json()
|
||||
@@ -468,7 +471,7 @@ export default function RootLayout ({
|
||||
? {
|
||||
...d,
|
||||
url: data.data.url,
|
||||
executable: info.executable,
|
||||
executable: downloadInfo.type == 0 ? info.executable : null,
|
||||
hash: data.data.hash
|
||||
}
|
||||
: d
|
||||
@@ -478,8 +481,8 @@ export default function RootLayout ({
|
||||
const res = await invoke<string>('download', {
|
||||
url: data.data.url,
|
||||
name: info.id,
|
||||
executable: info.executable,
|
||||
hash: data.data.hash
|
||||
hash: data.data.hash,
|
||||
downloadType: downloadInfo.type
|
||||
})
|
||||
|
||||
if (res === '1') {
|
||||
@@ -542,6 +545,7 @@ export default function RootLayout ({
|
||||
isProcessingQueue,
|
||||
getVersionInfo,
|
||||
getGameInfo,
|
||||
downloadProgress,
|
||||
normalConfig
|
||||
])
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ export default function DownloadsPopup () {
|
||||
</div>
|
||||
</div>
|
||||
<p className='text-2xl text-center'>
|
||||
{v.type == 1 ? 'Mod Manager for ' : null}{' '}
|
||||
{getVersionInfo(v.version)?.displayName}
|
||||
</p>
|
||||
<div className='mt-6.25 flex items-center justify-between'>
|
||||
|
||||
Reference in new issue
Block a user