-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor,feat: update better-auth, add audio toggle to view
add audio toggle and tooltips to view, prefetch data, and other improvements refactor other functions, use better-auth func for admin reset pw
- Loading branch information
1 parent
4461bfe
commit 74030d4
Showing
14 changed files
with
207 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,44 @@ | ||
import { getNode } from "@/lib/session/client"; | ||
import getSession from "@/lib/session/get-session"; | ||
import type { Metadata } from "next"; | ||
import { notFound } from "next/navigation"; | ||
import { SWRConfig } from "swr"; | ||
export async function generateMetadata(props: { params: Promise<{ slug: string }> }): Promise<Metadata> { | ||
const params = await props.params; | ||
const session = await getSession(params.slug); | ||
return { | ||
title: `Session ${params.slug.slice(0, 6)}`, | ||
title: session ? `Session ${params.slug.slice(0, 6)}` : "Invalid Session", | ||
}; | ||
} | ||
export default function ViewLayout({ | ||
export default async function ViewLayout({ | ||
children, | ||
params, | ||
}: { | ||
children: React.ReactNode; | ||
params: Promise<{ slug: string }>; | ||
}) { | ||
return children; | ||
const { slug } = await params; | ||
const session = await getSession(slug); | ||
if (!session) notFound(); | ||
const nodeSession = getNode(session).sessions({ id: session.id }); | ||
const { data: info, error: infoError } = await nodeSession.get(); | ||
const { data: files, error: filesError } = await nodeSession.files.list.get(); | ||
if (!info?.State.Running) await nodeSession.patch({ action: "start" }); | ||
if (info?.State.Paused) await nodeSession.patch({ action: "unpause" }); | ||
return ( | ||
<SWRConfig | ||
value={{ | ||
fallback: { | ||
[`/api/session/${slug}`]: { | ||
exists: true, | ||
error: infoError, | ||
password: info?.password, | ||
}, | ||
[`/api/session/${slug}/files`]: filesError || !files.success ? filesError : files.list, | ||
}, | ||
}} | ||
> | ||
{children} | ||
</SWRConfig> | ||
); | ||
} |
Oops, something went wrong.