mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00

* Added UI for Terms and Conditions Modal Dialogue * Handled the logout on not accepting * Added logic for terms acceptance * Add terms and conditions modal * Fixed bug on terms and conditions modal, clicking out of it won't close it now * Added acceptance of Terms to Database * Removed unnecessary api endpoints from index.js * Added NPM script to reset terms acceptance * Added translations, markdown terms and samples * Merged terms and conditions modal feature * feat/Modal Terms and Conditions Dialog * Amendments as requested by maintainers * Reset package-lock (again)
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
const path = require('path');
|
|
require('module-alias')({ base: path.resolve(__dirname, '..', 'api') });
|
|
const User = require('~/models/User');
|
|
const connect = require('./connect');
|
|
const { askQuestion, silentExit } = require('./helpers');
|
|
|
|
(async () => {
|
|
await connect();
|
|
|
|
console.purple('--------------------------');
|
|
console.purple('Reset terms acceptance');
|
|
console.purple('--------------------------');
|
|
|
|
console.yellow('This will reset the terms acceptance for all users.');
|
|
const confirm = await askQuestion('Are you sure you want to proceed? (y/n): ');
|
|
|
|
if (confirm.toLowerCase() !== 'y') {
|
|
console.yellow('Operation cancelled.');
|
|
silentExit(0);
|
|
}
|
|
|
|
try {
|
|
const result = await User.updateMany({}, { $set: { termsAccepted: false } });
|
|
console.green(`Updated ${result.modifiedCount} user(s).`);
|
|
} catch (error) {
|
|
console.red('Error resetting terms acceptance:', error);
|
|
silentExit(1);
|
|
}
|
|
|
|
silentExit(0);
|
|
})();
|
|
|
|
process.on('uncaughtException', (err) => {
|
|
if (!err.message.includes('fetch failed')) {
|
|
console.error('There was an uncaught error:');
|
|
console.error(err);
|
|
}
|
|
|
|
if (err.message.includes('fetch failed')) {
|
|
return;
|
|
} else {
|
|
process.exit(1);
|
|
}
|
|
});
|