Skip to content

Commit

Permalink
v1.1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
blarfoon committed Nov 5, 2021
1 parent 88d3803 commit efd3bc6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 56 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gdlauncher",
"version": "1.1.15-beta.7",
"version": "1.1.15",
"description": "GDLauncher is simple, yet powerful Minecraft custom launcher with a strong focus on the user experience",
"keywords": [
"minecraft",
Expand Down
41 changes: 0 additions & 41 deletions src/app/desktop/views/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ import { Transition } from 'react-transition-group';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import {
faArrowRight,
faExclamationCircle,
faCheckCircle,
faExternalLinkAlt
} from '@fortawesome/free-solid-svg-icons';
import { Input, Button } from 'antd';
import { useKey } from 'rooks';
import axios from 'axios';
import { login, loginOAuth } from '../../../common/reducers/actions';
import { load, requesting } from '../../../common/reducers/loading/actions';
import features from '../../../common/reducers/loading/features';
Expand Down Expand Up @@ -116,13 +113,6 @@ const Footer = styled.div`
width: calc(100% - 80px);
`;

const Status = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
color: ${props => props.theme.palette.text.third};
`;

const FooterLinks = styled.div`
font-size: 0.75rem;
margin: 0 !important;
Expand Down Expand Up @@ -152,29 +142,12 @@ const LoginFailMessage = styled.div`
color: ${props => props.theme.palette.colors.red};
`;

const StatusIcon = ({ color }) => {
return (
<FontAwesomeIcon
icon={color === 'red' ? faExclamationCircle : faCheckCircle}
color={color}
css={`
margin: 0 5px;
color: ${props =>
props.color === 'green'
? props.theme.palette.colors.green
: props.theme.palette.error.main};
`}
/>
);
};

const Login = () => {
const dispatch = useDispatch();
const [email, setEmail] = useState(null);
const [password, setPassword] = useState(null);
const [version, setVersion] = useState(null);
const [loginFailed, setLoginFailed] = useState(false);
const [status, setStatus] = useState({});
const loading = useSelector(
state => state.loading.accountAuthentication.isRequesting
);
Expand Down Expand Up @@ -206,18 +179,10 @@ const Login = () => {
}, 1000);
};

const fetchStatus = async () => {
const { data } = await axios.get('https://status.mojang.com/check');
const result = {};
Object.assign(result, ...data);
setStatus(result);
};

useKey(['Enter'], authenticate);

useEffect(() => {
ipcRenderer.invoke('getAppVersion').then(setVersion).catch(console.error);
fetchStatus().catch(console.error);
}, []);

