dkforest

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

commit aeb1422e6704b3999a8dfdf44849eb7223e3000c
parent 909870ae1475c3992da8b22dc0ceb6f5547a0c8b
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 28 Jun 2023 13:40:08 -0700

rename vars

Diffstat:
Mcmd/torsign/main.go | 4++--
Mpkg/database/tableChatMessages.go | 18+++++++++---------
2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/cmd/torsign/main.go b/cmd/torsign/main.go @@ -111,8 +111,8 @@ func encodepoint(P []*big.Int) []byte { } func hint(m []byte) *big.Int { - tmp := sha512.Sum512(m) - h := tmp[:] + shaSum := sha512.Sum512(m) + h := shaSum[:] sum := bi(0) for i := 0; i < 2*b; i++ { sum = biAdd(sum, biMul(biExp(bi(2), bi(int64(i))), bi(int64(Bit(h, int64(i)))))) diff --git a/pkg/database/tableChatMessages.go b/pkg/database/tableChatMessages.go @@ -132,7 +132,7 @@ func decryptMessageWithKey(key, msg string) (string, error) { } func (m *ChatMessage) MarshalJSON() ([]byte, error) { - var tmp struct { + var out struct { UUID string Message string RawMessage string @@ -141,16 +141,16 @@ func (m *ChatMessage) MarshalJSON() ([]byte, error) { CreatedAt string IsHellbanned bool } - tmp.UUID = m.UUID - tmp.Message = m.Message - tmp.RawMessage = m.RawMessage - tmp.Username = m.User.Username - tmp.IsHellbanned = m.IsHellbanned + out.UUID = m.UUID + out.Message = m.Message + out.RawMessage = m.RawMessage + out.Username = m.User.Username + out.IsHellbanned = m.IsHellbanned if m.ToUser != nil { - tmp.ToUsername = &m.ToUser.Username + out.ToUsername = &m.ToUser.Username } - tmp.CreatedAt = m.CreatedAt.Format("2006-01-02T15:04:05") - return json.Marshal(tmp) + out.CreatedAt = m.CreatedAt.Format("2006-01-02T15:04:05") + return json.Marshal(out) } func (m *ChatMessage) UserCanSee(user User) bool {