mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 01:36:06 -04:00
documentation
This commit is contained in:
parent
6e7546e649
commit
ce78c5e6ca
@ -68,6 +68,10 @@ const ENABLED_PROTECTIONS_EVENT_TYPE = "org.matrix.mjolnir.enabled_protections";
|
||||
const PROTECTED_ROOMS_EVENT_TYPE = "org.matrix.mjolnir.protected_rooms";
|
||||
const WARN_UNPROTECTED_ROOM_EVENT_PREFIX = "org.matrix.mjolnir.unprotected_room_warning.for.";
|
||||
const CONSEQUENCE_EVENT_DATA = "org.matrix.mjolnir.consequence";
|
||||
/**
|
||||
* Synapse will tell us where we last got to on polling reports, so we need
|
||||
* to store that for pagination on further polls
|
||||
*/
|
||||
export const REPORT_POLL_EVENT_TYPE = "org.matrix.mjolnir.report_poll";
|
||||
|
||||
export class Mjolnir {
|
||||
|
@ -20,20 +20,23 @@ import { LogLevel } from "matrix-bot-sdk";
|
||||
|
||||
class InvalidStateError extends Error {}
|
||||
|
||||
/**
|
||||
* A class to poll synapse's report endpoint, so we can act on new reports
|
||||
*
|
||||
* @param mjolnir The running Mjolnir instance
|
||||
* @param manager The report manager in to which we feed new reports
|
||||
*/
|
||||
export class ReportPoller {
|
||||
/*
|
||||
/**
|
||||
* https://matrix-org.github.io/synapse/latest/admin_api/event_reports.html
|
||||
* "from" is an opaque token that is returned from the API to paginate reports
|
||||
*/
|
||||
private from = 0;
|
||||
/**
|
||||
* The currently-pending report poll
|
||||
*/
|
||||
private timeout: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
/**
|
||||
* A class to poll synapse's report endpoint, so we can act on new reports
|
||||
*
|
||||
* @param mjolnir The running Mjolnir instance
|
||||
* @param manager The report manager in to which we feed new reports
|
||||
*/
|
||||
constructor(
|
||||
private mjolnir: Mjolnir,
|
||||
private manager: ReportManager,
|
||||
|
Loading…
Reference in New Issue
Block a user