Add page routing and content fetchers

This commit is contained in:
itsfinniii
2026-03-15 18:55:30 +01:00
parent bc11be5669
commit 21d5ba23a4
22 changed files with 923 additions and 9 deletions

View File

@@ -0,0 +1,30 @@
import { createDirectusConnection } from "@/lib/directus";
import { print } from "graphql";
import getPhotos from '@/graphql/photos/getPhotos.graphql';
import md5 from "md5";
export async function getPhotoFromHash(albumUrl: string, hash: string): Promise<PhotoAlbumPhoto | null> {
const client = await createDirectusConnection();
const result = await client.query(print(getPhotos));
result["Photo_Albums"][0]["photos"].forEach((photo: any) => {
const hashObject = md5(JSON.stringify({
id: photo.id,
url: photo.photo.url,
width: photo.photo.width,
height: photo.photo.height
}));
if (hash.substring(hash.length - 10) === hash) {
return {
id: photo.id,
text: photo.text,
photo: {
url: photo.photo.url,
width: photo.photo.width,
height: photo.photo.height
}
}
}
});
}