-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: access control and authentication (#7)
- Loading branch information
1 parent
381b453
commit 258a207
Showing
62 changed files
with
2,195 additions
and
144 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
AUTH_SECRET= | ||
AUTH_GITHUB_ID= | ||
AUTH_GITHUB_SECRET= |
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
Binary file added
BIN
+1.35 MB
...mo/blobs/1a26a4973394d047e29ea922fc55e8176e9ffac3ffd49ece7800022a260885e400001abc1f044a7d
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { GET, POST } from '@/utils/auth'; | ||
|
||
export const runtime = 'edge'; |
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 was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { validateBucketName } from '@/utils/cf'; | ||
import { formatBucketName, formatFullPath } from '@/utils'; | ||
import { ObjectExplorerProvider, FilePreviewProvider } from '@/components'; | ||
import type { Metadata } from 'next'; | ||
import { notFound } from 'next/navigation'; | ||
import { Ctx } from './ctx'; | ||
|
||
export type RouteParams = { bucket: string; path?: string[] }; | ||
type Props = { params: RouteParams; children: React.ReactNode }; | ||
|
||
export const generateMetadata = ({ params }: { params: RouteParams }): Metadata => ({ | ||
title: formatBucketName(params.bucket), | ||
}); | ||
|
||
const Layout = async ({ params: { bucket, path }, children }: Props): Promise<JSX.Element> => { | ||
const fullPath = formatFullPath(path); | ||
if (!(await validateBucketName(bucket))) return notFound(); | ||
|
||
return ( | ||
<> | ||
<Ctx bucketName={bucket} path={fullPath} /> | ||
|
||
<ObjectExplorerProvider> | ||
<FilePreviewProvider bucketName={bucket}>{children}</FilePreviewProvider> | ||
</ObjectExplorerProvider> | ||
</> | ||
); | ||
}; | ||
|
||
export default Layout; |
12 changes: 7 additions & 5 deletions
12
app/bucket/[...path]/page.tsx → app/bucket/[bucket]/[[...path]]/page.tsx
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
Oops, something went wrong.