how to access meta.config.maximumFileSize in plugin client side js?

Plugin Development
  • Hi.

    Since nodebb-plugin-composer-redactor don't listen to meta.config.maximumFileSize and I need to restrict this a bit
    I've modified redactor.js to this:
    traverseFile: function(file, e) {
    var maxFileSize = 1500 * 1024;
    if(file.size > maxFileSize){
    this.modal.close();
    this.selection.restore();
    this.core.setCallback('fileUploadError', 'file-size-error'); //needed?
    return app.alertError('[errormessage]',20000);
    }

    Is there a simple way to make maxFileSize contain the meta.config.maximumFileSize value instead?

  • It is available in the client side config object. You can use it as config.maximumFileSize


Suggested Topics


  • 0 Votes
    10 Posts
    422 Views

    topics.getUnreadData doesn't take an array of pids. You should use Topics.hasReadTopics(tids, uid);

  • 0 Votes
    1 Posts
    198 Views

    I have setup nodebb successfully with plugin mardown installed but the problem is when I redirect to this url (https://vgolang.com/topic/10/test-code) from the topic list in homepage, the highlighter work fine.

    But when I reload the page, the code highlighter has gone with no error in console. Could someone help me check this?, thanks so much!

  • 0 Votes
    1 Posts
    1k Views

    Suppose there are two files.

    library.js in the /nodebb-plugin-namePlugin
    file.js in /nodebb-plugin-namePlugin/static/lib

    Now I must do a lot of operation in my library.js and I must check when user is created. So I use the hook and It's everything ok, but, after I must my check in library I need to send a message to my file.js to change background color of a component. The proble is that I used this to communicate:

    websockets = module.parent.require('./socket.io'), //library.js websockets.in('uid_' + data.uid).emit('hash', { 'username': data.data.username }); //file.js socket.on('hash',function(){ console.log("DOG); });

    The problem is that I don't have data.uid value because I'm checking before that an user can registrate himself. Anyone can help me to use websocket without uid or can suggest me other methods?

  • 2 Votes
    18 Posts
    6k Views

    So now, I have questions to the NodeBB development team. @julian

    About @frissdiegurke 's idea.

    What do you think? Is it secure or do you have any better ideas, policies , plans?

    To manage dependencies between plugin,

    Can we enforce to install and activate plugins by dependencies? Or can we give warnings of wrong configurations, dependencies and so on by plugin on admin UI ( dash board? )?

    Do we have secure way to add/remove/modify custom data by plugin in a filtering pipe?

    For example, on filtering hook, data.pluginData.<plugin name> can be always for plugins (means some sure for core will not use it for different reason!! ), whether they are removed or not after filtering. I know if I select good name( random or highly uniq), then it will be quite safe but it will be better if we have an official space.

    If I want to make a npm module which is dedicated to NodeBB while it's not a plugin, then what is good name for. Maybe nodebb-helper-any-name. It may be for individual plugins.

    I had one more, but I forgot what was it while writing.... 🙂

  • 0 Votes
    8 Posts
    3k Views

    I've used hook method in my bbcode plugin (watch Extension block here - http://forum.apxeolog.com/topic/8/nodebb-bbcode-plugin)
    It is greate since:

    If there is no 'parent' plugin there will be no errors (noone call the hook) Plugin priority dosn't matter because hooks should be called after all plugins are loaded