Skip to content

Commit

Permalink
restore CF tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
blarfoon committed Feb 11, 2022
1 parent 2c732ad commit 37fb15f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/common/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ const trackFTBAPI = () => {
ga.sendCustomEvent('FTBAPICall');
};

const trackCurseForgeAPI = () => {
ga.sendCustomEvent('CurseForgeAPICall');
};

// Microsoft Auth
export const msExchangeCodeForAccessToken = (
clientId,
Expand Down Expand Up @@ -221,12 +225,14 @@ export const getFabricJson = ({ mcVersion, loaderVersion }) => {
// FORGE ADDONS

export const getAddon = async projectID => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/mods/${projectID}`;
const { data } = await axios.get(url);
return data?.data;
};

export const getMultipleAddons = async addons => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/mods`;
const { data } = await axios.post(
url,
Expand All @@ -238,6 +244,7 @@ export const getMultipleAddons = async addons => {
};

export const getAddonFiles = async projectID => {
trackCurseForgeAPI();
// Aggregate results in case of multiple pages
const results = [];
let hasMore = true;
Expand All @@ -254,38 +261,44 @@ export const getAddonFiles = async projectID => {
};

export const getAddonDescription = async projectID => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/mods/${projectID}/description`;
const { data } = await axios.get(url);
return data?.data;
};

export const getAddonFile = async (projectID, fileID) => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/mods/${projectID}/files/${fileID}`;
const { data } = await axios.get(url);
return data?.data;
};

export const getAddonsByFingerprint = async fingerprints => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/fingerprints`;
const { data } = await axios.post(url, { fingerprints });

return data?.data;
};

export const getAddonFileChangelog = async (projectID, fileID) => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/mods/${projectID}/files/${fileID}/changelog`;
const { data } = await axios.get(url);

return data?.data;
};

export const getAddonCategories = async () => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/categories?gameId=432`;
const { data } = await axios.get(url);
return data.data;
};

export const getCFVersionIds = async () => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/games/432/versions`;
const { data } = await axios.get(url);
return data.data;
Expand All @@ -302,6 +315,7 @@ export const getSearch = async (
categoryId,
modLoaderType
) => {
trackCurseForgeAPI();
const url = `${FORGESVC_URL}/mods/search`;

// Map sort to sortField
Expand Down
1 change: 0 additions & 1 deletion src/common/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const MC_LIBRARIES_URL = 'https://libraries.minecraft.net';
export const FORGESVC_URL = 'https://api.gdlauncher.com/cf';
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/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 37fb15f

Please sign in to comment.