Catch all subpaths
This commit is contained in:
parent
2c2fd045b3
commit
13c9a7140c
10 changed files with 21 additions and 8 deletions
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
|
@ -23,6 +23,10 @@ type Props = {
|
||||||
searchParams: SearchParams,
|
searchParams: SearchParams,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function get_path(file: string[]) {
|
||||||
|
return file.join("/");
|
||||||
|
}
|
||||||
|
|
||||||
function get_root(search_params: SearchParams) {
|
function get_root(search_params: SearchParams) {
|
||||||
console.log("HEEEERORORORRO", search_params)
|
console.log("HEEEERORORORRO", search_params)
|
||||||
return search_params['root'] ?? 'raw.monodon.me';
|
return search_params['root'] ?? 'raw.monodon.me';
|
||||||
|
@ -33,13 +37,14 @@ export async function generateMetadata(
|
||||||
parent: ResolvingMetadata,
|
parent: ResolvingMetadata,
|
||||||
): Promise<Metadata> {
|
): Promise<Metadata> {
|
||||||
return {
|
return {
|
||||||
title: `${params.file} | ${get_root(searchParams)}`,
|
title: `${get_path(params.file)} | ${get_root(searchParams)}`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function Page({
|
export default async function Page({
|
||||||
params, searchParams
|
params, searchParams
|
||||||
}: Props) {
|
}: Props) {
|
||||||
|
const path = get_path(params.file);
|
||||||
const root_url = `https://${get_root(searchParams)}/`;
|
const root_url = `https://${get_root(searchParams)}/`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -48,7 +53,7 @@ export default async function Page({
|
||||||
<div className={title_group}>
|
<div className={title_group}>
|
||||||
<div className={title_text_group}>
|
<div className={title_text_group}>
|
||||||
<p className={supertitle}>{root_url}</p>
|
<p className={supertitle}>{root_url}</p>
|
||||||
<p className={title}>{params.file}</p>
|
<p className={title}>{path}</p>
|
||||||
</div>
|
</div>
|
||||||
<button className={download_button}>
|
<button className={download_button}>
|
||||||
<Image
|
<Image
|
||||||
|
@ -58,7 +63,7 @@ export default async function Page({
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<Content src={`${root_url}${params.file}`} />
|
<Content src={`${root_url}${path}`} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
6
src/app/[...file]/types/text.css.ts
Normal file
6
src/app/[...file]/types/text.css.ts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { style } from '@vanilla-extract/css'
|
||||||
|
|
||||||
|
export const text = style({
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
whiteSpace: 'pre-wrap',
|
||||||
|
});
|
7
src/app/[...file]/types/text.tsx
Normal file
7
src/app/[...file]/types/text.tsx
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import * as style from './text.css'
|
||||||
|
|
||||||
|
export default function Text({ text }: { text: string }) {
|
||||||
|
return (
|
||||||
|
<p className={style.text}>{text}</p>
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,5 +0,0 @@
|
||||||
export default function Text({ text }: { text: string }) {
|
|
||||||
return (
|
|
||||||
<p>{text}</p>
|
|
||||||
);
|
|
||||||
}
|
|
Loading…
Reference in a new issue