Changing outbound urls
-
Should I write a plugin if I want to change all the postures that link outside of the forum? I dont want to change the urls in the database. It should be a type of filter that changes the urls when rendering the posts.
Example
In the post you have a link to http://www.google.comBut I want http://myproxy.com?u=http://www.google.com
In other words a prefix before the urls and the url must be urlencoded
And a setting in app whatever prefix should be, we can call the plugin prefix or somthing. I know hotel in PHP but not in Javascript. Please advise
$prefixsettinginacp.url_encode($urlfromdb). Maybe this is supereasy todo
-
Have a look at this plugin: https://github.com/psychobunny/nodebb-plugin-youtube/blob/master/library.js
A post filter is probably the most simplest type of plugin that you could make for NodeBB. Using that format you could write a regular expression to find all links and add your prefix
-
Cool, is it easy to get a text field in the acp as setting for this plugin? Iam going to fiddle with this later
-
Have a look here for a sample admin page
https://github.com/NodeBB/nodebb-plugin-kitchen-sink
I wish we could get more contributions to this plugin, us core devs just don't have the time to add all the cool samples and stuff to this plugin
-
Yeah, I love this project. I will try to help out as much as possible. Problem is that I have a newly started company and all my focus is in that now. Food on the table must go first hehe
-
I have to add that the kitchen-sink plugin is using the plain config-access in combination with the old settings-module. That's fine for a few attributes, but when it's getting more you should consider using the Settings Framework that allows you to save objects of any type, etc.
@psychobunny FYI I'm currently working on sth that's related to sample plugins: A rework of my nodebb-grunt-development which contains (currently nearly the only thing it contains xD , even the README didn't get an update yet...) a task to initialize a new module by initial setups.
-
Now I have started my work: https://github.com/Jenkler/nodebb-plugin-postlink
-
Now it works! @psychobunny plz check it out and do a code review if you have the time