Added CurseForge edge proxy

Co-authored-by: felix-fx-top <253056634+felix-fx-top@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot] 2026-03-31 10:36:56 +00:00 committed by lovable
parent 226712c011
commit 02fe60178a
2 changed files with 26 additions and 1 deletions

View File

@ -15,6 +15,7 @@ interface Mod {
followers: number;
categories: string[];
project_type: string;
source?: "modrinth" | "curseforge";
}
interface ModGridProps {

View File

@ -4,7 +4,7 @@ import Navbar from "@/components/Navbar";
import HeroSection from "@/components/HeroSection";
import ModGrid from "@/components/ModGrid";
import Footer from "@/components/Footer";
import { getUserProjects, searchMods, getRandomKeyword } from "@/lib/api";
import { getUserProjects, searchMods, searchCurseForge, getRandomKeyword } from "@/lib/api";
const Index = () => {
const randomKeyword = useMemo(() => getRandomKeyword(), []);
@ -22,6 +22,11 @@ const Index = () => {
queryFn: () => searchMods(randomKeyword, 0, 12),
});
const { data: cfData, isLoading: loadingCF } = useQuery({
queryKey: ["curseforge-discover", randomKeyword],
queryFn: () => searchCurseForge(randomKeyword, 0, 12),
});
const discoverMods = discoverData?.hits?.map((hit: any) => ({
id: hit.project_id,
slug: hit.slug,
@ -32,6 +37,20 @@ const Index = () => {
followers: hit.follows,
categories: hit.categories || [],
project_type: hit.project_type,
source: "modrinth" as const,
})) || [];
const curseForgeMods = cfData?.data?.map((mod: any) => ({
id: String(mod.id),
slug: String(mod.id),
title: mod.name,
description: mod.summary,
icon_url: mod.logo?.url,
downloads: mod.downloadCount,
followers: mod.thumbsUpCount || 0,
categories: mod.categories?.map((c: any) => c.name) || [],
project_type: "mod",
source: "curseforge" as const,
})) || [];
return (
@ -50,6 +69,11 @@ const Index = () => {
mods={discoverMods}
isLoading={loadingDiscover}
/>
<ModGrid
title="إضافات CurseForge 🟠"
mods={curseForgeMods}
isLoading={loadingCF}
/>
</div>
</main>
<Footer />