Topics.post without parsing
-
So, I'm pretty sure that
Tpoics.post
callsfilter:post.raw
oncontent
. Is there any way of passing a direct HTML string? If not, is there another way of achieving the same tasks asTopic.post
? I'm pretty sure it's justTopic.create
followed byTopic.reply
anyways. -
the post-parsing happens on post-request, not before saving the posts.
So you'd need to switch off anyfilter:parse.raw
calls before post-deliver (of certain posts)?As of this codefilter:messaging.parse
gets called with data-object that contains the parsed message and the original one.
So using a high priority (or low, I simply can't remember this fact ) for your hook and replacingdata.parsed
anddata.parsedMessage
withdata.message
inside should fit your needs (even so you wouldn't minimize other plugins performance). -
@frissdiegurke said:
filter:messaging.parse
gets called with data-object that contains the parsed message and the original one.So using a high priority (or low, I simply can't remember this fact ) for your hook and replacing
data.parsed
anddata.parsedMessage
withdata.message
inside should fit your needs (even so you wouldn't minimize other plugins performance).No, man. It's for chat messages only. @pitaj wants to interact with topic posts.
UPD: I'll try to dig the subj.
-
@Mega Ah, my fault.
So the real post-parsing works by calling thecomposer.renderPreview
socket-id? because the search for filter:parse.raw doesn't show up any other possibilities just curious.EDIT: my mind is tricking me out. please ignore
-
Uhm, it was kinda not so easy to dig it
@pitaj said:
So, I'm pretty sure that
Tpoics.post
callsfilter:post.raw
oncontent
. Is there any way of passing a direct HTML string? If not, is there another way of achieving the same tasks asTopic.post
?Yes,
Topics.post()
entailsfilter:parse.post
and I don't see any possibility to avoid it without core changing.
https://github.com/NodeBB/NodeBB/blob/master/src/topics/create.js#L255But, actually, if you even so wanna include raw html into posts, why would you just create another plugin?
Let's say BB-code
[rawhtml][/rawhtml]
. It'll be listening tofilter:post.parse
and will havepriority
more than Markdown and friends. Now all what the plugin should do > just replace< > "
inside BB-code to right symbols, and removes[rawhtml][/rawhtml]
from post.What do you think, will it okay for you? :3
-
@Mega that solution has XSS vulnerability written all over it. It I add that tag as possible, anyone could use it in a post, which could add script tags, etc. I could maybe add a private key or something, but that is still dangerous.
-