diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 1f8a88b3e46..6af0ed46d41 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -43,11 +43,11 @@ jobs: - name: Install global dependencies run: npm ci - - name: Remove sharp dependency - run: rm -rf node_modules/sharp + # - name: Remove sharp dependency + # run: rm -rf node_modules/sharp - - name: Install sharp with linux dependencies - run: cd api && SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp + # - name: Install sharp with linux dependencies + # run: cd api && SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install --arch=x64 --platform=linux --libc=glibc sharp - name: Build Client run: npm run frontend diff --git a/api/package.json b/api/package.json index 7d8094e30da..d548a74fa8e 100644 --- a/api/package.json +++ b/api/package.json @@ -63,7 +63,7 @@ "passport-local": "^1.0.0", "pino": "^8.12.1", "sanitize": "^2.1.2", - "sharp": "^0.32.1", + "sharp": "^0.32.5", "zod": "^3.22.2" }, "devDependencies": { diff --git a/api/server/index.js b/api/server/index.js index 1f43918d291..8a6f4381970 100644 --- a/api/server/index.js +++ b/api/server/index.js @@ -9,7 +9,7 @@ const errorController = require('./controllers/ErrorController'); const passport = require('passport'); const configureSocialLogins = require('./socialLogins'); -const port = process.env.PORT || 3080; +const port = Number(process.env.PORT) || 3080; const host = process.env.HOST || 'localhost'; const projectPath = path.join(__dirname, '..', '..', 'client'); const { jwtLogin, passportLogin } = require('../strategies'); diff --git a/api/server/middleware/loginLimiter.js b/api/server/middleware/loginLimiter.js index 283e3b1b823..bca07d0a7a9 100644 --- a/api/server/middleware/loginLimiter.js +++ b/api/server/middleware/loginLimiter.js @@ -7,6 +7,10 @@ const loginLimiter = rateLimit({ windowMs, max, message: `Too many login attempts from this IP, please try again after ${windowInMinutes} minutes.`, + keyGenerator: function (req) { + // Strip out the port number from the IP address + return req.ip.replace(/:\d+[^:]*$/, ''); + }, }); module.exports = loginLimiter; diff --git a/api/server/middleware/registerLimiter.js b/api/server/middleware/registerLimiter.js index 9bd3bc91f42..df2d3d1ca8f 100644 --- a/api/server/middleware/registerLimiter.js +++ b/api/server/middleware/registerLimiter.js @@ -7,6 +7,10 @@ const registerLimiter = rateLimit({ windowMs, max, message: `Too many accounts created from this IP, please try again after ${windowInMinutes} minutes`, + keyGenerator: function (req) { + // Strip out the port number from the IP address + return req.ip.replace(/:\d+[^:]*$/, ''); + }, }); module.exports = registerLimiter; diff --git a/api/strategies/localStrategy.js b/api/strategies/localStrategy.js index e145796cb2a..14c97183973 100644 --- a/api/strategies/localStrategy.js +++ b/api/strategies/localStrategy.js @@ -50,9 +50,10 @@ async function passportLogin(req, email, password, done) { } function logError(title, parameters) { + const entries = Object.entries(parameters).map(([name, value]) => ({ name, value })); DebugControl.log.functionName(title); - if (parameters) { - DebugControl.log.parameters(parameters); + if (entries) { + DebugControl.log.parameters(entries); } } diff --git a/bun.lockb b/bun.lockb new file mode 100755 index 00000000000..25f9ccd96af Binary files /dev/null and b/bun.lockb differ diff --git a/client/package.json b/client/package.json index 00425fd9351..d3c5d012d1b 100644 --- a/client/package.json +++ b/client/package.json @@ -9,7 +9,9 @@ "dev": "cross-env NODE_ENV=development dotenv -e ../.env -- vite", "preview-prod": "cross-env NODE_ENV=development dotenv -e ../.env -- vite preview", "test": "cross-env NODE_ENV=test jest --watch", - "test:ci": "cross-env NODE_ENV=test jest --ci" + "test:ci": "cross-env NODE_ENV=test jest --ci", + "b:build": "NODE_ENV=production bunx --bun vite build", + "b:dev": "NODE_ENV=development bunx --bun vite" }, "repository": { "type": "git", diff --git a/package-lock.json b/package-lock.json index 3f967af73e9..849219d91ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -90,7 +90,7 @@ "passport-local": "^1.0.0", "pino": "^8.12.1", "sanitize": "^2.1.2", - "sharp": "^0.32.1", + "sharp": "^0.32.5", "zod": "^3.22.2" }, "devDependencies": { @@ -26774,7 +26774,7 @@ }, "packages/data-provider": { "name": "librechat-data-provider", - "version": "0.1.6", + "version": "0.1.7", "license": "ISC", "dependencies": { "@tanstack/react-query": "^4.28.0", diff --git a/package.json b/package.json index 9c6aa245919..14304f10ab7 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,14 @@ "prepare": "node config/prepare.js", "lint:fix": "eslint --fix \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"", "lint": "eslint \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"", - "format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"" + "format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"", + "b:api": "NODE_ENV=production bun run api/server/index.js", + "b:api:dev": "NODE_ENV=development bun run --watch api/server/index.js", + "b:data-provider": "cd packages/data-provider && bun run b:build", + "b:client": "bun run b:data-provider && cd client && bun run b:build", + "b:client:dev": "cd client && bun run b:dev", + "b:test:client": "cd client && bun run test", + "b:test:api": "cd api && bun run test" }, "repository": { "type": "git", diff --git a/packages/data-provider/package.json b/packages/data-provider/package.json index 9219e443e97..aa69af2e26a 100644 --- a/packages/data-provider/package.json +++ b/packages/data-provider/package.json @@ -11,7 +11,9 @@ "build:watch": "rollup -c -w", "test": "jest --coverage --watch", "test:ci": "jest --coverage --ci", - "verify": "npm run test:ci" + "verify": "npm run test:ci", + "b:clean": "bun run rimraf dist", + "b:build": "bun run b:clean && bun run rollup -c --silent --bundleConfigAsCjs" }, "repository": { "type": "git",