LibreChat/config/reset-terms.js
Marco Beretta 79b836d79f
📃 fix: Enforce Terms Acceptance on the Server and Mark Backfilled Consent (#17063)
* fix: Enforce Terms Acceptance on the Server When modalAcceptance Is On

* fix: Mark Backfilled Terms Acceptance Timestamps

* test: Cover Server-Enforced Terms Acceptance in the Mock Harness

* fix: Gate Management Routes and Skill Sync and Resolve Terms Policy Fail-Closed

* fix: Evict Cached Auth Documents When Terms Acceptance Is Reset

* fix: Guard Skill Sync Behind Terms Acceptance for Every Skill List Route

* fix: Move Terms Skill-Sync Guard Into the API Package and Evict All Users on Reset

* fix: Batch Terms Reset Cache Eviction and Sign the Spec User In Fresh

* fix: Let Stop Through the Terms Gate, Refresh Startup Config, and Wait Out Failed Eviction

* refactor: Narrow the Terms Exemptions and Share One Refusal Path Across Clients

* refactor: Compose the JWT Terms Gate Through an API Package Helper

* style: Sort Imports for the Shared Terms Refusal Helper

* test: Expose the Terms Gate Helper in the JWT Auth Spec Mock

* test: Cover the Terms Refusal Code on Pre-Stream Upload Errors
2026-10-14 17:45:28 +02:00

44 lines
1.2 KiB
JavaScript

const path = require('path');
require('module-alias')({ base: path.resolve(__dirname, '..', 'api') });
const { resetTermsAcceptance } = require('~/models');
const { askQuestion, silentExit } = require('./helpers');
const connect = require('./connect');
(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 resetTermsAcceptance();
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);
}
});