mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-10-01 05:36:06 +00:00
Support Pantalaimon for encryption support
Requires a special build of the bot-sdk and pantalaimon currently
This commit is contained in:
parent
a2595652b8
commit
517025b6c2
@ -12,7 +12,7 @@ Phase 1:
|
|||||||
* [x] Update lists with new bans/ACLs
|
* [x] Update lists with new bans/ACLs
|
||||||
|
|
||||||
Phase 2:
|
Phase 2:
|
||||||
* [ ] Pantalaimon support
|
* [x] Pantalaimon support
|
||||||
* [ ] Redact messages on ban (optionally)
|
* [ ] Redact messages on ban (optionally)
|
||||||
* [ ] Less spam in management room
|
* [ ] Less spam in management room
|
||||||
* [ ] Vet rooms on startup option
|
* [ ] Vet rooms on startup option
|
||||||
|
@ -1,9 +1,23 @@
|
|||||||
# Where the homeserver is located (client-server URL)
|
# Where the homeserver is located (client-server URL). This should point at
|
||||||
|
# pantalaimon if you're using that.
|
||||||
homeserverUrl: "https://matrix.org"
|
homeserverUrl: "https://matrix.org"
|
||||||
|
|
||||||
# The access token for the bot to use
|
# The access token for the bot to use. Do not populate if using Pantalaimon.
|
||||||
accessToken: "YOUR_TOKEN_HERE"
|
accessToken: "YOUR_TOKEN_HERE"
|
||||||
|
|
||||||
|
# Pantalaimon options (https://github.com/matrix-org/pantalaimon)
|
||||||
|
pantalaimon:
|
||||||
|
# If true, accessToken above is ignored and the username/password below will be
|
||||||
|
# used instead. The access token of the bot will be stored in the dataPath.
|
||||||
|
use: false
|
||||||
|
|
||||||
|
# The username to login with.
|
||||||
|
username: mjolnir
|
||||||
|
|
||||||
|
# The password to login with. Can be removed after the bot has logged in once and
|
||||||
|
# stored the access token.
|
||||||
|
password: your_password
|
||||||
|
|
||||||
# The directory the bot should store various bits of information in
|
# The directory the bot should store various bits of information in
|
||||||
dataPath: "/data/storage"
|
dataPath: "/data/storage"
|
||||||
|
|
||||||
|
@ -19,6 +19,11 @@ import * as config from "config";
|
|||||||
interface IConfig {
|
interface IConfig {
|
||||||
homeserverUrl: string;
|
homeserverUrl: string;
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
|
pantalaimon: {
|
||||||
|
use: boolean;
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
};
|
||||||
dataPath: string;
|
dataPath: string;
|
||||||
autojoin: boolean;
|
autojoin: boolean;
|
||||||
managementRoom: string;
|
managementRoom: string;
|
||||||
|
12
src/index.ts
12
src/index.ts
@ -19,6 +19,7 @@ import {
|
|||||||
AutojoinRoomsMixin,
|
AutojoinRoomsMixin,
|
||||||
LogService,
|
LogService,
|
||||||
MatrixClient,
|
MatrixClient,
|
||||||
|
PantalaimonClient,
|
||||||
Permalinks,
|
Permalinks,
|
||||||
RichConsoleLogger,
|
RichConsoleLogger,
|
||||||
SimpleFsStorageProvider
|
SimpleFsStorageProvider
|
||||||
@ -29,14 +30,21 @@ import { Mjolnir } from "./Mjolnir";
|
|||||||
|
|
||||||
LogService.setLogger(new RichConsoleLogger());
|
LogService.setLogger(new RichConsoleLogger());
|
||||||
|
|
||||||
|
(async function () {
|
||||||
const storage = new SimpleFsStorageProvider(path.join(config.dataPath, "bot.json"));
|
const storage = new SimpleFsStorageProvider(path.join(config.dataPath, "bot.json"));
|
||||||
const client = new MatrixClient(config.homeserverUrl, config.accessToken, storage);
|
|
||||||
|
let client: MatrixClient;
|
||||||
|
if (config.pantalaimon.use) {
|
||||||
|
const pantalaimon = new PantalaimonClient(config.homeserverUrl, storage);
|
||||||
|
client = await pantalaimon.createClientWithCredentials(config.pantalaimon.username, config.pantalaimon.password);
|
||||||
|
} else {
|
||||||
|
client = new MatrixClient(config.homeserverUrl, config.accessToken, storage);
|
||||||
|
}
|
||||||
|
|
||||||
if (config.autojoin) {
|
if (config.autojoin) {
|
||||||
AutojoinRoomsMixin.setupOnClient(client);
|
AutojoinRoomsMixin.setupOnClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
(async function () {
|
|
||||||
const banLists: BanList[] = [];
|
const banLists: BanList[] = [];
|
||||||
const protectedRooms: { [roomId: string]: string } = {};
|
const protectedRooms: { [roomId: string]: string } = {};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user