From 310dea76b74902b138f9c2721fce7e52f9f1fdc0 Mon Sep 17 00:00:00 2001 From: Niklas Widmann Date: Thu, 15 Aug 2024 16:28:21 +0200 Subject: [PATCH] more mods & supported mods page --- .github/workflows/release.yml | 191 +++++++++++++++-------------- generator/src/install.mjs | 101 ++++++++++++--- index.html | 19 --- web/mods/ad-astra.json | 5 + web/mods/aether.json | 5 + web/mods/alexs-caves.json | 5 + web/mods/amendments.json | 5 + web/mods/another-furniture.json | 5 + web/mods/atmospheric.json | 5 + web/mods/autumnity.json | 5 + web/mods/biomes-o-plenty.json | 5 + web/mods/botania.json | 5 + web/mods/botarium.json | 5 + web/mods/bountiful.json | 5 + web/mods/brazier.json | 5 + web/mods/compatoplenty.json | 5 + web/mods/create.json | 5 + web/mods/ecologics.json | 5 + web/mods/endergetic.json | 5 + web/mods/environmental.json | 5 + web/mods/farmers-delight.json | 5 + web/mods/galosphere.json | 5 + web/mods/ice-and-fire-dragons.json | 5 + web/mods/mystical-oak-tree.json | 5 + web/mods/naturalist.json | 5 + web/mods/neapolitan.json | 5 + web/mods/oreganized.json | 5 + web/mods/overweight-farming.json | 5 + web/mods/quark.json | 5 + web/mods/supplementaries.json | 5 + web/mods/the-twilight-forest.json | 5 + web/mods/thermal-expansion.json | 5 + web/mods/thermal-foundation.json | 5 + web/mods/tinkers-construct.json | 5 + web/mods/upgrade-aquatic.json | 5 + web/mods/waystones.json | 5 + web/mods/windsweptmod.json | 5 + web/src/layouts/Layout.astro | 12 +- web/src/lib/getIcons.ts | 10 +- web/src/pages/index.astro | 18 ++- web/src/pages/mods.astro | 64 ++++++++++ 41 files changed, 442 insertions(+), 143 deletions(-) delete mode 100644 index.html create mode 100644 web/mods/ad-astra.json create mode 100644 web/mods/aether.json create mode 100644 web/mods/alexs-caves.json create mode 100644 web/mods/amendments.json create mode 100644 web/mods/another-furniture.json create mode 100644 web/mods/atmospheric.json create mode 100644 web/mods/autumnity.json create mode 100644 web/mods/biomes-o-plenty.json create mode 100644 web/mods/botania.json create mode 100644 web/mods/botarium.json create mode 100644 web/mods/bountiful.json create mode 100644 web/mods/brazier.json create mode 100644 web/mods/compatoplenty.json create mode 100644 web/mods/create.json create mode 100644 web/mods/ecologics.json create mode 100644 web/mods/endergetic.json create mode 100644 web/mods/environmental.json create mode 100644 web/mods/farmers-delight.json create mode 100644 web/mods/galosphere.json create mode 100644 web/mods/ice-and-fire-dragons.json create mode 100644 web/mods/mystical-oak-tree.json create mode 100644 web/mods/naturalist.json create mode 100644 web/mods/neapolitan.json create mode 100644 web/mods/oreganized.json create mode 100644 web/mods/overweight-farming.json create mode 100644 web/mods/quark.json create mode 100644 web/mods/supplementaries.json create mode 100644 web/mods/the-twilight-forest.json create mode 100644 web/mods/thermal-expansion.json create mode 100644 web/mods/thermal-foundation.json create mode 100644 web/mods/tinkers-construct.json create mode 100644 web/mods/upgrade-aquatic.json create mode 100644 web/mods/waystones.json create mode 100644 web/mods/windsweptmod.json create mode 100644 web/src/pages/mods.astro diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d8a8ff..6ac7f30 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,113 +1,114 @@ name: Build Website on: - workflow_dispatch: - inputs: - skipCache: - description: 'skip the cached icons?' - default: false - type: boolean - push: - paths: - - .gitmodules - - pack/index.toml + workflow_dispatch: + inputs: + skipCache: + description: "skip the cached icons?" + default: false + type: boolean + push: + paths: + - .gitmodules + - pack/index.toml env: - REGISTRY: ghcr.io - GITHUB_REPO: ${{ github.repository }} + REGISTRY: ghcr.io + GITHUB_REPO: ${{ github.repository }} jobs: - datagen: - runs-on: windows-2022 - permissions: - contents: read - packages: read + datagen: + runs-on: windows-2022 + permissions: + contents: read + packages: read - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: true + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true - - name: Install pnpm - uses: pnpm/action-setup@v4 - with: - run_install: false + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + run_install: false - - name: Install Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: 'pnpm' + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: "pnpm" - - name: Install dependencies - run: pnpm install --frozen-lockfile --strict-peer-dependencies - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install dependencies + run: pnpm install --frozen-lockfile --strict-peer-dependencies + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/cache@v4 - name: Setup icons cache - id: cache - with: - path: web/public/icons - lookup-only: ${{ inputs.skipCache }} - key: icons-${{ hashFiles('.gitmodules', 'pack/index.toml') }} - restore-keys: | - icons- + - uses: actions/cache@v4 + name: Setup icons cache + id: cache + with: + path: web/public/icons + lookup-only: ${{ inputs.skipCache }} + key: icons-${{ hashFiles('.gitmodules', 'pack/index.toml') }} + restore-keys: | + icons- - - name: Generate Data - if: inputs.skipCache || steps.cache.outputs.cache-hit != 'true' - run: pnpm run gen - env: - CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + - name: Generate Data + if: inputs.skipCache || steps.cache.outputs.cache-hit != 'true' + run: pnpm run gen + env: + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - - name: Upload generated data as artifact - uses: actions/upload-artifact@v4 - with: - retention-days: 1 - name: generated-data - path: web/public/icons + - name: Upload generated data as artifact + uses: actions/upload-artifact@v4 + with: + retention-days: 1 + name: generated-data + path: web/public/icons - docker: - runs-on: ubuntu-latest - needs: datagen - permissions: - contents: read - packages: write - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - submodules: false + docker: + runs-on: ubuntu-latest + needs: datagen + permissions: + contents: read + packages: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: false - - name: Download generated data from artifact - uses: actions/download-artifact@v4 - with: - name: generated-data - path: web/public/icons + - name: Download generated data from artifact + uses: actions/download-artifact@v4 + with: + name: generated-data + path: web/public/icons - - name: Log in to the Container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Log in to the Container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.GITHUB_REPO }} - tags: | - type=raw,value=latest - type=raw,value=stable,enable=${{ github.event_name == 'release' }} - type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} - type=sha,priority=250,enable=${{ github.event_name != 'release' }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.GITHUB_REPO }} + tags: | + type=raw,value=latest + type=raw,value=stable,enable=${{ github.event_name == 'release' }} + type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} + type=sha,priority=250,enable=${{ github.event_name != 'release' }} - - name: Build and push Docker image - uses: docker/build-push-action@v6 - with: - file: web/Dockerfile - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + file: web/Dockerfile + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/generator/src/install.mjs b/generator/src/install.mjs index 77529f8..670a8cf 100644 --- a/generator/src/install.mjs +++ b/generator/src/install.mjs @@ -1,6 +1,6 @@ import { createHash } from 'crypto' -import { createWriteStream, existsSync, mkdirSync, readFileSync, rmSync, statSync } from 'fs' -import { dirname, join } from 'path' +import { createWriteStream, existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs' +import { basename, dirname, join } from 'path' import { Readable } from 'stream' import { parse } from 'toml' @@ -22,6 +22,27 @@ function verifySha(name, content, checksum) { } } +const sharedHeaders = { + accept: 'application/json', + 'User-Agent': 'voidshake/icons', +} + +async function fetchFromModrinth(endpoint) { + const token = process.env.MODRINTH_TOKEN + + if (!token) throw new Error(`Unable to download from modrinth without passing a token`) + + const response = await fetch(`https://api.modrinth.com/v2/${endpoint}`, { + headers: { + ...sharedHeaders, + authorization: token, + }, + }) + if (!response.ok) throw new Error(response.statusText) + + return await response.json() +} + async function fetchFromCurseforge(endpoint) { const token = process.env.CURSEFORGE_TOKEN @@ -29,22 +50,22 @@ async function fetchFromCurseforge(endpoint) { const response = await fetch(`https://api.curseforge.com/${endpoint}`, { headers: { + ...sharedHeaders, 'x-api-key': token, }, }) if (!response.ok) throw new Error(response.statusText) - return response + const { data } = await response.json() + return data } async function getUrlFrom({ download, name, update }) { if (download.url) return download.url if (download.mode === 'metadata:curseforge' && update.curseforge) { - const response = await fetchFromCurseforge( + return fetchFromCurseforge( `v1/mods/${update.curseforge['project-id']}/files/${update.curseforge['file-id']}/download-url` ) - const { data } = await response.json() - return data } throw new Error(`unable to find url for ${name}`) @@ -67,6 +88,62 @@ async function downloadFile(definition, outPath) { }) } +async function downloadMod(definition, dir) { + console.log(` downloading ${definition.filename}...`) + + const outPath = join(to, dir, definition.filename) + + if (!existsSync(outPath) || options.includes('--overwrite')) { + await downloadFile(definition, outPath) + } else { + console.log(` using cached file for ${outPath}`) + } + + verifyFileSha(outPath, definition.download.hash) +} + +async function getModInfo(definition) { + if ('curseforge' in definition.update) { + const data = await fetchFromCurseforge(`v1/mods/${definition.update.curseforge['project-id']}`) + const url = `https://www.curseforge.com/minecraft/mc-mods/${data.slug}` + const icon = data.logo?.thumbnailUrl + return { url, icon } + } + + if ('modrinth' in definition.update) { + const data = await fetchFromModrinth(`project/${definition.update.modrinth['mod-id']}`) + const url = `https://modrinth.com/mod/${data.slug}` + const icon = data.icon_url + return { url, icon } + } + + return null +} + +async function gatherInfo(definition, file) { + const outDir = join('..', 'web', dirname(file)) + + if (!existsSync(outDir)) { + mkdirSync(outDir, { recursive: true }) + } + + const base = basename(file) + const name = base.substring(0, base.length - '.pw.toml'.length) + '.json' + const out = join(outDir, name) + + writeFileSync( + out, + JSON.stringify( + { + name: definition.name, + ...(await getModInfo(definition)), + }, + null, + 2 + ) + ) +} + async function installPack(from, to, options) { if (!from) throw new Error('input argument missing') if (!to) throw new Error('output argument missing') @@ -90,17 +167,7 @@ async function installPack(from, to, options) { index.files.map(async ({ file }) => { const definition = readToml(join(packDir, file)) - console.log(` downloading ${definition.filename}...`) - - const outPath = join(to, dirname(file), definition.filename) - - if (!existsSync(outPath) || options.includes('--overwrite')) { - await downloadFile(definition, outPath) - } else { - console.log(` using cached file for ${outPath}`) - } - - verifyFileSha(outPath, definition.download.hash) + await Promise.all([downloadMod(definition, dirname(file)), gatherInfo(definition, file)]) }) ) diff --git a/index.html b/index.html deleted file mode 100644 index 16377fa..0000000 --- a/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - Minecraft Icons - - -

This website serves icons of minecraft blocks & items that have been generated using its assets

-

Try requesting an icons using the following path template:

- /assets/icons/[namespace]/[id].png -

For example

- - - diff --git a/web/mods/ad-astra.json b/web/mods/ad-astra.json new file mode 100644 index 0000000..7f66477 --- /dev/null +++ b/web/mods/ad-astra.json @@ -0,0 +1,5 @@ +{ + "name": "Ad Astra", + "url": "https://modrinth.com/mod/ad-astra", + "icon": "https://cdn.modrinth.com/data/3ufwT9JF/2a15f23b7ffa2d50fc6ae1c42029a728ce3e2847.jpeg" +} \ No newline at end of file diff --git a/web/mods/aether.json b/web/mods/aether.json new file mode 100644 index 0000000..e6e9fe7 --- /dev/null +++ b/web/mods/aether.json @@ -0,0 +1,5 @@ +{ + "name": "The Aether", + "url": "https://modrinth.com/mod/aether", + "icon": "https://cdn.modrinth.com/data/YhmgMVyu/0505092d2d3336722f12b1deca268f9fdeebd8f4.png" +} \ No newline at end of file diff --git a/web/mods/alexs-caves.json b/web/mods/alexs-caves.json new file mode 100644 index 0000000..b56ee07 --- /dev/null +++ b/web/mods/alexs-caves.json @@ -0,0 +1,5 @@ +{ + "name": "Alex's Caves", + "url": "https://modrinth.com/mod/alexs-caves", + "icon": "https://cdn.modrinth.com/data/U6GY0xp0/4165eef78a7efa0f5acda964dd094c08ee0e5680.png" +} \ No newline at end of file diff --git a/web/mods/amendments.json b/web/mods/amendments.json new file mode 100644 index 0000000..988e43c --- /dev/null +++ b/web/mods/amendments.json @@ -0,0 +1,5 @@ +{ + "name": "Amendments", + "url": "https://modrinth.com/mod/amendments", + "icon": "https://cdn.modrinth.com/data/6iTJugQR/0f0af8eb01acd1da0947c6f9fa6790e558f7aad3.png" +} \ No newline at end of file diff --git a/web/mods/another-furniture.json b/web/mods/another-furniture.json new file mode 100644 index 0000000..32421f2 --- /dev/null +++ b/web/mods/another-furniture.json @@ -0,0 +1,5 @@ +{ + "name": "Another Furniture", + "url": "https://modrinth.com/mod/another-furniture", + "icon": "https://cdn.modrinth.com/data/ulloLmqG/c3741a740ede138ab2d62ca49add0ab69dd828d4.png" +} \ No newline at end of file diff --git a/web/mods/atmospheric.json b/web/mods/atmospheric.json new file mode 100644 index 0000000..d106959 --- /dev/null +++ b/web/mods/atmospheric.json @@ -0,0 +1,5 @@ +{ + "name": "Atmospheric", + "url": "https://modrinth.com/mod/atmospheric", + "icon": "https://cdn.modrinth.com/data/U9sJOFmJ/d249e9820421069bfcae668127ebc83313aef7c5.png" +} \ No newline at end of file diff --git a/web/mods/autumnity.json b/web/mods/autumnity.json new file mode 100644 index 0000000..15edd25 --- /dev/null +++ b/web/mods/autumnity.json @@ -0,0 +1,5 @@ +{ + "name": "Autumnity", + "url": "https://modrinth.com/mod/autumnity", + "icon": "https://cdn.modrinth.com/data/cRh6MJ6n/b1893213f89b7eb52d2bae9631cb67365d780971.png" +} \ No newline at end of file diff --git a/web/mods/biomes-o-plenty.json b/web/mods/biomes-o-plenty.json new file mode 100644 index 0000000..f014637 --- /dev/null +++ b/web/mods/biomes-o-plenty.json @@ -0,0 +1,5 @@ +{ + "name": "Biomes O' Plenty", + "url": "https://modrinth.com/mod/biomes-o-plenty", + "icon": "https://cdn.modrinth.com/data/HXF82T3G/ffb870e12c325b795d54833f8f899126553ef06f.png" +} \ No newline at end of file diff --git a/web/mods/botania.json b/web/mods/botania.json new file mode 100644 index 0000000..19494cb --- /dev/null +++ b/web/mods/botania.json @@ -0,0 +1,5 @@ +{ + "name": "Botania", + "url": "https://modrinth.com/mod/botania", + "icon": "https://cdn.modrinth.com/data/pfjLUfGv/4c006056fd05fdd63b83d79c7c3bb9712d2f49bc.png" +} \ No newline at end of file diff --git a/web/mods/botarium.json b/web/mods/botarium.json new file mode 100644 index 0000000..f296502 --- /dev/null +++ b/web/mods/botarium.json @@ -0,0 +1,5 @@ +{ + "name": "Botarium", + "url": "https://modrinth.com/mod/botarium", + "icon": "https://cdn.modrinth.com/data/2u6LRnMa/31d70002f565c2ae1b2901667f3fb9f553281594.png" +} \ No newline at end of file diff --git a/web/mods/bountiful.json b/web/mods/bountiful.json new file mode 100644 index 0000000..c34057f --- /dev/null +++ b/web/mods/bountiful.json @@ -0,0 +1,5 @@ +{ + "name": "Bountiful", + "url": "https://modrinth.com/mod/bountiful", + "icon": "https://cdn.modrinth.com/data/BpwWFOVM/icon.png" +} \ No newline at end of file diff --git a/web/mods/brazier.json b/web/mods/brazier.json new file mode 100644 index 0000000..9d3a117 --- /dev/null +++ b/web/mods/brazier.json @@ -0,0 +1,5 @@ +{ + "name": "Brazier", + "url": "https://modrinth.com/mod/brazier", + "icon": "https://cdn.modrinth.com/data/5okEW6TG/icon.png" +} \ No newline at end of file diff --git a/web/mods/compatoplenty.json b/web/mods/compatoplenty.json new file mode 100644 index 0000000..9f3cdbb --- /dev/null +++ b/web/mods/compatoplenty.json @@ -0,0 +1,5 @@ +{ + "name": "Compat O' Plenty", + "url": "https://modrinth.com/mod/compatoplenty", + "icon": "https://cdn.modrinth.com/data/be9yNxNu/icon.png" +} \ No newline at end of file diff --git a/web/mods/create.json b/web/mods/create.json new file mode 100644 index 0000000..5965fab --- /dev/null +++ b/web/mods/create.json @@ -0,0 +1,5 @@ +{ + "name": "Create", + "url": "https://modrinth.com/mod/create", + "icon": "https://cdn.modrinth.com/data/LNytGWDc/icon.png" +} \ No newline at end of file diff --git a/web/mods/ecologics.json b/web/mods/ecologics.json new file mode 100644 index 0000000..9883d97 --- /dev/null +++ b/web/mods/ecologics.json @@ -0,0 +1,5 @@ +{ + "name": "Ecologics", + "url": "https://modrinth.com/mod/ecologics", + "icon": "https://cdn.modrinth.com/data/NCKpPR0Z/1f03abae2fdfb2bbab34e8bd26b41b5bca68488e.png" +} \ No newline at end of file diff --git a/web/mods/endergetic.json b/web/mods/endergetic.json new file mode 100644 index 0000000..1584297 --- /dev/null +++ b/web/mods/endergetic.json @@ -0,0 +1,5 @@ +{ + "name": "The Endergetic Expansion", + "url": "https://modrinth.com/mod/endergetic", + "icon": "https://cdn.modrinth.com/data/cPle5Z8G/f1d3dd4820930746f7ca9c91c62c6849d62d1c19.png" +} \ No newline at end of file diff --git a/web/mods/environmental.json b/web/mods/environmental.json new file mode 100644 index 0000000..043fa9f --- /dev/null +++ b/web/mods/environmental.json @@ -0,0 +1,5 @@ +{ + "name": "Environmental", + "url": "https://modrinth.com/mod/environmental", + "icon": "https://cdn.modrinth.com/data/OqtiAZcV/ef3523b5d3d003d53ad0406e60e16839d33b58a9.png" +} \ No newline at end of file diff --git a/web/mods/farmers-delight.json b/web/mods/farmers-delight.json new file mode 100644 index 0000000..8cbecab --- /dev/null +++ b/web/mods/farmers-delight.json @@ -0,0 +1,5 @@ +{ + "name": "Farmer's Delight", + "url": "https://modrinth.com/mod/farmers-delight", + "icon": "https://cdn.modrinth.com/data/R2OftAxM/8e7aa38ab94d94bb0a2894a218b69beb49002b34.png" +} \ No newline at end of file diff --git a/web/mods/galosphere.json b/web/mods/galosphere.json new file mode 100644 index 0000000..ffd0b0b --- /dev/null +++ b/web/mods/galosphere.json @@ -0,0 +1,5 @@ +{ + "name": "Galosphere", + "url": "https://modrinth.com/mod/galosphere", + "icon": "https://cdn.modrinth.com/data/Kn7xyQ1v/27ac9c8c5b3479faaa46dc050996e89fcad8f2d7.png" +} \ No newline at end of file diff --git a/web/mods/ice-and-fire-dragons.json b/web/mods/ice-and-fire-dragons.json new file mode 100644 index 0000000..344be14 --- /dev/null +++ b/web/mods/ice-and-fire-dragons.json @@ -0,0 +1,5 @@ +{ + "name": "Ice and Fire", + "url": "https://modrinth.com/mod/ice-and-fire-dragons", + "icon": "https://cdn.modrinth.com/data/LVnvHVBp/7f4900581f5f2e1108829fa45e54331eb91dace1.png" +} \ No newline at end of file diff --git a/web/mods/mystical-oak-tree.json b/web/mods/mystical-oak-tree.json new file mode 100644 index 0000000..617f7e7 --- /dev/null +++ b/web/mods/mystical-oak-tree.json @@ -0,0 +1,5 @@ +{ + "name": "Mystical Oak Tree", + "url": "https://modrinth.com/mod/mystical-oak-tree", + "icon": "https://cdn.modrinth.com/data/eUma2vmY/02ee836ecd58476c585ce67119fb47d95f07f7dc.gif" +} \ No newline at end of file diff --git a/web/mods/naturalist.json b/web/mods/naturalist.json new file mode 100644 index 0000000..26bb0e1 --- /dev/null +++ b/web/mods/naturalist.json @@ -0,0 +1,5 @@ +{ + "name": "Naturalist", + "url": "https://modrinth.com/mod/naturalist", + "icon": "https://cdn.modrinth.com/data/F8BQNPWX/bbc2199861f44c2027abb411d53bfceb683fea92.gif" +} \ No newline at end of file diff --git a/web/mods/neapolitan.json b/web/mods/neapolitan.json new file mode 100644 index 0000000..d36177b --- /dev/null +++ b/web/mods/neapolitan.json @@ -0,0 +1,5 @@ +{ + "name": "Neapolitan", + "url": "https://modrinth.com/mod/neapolitan", + "icon": "https://cdn.modrinth.com/data/InYMuiQt/7d37bccf6e93b11f55d39e28fc810d257d2334cb.png" +} \ No newline at end of file diff --git a/web/mods/oreganized.json b/web/mods/oreganized.json new file mode 100644 index 0000000..0817778 --- /dev/null +++ b/web/mods/oreganized.json @@ -0,0 +1,5 @@ +{ + "name": "Oreganized", + "url": "https://modrinth.com/mod/oreganized", + "icon": "https://cdn.modrinth.com/data/2FJutzEL/0b12e2be0a88ec9ae63e6de027e96e97c133f5a2.png" +} \ No newline at end of file diff --git a/web/mods/overweight-farming.json b/web/mods/overweight-farming.json new file mode 100644 index 0000000..571b832 --- /dev/null +++ b/web/mods/overweight-farming.json @@ -0,0 +1,5 @@ +{ + "name": "Overweight Farming", + "url": "https://modrinth.com/mod/overweight-farming", + "icon": "https://cdn.modrinth.com/data/bCxmmxKN/abc0da5e54331ff6fa32f3fd36b4a2d548eba2f2.png" +} \ No newline at end of file diff --git a/web/mods/quark.json b/web/mods/quark.json new file mode 100644 index 0000000..45d0374 --- /dev/null +++ b/web/mods/quark.json @@ -0,0 +1,5 @@ +{ + "name": "Quark", + "url": "https://modrinth.com/mod/quark", + "icon": "https://cdn.modrinth.com/data/qnQsVE2z/64151f8964bc6b81d968e814bf7344bbdfad27d0.png" +} \ No newline at end of file diff --git a/web/mods/supplementaries.json b/web/mods/supplementaries.json new file mode 100644 index 0000000..4b8a516 --- /dev/null +++ b/web/mods/supplementaries.json @@ -0,0 +1,5 @@ +{ + "name": "Supplementaries", + "url": "https://modrinth.com/mod/supplementaries", + "icon": "https://cdn.modrinth.com/data/fFEIiSDQ/b3e68729bd714fa2bc94a0aeed70b730c41a791a.png" +} \ No newline at end of file diff --git a/web/mods/the-twilight-forest.json b/web/mods/the-twilight-forest.json new file mode 100644 index 0000000..4c46e97 --- /dev/null +++ b/web/mods/the-twilight-forest.json @@ -0,0 +1,5 @@ +{ + "name": "The Twilight Forest", + "url": "https://www.curseforge.com/minecraft/mc-mods/the-twilight-forest", + "icon": "https://media.forgecdn.net/avatars/thumbnails/14/212/256/256/635589178760357568.png" +} \ No newline at end of file diff --git a/web/mods/thermal-expansion.json b/web/mods/thermal-expansion.json new file mode 100644 index 0000000..809309a --- /dev/null +++ b/web/mods/thermal-expansion.json @@ -0,0 +1,5 @@ +{ + "name": "Thermal Expansion", + "url": "https://modrinth.com/mod/thermal-expansion", + "icon": "https://cdn.modrinth.com/data/hmD6rrUJ/icon.png" +} \ No newline at end of file diff --git a/web/mods/thermal-foundation.json b/web/mods/thermal-foundation.json new file mode 100644 index 0000000..a9298ef --- /dev/null +++ b/web/mods/thermal-foundation.json @@ -0,0 +1,5 @@ +{ + "name": "Thermal Foundation", + "url": "https://modrinth.com/mod/thermal-foundation", + "icon": "https://cdn.modrinth.com/data/Xvg6q5Wp/icon.png" +} \ No newline at end of file diff --git a/web/mods/tinkers-construct.json b/web/mods/tinkers-construct.json new file mode 100644 index 0000000..930a2f5 --- /dev/null +++ b/web/mods/tinkers-construct.json @@ -0,0 +1,5 @@ +{ + "name": "Tinkers' Construct", + "url": "https://modrinth.com/mod/tinkers-construct", + "icon": "https://cdn.modrinth.com/data/rxIIYO6c/7a24bafaf8a7ce40cea07a4a070e6dd78a86ebd6.png" +} \ No newline at end of file diff --git a/web/mods/upgrade-aquatic.json b/web/mods/upgrade-aquatic.json new file mode 100644 index 0000000..a075c66 --- /dev/null +++ b/web/mods/upgrade-aquatic.json @@ -0,0 +1,5 @@ +{ + "name": "Upgrade Aquatic", + "url": "https://modrinth.com/mod/upgrade-aquatic", + "icon": "https://cdn.modrinth.com/data/gTuTFFyz/3844e2db7f344f4672d5b5391a5e4e67f065e020.png" +} \ No newline at end of file diff --git a/web/mods/waystones.json b/web/mods/waystones.json new file mode 100644 index 0000000..30f92d0 --- /dev/null +++ b/web/mods/waystones.json @@ -0,0 +1,5 @@ +{ + "name": "Waystones", + "url": "https://modrinth.com/mod/waystones", + "icon": "https://cdn.modrinth.com/data/LOpKHB2A/icon.png" +} \ No newline at end of file diff --git a/web/mods/windsweptmod.json b/web/mods/windsweptmod.json new file mode 100644 index 0000000..f128b07 --- /dev/null +++ b/web/mods/windsweptmod.json @@ -0,0 +1,5 @@ +{ + "name": "Windswept!", + "url": "https://www.curseforge.com/minecraft/mc-mods/windsweptmod", + "icon": "https://media.forgecdn.net/avatars/thumbnails/633/27/256/256/638033693086964776.png" +} \ No newline at end of file diff --git a/web/src/layouts/Layout.astro b/web/src/layouts/Layout.astro index 19be063..8c8fe70 100644 --- a/web/src/layouts/Layout.astro +++ b/web/src/layouts/Layout.astro @@ -27,6 +27,7 @@ const { title } = Astro.props --accent-dark: rgba(49, 10, 101); --bg: #13151a; --bg-light: rgb(67, 73, 85); + --bg-lighter: rgb(92, 99, 116); --text: #ebebeb; } @@ -62,7 +63,8 @@ const { title } = Astro.props a { color: var(--accent); - &:not(:hover) { + &:not(:hover), + &:has(button) { text-decoration: none; } } @@ -82,8 +84,8 @@ const { title } = Astro.props transition: outline 0.1s ease, - background 0.1s ease, - m; + color 0.1s ease, + background 0.1s ease; &:focus-visible { outline-width: 2px; @@ -96,5 +98,9 @@ const { title } = Astro.props button { cursor: pointer; + + &:hover { + background: var(--bg-lighter); + } } diff --git a/web/src/lib/getIcons.ts b/web/src/lib/getIcons.ts index 4572470..d546611 100644 --- a/web/src/lib/getIcons.ts +++ b/web/src/lib/getIcons.ts @@ -2,15 +2,19 @@ import { readdirSync, statSync } from 'fs' import { join, parse, resolve } from 'path' import type { Icon } from '../types/Icon.ts' -export default function getIcons() { - const baseDir = resolve('public/icons') +const baseDir = resolve('public/icons') - const namespaces = readdirSync(baseDir) +export function getNamespaces() { + return readdirSync(baseDir) .filter(it => statSync(join(baseDir, it)).isDirectory()) .toSorted(it => { if (it === 'minecraft') return -1 return 0 }) +} + +export default function getIcons() { + const namespaces = getNamespaces() return namespaces.flatMap(namespace => { const files = readdirSync(join(baseDir, namespace)) diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index 40409f0..abdc680 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -30,7 +30,11 @@ const exampleUrls = examples.map(it => `/icons/${it}.png`) - + + + + + @@ -46,14 +50,16 @@ const exampleUrls = examples.map(it => `/icons/${it}.png`) } button { - background: var(--accent); - margin-top: 1rem; margin-left: 3em; - &:hover { - background: var(--accent-light); - color: black; + &.accent { + background: var(--accent); + + &:hover { + background: var(--accent-light); + color: black; + } } } diff --git a/web/src/pages/mods.astro b/web/src/pages/mods.astro new file mode 100644 index 0000000..a309cc7 --- /dev/null +++ b/web/src/pages/mods.astro @@ -0,0 +1,64 @@ +--- +import { readdirSync, readFileSync } from 'fs' +import { join, resolve } from 'path' +import Layout from '../layouts/Layout.astro' + +const modDir = resolve('mods') + +type ModInfo = { + name: string + icon?: string + url: string +} + +const mods: ModInfo[] = readdirSync(modDir) + .map(it => join(modDir, it)) + .map(it => readFileSync(it).toString()) + .map(it => JSON.parse(it)) +--- + + +
+

Supported mods

+ +
+
+ +