Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screenshot viewer #11

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# OxLAUNCHER [![OxLAUNCHER CI](https://github.com/Proxwian/OxLAUNCHER/actions/workflows/nodejs.yml/badge.svg)](https://github.com/Proxwian/OxLAUNCHER/actions/workflows/nodejs.yml)

Latest version: 1.4.0
Latest version: 1.4.1
6,678 changes: 5,335 additions & 1,343 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oxlauncher",
"version": "1.4.0",
"version": "1.4.1",
"description": "OxLAUNCHER is simple and powerful tool to download and manage minecraft modpacks. Based on GDLauncher",
"keywords": [
"minecraft",
Expand Down
4 changes: 2 additions & 2 deletions public/discordRPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let activity;
const initialAppStartup = Math.floor(Date.now() / 1000);

const defaultValue = {
details: 'Смотрит сборки',
details: 'На главном экране',
startTimestamp: initialAppStartup,
largeImageKey: 'default_big',
largeImageText: 'OxLAUNCHER - Лучший Minecraft лаунчер для установки сборок с модификациями и не только',
Expand Down Expand Up @@ -38,7 +38,7 @@ exports.update = details => {
activity = {
...activity,
startTimestamp: Math.floor(Date.now() / 1000),
details: `Играет в ${details}`
details: `${details}`
};
client.setActivity(activity);
};
Expand Down
38 changes: 19 additions & 19 deletions src/app/desktop/DesktopRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,25 +81,25 @@ function DesktopRoot({ store }) {

const manifests = await dispatch(initManifests());

let isJava8OK = javaPath;
let isJavaLatestOk = javaLatestPath;

if (!javaPath) {
({ isValid: isJava8OK } = await isLatestJavaDownloaded(
manifests,
userData,
true
));
}

if (!isJavaLatestOk) {
({ isValid: isJavaLatestOk } = await isLatestJavaDownloaded(
manifests,
userData,
true,
LATEST_JAVA_VERSION
));
}
let isJava8OK = true;
let isJavaLatestOk = true;

// if (!javaPath) {
// ({ isValid: isJava8OK } = await isLatestJavaDownloaded(
// manifests,
// userData,
// true
// ));
// }

// if (!isJavaLatestOk) {
// ({ isValid: isJavaLatestOk } = await isLatestJavaDownloaded(
// manifests,
// userData,
// true,
// LATEST_JAVA_VERSION
// ));
// }

if (!isJava8OK || !isJavaLatestOk) {
dispatch(openModal('JavaSetup', { preventClose: true }));
Expand Down
42 changes: 25 additions & 17 deletions src/app/desktop/components/Instances/Instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
faBoxOpen,
faCopy,
faServer,
faHammer
faHammer,
faImage
} from '@fortawesome/free-solid-svg-icons';
import psTree from 'ps-tree';
import { ContextMenuTrigger, ContextMenu, MenuItem } from 'react-contextmenu';
Expand Down Expand Up @@ -250,11 +251,8 @@ const Instance = ({ instanceName }) => {
finallyUpdate;
setNeedUpdate(false);
}
const updatePack = () => {
dispatch(openModal('InstanceManager', { instanceName: instanceName, openUpdater: true }));
};
const openBisectModal = () => {
dispatch(openModal('BisectHosting'));
const openScreenshots = () => {
dispatch(openModal('InstanceManager', { instanceName: instanceName, openScreenshots: true }));
};
const instanceExportCurseForge = () => {
dispatch(openModal('InstanceExportCurseForge', { instanceName }));
Expand Down Expand Up @@ -392,31 +390,41 @@ const Instance = ({ instanceName }) => {
</MenuItem>
)}
{Boolean(isNeedUpdate) && (
<MenuItem disabled={Boolean(isInQueue)}
css={`
<MenuItem disabled={Boolean(isInQueue)}
css={`
color: #6D4D52;
`}
onClick={updateDatapack}>
<FontAwesomeIcon
icon={faSpinner}
css={`
color: #6D4D52;
`}
onClick={updateDatapack}>
margin-right: 10px;
width: 25px !important;
`}
/>
Обновить
</MenuItem>
)}
<MenuItem disabled={Boolean(isInQueue)} onClick={manageInstance}>
<FontAwesomeIcon
icon={faSpinner}
icon={faWrench}
css={`
color: #6D4D52;
margin-right: 10px;
width: 25px !important;
`}
/>
Обновить
Управление
</MenuItem>
)}
<MenuItem disabled={Boolean(isInQueue)} onClick={manageInstance}>
<MenuItem disabled={Boolean(isInQueue)} onClick={openScreenshots}>
<FontAwesomeIcon
icon={faWrench}
icon={faImage}
css={`
margin-right: 10px;
width: 25px !important;
`}
/>
Настройки
Скриншоты
</MenuItem>
<MenuItem onClick={openFolder}>
<FontAwesomeIcon
Expand Down
10 changes: 4 additions & 6 deletions src/app/desktop/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -911,18 +911,16 @@ export const getPlayerSkinMojang = async (uuid) => {
return decoded?.textures?.SKIN?.url;
};

export const getPlayerSkinOx = async (nickname) => {
return oxGetPlayerSkin(nickname);
const playerSkin = await oxGetPlayerSkin(nickname);
export const getPlayerSkinOx = async (uuid) => {
const playerSkin = await oxGetPlayerSkin(uuid);
const { data } = playerSkin;
const base64 = data.properties[0].value;
const decoded = JSON.parse(Buffer.from(base64, 'base64').toString());
return decoded?.textures?.SKIN?.url;
};

export const getPlayerSkinElyBy = async (nickname) => {
return elybyGetPlayerSkin(nickname);
const playerSkin = await elybyGetPlayerSkin(nickname);
export const getPlayerSkinElyBy = async (uuid) => {
const playerSkin = await elybyGetPlayerSkin(uuid);
const { data } = playerSkin;
const base64 = data.properties[0].value;
const decoded = JSON.parse(Buffer.from(base64, 'base64').toString());
Expand Down
53 changes: 27 additions & 26 deletions src/app/desktop/views/Home.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect, memo, useMemo } from 'react';
import styled from 'styled-components';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faPlus } from '@fortawesome/free-solid-svg-icons';
import { faImages, faPlus } from '@fortawesome/free-solid-svg-icons';
import { Button } from 'antd';
import { useSelector, useDispatch } from 'react-redux';
import { ipcRenderer } from 'electron';
Expand All @@ -21,14 +21,20 @@ import { updateLastUpdateVersion } from '../../../common/reducers/actions';
import { _getInstances, _getInstancesPath, _getTempPath } from '../../../common/utils/selectors';

import { useDebouncedCallback } from 'use-debounce';
import { ACCOUNT_MICROSOFT } from '../../../common/utils/constants';
import { ACCOUNT_ELYBY, ACCOUNT_MICROSOFT, ACCOUNT_OFFLINE, ACCOUNT_OXAUTH } from '../../../common/utils/constants';

const AddInstanceIcon = styled(Button)`
position: fixed;
bottom: 20px;
left: 20px;
`;

const ShowScreenshotsIcon = styled(Button)`
position: fixed;
bottom: 20px;
left: 80px;
`;

const AccountContainer = styled(Button)`
position: fixed;
bottom: 20px;
Expand All @@ -55,6 +61,8 @@ const Home = () => {
const [annoucement, setAnnoucement] = useState(null);

useEffect(() => {
const discordRPCDetails = `На главной`;
ipcRenderer.invoke('update-discord-rpc', discordRPCDetails);
const init = async () => {
// setInstalling(false);
// setInitinstall(false);
Expand All @@ -79,23 +87,6 @@ const Home = () => {
useEffect(() => {
extractFace(account.skin).then(setProfileImage).catch(console.error);
}, [account]);

const getInstances = (instances, sortOrder) => {
// Data normalization for missing fields
const inst = instances.map(instance => {
return {
...instance,
timePlayed: instance.timePlayed || 0,
lastPlayed: instance.lastPlayed || 0
};
});

switch (sortOrder) {
default:
return inst;
}
};


return (
<div>
Expand All @@ -112,16 +103,26 @@ const Home = () => {
{annoucement}
</div>
) : null}
<Instances
css={`
bottom: 20px;
left: 20px;`
}/>
<Instances
css={`
bottom: 20px;
left: 20px;`
}/>
<AddInstanceIcon type="primary" onClick={() => openAddInstanceModal(0)}>
<FontAwesomeIcon icon={faPlus} />
</AddInstanceIcon>
<AccountContainer type="primary" onClick={openAccountModal}>
{profileImage && account.accountType === ACCOUNT_MICROSOFT ? (
<ShowScreenshotsIcon type="primary" onClick={() => dispatch(openModal('ScreenshotManager'))}>
<FontAwesomeIcon icon={faImages} />
</ShowScreenshotsIcon>
<AccountContainer
type="primary"
onClick={openAccountModal}
css={`
background-color: ${account.accountType == ACCOUNT_OFFLINE ? (`#545454`) : account.accountType == ACCOUNT_OXAUTH ? (`#3c6a5b`) : account.accountType == ACCOUNT_ELYBY ? (`#187c41`) : (`#830d0d`)};
border-color: ${account.accountType == ACCOUNT_OFFLINE ? (`#545454`) : account.accountType == ACCOUNT_OXAUTH ? (`#3c6a5b`) : account.accountType == ACCOUNT_ELYBY ? (`#187c41`) : (`#830d0d`)};
`}
>
{profileImage && account.accountType !== ACCOUNT_OFFLINE ? (
<img
src={`data:image/jpeg;base64,${profileImage}`}
css={`
Expand Down
2 changes: 1 addition & 1 deletion src/app/desktop/views/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ const Login = () => {
`}
>
<center>
<a onClick={() => dispatch(openModal('ChangeLogs'))}>v. 1.4.0</a>
<a onClick={() => dispatch(openModal('ChangeLogs'))}>v. 1.4.1</a>
</center>
</div>
<div
Expand Down
1 change: 0 additions & 1 deletion src/app/desktop/views/Onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
faLongArrowAltUp,
faLongArrowAltDown
} from '@fortawesome/free-solid-svg-icons';
import backgroundVideo from '../../../common/assets/onboarding.webm';
import { _getCurrentAccount } from '../../../common/utils/selectors';
import BisectHosting from '../../../ui/BisectHosting';
import KoFiButton from '../../../common/assets/ko-fi.png';
Expand Down
8 changes: 4 additions & 4 deletions src/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,9 @@ export const oxInvalidate = (accessToken, clientToken) => {
);
};

export const oxGetPlayerSkin = nickname => {
export const oxGetPlayerSkin = uuid => {
return axios.get(
`https://s.namemc.com/i/1dbf93bef2b95e0c.png`
`https://oxlauncher.com/session/minecraft/profile/${uuid}`
);
};

Expand Down Expand Up @@ -345,9 +345,9 @@ export const elybyInvalidate = (accessToken, clientToken) => {
);
};

export const elybyGetPlayerSkin = nickname => {
export const elybyGetPlayerSkin = uuid => {
return axios.get(
`https://s.namemc.com/i/d96b3d3f72a9fa57.png`
`http://minecraft.ely.by/session/minecraft/profile/${uuid}`
);
};

Expand Down
1 change: 1 addition & 0 deletions src/common/components/ModalsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const modalsComponentLookupTable = {
lazy(() => import('../modals/OptedOutModsList'))
),
BisectHosting: AsyncComponent(lazy(() => import('../modals/BisectHosting'))),
ScreenshotManager: AsyncComponent(lazy(() => import('../modals/ScreenshotManager'))),
Onboarding: AsyncComponent(lazy(() => import('../modals/Onboarding'))),
ModOverview: AsyncComponent(lazy(() => import('../modals/ModOverview'))),
ModChangelog: AsyncComponent(lazy(() => import('../modals/ModChangelog'))),
Expand Down
20 changes: 12 additions & 8 deletions src/common/modals/AccountsManager.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React, { useState, useEffect, memo, useMemo } from 'react';
import React, { useEffect } from 'react';
import { ipcRenderer } from 'electron';
import styled from 'styled-components';
import { Spin, message } from 'antd';
import { useSelector, useDispatch } from 'react-redux';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faOtter, faTrash } from '@fortawesome/free-solid-svg-icons';
import { faTrash } from '@fortawesome/free-solid-svg-icons';
import Modal from '../components/Modal';
import { _getAccounts, _getCurrentAccount } from '../utils/selectors';
import { openModal, closeModal } from '../reducers/modals/actions';
Expand All @@ -18,7 +19,6 @@ import { load } from '../reducers/loading/actions';
import features from '../reducers/loading/features';
import { ACCOUNT_ELYBY, ACCOUNT_MICROSOFT, ACCOUNT_MOJANG, ACCOUNT_OFFLINE, ACCOUNT_OXAUTH } from '../utils/constants';
import { extractFace } from '../../app/desktop/utils';
import { faEarlybirds } from '@fortawesome/free-brands-svg-icons';

const ProfileSettings = () => {
const dispatch = useDispatch();
Expand All @@ -27,8 +27,13 @@ const ProfileSettings = () => {
const isLoading = useSelector(state => state.loading.accountAuthentication);

useEffect(() => {
const discordRPCDetails = `Смотрит список профилей`;
ipcRenderer.invoke('update-discord-rpc', discordRPCDetails);
accounts.map(async account => {
if (account.skin == "") account.skinFace = ""; return;
if (account.skin == "" || account.skin == undefined) {
account.skinFace = "";
return;
}
account.skinFace = await extractFace(account.skin);
})
}, [accounts]);
Expand All @@ -40,7 +45,7 @@ const ProfileSettings = () => {
width: 400px;
max-height: 700px;
`}
title="Менеджер профилей"
title="Менеджер аккаунтов"
>
<Container>
<AccountsContainer>
Expand Down Expand Up @@ -90,8 +95,7 @@ const ProfileSettings = () => {
}}
>
<div>
{(account.accountType === ACCOUNT_MICROSOFT) && (

{(account.accountType != ACCOUNT_OFFLINE) && (
<img
src={`data:image/jpeg;base64,${account.skinFace}`}
css={`
Expand Down Expand Up @@ -183,7 +187,7 @@ const ProfileSettings = () => {
</AccountsContainer>
<AccountContainer>
<AccountItem onClick={() => dispatch(openModal('AddAccount'))}>
Добавить профиль
Добавить аккаунт
</AccountItem>
</AccountContainer>
</Container>
Expand Down
Loading
Loading