mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-06-08 19:32:17 +03:00
minor message changes
This commit is contained in:
parent
7677d48704
commit
dc6fa21eaa
11
host.go
11
host.go
@ -814,25 +814,26 @@ func (h *Host) InitCommands(c *chat.Commands) {
|
||||
return nil
|
||||
})
|
||||
if kicked != nil {
|
||||
room.Send(message.NewAnnounceMsg(fmt.Sprintf("%v were kicked during pubkey reverification.", kicked)))
|
||||
room.Send(message.NewAnnounceMsg("Kicked during pubkey reverification: " + strings.Join(kicked, ", ")))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
allowlistStatus := func() (msgs []string) {
|
||||
if h.auth.AllowlistMode() {
|
||||
msgs = []string{"The allowlist is currently enabled."}
|
||||
msgs = []string{"allowlist enabled"}
|
||||
} else {
|
||||
msgs = []string{"The allowlist is currently disabled."}
|
||||
msgs = []string{"allowlist disabled"}
|
||||
}
|
||||
allowlistedUsers := []string{}
|
||||
allowlistedKeys := []string{}
|
||||
// TODO: if we switch the loops, we can get unlisted users instead of unconnected keys easily
|
||||
h.auth.allowlist.Each(func(key string, item set.Item) error {
|
||||
keyFP := item.Key()
|
||||
if forConnectedUsers(func(user *chat.Member, pk ssh.PublicKey) error {
|
||||
if pk != nil && sshd.Fingerprint(pk) == keyFP {
|
||||
allowlistedUsers = append(allowlistedUsers, user.Name())
|
||||
return errors.New("not an actual error, but exit early because we found the key")
|
||||
return io.EOF
|
||||
}
|
||||
return nil
|
||||
}) == nil {
|
||||
@ -842,7 +843,7 @@ func (h *Host) InitCommands(c *chat.Commands) {
|
||||
return nil
|
||||
})
|
||||
if len(allowlistedUsers) != 0 {
|
||||
msgs = append(msgs, fmt.Sprintf("The following connected users are on the allowlist: %v", allowlistedUsers))
|
||||
msgs = append(msgs, "Connected users on the allowlist: "+strings.Join(allowlistedUsers, ", "))
|
||||
}
|
||||
if len(allowlistedKeys) != 0 {
|
||||
msgs = append(msgs, fmt.Sprintf("The following keys of not connected users are on the allowlist: %v", allowlistedKeys))
|
||||
|
Loading…
x
Reference in New Issue
Block a user