feat: add dark mode UI and SQLite as alternate database backend
Dark mode: CSS custom properties + .dark class toggled via Redux/localStorage, with a theme toggle in the Header and Settings page. Foundation didn't exist yet despite prior assumption, so it was built from scratch. SQLite: new DB_ENGINE=mongo|sqlite env var selects the metadata backend at runtime (Mongo stays default, no behavior change unless opted in). File/thumbnail bytes continue to use the existing fs/S3 storage path. Implemented via a shared DB interface (dbTypes.ts) with parallel mongoDB/ and sqliteDB/ implementations, selected through dbFactory.ts, with JWT/encryption logic extracted into userCrypto.ts so both engines share it.
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
import User, { UserInterface } from "../models/user-model";
|
||||
import mongoose from "mongoose";
|
||||
import { Request, Response, NextFunction } from "express";
|
||||
import { Response } from "express";
|
||||
import NotFoundError from "./NotFoundError";
|
||||
import { createLoginCookie } from "../cookies/create-cookies";
|
||||
import { getUserDB } from "../db/dbFactory";
|
||||
|
||||
// interface RequestType extends Request {
|
||||
// user?: userAccessType,
|
||||
// token?: string,
|
||||
// encryptedToken?: string,
|
||||
// }
|
||||
const userDB = getUserDB();
|
||||
|
||||
type userAccessType = {
|
||||
_id: mongoose.Types.ObjectId;
|
||||
_id: any;
|
||||
emailVerified: boolean;
|
||||
email: string;
|
||||
botChecked: boolean;
|
||||
@@ -19,10 +14,10 @@ type userAccessType = {
|
||||
|
||||
const userUpdateCheck = async (
|
||||
res: Response,
|
||||
id: mongoose.Types.ObjectId,
|
||||
id: string,
|
||||
uuid: string | undefined
|
||||
) => {
|
||||
const updatedUser = await User.findById(id);
|
||||
const updatedUser = await userDB.getUserInfo(id);
|
||||
|
||||
if (!updatedUser) throw new NotFoundError("Cannot find updated user auth");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user