aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorKushBlazingJudah <59340248+KushBlazingJudah@users.noreply.github.com>2021-11-09 19:37:34 -0400
committerFChannel <>2022-06-19 12:53:29 -0700
commite15bf8cd1375f24251929ff3e13f883f692ee03a (patch)
tree661fec8cc005630a67df1fc4c933a1e8a19f686b /client.go
parent7116705959bad9244893434039a0da9b500f5043 (diff)
slacking off is great; here's part 6
Diffstat (limited to 'client.go')
-rw-r--r--client.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/client.go b/client.go
index 93b72f5..d4462d7 100644
--- a/client.go
+++ b/client.go
@@ -26,11 +26,14 @@ func MediaProxy(url string) string {
return url
}
- MediaHashs[HashMedia(url)] = url
- return "/api/media?hash=" + HashMedia(url)
+ MediaHashs[util.HashMedia(url)] = url
+ return "/api/media?hash=" + util.HashMedia(url)
}
func ParseAttachment(obj activitypub.ObjectBase, catalog bool) template.HTML {
+ // TODO: convert all of these to Sprintf statements, or use strings.Builder or something, anything but this really
+ // string concatenation is highly inefficient _especially_ when being used like this
+
if len(obj.Attachment) < 1 {
return ""
}
@@ -105,7 +108,7 @@ func ParseAttachment(obj activitypub.ObjectBase, catalog bool) template.HTML {
}
func ParseContent(board activitypub.Actor, op string, content string, thread activitypub.ObjectBase) (template.HTML, error) {
-
+ // TODO: should escape more than just < and >, should also escape &, ", and '
nContent := strings.ReplaceAll(content, `<`, "&lt;")
nContent, err := ParseLinkComments(board, op, nContent, thread)
@@ -221,6 +224,7 @@ func ParseLinkTitle(actorName string, op string, content string) string {
content = strings.Replace(content, match[i][0], ">>"+util.ShortURL(actorName, link)+isOP, 1)
}
+ // TODO: this drops more than we need to
content = strings.ReplaceAll(content, "'", "")
content = strings.ReplaceAll(content, "\"", "")
content = strings.ReplaceAll(content, ">", `/\&lt;`)