working authirization
This commit is contained in:
@ -33,22 +33,6 @@ const LaunchPage = () => {
|
||||
navigate('/login');
|
||||
}
|
||||
|
||||
window.electron.ipcRenderer.on('download-progress', (progress: any) => {
|
||||
setDownloadProgress(progress as number);
|
||||
});
|
||||
|
||||
// Добавляем слушатель для статуса установки
|
||||
window.electron.ipcRenderer.on('installation-progress', (data: any) => {
|
||||
setInstallStatus((data as { status: string }).status);
|
||||
});
|
||||
|
||||
// Обновляем слушатель для статуса установки
|
||||
window.electron.ipcRenderer.on('installation-status', (data: any) => {
|
||||
const { step, message } = data as { step: string; message: string };
|
||||
setInstallStep(step);
|
||||
setInstallMessage(message);
|
||||
});
|
||||
|
||||
return () => {
|
||||
window.electron.ipcRenderer.removeAllListeners('download-progress');
|
||||
window.electron.ipcRenderer.removeAllListeners('installation-progress');
|
||||
@ -77,6 +61,11 @@ const LaunchPage = () => {
|
||||
setIsDownloading(true);
|
||||
setDownloadProgress(0);
|
||||
|
||||
// Загружаем настройки и токены
|
||||
const savedConfig = JSON.parse(
|
||||
localStorage.getItem('launcher_config') || '{}',
|
||||
);
|
||||
|
||||
// Сначала проверяем и обновляем файлы
|
||||
const downloadResult = await window.electron.ipcRenderer.invoke(
|
||||
'download-and-extract',
|
||||
@ -95,9 +84,16 @@ const LaunchPage = () => {
|
||||
);
|
||||
}
|
||||
|
||||
// Затем запускаем Minecraft
|
||||
const launchResult =
|
||||
await window.electron.ipcRenderer.invoke('launch-minecraft');
|
||||
// Затем запускаем Minecraft с данными авторизации
|
||||
const launchResult = await window.electron.ipcRenderer.invoke(
|
||||
'launch-minecraft',
|
||||
{
|
||||
accessToken: savedConfig.accessToken,
|
||||
uuid: savedConfig.uuid,
|
||||
username: savedConfig.username,
|
||||
memory: savedConfig.memory || 4096,
|
||||
},
|
||||
);
|
||||
|
||||
if (launchResult?.success) {
|
||||
showNotification('Minecraft успешно запущен!', 'success');
|
||||
|
Reference in New Issue
Block a user