diff options
| author | MohamedBassem <me@mbassem.com> | 2024-02-06 12:26:29 +0000 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-02-06 12:26:29 +0000 |
| commit | 083ea5bd19172381bb53e95aaf98eaabef839c54 (patch) | |
| tree | 4d1c041aab7cd8d15382330db08caeb9c5a12c63 /lib | |
| parent | b792121977ade8bdd3fb62704b65a9fcbd1436b9 (diff) | |
| download | karakeep-083ea5bd19172381bb53e95aaf98eaabef839c54.tar.zst | |
Move the web app into a subdir
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/auth.ts | 25 | ||||
| -rw-r--r-- | lib/config.ts | 20 | ||||
| -rw-r--r-- | lib/prisma.ts | 5 | ||||
| -rw-r--r-- | lib/types/api/links.ts | 26 | ||||
| -rw-r--r-- | lib/types/next-auth.d.ts | 12 | ||||
| -rw-r--r-- | lib/utils.ts | 6 |
6 files changed, 0 insertions, 94 deletions
diff --git a/lib/auth.ts b/lib/auth.ts deleted file mode 100644 index 9b21e605..00000000 --- a/lib/auth.ts +++ /dev/null @@ -1,25 +0,0 @@ -import NextAuth, { NextAuthOptions } from "next-auth" -import { PrismaAdapter } from "@next-auth/prisma-adapter" -import AuthentikProvider from "next-auth/providers/authentik"; -import serverConfig from "@/lib/config"; -import prisma from "@/lib/prisma"; - -let providers = []; - -if (serverConfig.auth.authentik) { - providers.push(AuthentikProvider(serverConfig.auth.authentik)); -} - -export const authOptions: NextAuthOptions = { - // Configure one or more authentication providers - adapter: PrismaAdapter(prisma), - providers: providers, - callbacks: { - session({ session, token, user }) { - session.user = { ...user }; - return session; - } - } -}; - -export const authHandler = NextAuth(authOptions); diff --git a/lib/config.ts b/lib/config.ts deleted file mode 100644 index ef86cb5a..00000000 --- a/lib/config.ts +++ /dev/null @@ -1,20 +0,0 @@ -function buildAuthentikConfig() { - let {id, secret, issuer} = process.env; - if (!id || !secret || !issuer) { - return undefined; - } - - return { - clientId: id, - clientSecret: secret, - issuer: issuer, - }; -} - -const serverConfig = { - auth: { - authentik: buildAuthentikConfig(), - } -}; - -export default serverConfig; diff --git a/lib/prisma.ts b/lib/prisma.ts deleted file mode 100644 index d73ba5f2..00000000 --- a/lib/prisma.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { PrismaClient } from '@prisma/client' - -const prisma = new PrismaClient(); - -export default prisma; diff --git a/lib/types/api/links.ts b/lib/types/api/links.ts deleted file mode 100644 index 81cde053..00000000 --- a/lib/types/api/links.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { z } from "zod"; - -export const ZBookmarkedLink = z.object({ - id: z.string(), - url: z.string().url(), - createdAt: z.coerce.date(), - - details: z.object({ - title: z.string(), - description: z.string(), - imageUrl: z.string().url(), - }).nullish(), - -}); -export type ZBookmarkedLink = z.infer<typeof ZBookmarkedLink>; - - -// POST /v1/links -export const ZNewBookmarkedLinkRequest = ZBookmarkedLink.pick({ url: true }); - - -// GET /v1/links -export const ZGetLinksResponse = z.object({ - links: z.array(ZBookmarkedLink), -}); -export type ZGetLinksResponse = z.infer<typeof ZGetLinksResponse>; diff --git a/lib/types/next-auth.d.ts b/lib/types/next-auth.d.ts deleted file mode 100644 index bdd3bd03..00000000 --- a/lib/types/next-auth.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import NextAuth, { DefaultSession } from "next-auth" - -declare module "next-auth" { - /** - * Returned by `useSession`, `getSession` and received as a prop on the `SessionProvider` React Context - */ - interface Session { - user: { - id: string; - } & DefaultSession["user"]; - } -} diff --git a/lib/utils.ts b/lib/utils.ts deleted file mode 100644 index d084ccad..00000000 --- a/lib/utils.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { type ClassValue, clsx } from "clsx" -import { twMerge } from "tailwind-merge" - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)) -} |
