removed federation, closes #12

This commit is contained in:
Aine
2022-08-29 19:58:54 +03:00
parent e52de55e1a
commit 505a1b42d7
6 changed files with 4 additions and 14 deletions

View File

@@ -35,7 +35,6 @@ env vars
<summary>other optional config parameters</summary>
* **POSTMOOGLE_NOOWNER** - allow change room settings by any room partisipant
* **POSTMOOGLE_FEDERATION** - allow usage of Postmoogle by users from others homeservers
* **POSTMOOGLE_NOENCRYPTION** - disable encryption support
* **POSTMOOGLE_STATUSMSG** - presence status message
* **POSTMOOGLE_SENTRY_DSN** - sentry DSN

View File

@@ -18,7 +18,6 @@ import (
// Bot represents matrix bot
type Bot struct {
noowner bool
federation bool
prefix string
domain string
allowedUsers []*regexp.Regexp
@@ -36,14 +35,14 @@ type Bot struct {
func New(
lp *linkpearl.Linkpearl,
log *logger.Logger,
prefix, domain string,
noowner, federation bool,
prefix string,
domain string,
noowner bool,
allowedUsers []*regexp.Regexp,
allowedAdmins []*regexp.Regexp,
) *Bot {
b := &Bot{
noowner: noowner,
federation: federation,
prefix: prefix,
domain: domain,
allowedUsers: allowedUsers,

View File

@@ -124,11 +124,6 @@ func (b *Bot) handleCommand(ctx context.Context, evt *event.Event, commandSlice
return
}
// ignore requests over federation if disabled
if !b.federation && evt.Sender.Homeserver() != b.lp.GetClient().UserID.Homeserver() {
return
}
if !cmd.allowed(evt.Sender, evt.RoomID) {
b.SendNotice(ctx, evt.RoomID, "not allowed to do that, kupo")
return

View File

@@ -87,7 +87,7 @@ func initBot(cfg *config.Config) {
// nolint // Fatal = panic, not os.Exit()
log.Fatal("cannot initialize matrix bot: %v", err)
}
mxb = bot.New(lp, mxlog, cfg.Prefix, cfg.Domain, cfg.NoOwner, cfg.Federation, cfg.Users, cfg.Admins)
mxb = bot.New(lp, mxlog, cfg.Prefix, cfg.Domain, cfg.NoOwner, cfg.Users, cfg.Admins)
log.Debug("bot has been created")
}

View File

@@ -34,7 +34,6 @@ func New() (*Config, error) {
Port: env.String("port", defaultConfig.Port),
NoEncryption: env.Bool("noencryption"),
NoOwner: env.Bool("noowner"),
Federation: env.Bool("federation"),
MaxSize: env.Int("maxsize", defaultConfig.MaxSize),
StatusMsg: env.String("statusmsg", defaultConfig.StatusMsg),
Users: userPatterns,

View File

@@ -20,8 +20,6 @@ type Config struct {
NoEncryption bool
// NoOwner allows room settings change by any participant
NoOwner bool
// Federation allows usage of Postmoogle by users from other homeservers
Federation bool
// Prefix for commands
Prefix string
// MaxSize of an email (including attachments)