Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Dependencies step to avoid rebuilds if the package.json or package-lock.json have not changed.
FROM node:18-alpine as BUILD-DEPS
FROM node:20-alpine as BUILD-DEPS

WORKDIR /mtsu-deps
COPY --chown=node:node package.json package-lock.json ./
Expand Down
34 changes: 2 additions & 32 deletions app/g/[...slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,12 @@
"use client"
import { Metadata } from "next"
import { APIPathsV1, fetchJSON, getCacheUrl } from "../../../lib/api/other"
import { changeExtension, clamp } from "../../../lib/helpers"
import { Gallery } from "../../../types/api"
import GalleryPage from "./gallery"

export const getGallery = async (slug: string) => {
const slugs = slug
if (!slugs || slugs.length === 0) {
return null
}

const gallery: Gallery = await fetchJSON(`${APIPathsV1.Gallery}${slugs[0]}`)
if (!gallery) {
return null
}

if (!gallery.Files) {
gallery.Files = []
}

const thumbnails: string[] = []
gallery.Files.forEach((file, i) => {
thumbnails.push(getCacheUrl(`/thumbnails/${gallery.Meta.UUID}/${changeExtension(file, ".webp")}`))
gallery.Files[i] = getCacheUrl(`/${gallery.Meta.UUID}/${file}`)
})

return {
gallery,
thumbnails,
page: slugs.length > 1 ? clamp(parseInt(slugs[1]), 0, gallery.Count) : 0,
}
}

export const metadata: Metadata = {
title: "Mangatsu | gallery",
description: "Gallery",
}

export default async function Page() {
export default function Page() {
return <GalleryPage />
}
40 changes: 2 additions & 38 deletions app/series/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,6 @@
import { Metadata } from "next"
import { APIPathsV1, fetchJSON, getCacheUrl } from "../../../lib/api/other"
import { changeExtension, clamp } from "../../../lib/helpers"
import { Gallery } from "../../../types/api"
"use client"
import SeriesPage from "./series"

export const getGalleries = async (slug: string) => {
const slugs = slug
if (!slugs || slugs.length === 0) {
return null
}

const gallery: Gallery = await fetchJSON(`${APIPathsV1.Gallery}${slugs[0]}`)
if (!gallery) {
return null
}

if (!gallery.Files) {
gallery.Files = []
}

const thumbnails: string[] = []
gallery.Files.forEach((file, i) => {
thumbnails.push(getCacheUrl(`/thumbnails/${gallery.Meta.UUID}/${changeExtension(file, ".webp")}`))
gallery.Files[i] = getCacheUrl(`/${gallery.Meta.UUID}/${file}`)
})

return {
gallery,
thumbnails,
page: slugs.length > 1 ? clamp(parseInt(slugs[1]), 0, gallery.Count) : 0,
}
}

export const metadata: Metadata = {
title: "Mangatsu | gallery",
description: "Gallery",
}

export default async function Page({ params }: { params: { slug: string } }) {
export default function Page() {
return <SeriesPage />
}
1 change: 0 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
2 changes: 1 addition & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const nextConfig = {
formats: ["image/webp"],
minimumCacheTTL: 60 * 60 * 24 * 30,
},
output: "standalone",
output: "export",
}

export default nextConfig