commit 9cc26121cb860a0191ed5eb5fca2e8536fe8e003
parent a7470a0b193a3a02871120a27fe0960d6dfa56ac
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Thu, 2 Mar 2023 22:50:19 -0800
move code
Diffstat:
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/pkg/web/handlers/api/v1/topBarHandler.go b/pkg/web/handlers/api/v1/topBarHandler.go
@@ -1021,20 +1021,6 @@ func convertLinks(in string, getUserByUsername func(string) (database.User, erro
return quote + newRest
}
-func convertPGPClearsignToFile(html string, authUserID database.UserID) string {
- if b, _ := clearsign.Decode([]byte(html)); b != nil {
- startIdx := strings.Index(html, pgpSignedPrefix)
- endIdx := strings.Index(html, pgpSignedSuffix)
- tmp := html[startIdx : endIdx+len(pgpSignedSuffix)]
- upload, _ := database.CreateUpload("pgp_clearsign.txt", []byte(tmp), authUserID)
- msgBefore := html[0:startIdx]
- msgAfter := html[endIdx+len(pgpSignedSuffix):]
- html = msgBefore + ` [<a href="/uploads/` + upload.FileName + `" rel="noopener noreferrer" target="_blank">` + upload.OrigFileName + `</a>] ` + msgAfter
- html = strings.TrimSpace(html)
- }
- return html
-}
-
func extractPGPMessage(html string) (out string) {
startIdx := strings.Index(html, pgpPrefix)
endIdx := strings.Index(html, pgpSuffix)
@@ -1090,6 +1076,20 @@ func convertPGPPublicKeyToFile(html string, authUserID database.UserID) string {
return html
}
+func convertPGPClearsignToFile(html string, authUserID database.UserID) string {
+ if b, _ := clearsign.Decode([]byte(html)); b != nil {
+ startIdx := strings.Index(html, pgpSignedPrefix)
+ endIdx := strings.Index(html, pgpSignedSuffix)
+ tmp := html[startIdx : endIdx+len(pgpSignedSuffix)]
+ upload, _ := database.CreateUpload("pgp_clearsign.txt", []byte(tmp), authUserID)
+ msgBefore := html[0:startIdx]
+ msgAfter := html[endIdx+len(pgpSignedSuffix):]
+ html = msgBefore + ` [<a href="/uploads/` + upload.FileName + `" rel="noopener noreferrer" target="_blank">` + upload.OrigFileName + `</a>] ` + msgAfter
+ html = strings.TrimSpace(html)
+ }
+ return html
+}
+
func convertInlinePGPPublicKey(inlinePKey string) string {
// If it contains new lines, it was probably pasted using multi-line text box
if strings.Contains(inlinePKey, "\n") {