Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

remove comments

daniel31x13adcc4e85ace8
diff --git a/lib/client/getServerSideProps.ts b/lib/client/getServerSideProps.ts
index 44957d68..b208f3e7 100644
--- a/lib/client/getServerSideProps.ts
+++ b/lib/client/getServerSideProps.ts
@@ -4,14 +4,10 @@ import { i18n } from "next-i18next.config";
import { getToken } from "next-auth/jwt";
import { prisma } from "../api/db";
-// Keep this in a separate file, it's for logged out users
-// For logged in users, we'll use their preferred language from the database (default: en)
const getServerSideProps: GetServerSideProps = async (ctx) => {
const acceptLanguageHeader = ctx.req.headers["accept-language"];
const availableLanguages = i18n.locales;
- // Check if it's a logged in user
- // If it is, get the user's preferred language from the database
const token = await getToken({ req: ctx.req });
if (token) {
@@ -30,17 +26,14 @@ const getServerSideProps: GetServerSideProps = async (ctx) => {
}
}
- // Parse the accept-language header to get an array of languages
const acceptedLanguages = acceptLanguageHeader
?.split(",")
.map((lang) => lang.split(";")[0]);
- // Find the best match between the accepted languages and available languages
let bestMatch = acceptedLanguages?.find((lang) =>
availableLanguages.includes(lang)
);
- // If no direct match, find the best partial match
if (!bestMatch) {
acceptedLanguages?.some((acceptedLang) => {
const partialMatch = availableLanguages.find((lang) =>