From 79c5588719db678a007a3738b4e029eecc1cf4ee Mon Sep 17 00:00:00 2001 From: Evan Song Date: Wed, 13 Nov 2024 00:11:26 -0700 Subject: [PATCH 01/40] feat: init selecting paper+purpur on purchase flow Signed-off-by: Evan Song --- .../ui/servers/icons/LoaderIcon.vue | 70 ++++++++++++++++++- .../src/components/billing/PurchaseModal.vue | 10 ++- 2 files changed, 78 insertions(+), 2 deletions(-) diff --git a/apps/frontend/src/components/ui/servers/icons/LoaderIcon.vue b/apps/frontend/src/components/ui/servers/icons/LoaderIcon.vue index 8647d9cd1..ac89e1cbc 100644 --- a/apps/frontend/src/components/ui/servers/icons/LoaderIcon.vue +++ b/apps/frontend/src/components/ui/servers/icons/LoaderIcon.vue @@ -153,6 +153,65 @@ /> + + + + + + + + + + + + (); diff --git a/packages/ui/src/components/billing/PurchaseModal.vue b/packages/ui/src/components/billing/PurchaseModal.vue index 411b30022..fdcca523e 100644 --- a/packages/ui/src/components/billing/PurchaseModal.vue +++ b/packages/ui/src/components/billing/PurchaseModal.vue @@ -75,7 +75,15 @@ /> -->
- +
+

Plugin loaders

+
+
+ +
+
diff --git a/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue b/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue index 18781fc64..505bffdd8 100644 --- a/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue +++ b/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue @@ -1,11 +1,13 @@ @@ -33,7 +39,7 @@ defineExpose({ class="h-captcha" data-sitekey="4a7a2c80-68f2-4190-9d52-131c76e0c14e" :data-theme="$theme.active === 'light' ? 'light' : 'dark'" - data-callback="updateCatpchaToken" + data-callback="hCaptchaUpdateToken" >
From fee8cc201c532f6061001857728a2a72beb55226 Mon Sep 17 00:00:00 2001 From: Evan Song Date: Mon, 18 Nov 2024 16:06:56 -0700 Subject: [PATCH 07/40] fix: more robust loader dropdown logic Signed-off-by: Evan Song --- .../servers/manage/[id]/options/loader.vue | 106 ++++++++++-------- 1 file changed, 62 insertions(+), 44 deletions(-) diff --git a/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue b/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue index 1c6e9d712..f107c2c15 100644 --- a/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue +++ b/apps/frontend/src/pages/servers/manage/[id]/options/loader.vue @@ -35,15 +35,34 @@
-
{{ selectedLoader }} version
+
+ + + +
+
-
+
- +
@@ -285,6 +297,7 @@ import { RightArrowIcon, XIcon, CompassIcon, + DropdownIcon, } from "@modrinth/assets"; import type { Server } from "~/composables/pyroServers"; @@ -492,43 +505,48 @@ const cachedVersions: Record = {}; watch(selectedMCVersion, async () => { if (selectedMCVersion.value.trim().length < 3) return; + isLoading.value = true; loadingServerCheck.value = true; - // Check if Minecraft version exists - const mcRes = - cachedVersions[selectedMCVersion.value] || - (await $fetch(`/loader-versions?loader=minecraft&version=${selectedMCVersion.value}`)); - - cachedVersions[selectedMCVersion.value] = mcRes; + try { + // Check if Minecraft version exists + const mcRes = + cachedVersions[selectedMCVersion.value] || + (await $fetch(`/loader-versions?loader=minecraft&version=${selectedMCVersion.value}`)); - if (!mcRes.downloads?.server) { - serverCheckError.value = - "We couldn't find a server.jar for this version. Please pick another one."; - loadingServerCheck.value = false; - return; - } + cachedVersions[selectedMCVersion.value] = mcRes; - // Fetch Paper/Purpur versions if needed - if (selectedLoader.value.toLowerCase() === "paper") { - const paperRes = await fetchPaperVersions(selectedMCVersion.value); - if (!paperRes) { - serverCheckError.value = "This Minecraft version is not supported by Paper."; - loadingServerCheck.value = false; + if (!mcRes.downloads?.server) { + serverCheckError.value = + "We couldn't find a server.jar for this version. Please pick another one."; return; } - } - if (selectedLoader.value.toLowerCase() === "purpur") { - const purpurRes = await fetchPurpurVersions(selectedMCVersion.value); - if (!purpurRes) { - serverCheckError.value = "This Minecraft version is not supported by Purpur."; - loadingServerCheck.value = false; - return; + // Fetch Paper/Purpur versions if needed + if (selectedLoader.value.toLowerCase() === "paper") { + const paperRes = await fetchPaperVersions(selectedMCVersion.value); + if (!paperRes) { + serverCheckError.value = "This Minecraft version is not supported by Paper."; + return; + } } - } - serverCheckError.value = ""; - loadingServerCheck.value = false; + if (selectedLoader.value.toLowerCase() === "purpur") { + const purpurRes = await fetchPurpurVersions(selectedMCVersion.value); + if (!purpurRes) { + serverCheckError.value = "This Minecraft version is not supported by Purpur."; + return; + } + } + + serverCheckError.value = ""; + } catch (error) { + console.error(error); + serverCheckError.value = "Failed to fetch versions. Please try again."; + } finally { + loadingServerCheck.value = false; + isLoading.value = false; + } }); const onShow = () => { From ce5cc2ab6cbd3de9fdbc639d5b6e5c552a3a4594 Mon Sep 17 00:00:00 2001 From: Evan Song Date: Mon, 18 Nov 2024 16:11:15 -0700 Subject: [PATCH 08/40] fix: handle "not yet supported" install err Signed-off-by: Evan Song --- apps/frontend/src/pages/servers/manage/[id].vue | 8 ++++++++ apps/frontend/src/pages/servers/manage/[id]/index.vue | 1 + 2 files changed, 9 insertions(+) diff --git a/apps/frontend/src/pages/servers/manage/[id].vue b/apps/frontend/src/pages/servers/manage/[id].vue index 2348558ee..a253c4b2e 100644 --- a/apps/frontend/src/pages/servers/manage/[id].vue +++ b/apps/frontend/src/pages/servers/manage/[id].vue @@ -175,6 +175,14 @@ reinstalling your server, and if the problem persists, please contact Modrinth support with your server's debug information.
+
+ An error occurred while installing your server because Modrinth Servers does not + support the version of Minecraft or the loader you specified. Try reinstalling + your server with a different version or loader, and if the problem persists, + please contact Modrinth support with your server's debug information. +
{ mcError.value = response; + // @ts-ignore const analysis = (await $fetch(`https://api.mclo.gs/1/insights/${response.id}`, { method: "POST", headers: { From e3f1bcf9bac2056d0c9638d508ac402192a5380d Mon Sep 17 00:00:00 2001 From: Evan Song Date: Mon, 18 Nov 2024 16:17:41 -0700 Subject: [PATCH 09/40] chore: fix icon kerfuffles Signed-off-by: Evan Song --- apps/frontend/src/pages/servers/manage/[id].vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/frontend/src/pages/servers/manage/[id].vue b/apps/frontend/src/pages/servers/manage/[id].vue index a253c4b2e..878c01acb 100644 --- a/apps/frontend/src/pages/servers/manage/[id].vue +++ b/apps/frontend/src/pages/servers/manage/[id].vue @@ -128,11 +128,11 @@ class="mx-auto mb-4 flex justify-between gap-2 rounded-2xl border-2 border-solid border-red bg-bg-red p-4 font-semibold text-contrast" >
-