Skip to content

Commit

Permalink
Use the local version of the metadata.json instead of sourcing from g…
Browse files Browse the repository at this point in the history
…ithub (#1320)

Use the local version of the metadata.json instead of sourcing it from github main branch
  • Loading branch information
grymmy committed Dec 20, 2023
1 parent b802ae9 commit 3f8fb2d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/lib/game-saving/gallery.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import metadata from '../../../games/metadata.json'

export interface GameMetadata {
filename: string
title: string
Expand All @@ -8,4 +10,4 @@ export interface GameMetadata {
isNew: true | undefined
}

export const getGalleryGames = async () => await fetch('https://raw.githubusercontent.com/hackclub/sprig/main/games/metadata.json').then((res) => res.json()) as GameMetadata[]
export const getGalleryGames = () => metadata as GameMetadata[]
2 changes: 1 addition & 1 deletion src/pages/gallery/[filename].astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let tutorial: string[] | undefined = files
?.map(md => md.compiledContent())
if (tutorial.length == 0) tutorial = undefined
const games = await getGalleryGames()
const games = getGalleryGames()
const metadata = games.find(game => game.filename === filename)
const name = metadata?.title
const authorName = metadata?.author
Expand Down
2 changes: 1 addition & 1 deletion src/pages/gallery/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Gallery from "./gallery";
const session = await getSession(Astro.cookies);
const games = await getGalleryGames();
const games = getGalleryGames();
const tags = [
...new Set(games.reduce<string[]>((p, c) => [...p, ...c.tags], [])),
];
Expand Down

1 comment on commit 3f8fb2d

@vercel
Copy link

@vercel vercel bot commented on 3f8fb2d Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sprig – ./

sprig.vercel.app
sprig-git-main-gamer.vercel.app
sprig-gamer.vercel.app

Please sign in to comment.