return (
Expand Down Expand Up @@ -340,12 +305,6 @@ const Login = () => {
Acceptable Use Policy
</span>
</div>
<Status>
Auth: <StatusIcon color={status['authserver.mojang.com']} />
Session: <StatusIcon color={status['session.minecraft.net']} />
Skins: <StatusIcon color={status['textures.minecraft.net']} />
API: <StatusIcon color={status['api.mojang.com']} />
</Status>
</Footer>
</LeftSide>
<Background transitionState={transitionState}>
Expand Down
40 changes: 27 additions & 13 deletions src/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ const trackCurseForgeAPI = (url, params = {}, method = 'get') => {
ga.sendCustomEvent('CurseForgeAPICall');

// Temporarily disable this
const switcher = false;
const switcher = true;
if (switcher) {
const patchedUrl = url.replace(FORGESVC_URL, `${GDL_SERVE_API}/curseforge`);
let req = null;
if (method === 'get') {
req = axios.get(patchedUrl, { params });
req = axios.get(url, { params });
} else if (method === 'post') {
req = axios.post(patchedUrl, params);
req = axios.post(url, params);
}

if (req) {
Expand Down Expand Up @@ -243,19 +242,22 @@ export const getFabricJson = ({ mcVersion, loaderVersion }) => {

export const getAddon = projectID => {
const url = `${FORGESVC_URL}/addon/${projectID}`;
trackCurseForgeAPI(url);
const myUrl = `${GDL_SERVE_API}/mods/${projectID}`;
trackCurseForgeAPI(myUrl);
return axios.get(url);
};

export const getMultipleAddons = async addons => {
const url = `${FORGESVC_URL}/addon`;
trackCurseForgeAPI(url, addons, 'post');
const myUrl = `${GDL_SERVE_API}/mods`;
trackCurseForgeAPI(myUrl, addons, 'post');
return axios.post(url, addons);
};

export const getAddonFiles = projectID => {
const url = `${FORGESVC_URL}/addon/${projectID}/files`;
trackCurseForgeAPI(url);
const myUrl = `${GDL_SERVE_API}/mods/${projectID}/files`;
trackCurseForgeAPI(myUrl);
return axios.get(url).then(res => ({
...res,
data: res.data.sort(sortByDate)
Expand All @@ -264,31 +266,41 @@ export const getAddonFiles = projectID => {

export const getAddonDescription = projectID => {
const url = `${FORGESVC_URL}/addon/${projectID}/description`;
trackCurseForgeAPI(url);
const myUrl = `${GDL_SERVE_API}/mods/${projectID}/description`;

trackCurseForgeAPI(myUrl);
return axios.get(url);
};

export const getAddonFile = (projectID, fileID) => {
const url = `${FORGESVC_URL}/addon/${projectID}/file/${fileID}`;
trackCurseForgeAPI(url);
const myUrl = `${GDL_SERVE_API}/mods/${projectID}/files/${fileID}`;

trackCurseForgeAPI(myUrl);
return axios.get(url);
};

export const getAddonsByFingerprint = fingerprints => {
const url = `${FORGESVC_URL}/fingerprint`;
trackCurseForgeAPI(url, fingerprints, 'post');
const myUrl = `${GDL_SERVE_API}/fingerprints`;

trackCurseForgeAPI(myUrl, fingerprints, 'post');
return axios.post(url, fingerprints);
};

export const getAddonFileChangelog = (projectID, fileID) => {
const url = `${FORGESVC_URL}/addon/${projectID}/file/${fileID}/changelog`;
trackCurseForgeAPI(url);
const myUrl = `${GDL_SERVE_API}/mods/${projectID}/files/${fileID}/changelog`;

trackCurseForgeAPI(myUrl);
return axios.get(url);
};

export const getAddonCategories = () => {
const url = `${FORGESVC_URL}/category?gameId=432`;
trackCurseForgeAPI(url);
const myUrl = `${GDL_SERVE_API}/categories?gameId=432`;

trackCurseForgeAPI(myUrl);
return axios.get(url);
};

Expand All @@ -304,6 +316,8 @@ export const getSearch = (
modLoaderType
) => {
const url = `${FORGESVC_URL}/addon/search`;
const myUrl = `${GDL_SERVE_API}/mods/search`;

const params = {
gameId: 432,
categoryId: categoryId || 0,
Expand All @@ -316,7 +330,7 @@ export const getSearch = (
sectionId: type === 'mods' ? 6 : 4471,
searchFilter
};
trackCurseForgeAPI(url, params);
trackCurseForgeAPI(myUrl, { ...params, pageSize: 20 });
return axios.get(url, { params });
};

Expand Down
2 changes: 1 addition & 1 deletion src/common/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const MC_LIBRARIES_URL = 'https://libraries.minecraft.net';
export const FORGESVC_URL = 'https://addons-ecs.forgesvc.net/api/v2';
export const FTB_API_URL = 'https://api.modpacks.ch/public';
export const FTB_MODPACK_URL = 'https://feed-the-beast.com/modpack';
export const GDL_SERVE_API = 'https://api.gdlauncher.com/serve';
export const GDL_SERVE_API = 'https://api.gdlauncher.com/cf';
export const NEWS_URL =
'https://www.minecraft.net/en-us/feeds/community-content/rss';
export const FMLLIBS_OUR_BASE_URL = 'https://fmllibs.gdevs.io';
Expand Down

0 comments on commit efd3bc6

Please sign in to comment.