mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-06-28 07:32:30 +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
|
||||
|
||||
Phase 2:
|
||||
* [ ] Pantalaimon support
|
||||
* [x] Pantalaimon support
|
||||
* [ ] Redact messages on ban (optionally)
|
||||
* [ ] Less spam in management room
|
||||
* [ ] 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"
|
||||
|
||||
# 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"
|
||||
|
||||
# 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
|
||||
dataPath: "/data/storage"
|
||||
|
||||
|
|
|
@ -19,6 +19,11 @@ import * as config from "config";
|
|||
interface IConfig {
|
||||
homeserverUrl: string;
|
||||
accessToken: string;
|
||||
pantalaimon: {
|
||||
use: boolean;
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
dataPath: string;
|
||||
autojoin: boolean;
|
||||
managementRoom: string;
|
||||
|
|
22
src/index.ts
22
src/index.ts
|
@ -19,6 +19,7 @@ import {
|
|||
AutojoinRoomsMixin,
|
||||
LogService,
|
||||
MatrixClient,
|
||||
PantalaimonClient,
|
||||
Permalinks,
|
||||
RichConsoleLogger,
|
||||
SimpleFsStorageProvider
|
||||
|
@ -29,14 +30,21 @@ import { Mjolnir } from "./Mjolnir";
|
|||
|
||||
LogService.setLogger(new RichConsoleLogger());
|
||||
|
||||
const storage = new SimpleFsStorageProvider(path.join(config.dataPath, "bot.json"));
|
||||
const client = new MatrixClient(config.homeserverUrl, config.accessToken, storage);
|
||||
|
||||
if (config.autojoin) {
|
||||
AutojoinRoomsMixin.setupOnClient(client);
|
||||
}
|
||||
|
||||
(async function () {
|
||||
const storage = new SimpleFsStorageProvider(path.join(config.dataPath, "bot.json"));
|
||||
|
||||
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) {
|
||||
AutojoinRoomsMixin.setupOnClient(client);
|
||||
}
|
||||
|
||||
const banLists: BanList[] = [];
|
||||
const protectedRooms: { [roomId: string]: string } = {};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user