stable launch minecraft
This commit is contained in:
@ -14,6 +14,7 @@ import {
|
||||
installTask,
|
||||
installDependenciesTask,
|
||||
} from '@xmcl/installer';
|
||||
import { Dispatcher, Agent } from 'undici';
|
||||
import { spawn } from 'child_process';
|
||||
import { AuthService } from './auth-service';
|
||||
import { API_BASE_URL } from '../renderer/api';
|
||||
@ -48,6 +49,11 @@ const MCSTATUS_API_URL = 'https://api.mcstatus.io/v2/status/java/';
|
||||
// Создаем экземпляр сервиса аутентификации
|
||||
const authService = new AuthService();
|
||||
|
||||
const agent = new Agent({
|
||||
connections: 16, // максимум 16 одновременных соединений (скачиваний)
|
||||
// тут можно задать и другие параметры при необходимости
|
||||
});
|
||||
|
||||
// Модифицированная функция для получения последней версии релиза с произвольного URL
|
||||
export async function getLatestReleaseVersion(apiUrl: string): Promise<string> {
|
||||
try {
|
||||
@ -610,6 +616,7 @@ export function initMinecraftHandlers() {
|
||||
skipRevalidate: true,
|
||||
assetsDownloadConcurrency: 2,
|
||||
librariesDownloadConcurrency: 2,
|
||||
dispatcher: agent,
|
||||
...DOWNLOAD_OPTIONS,
|
||||
});
|
||||
|
||||
@ -701,6 +708,7 @@ export function initMinecraftHandlers() {
|
||||
const depsTask = installDependenciesTask(resolvedVersion, {
|
||||
skipRevalidate: true,
|
||||
prevalidSizeOnly: true,
|
||||
dispatcher: agent,
|
||||
assetsDownloadConcurrency: 2,
|
||||
librariesDownloadConcurrency: 2,
|
||||
checksumValidatorResolver: () => ({
|
||||
|
||||
Reference in New Issue
Block a user