diff options
author | LynithDev <61880709+LynithDev@users.noreply.github.com> | 2024-01-07 16:16:39 +0100 |
---|---|---|
committer | LynithDev <61880709+LynithDev@users.noreply.github.com> | 2024-01-07 16:16:39 +0100 |
commit | ffcff29edf223a04d9cd2a0c39b26f558f512081 (patch) | |
tree | d71e158f702ce030d302495a656c3f6902933706 | |
parent | d9eced756d6012bcb4036970fe7ca4d4b6b7edf4 (diff) | |
download | Nexus-ffcff29edf223a04d9cd2a0c39b26f558f512081.tar.gz Nexus-ffcff29edf223a04d9cd2a0c39b26f558f512081.tar.bz2 Nexus-ffcff29edf223a04d9cd2a0c39b26f558f512081.zip |
Fix modrinth urls + add organization / user support
-rw-r--r-- | apps/website/config.ts | 5 | ||||
-rw-r--r-- | apps/website/src/pages/mods.astro | 12 | ||||
-rw-r--r-- | apps/website/src/types/Config.d.ts | 5 |
3 files changed, 15 insertions, 7 deletions
diff --git a/apps/website/config.ts b/apps/website/config.ts index 45d9dac..cb4e515 100644 --- a/apps/website/config.ts +++ b/apps/website/config.ts @@ -7,7 +7,10 @@ export const configConst = { youtube: 'https://youtube.com/@Polyfrost', discord: '/discord', github: 'https://github.com/Polyfrost', - modrinthId: 'polyfrost', + modrinth: { + id: 'polyfrost', + type: 'organization', + }, skyclient: 'https://skyclient.co', }, navbar: { diff --git a/apps/website/src/pages/mods.astro b/apps/website/src/pages/mods.astro index 4f4e60a..69e57f9 100644 --- a/apps/website/src/pages/mods.astro +++ b/apps/website/src/pages/mods.astro @@ -9,7 +9,9 @@ import configConst from '@config'; import Layout from '@layouts/Layout.astro'; import { Code } from 'astro:components'; -const modrinthId = configConst.socials.modrinthId; +const modrinthId = configConst.socials.modrinth.id; +const modrinthType = configConst.socials.modrinth.type; +const modrinthUrl = `https://modrinth.com/${modrinthType}/${modrinthId}`; --- <Layout> @@ -43,7 +45,7 @@ const modrinthId = configConst.socials.modrinthId; <div class="flex flex-col justify-start items-center max-w-full mt-6 md:mt-10 gap-6 px-4"> <Header align="center" size="xxl" class="text-navy-peony max-w-[500px]">Redefining modding, one mod at a time</Header> <div class="flex flex-row justify-center items-center gap-x-2"> - <Button style="primary" iconLeft="download" href={`https://modrinth.com/user/${configConst.socials.modrinthId}`}>Download</Button> + <Button style="primary" iconLeft="download" href={modrinthUrl}>Download</Button> <Button style="secondary" iconLeft="github" href={configConst.socials.github}>Source</Button> </div> @@ -134,7 +136,7 @@ const modrinthId = configConst.socials.modrinthId; <div class="flex flex-col gap-y-1 relative justify-center items-center"> <Header size="xl" class="text-navy-peony text-header-page w-11/12 md:max-w-lg text-center">Get our mods, available on Modrinth and GitHub.</Header> <div class="flex flex-row justify-center items-center gap-x-2"> - <Button style="primary" iconLeft="link-external" href={`https://modrinth.com/user/${configConst.socials.modrinthId}`}>Modrinth</Button> + <Button style="primary" iconLeft="link-external" href={modrinthUrl}>Modrinth</Button> <Button style="primary" iconLeft="github" href={configConst.socials.github}>GitHub</Button> </div> </div> @@ -142,10 +144,10 @@ const modrinthId = configConst.socials.modrinthId; </Layout> -<script define:vars={{ modrinthId: modrinthId }}> +<script define:vars={{ modrinthType: modrinthType, modrinthId: modrinthId }}> async function getModCount() { - const res = await fetch(`https://api.modrinth.com/v2/user/${modrinthId}/projects`); + const res = await fetch(`https://api.modrinth.com/v2/${modrinthType}/${modrinthId}/projects`); const data = await res.json(); const mods = data.filter((mod) => { return mod.slug !== 'oneconfig' && mod.slug !== 'easeify'; diff --git a/apps/website/src/types/Config.d.ts b/apps/website/src/types/Config.d.ts index 7635de6..870cb3c 100644 --- a/apps/website/src/types/Config.d.ts +++ b/apps/website/src/types/Config.d.ts @@ -49,7 +49,10 @@ export interface Config { // twitter: string, discord: string, github: string, - modrinthId: string, + modrinth: { + type: "user" | "organization", + id: string, + }, skyclient: string, }, navbar: { |