mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
👤 fix: Create User with timestamps (#3070)
* 👤 fix: Create User with timestamps
* chore: fix lint script to ignore venv
* chore: linting
This commit is contained in:
parent
bcaa7d5d29
commit
04502e9525
4 changed files with 11 additions and 12 deletions
|
|
@ -62,7 +62,7 @@ const updateUser = async function (userId, updateData) {
|
||||||
const createUser = async (data, disableTTL = true) => {
|
const createUser = async (data, disableTTL = true) => {
|
||||||
const userData = {
|
const userData = {
|
||||||
...data,
|
...data,
|
||||||
expiresAt: new Date(Date.now() + 604800 * 1000), // 1 week in milliseconds
|
expiresAt: disableTTL ? null : new Date(Date.now() + 604800 * 1000), // 1 week in milliseconds
|
||||||
};
|
};
|
||||||
|
|
||||||
if (disableTTL) {
|
if (disableTTL) {
|
||||||
|
|
@ -70,8 +70,8 @@ const createUser = async (data, disableTTL = true) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await User.collection.insertOne(userData);
|
const user = await User.create(userData);
|
||||||
return result.insertedId;
|
return user._id;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.code === 11000) {
|
if (error.code === 11000) {
|
||||||
// Duplicate key error code
|
// Duplicate key error code
|
||||||
|
|
|
||||||
|
|
@ -69,11 +69,11 @@ function convertToUsername(input, defaultValue = '') {
|
||||||
async function setupOpenId() {
|
async function setupOpenId() {
|
||||||
try {
|
try {
|
||||||
if (process.env.PROXY) {
|
if (process.env.PROXY) {
|
||||||
const proxyAgent = new HttpsProxyAgent(process.env.PROXY);
|
const proxyAgent = new HttpsProxyAgent(process.env.PROXY);
|
||||||
custom.setHttpOptionsDefaults({
|
custom.setHttpOptionsDefaults({
|
||||||
agent: proxyAgent
|
agent: proxyAgent,
|
||||||
});
|
});
|
||||||
logger.info(`[openidStrategy] proxy agent added: ${process.env.PROXY}`);
|
logger.info(`[openidStrategy] proxy agent added: ${process.env.PROXY}`);
|
||||||
}
|
}
|
||||||
const issuer = await Issuer.discover(process.env.OPENID_ISSUER);
|
const issuer = await Issuer.discover(process.env.OPENID_ISSUER);
|
||||||
const client = new issuer.Client({
|
const client = new issuer.Client({
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import { Constants } from 'librechat-data-provider';
|
||||||
import { useGetStartupConfig } from 'librechat-data-provider/react-query';
|
import { useGetStartupConfig } from 'librechat-data-provider/react-query';
|
||||||
import { useLocalize } from '~/hooks';
|
import { useLocalize } from '~/hooks';
|
||||||
|
|
||||||
|
|
||||||
export default function Footer({ className }: { className?: string }) {
|
export default function Footer({ className }: { className?: string }) {
|
||||||
const { data: config } = useGetStartupConfig();
|
const { data: config } = useGetStartupConfig();
|
||||||
const localize = useLocalize();
|
const localize = useLocalize();
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@
|
||||||
"e2e:update": "playwright test --config=e2e/playwright.config.js --update-snapshots",
|
"e2e:update": "playwright test --config=e2e/playwright.config.js --update-snapshots",
|
||||||
"e2e:report": "npx playwright show-report e2e/playwright-report",
|
"e2e:report": "npx playwright show-report e2e/playwright-report",
|
||||||
"prepare": "node config/prepare.js",
|
"prepare": "node config/prepare.js",
|
||||||
"lint:fix": "eslint --fix \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
|
"lint:fix": "eslint --fix \"{,!(node_modules|venv)/**/}*.{js,jsx,ts,tsx}\"",
|
||||||
"lint": "eslint \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
|
"lint": "eslint \"{,!(node_modules|venv)/**/}*.{js,jsx,ts,tsx}\"",
|
||||||
"format": "prettier-eslint --write \"{,!(node_modules)/**/}*.{js,jsx,ts,tsx}\"",
|
"format": "prettier-eslint --write \"{,!(node_modules|venv)/**/}*.{js,jsx,ts,tsx}\"",
|
||||||
"b:api": "NODE_ENV=production bun run api/server/index.js",
|
"b:api": "NODE_ENV=production bun run api/server/index.js",
|
||||||
"b:api-inspect": "NODE_ENV=production bun --inspect run api/server/index.js",
|
"b:api-inspect": "NODE_ENV=production bun --inspect run api/server/index.js",
|
||||||
"b:api:dev": "NODE_ENV=production bun run --watch api/server/index.js",
|
"b:api:dev": "NODE_ENV=production bun run --watch api/server/index.js",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue