feat: Log user ips (#8872)
* wip * store ip and headers * Update admin-file.vue * require admin for view ip/headers * IP (recent) 消した * admin必須 * opt in * clean ips periodically * respect logging setting in drive/files/create
This commit is contained in:
18
packages/backend/src/queue/processors/system/clean.ts
Normal file
18
packages/backend/src/queue/processors/system/clean.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import Bull from 'bull';
|
||||
import { LessThan } from 'typeorm';
|
||||
import { UserIps } from '@/models/index.js';
|
||||
|
||||
import { queueLogger } from '../../logger.js';
|
||||
|
||||
const logger = queueLogger.createSubLogger('clean');
|
||||
|
||||
export async function clean(job: Bull.Job<Record<string, unknown>>, done: any): Promise<void> {
|
||||
logger.info('Cleaning...');
|
||||
|
||||
UserIps.delete({
|
||||
createdAt: LessThan(new Date(Date.now() - (1000 * 60 * 60 * 24 * 90))),
|
||||
});
|
||||
|
||||
logger.succ('Cleaned.');
|
||||
done();
|
||||
}
|
@@ -3,12 +3,14 @@ import { tickCharts } from './tick-charts.js';
|
||||
import { resyncCharts } from './resync-charts.js';
|
||||
import { cleanCharts } from './clean-charts.js';
|
||||
import { checkExpiredMutings } from './check-expired-mutings.js';
|
||||
import { clean } from './clean.js';
|
||||
|
||||
const jobs = {
|
||||
tickCharts,
|
||||
resyncCharts,
|
||||
cleanCharts,
|
||||
checkExpiredMutings,
|
||||
clean,
|
||||
} as Record<string, Bull.ProcessCallbackFunction<Record<string, unknown>> | Bull.ProcessPromiseFunction<Record<string, unknown>>>;
|
||||
|
||||
export default function(dbQueue: Bull.Queue<Record<string, unknown>>) {
|
||||
|
Reference in New Issue
Block a user