⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.
TypeScript bookmarkbookmark-managercollaborationnextjsreact-nativeread-it-laterself-hostedtypescript
small improvement + better error handling
daniel31x13e872c25332b5
diff --git a/lib/api/controllers/links/postLink.ts b/lib/api/controllers/links/postLink.tsindex 80cf2ad8..2877c816 100644--- a/lib/api/controllers/links/postLink.ts+++ b/lib/api/controllers/links/postLink.ts@@ -68,7 +68,10 @@ export default async function postLink(const validatedUrl = link.url ? await validateUrlSize(link.url) : undefined;if (validatedUrl === null)- return { response: "File is too large to be stored.", status: 400 };+ return {+ response: "Something went wrong while retrieving the file size.",+ status: 400,+ };const contentType = validatedUrl?.get("content-type");let linkType = "url";diff --git a/lib/api/controllers/users/userId/deleteUserById.ts b/lib/api/controllers/users/userId/deleteUserById.tsindex c9cbd385..2a5a0833 100644--- a/lib/api/controllers/users/userId/deleteUserById.ts+++ b/lib/api/controllers/users/userId/deleteUserById.ts@@ -5,6 +5,9 @@ import Stripe from "stripe";import { DeleteUserBody } from "@/types/global";import removeFile from "@/lib/api/storage/removeFile";+const keycloakEnabled = process.env.KEYCLOAK_CLIENT_SECRET;+const authentikEnabled = process.env.AUTHENTIK_CLIENT_SECRET;+export default async function deleteUserById(userId: number,body: DeleteUserBody@@ -22,7 +25,7 @@ export default async function deleteUserById(}// Then, we check if the provided password matches the one stored in the database (disabled in Keycloak integration)- if (!process.env.KEYCLOAK_CLIENT_SECRET) {+ if (!keycloakEnabled && !authentikEnabled) {const isPasswordValid = bcrypt.compareSync(body.password,user.password as stringdiff --git a/package.json b/package.jsonindex 4917ee87..5a6b24e8 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "linkwarden",- "version": "2.4.0",+ "version": "2.4.5","main": "index.js","repository": "https://github.com/linkwarden/linkwarden.git","author": "Daniel31X13 <[email protected]>",diff --git a/pages/api/v1/auth/[...nextauth].ts b/pages/api/v1/auth/[...nextauth].tsindex 0db48d6b..d7549de8 100644--- a/pages/api/v1/auth/[...nextauth].ts+++ b/pages/api/v1/auth/[...nextauth].ts@@ -598,6 +598,7 @@ if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true") {},}));+const _linkAccount = adapter.linkAccount;adapter.linkAccount = (account) => {const { "not-before-policy": _, refresh_expires_in, ...data } = account;diff --git a/pages/settings/delete.tsx b/pages/settings/delete.tsxindex d7b111fc..0c789327 100644--- a/pages/settings/delete.tsx+++ b/pages/settings/delete.tsx@@ -5,6 +5,9 @@ import CenteredForm from "@/layouts/CenteredForm";import { signOut, useSession } from "next-auth/react";import Link from "next/link";+const keycloakEnabled = process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true";+const authentikEnabled = process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === "true";+export default function Delete() {const [password, setPassword] = useState("");const [comment, setComment] = useState<string>();@@ -23,7 +26,7 @@ export default function Delete() {},};- if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED !== "true" && password == "") {+ if (!keycloakEnabled && !authentikEnabled && password == "") {return toast.error("Please fill the required fields.");}