⚡️⚡️⚡️ 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
remove comments
daniel31x13adcc4e85ace8
diff --git a/lib/client/getServerSideProps.ts b/lib/client/getServerSideProps.tsindex 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 databaseconst 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 languagesconst acceptedLanguages = acceptLanguageHeader?.split(",").map((lang) => lang.split(";")[0]);- // Find the best match between the accepted languages and available languageslet bestMatch = acceptedLanguages?.find((lang) =>availableLanguages.includes(lang));- // If no direct match, find the best partial matchif (!bestMatch) {acceptedLanguages?.some((acceptedLang) => {const partialMatch = availableLanguages.find((lang) =>