mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 02:15:01 +00:00
Restructure skin permalink route
This commit is contained in:
parent
b761f81c21
commit
9101dc94ce
4 changed files with 37 additions and 16 deletions
12
packages/skin-database/app/skin/[hash]/[fileName]/page.tsx
Normal file
12
packages/skin-database/app/skin/[hash]/[fileName]/page.tsx
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import App from "../../../App";
|
||||
import type { Metadata } from "next";
|
||||
import { generateSkinPageMetadata } from "../skinMetadata.js";
|
||||
|
||||
export async function generateMetadata({ params }): Promise<Metadata> {
|
||||
const { hash, fileName: _fileName } = await params;
|
||||
return generateSkinPageMetadata(hash);
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
return <App />;
|
||||
}
|
||||
12
packages/skin-database/app/skin/[hash]/page.tsx
Normal file
12
packages/skin-database/app/skin/[hash]/page.tsx
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import App from "../../App";
|
||||
import type { Metadata } from "next";
|
||||
import { generateSkinPageMetadata } from "./skinMetadata.js";
|
||||
|
||||
export async function generateMetadata({ params }): Promise<Metadata> {
|
||||
const { hash } = await params;
|
||||
return generateSkinPageMetadata(hash);
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
return <App />;
|
||||
}
|
||||
|
|
@ -1,15 +1,10 @@
|
|||
import App from "../../App";
|
||||
import type { Metadata } from "next";
|
||||
import SkinModel from "../../../data/SkinModel";
|
||||
import UserContext from "../../../data/UserContext";
|
||||
|
||||
const DESCRIPTION =
|
||||
"Infinite scroll through 80k Winamp skins with interactive preview";
|
||||
|
||||
export async function generateMetadata({ params }): Promise<Metadata> {
|
||||
const { segments } = await params;
|
||||
const [hash, _fileName] = segments;
|
||||
import { Metadata } from "next";
|
||||
import SkinModel from "../../../data/SkinModel.js";
|
||||
import UserContext from "../../../data/UserContext.js";
|
||||
|
||||
export async function generateSkinPageMetadata(
|
||||
hash: string
|
||||
): Promise<Metadata> {
|
||||
const skin = await SkinModel.fromMd5Assert(new UserContext(), hash);
|
||||
const fileName = await skin.getFileName();
|
||||
const readme = await skin.getReadme();
|
||||
|
|
@ -26,7 +21,10 @@ export async function generateMetadata({ params }): Promise<Metadata> {
|
|||
];
|
||||
|
||||
const title = `${fileName} - Winamp Skin Museum`;
|
||||
const description = readme == null ? DESCRIPTION : readme.slice(0, 300);
|
||||
const description =
|
||||
readme == null
|
||||
? `The Winamp Skin "${fileName}" in the Winamp Skin Museum. Explore skins, view details, and interact with previews.`
|
||||
: readme.slice(0, 300);
|
||||
return {
|
||||
title,
|
||||
description,
|
||||
|
|
@ -50,7 +48,3 @@ export async function generateMetadata({ params }): Promise<Metadata> {
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
return <App />;
|
||||
}
|
||||
|
|
@ -31,6 +31,9 @@ export const SKIN_CDN = R2_CDN;
|
|||
// Uncomment these if something goes wrong
|
||||
// export const SCREENSHOT_CDN = "https://cdn.webampskins.org";
|
||||
// export const SKIN_CDN = "https://cdn.webampskins.org";
|
||||
|
||||
// Note: This is a Cloudflare proxy for api.webamp.org which
|
||||
// provides some additional caching.
|
||||
export const API_URL = "https://api.webampskins.org";
|
||||
// export const API_URL = "https://dev.webamp.org";
|
||||
export const HEADING_HEIGHT = 46;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue