feat: add Fabric version update and improve launch params handling
This commit is contained in:
@ -414,10 +414,6 @@ export function initMinecraftHandlers() {
|
|||||||
// Удаляем временную директорию
|
// Удаляем временную директорию
|
||||||
fs.rmSync(tempDir, { recursive: true });
|
fs.rmSync(tempDir, { recursive: true });
|
||||||
|
|
||||||
// После распаковки архива и перед запуском
|
|
||||||
const versionsContents = fs.readdirSync(versionsDir);
|
|
||||||
console.log('Доступные версии:', versionsContents);
|
|
||||||
|
|
||||||
return { success: true, updated: true, version: latestVersion, packName };
|
return { success: true, updated: true, version: latestVersion, packName };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error in download-and-extract:', error);
|
console.error('Error in download-and-extract:', error);
|
||||||
@ -434,6 +430,7 @@ export function initMinecraftHandlers() {
|
|||||||
username,
|
username,
|
||||||
memory = 2048,
|
memory = 2048,
|
||||||
baseVersion = '1.21.4',
|
baseVersion = '1.21.4',
|
||||||
|
fabricVersion = 'fabric0.16.14',
|
||||||
packName = 'Comfort', // Название основной сборки
|
packName = 'Comfort', // Название основной сборки
|
||||||
versionToLaunchOverride = '', // Возможность переопределить версию для запуска
|
versionToLaunchOverride = '', // Возможность переопределить версию для запуска
|
||||||
serverIp = 'popa-popa.ru',
|
serverIp = 'popa-popa.ru',
|
||||||
@ -454,8 +451,8 @@ export function initMinecraftHandlers() {
|
|||||||
let versionToLaunch = versionToLaunchOverride;
|
let versionToLaunch = versionToLaunchOverride;
|
||||||
|
|
||||||
if (!versionToLaunch) {
|
if (!versionToLaunch) {
|
||||||
if (versionsContents.includes(`${baseVersion}-fabric0.16.14`)) {
|
if (versionsContents.includes(`${baseVersion}-${fabricVersion}`)) {
|
||||||
versionToLaunch = `${baseVersion}-fabric0.16.14`;
|
versionToLaunch = `${baseVersion}-${fabricVersion}`;
|
||||||
} else if (versionsContents.includes(packName)) {
|
} else if (versionsContents.includes(packName)) {
|
||||||
versionToLaunch = packName;
|
versionToLaunch = packName;
|
||||||
} else {
|
} else {
|
||||||
@ -556,9 +553,6 @@ export function initMinecraftHandlers() {
|
|||||||
message: 'Получение списка версий Fabric...',
|
message: 'Получение списка версий Fabric...',
|
||||||
});
|
});
|
||||||
|
|
||||||
const fabricVersions = await getFabricLoaders();
|
|
||||||
const fabricVersion = fabricVersions[0]; // Последняя версия
|
|
||||||
|
|
||||||
if (fabricVersion) {
|
if (fabricVersion) {
|
||||||
event.sender.send('installation-status', {
|
event.sender.send('installation-status', {
|
||||||
step: 'fabric-install',
|
step: 'fabric-install',
|
||||||
@ -578,7 +572,7 @@ export function initMinecraftHandlers() {
|
|||||||
// 3. Подготовка версии и установка зависимостей
|
// 3. Подготовка версии и установка зависимостей
|
||||||
try {
|
try {
|
||||||
// Используем идентификатор Fabric-версии
|
// Используем идентификатор Fabric-версии
|
||||||
const fabricVersionId = `${baseVersion}-fabric0.16.14`;
|
const fabricVersionId = `${baseVersion}-${fabricVersion}`;
|
||||||
|
|
||||||
event.sender.send('installation-status', {
|
event.sender.send('installation-status', {
|
||||||
step: 'version-parse',
|
step: 'version-parse',
|
||||||
|
@ -21,7 +21,19 @@ declare global {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const LaunchPage = () => {
|
const launchOptions = {
|
||||||
|
downloadUrl:
|
||||||
|
'https://github.com/DIKER0K/Comfort/releases/latest/download/Comfort.zip',
|
||||||
|
apiReleaseUrl: 'https://api.github.com/repos/DIKER0K/Comfort/releases/latest',
|
||||||
|
versionFileName: 'comfort_version.txt',
|
||||||
|
packName: 'Comfort',
|
||||||
|
memory: 4096,
|
||||||
|
baseVersion: '1.21.4',
|
||||||
|
serverIp: 'popa-popa.ru',
|
||||||
|
fabricVersion: 'fabric0.16.14',
|
||||||
|
};
|
||||||
|
|
||||||
|
const LaunchPage = (launchOptions: any) => {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [isDownloading, setIsDownloading] = useState(false);
|
const [isDownloading, setIsDownloading] = useState(false);
|
||||||
const [downloadProgress, setDownloadProgress] = useState(0);
|
const [downloadProgress, setDownloadProgress] = useState(0);
|
||||||
@ -90,15 +102,12 @@ const LaunchPage = () => {
|
|||||||
localStorage.getItem('launcher_config') || '{}',
|
localStorage.getItem('launcher_config') || '{}',
|
||||||
);
|
);
|
||||||
|
|
||||||
// Опции для скачивания и запуска сборки
|
// Опции для скачивания сборки
|
||||||
const packOptions = {
|
const packOptions = {
|
||||||
downloadUrl:
|
downloadUrl: launchOptions.downloadUrl,
|
||||||
'https://github.com/DIKER0K/Comfort/releases/latest/download/Comfort.zip',
|
apiReleaseUrl: launchOptions.apiReleaseUrl,
|
||||||
apiReleaseUrl:
|
versionFileName: launchOptions.versionFileName,
|
||||||
'https://api.github.com/repos/DIKER0K/Comfort/releases/latest',
|
packName: launchOptions.packName,
|
||||||
versionFileName: 'comfort_version.txt',
|
|
||||||
packName: 'Comfort',
|
|
||||||
serverIp: 'popa-popa.ru',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Передаем опции для скачивания
|
// Передаем опции для скачивания
|
||||||
@ -124,19 +133,20 @@ const LaunchPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Опции для запуска
|
// Опции для запуска
|
||||||
const launchOptions = {
|
const options = {
|
||||||
accessToken: savedConfig.accessToken,
|
accessToken: savedConfig.accessToken,
|
||||||
uuid: savedConfig.uuid,
|
uuid: savedConfig.uuid,
|
||||||
username: savedConfig.username,
|
username: savedConfig.username,
|
||||||
memory: savedConfig.memory || 4096,
|
memory: launchOptions.memory,
|
||||||
baseVersion: '1.21.4',
|
baseVersion: launchOptions.baseVersion,
|
||||||
packName: packOptions.packName,
|
packName: launchOptions.packName,
|
||||||
serverIp: packOptions.serverIp,
|
serverIp: launchOptions.serverIp,
|
||||||
|
fabricVersion: launchOptions.fabricVersion,
|
||||||
};
|
};
|
||||||
|
|
||||||
const launchResult = await window.electron.ipcRenderer.invoke(
|
const launchResult = await window.electron.ipcRenderer.invoke(
|
||||||
'launch-minecraft',
|
'launch-minecraft',
|
||||||
launchOptions,
|
options,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (needsSecondAttempt) {
|
if (needsSecondAttempt) {
|
||||||
@ -149,14 +159,7 @@ const LaunchPage = () => {
|
|||||||
|
|
||||||
const secondAttempt = await window.electron.ipcRenderer.invoke(
|
const secondAttempt = await window.electron.ipcRenderer.invoke(
|
||||||
'launch-minecraft',
|
'launch-minecraft',
|
||||||
{
|
options,
|
||||||
accessToken: savedConfig.accessToken,
|
|
||||||
uuid: savedConfig.uuid,
|
|
||||||
username: savedConfig.username,
|
|
||||||
memory: savedConfig.memory || 4096,
|
|
||||||
serverIp: packOptions.serverIp,
|
|
||||||
packName: packOptions.packName,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
showNotification('Minecraft успешно запущен!', 'success');
|
showNotification('Minecraft успешно запущен!', 'success');
|
||||||
|
Reference in New Issue
Block a user