Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .cspell-allowed-words
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
aminda
anymore
appservice
appservices
autojoin
backingstore
baldr
banlist
cirillo
conduwuit
csam
datadirectory
deanonymisation
deanonymise
deduplicator
displayname
dockerised
dogfooded
draupnir
draupnirfactory
draupnir's
draupnirs
errcode
eventcontext
filepermissions
foobar
gnuxie
healthz
homeserver
homeservers
honor
honoring
ingword
introspected
joinable
joinwave
journalctl
langua
legacymentions
localpart
loggable
makeconfirmation
managementroom
marewolf
mjolnir
mjolnirs
moderationroom
msgtype
mxid
mxids
mytable
myurl
ncii
neko
nnedword
nodesource
nord
nsfw
oneliner
pantalaimon
powerlevel
precalculated
preemptively
preminor
protectrooms
psql
qmarks
ralston
redacter
resultify
roomid
rustup
safemode
savepoints
schemav
sdkmps
seibel's
sextortion
shadowban
shadowbanned
spammy
spamtesting
stringfrom
sublicensable
sweepy
syncloop
takedown
takendown
tatsuo
tojoin
trusteduser
tsnode
tsplugin
typebox
uisi
unbannable
unbanner
unixepoch
unprotecting
unredacted
unrestrict
unrestriction
unstarted
unsuspension
useraccount
vars
webapi
webapis
webproxy
writeback
yeha
17 changes: 17 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{

"$schema": "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
"version": "0.2",
"language": "en_GB",
"words": ["add", "to", ".cspell-allowed-words", "instead"],
"flagWords": ["flaggedword", "hte"],
"dictionaries": ["cspell-allowed-words"],

"dictionaryDefinitions": [
{
"name": "cspell-allowed-words",
"path": "./.cspell-allowed-words",
"addWords": true
}
]
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ for installation instructions and usage guides.
specific moderation tasks by shadowing the actions taken by your Matrix
Client.

- Draupnir synchonises bans for users, and servers across all of the matrix
- Draupnir synchronises bans for users, and servers across all of the matrix
rooms that you moderate

- Draupnir can protect your community by applying policies from community
Expand Down Expand Up @@ -116,7 +116,7 @@ Mjolnir**.
the rewrite of the core of Draupnir into the
[matrix-protection-suite](https://github.com/Gnuxie/matrix-protection-suite),
providing all the Matrix client code required to operate a protection
platform. The matrix-protection-suite also covers severall shortfalls in the
platform. The matrix-protection-suite also covers several shortfalls in the
available SDK's, providing event parsing and types that keep code secure and
sound. The
[interface-manager](https://github.com/the-draupnir-project/interface-manager)
Expand Down
8 changes: 4 additions & 4 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import tsplugin from "@typescript-eslint/eslint-plugin";

// this configuration file stilli includes random shite from these directories
// and I do not understand why. It is one of the most frustraiting things
// this configuration file still includes random shite from these directories
// and I do not understand why. It is one of the most frustrating things
// my guess is that there is some hidden ambient config that is included
// full of eslint defaults that we can't intercept??
// I don't know, but it's one of the most frustraiting things ever.
// I don't know, but it's one of the most frustrating things ever.
const ignores = [
"**/docs/**",
"**/.husky/**",
Expand Down Expand Up @@ -44,7 +44,7 @@ const rulesFromMPS = {
};

export default tseslint.config({
// This is a typescript-eslint configurartion for typescript files.
// This is a typescript-eslint configuration for typescript files.
// This will not work against js files.
files: ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"],
extends: [eslint.configs.recommended, ...tseslint.configs.strictTypeChecked],
Expand Down
6 changes: 3 additions & 3 deletions src/Draupnir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { IConfig } from "./config";
import { LogLevel } from "matrix-bot-sdk";
import {
ARGUMENT_PROMPT_LISTENER,
DEFAUILT_ARGUMENT_PROMPT_LISTENER,
DEFAULT_ARGUMENT_PROMPT_LISTENER,
makeListenerForArgumentPrompt as makeListenerForArgumentPrompt,
makeListenerForPromptDefault,
} from "./commands/interface-manager/MatrixPromptForAccept";
Expand Down Expand Up @@ -95,7 +95,7 @@ const log = new Logger("Draupnir");
export class Draupnir implements Client, MatrixAdaptorContext {
/**
* This is for users who are not listed on a watchlist,
* but have been flagged by the automatic spam detection as suispicous
* but have been flagged by the automatic spam detection as suspicious
*/
public unlistedUserRedactionQueue = new UnlistedUserRedactionQueue();

Expand Down Expand Up @@ -188,7 +188,7 @@ export class Draupnir implements Client, MatrixAdaptorContext {
)
);
this.reactionHandler.on(
DEFAUILT_ARGUMENT_PROMPT_LISTENER,
DEFAULT_ARGUMENT_PROMPT_LISTENER,
makeListenerForPromptDefault(
this.commandRoomID,
this.commandDispatcher,
Expand Down
8 changes: 4 additions & 4 deletions src/DraupnirBotMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export function constructWebAPIs(draupnir: Draupnir): WebAPIs {
* This includes the webAPIS that accompany Draupnir in bot mode.
*
* The appservice also implements `SafeModeToggle` but has different requirements.
* This interface is exlusively used by the entrypoints to draupnir's bot mode.
* This interface is exclusively used by the entrypoints to draupnir's bot mode.
*/
interface BotModeTogle extends SafeModeToggle {
interface BotModeToggle extends SafeModeToggle {
encryptionInitialized(): Promise<void>;
stopEverything(): void;
startFromScratch(
Expand All @@ -79,7 +79,7 @@ interface BotModeTogle extends SafeModeToggle {
): Promise<Result<SafeModeDraupnir>>;
}

export class DraupnirBotModeToggle implements BotModeTogle {
export class DraupnirBotModeToggle implements BotModeToggle {
private draupnir: Draupnir | null = null;
private safeModeDraupnir: SafeModeDraupnir | null = null;
private webAPIs: WebAPIs | null = null;
Expand Down Expand Up @@ -131,7 +131,7 @@ export class DraupnirBotModeToggle implements BotModeTogle {
clientsInRoomMap,
DefaultEventDecoder
);
// needed to have accurate join infomration.
// needed to have accurate join information.
(
await clientsInRoomMap.makeClientRooms(clientUserID, async () =>
joinedRoomsSafe(client)
Expand Down
10 changes: 5 additions & 5 deletions src/appservice/AppService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class MjolnirAppService {
public readonly commands: AppserviceCommandHandler;

/**
* The constructor is private because we want to ensure intialization steps are followed,
* The constructor is private because we want to ensure initialization steps are followed,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, correction should be "initialisation"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole file has a lot of initialization / initialize.

* use `makeMjolnirAppService`.
*/
private constructor(
Expand Down Expand Up @@ -91,7 +91,7 @@ export class MjolnirAppService {
/**
* Make and initialize the app service from the config, ready to be started.
* @param config The appservice's config, not draupnirs's, see `src/appservice/config`.
* @param dataStore A datastore to persist infomration about the draupnir to.
* @param dataStore A datastore to persist information about the draupnir to.
* @param registrationFilePath A file path to the registration file to read the namespace and tokens from.
* @returns A new `MjolnirAppService`.
*/
Expand Down Expand Up @@ -249,7 +249,7 @@ export class MjolnirAppService {
}

public onUserQuery(_queriedUser: MatrixUser) {
return {}; // auto-provision users with no additonal data
return {}; // auto-provision users with no additional data
}

// Provision a new draupnir for the invitee when the appservice bot (designated by this.bridge.botUserId) is invited to a room.
Expand Down Expand Up @@ -289,7 +289,7 @@ export class MjolnirAppService {
.getClient()
.sendText(
mxEvent.room_id,
"Please accept the inviations to the newly provisioned rooms. These will be the home of your Draupnir Instance. This room will not be used in the future."
"Please accept the invitations to the newly provisioned rooms. These will be the home of your Draupnir Instance. This room will not be used in the future."
);
} catch (e: unknown) {
log.error(
Expand All @@ -307,7 +307,7 @@ export class MjolnirAppService {
);
}
try {
// reject the invite to keep the room clean and make sure the invetee doesn't get confused and think this is their draupnir.
// reject the invite to keep the room clean and make sure the invitee doesn't get confused and think this is their draupnir.
await this.bridge.getBot().getClient().leaveRoom(mxEvent.room_id);
} catch (e: unknown) {
log.warn("Unable to reject an invite to a room", e);
Expand Down
4 changes: 2 additions & 2 deletions src/appservice/AppServiceDraupnirManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class AppServiceDraupnirManager {
},
});
if (!isStringRoomID(managementRoomID)) {
throw new TypeError(`${managementRoomID} malformed managmentRoomID`);
throw new TypeError(`${managementRoomID} malformed managementRoomID`);
}
const draupnir = await this.makeInstance(
mjolnirLocalPart,
Expand Down Expand Up @@ -256,7 +256,7 @@ export class AppServiceDraupnirManager {
}

/**
* Utility that creates a matrix client for a virtual user on our homeserver with the specified loclapart.
* Utility that creates a matrix client for a virtual user on our homeserver with the specified localpart.
* @param localPart The localpart of the virtual user we need a client for.
* @returns A bridge intent with the complete mxid of the virtual user and a MatrixClient.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/appservice/bot/AppserviceBotCommandDispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function makeAppserviceCommandNormaliser(
isAllowedOnlySymbolPrefixes: false,
additionalPrefixes: ["admin"],
getDisplayName: function (): string {
// TODO: I don't nkow how we're going to do this yet but we'll
// TODO: I don't know how we're going to do this yet but we'll
// figure it out one day.
return "admin";
},
Expand Down
4 changes: 2 additions & 2 deletions src/appservice/bot/AppserviceCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { MatrixEventContext } from "../../commands/interface-manager/MPSMatrixIn
import { MatrixReactionHandler } from "../../commands/interface-manager/MatrixReactionHandler";
import {
ARGUMENT_PROMPT_LISTENER,
DEFAUILT_ARGUMENT_PROMPT_LISTENER,
DEFAULT_ARGUMENT_PROMPT_LISTENER,
makeListenerForArgumentPrompt,
makeListenerForPromptDefault,
} from "../../commands/interface-manager/MatrixPromptForAccept";
Expand Down Expand Up @@ -82,7 +82,7 @@ export class AppserviceCommandHandler {
)
);
this.reactionHandler.on(
DEFAUILT_ARGUMENT_PROMPT_LISTENER,
DEFAULT_ARGUMENT_PROMPT_LISTENER,
makeListenerForPromptDefault(
this.adminRoomID,
this.commandDispatcher,
Expand Down
2 changes: 1 addition & 1 deletion src/appservice/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { Value } from "@sinclair/typebox/value";
/**
* This file provides the entrypoint for the appservice mode for draupnir.
* A registration file can be generated `ts-node src/appservice/cli.ts -r -u "http://host.docker.internal:9000"`
* and the appservice can be started with `ts-node src/appservice/cli -p 9000 -c your-confg.yaml`.
* and the appservice can be started with `ts-node src/appservice/cli -p 9000 -c your-config.yaml`.
*/
const cli = new Cli({
registrationPath: "draupnir-registration.yaml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const SchemaOptions = {
),
legacyUpgrade(db) {
// An older version of this store used a different schema management system
// fortunatley the data is just a psersistent cache so we don't need to worry about removing it.
// fortunately the data is just a persistent cache so we don't need to worry about removing it.
db.exec(`
DROP TABLE room_state_event;
DROP TABLE room_info;
Expand Down Expand Up @@ -225,7 +225,7 @@ export class SqliteRoomStateBackingStore
);
const deleteRoom = this.db.transaction(() => {
deleteStateStatement.run(roomID);
deleteMetaStatement.run(roomID); // needs to be last to avoid violating foriegn key cnostraint
deleteMetaStatement.run(roomID); // needs to be last to avoid violating foreign key constraint
});
try {
deleteRoom();
Expand Down
2 changes: 1 addition & 1 deletion src/capabilities/RoomTakedownCapability.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const RoomTakedownCapability = Type.Intersect([
Capability,
]);
// we'll probably want to include room details too so we can provide some
// rudinemtary information to takedown.
// rudimentary information to takedown.
// I'd make the fields optional however because it may be impossible
// to get those details on conduwuit.
export type RoomTakedownCapability = {
Expand Down
2 changes: 1 addition & 1 deletion src/capabilities/StandardUserConsequencesRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class StandardUserConsequencesRenderer implements UserConsequences {

describeCapabilityRenderer<UserConsequences, Draupnir>({
name: "StandardUserConsequences",
description: "Renders your mum uselesss",
description: "Renders your mum useless",
interface: "UserConsequences",
factory(description, draupnir, capability) {
return new StandardUserConsequencesRenderer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export class SynapseAdminRoomTakedownCapability
details = detailsResponse.ok;
}
log.debug("Taking down room", roomID);
// we use delte V1 because clients do not pick up the user's own leave event
// we use delete V1 because clients do not pick up the user's own leave event
// in V2 and i don't know why.
// That is very important in the case of stuck invitations.
const takedownResult = await this.adminClient.deleteRoom(roomID, {
Expand All @@ -103,7 +103,7 @@ export class SynapseAdminRoomTakedownCapability
describeCapabilityProvider<Draupnir>({
name: SynapseAdminRoomTakedownCapability.name,
interface: "RoomTakedownCapability",
description: "Takesdown rooms using the synapse admin API",
description: "Takes down rooms using the synapse admin API",
factory(description, draupnir) {
if (draupnir.synapseAdminClient === undefined) {
throw new TypeError(
Expand Down
4 changes: 2 additions & 2 deletions src/commands/DraupnirCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import { DraupnirProtectionsCapabilityCommand } from "./ProtectionsCapabilitiesC
import { JoinWaveCommandTable } from "../protections/JoinWaveShortCircuit";
import { DraupnirTakedownCommand } from "./server-admin/Takedown";
import { SynapseAdminSuspendUserCommand } from "./server-admin/SuspendCommand";
import { SynpaseAdminUnrestrictUserCommand } from "./server-admin/UnrestrictCommand";
import { SynapseAdminUnrestrictUserCommand } from "./server-admin/UnrestrictCommand";
import { DraupnirPolicyRemoveCommand } from "./unban/PolicyRemove";

// TODO: These commands should all be moved to subdirectories tbh and this
Expand All @@ -67,7 +67,7 @@ export const SynapseAdminCommands = new StandardCommandTable("synapse admin")
.internCommand(SynapseAdminHijackRoomCommand, ["hijack", "room"])
.internCommand(SynapseAdminShutdownRoomCommand, ["shutdown", "room"])
.internCommand(SynapseAdminSuspendUserCommand, ["suspend"])
.internCommand(SynpaseAdminUnrestrictUserCommand, ["unrestrict"]);
.internCommand(SynapseAdminUnrestrictUserCommand, ["unrestrict"]);

const DraupnirCommands = new StandardCommandTable("draupnir")
.internCommand(DraupnirAliasMoveCommand, ["alias", "move"])
Expand Down
Loading