Added toggle for 'repointing' as well as (slightly) better documentation and homepage
This commit is contained in:
parent
dc48d44400
commit
65c5023ae4
5 changed files with 85 additions and 9 deletions
|
@ -18,23 +18,24 @@ function get_path(file: string[]) {
|
|||
return file.join("/");
|
||||
}
|
||||
|
||||
function get_root(search_params: SearchParams) {
|
||||
return search_params['root'] ?? 'raw.monodon.me';
|
||||
function get_root(enable_repointing: boolean, search_params: SearchParams) {
|
||||
return `https://${search_params['root'] ?? 'raw.monodon.me'}/`;
|
||||
}
|
||||
|
||||
export async function generateMetadata(
|
||||
{ params, searchParams }: Props,
|
||||
): Promise<Metadata> {
|
||||
return {
|
||||
title: `${get_path(params.file)} | ${get_root(searchParams)}`,
|
||||
title: `${get_path(params.file)} | ${get_root(true, searchParams)}`,
|
||||
};
|
||||
}
|
||||
|
||||
export default async function Page({
|
||||
params, searchParams
|
||||
}: Props) {
|
||||
const enable_repointing = process.env.ENABLE_REPOINTING == 'true';
|
||||
const path = get_path(params.file);
|
||||
const root = `https://${get_root(searchParams)}/`;
|
||||
const root = get_root(enable_repointing, searchParams);
|
||||
const full = `${root}${path}`;
|
||||
|
||||
const download_ttys = [
|
||||
|
@ -68,7 +69,10 @@ export default async function Page({
|
|||
<div className={style.download_tty_group}>
|
||||
{download_ttys.map((text, index) => <Copy key={index} text={text}>{text}</Copy>)}
|
||||
</div>
|
||||
<Content src={`${root}${path}`} />
|
||||
{(!enable_repointing && searchParams['root'] != undefined) ?
|
||||
<p>Error: this instance of Motto does not have repointing enabled</p> :
|
||||
<Content src={`${root}${path}`} />
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue