dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit ac32bdc7f13bc333b86d14d2844034d58c56c800
parent e38d1d4fca2aa8c82f20ccce7bc13850ba2d4dd8
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Thu,  2 Mar 2023 23:45:10 -0800

can send multiline raw clearsign message to @0 to get information

Diffstat:
Mpkg/web/handlers/api/v1/slashInterceptor.go | 20++++++++++++++++++++
1 file changed, 20 insertions(+), 0 deletions(-)

diff --git a/pkg/web/handlers/api/v1/slashInterceptor.go b/pkg/web/handlers/api/v1/slashInterceptor.go @@ -964,6 +964,26 @@ func handlePm0(c *Command, msg string) (handled bool) { c.err = ErrRedirect return true + } else if b, _ := clearsign.Decode([]byte(msg)); b != nil { + if p, err := packet.Read(b.ArmoredSignature.Body); err == nil { + if sig, ok := p.(*packet.Signature); ok { + zero := c.getZeroUser() + msg := fmt.Sprintf("<br />"+ + "<table %s>"+ + "<tr><td align=\"right\">Signature made:&nbsp;&nbsp;</td><td><span style=\"color: #82e17f;\">%s</span></td></tr>"+ + "<tr><td align=\"right\">Fingerprint:&nbsp;&nbsp;</td><td><span style=\"color: #82e17f;\">%s</span></td></tr>"+ + "<tr><td align=\"right\">Issuer:&nbsp;&nbsp;</td><td><span style=\"color: #82e17f;\">%s</span></td></tr>"+ + "</table>", + zero.GenerateChatStyle(), + sig.CreationTime.Format(time.RFC1123), + utils.FormatPgPFingerprint(sig.IssuerFingerprint), + utils.Ternary(sig.SignerUserId != nil, *sig.SignerUserId, "n/a")) + c.zeroMsg(msg) + c.err = ErrRedirect + return true + } + } + } else if c.upload != nil { // If we sent a clearsign file to @0, the bot will reply with information about the signature