add own cdn server
This commit is contained in:
@ -18,6 +18,29 @@ import { spawn } from 'child_process';
|
|||||||
import { AuthService } from './auth-service';
|
import { AuthService } from './auth-service';
|
||||||
import { API_BASE_URL } from '../renderer/api';
|
import { API_BASE_URL } from '../renderer/api';
|
||||||
|
|
||||||
|
const CDN = 'https://cdn.minecraft.popa-popa.ru';
|
||||||
|
|
||||||
|
const DOWNLOAD_OPTIONS = {
|
||||||
|
// assets (objects/)
|
||||||
|
assetsHost: `${CDN}/assets/objects`,
|
||||||
|
|
||||||
|
// библиотеки (jar'ы)
|
||||||
|
libraryHost(library: { path: any }) {
|
||||||
|
return `${CDN}/libraries/${library.path}`;
|
||||||
|
},
|
||||||
|
|
||||||
|
assetsIndexUrl: (version: any) =>
|
||||||
|
`${CDN}/assets/indexes/${version.assetIndex.id}.json`,
|
||||||
|
|
||||||
|
// версии
|
||||||
|
json(versionInfo: { id: any }) {
|
||||||
|
return `${CDN}/versions/${versionInfo.id}/${versionInfo.id}.json`;
|
||||||
|
},
|
||||||
|
client(resolved: { id: any }) {
|
||||||
|
return `${CDN}/versions/${resolved.id}/${resolved.id}.jar`;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
// Константы
|
// Константы
|
||||||
const AUTHLIB_INJECTOR_FILENAME = 'authlib-injector-1.2.5.jar';
|
const AUTHLIB_INJECTOR_FILENAME = 'authlib-injector-1.2.5.jar';
|
||||||
const MCSTATUS_API_URL = 'https://api.mcstatus.io/v2/status/java/';
|
const MCSTATUS_API_URL = 'https://api.mcstatus.io/v2/status/java/';
|
||||||
@ -587,6 +610,7 @@ export function initMinecraftHandlers() {
|
|||||||
skipRevalidate: true,
|
skipRevalidate: true,
|
||||||
assetsDownloadConcurrency: 2,
|
assetsDownloadConcurrency: 2,
|
||||||
librariesDownloadConcurrency: 2,
|
librariesDownloadConcurrency: 2,
|
||||||
|
...DOWNLOAD_OPTIONS,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('installMcTask started for', minecraftVersion.id);
|
console.log('installMcTask started for', minecraftVersion.id);
|
||||||
@ -684,6 +708,7 @@ export function initMinecraftHandlers() {
|
|||||||
// Игнорируем sha1, чтобы не падать из-за несоответствий
|
// Игнорируем sha1, чтобы не падать из-за несоответствий
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
...DOWNLOAD_OPTIONS,
|
||||||
});
|
});
|
||||||
|
|
||||||
await depsTask.startAndWait({
|
await depsTask.startAndWait({
|
||||||
|
|||||||
Reference in New Issue
Block a user