Emaze Plugin Help

NodeBB Plugins
  • Okay, thanks for your help so far. When I try the Emaze plugin, I receive this error: ^
    18/2 15:33 [7624] - error: SyntaxError: Unexpected token }
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)

  • I resolved the issue by putting (function(module) { at the top. However, it's not turning my link into an iframe. The http link just remains a link when posted.

  • @JonDoe12 Got a link to the page you're testing?
    Not sure why my paste didn't work, but yes, the full code should be

    (function(module) {
        "use strict";
        var Prezi = {},
            Embed = '<iframe src="http://prezi.com/embed/$1/?bgcolor=ffffff&amp;lock_to_path=0&amp;autoplay=0&amp;autohide_ctrls=0#" allowfullscreen="" mozallowfullscreen="" webkitallowfullscreen="" frameborder="0" height="400" width="550"></iframe>';
        var	Prezi = /<a href="(?:https?:\/\/)?\/prezi.com\/([\w\-_]+)\/.+">.+<\/a>/g;
    
    
        Prezi.parse = function(data, callback) {
    
            if (!data || !data.postData || !data.postData.content) {
                return callback(null, data);
            }
            if (data.postData.content.match(Prezi)) {
                data.postData.content = data.postData.content.replace(Prezi, Embed);
            }
    
            callback(null, data);
        };
    
        module.exports = Prezi;
    }(module));
    

    Just replace the bit between }(module)); and the start for the emaze plugin.

  • The site is in development on my local host, I wish I could link it here. This is my full code for the emaze plugin, but the link just remains a link without becoming an iframe. Update: The prezi plugin doesn't seem to be working either.

    Emaze Plugin:

    (function(module) {    
        "use strict";
        var Emaze = {},
            Embed = '<iframe src="http://app.emaze.com/@$1/$2" width="960px" height="540px" seamless webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
        var Emaze = /<a href="(?:https?:\/\/)?\/app.emaze.com\/@([\w\-_]+)\/([\w\-_]+)">.+<\/a>/g;
    
    
        Emaze.parse = function(data, callback) {
    
        if (!data || !data.postData || !data.postData.content) {
            return callback(null, data);
        }
        if (data.postData.content.match(Emaze)) {
            data.postData.content = data.postData.content.replace(Emaze, Embed);
        }
    
        callback(null, data);
    };
    
    module.exports = Emaze;
    }(module));
    
  • @JonDoe12 Give me 20 minutes or so and I'll spool up a test version of NodeBB and test them out. 👍

  • Thank you. In the mean time, I'll keep cranking away and try to find the issue. I appreciate your help.

    My current theory is that:

    "(?:https?:\/\/)?\/app.emaze.com" 
    

    -may have one too many "/". We're escaping in between the "?" and app.emaze.com. However, I think that would make the URL have three "/" as in:

    https?:///app.emaze.com

    Update on Emaze: Yes, that was it. There were one too many "/". This is the regex that worked for me:

    var Emaze = /<a href="(?:https?:\/\/)?app.emaze.com\/@([\w\-_]+)\/([\w\-_]+)">.+<\/a>/g;
    

    I'm starting on prezi now.

  • @JonDoe12 Prezi will be the same issue in that case. Technically I'd escape the .'s in app.emaze.com too while you're there.

    (Just add a backslash before it.)

  • You two should totally just be collaborators on the plugin :shipit:

  • @julian I'm sure he'll give credit in his files somewhere. That's good enough for me. 🙂 Wouldn't want too much more rep than you Julian. 😆

  • I was just going to let you take most of the credit. It's still your plugin, and you helped me make the modifications. I'm working on a new modification now, though. I'm trying to get the presentations to embed into an area of the user's profile.

    Right now, I'm testing it with the Fullname field on the profile, by entering the URL of the presentations (instead of a human name) and seeing if it parses into an embedded slide show.

    Would this be easy to accomplish? If not, are there any hints you could give me @a_5mith ?

    So far, I've edited the library.js file and replaced data.post and data.post.conent with data.fullname and data.fullname.content. I've also tried changing the hook in plugin.js from:

     { "hook": "filter:parse.post", "method": "parse", "callbacked": true }
    ]
    

    to

     { "hook": "action:user.set", "method": "parse", "callbacked": true }
    ]
    

    I feel like I'm missing something, though. If you're up to it, I'd like to collaborate with you further.


Suggested Topics


  • 0 Votes
    2 Posts
    2k Views

    Never finished it. (Did I publish it on npm? Oops?)

    Since then there has been a few gamification plugins built, for example by @nicolas

  • 0 Votes
    3 Posts
    2k Views

    That error is caused by the following bit of code in src/plugins.js

    paths = paths.map(function(pluginLib) { var parent = path.dirname(pluginLib); return cached.filter(function(libPath) { return libPath.indexOf(parent) !== -1; }); }).reduce(function(prev, cur) { return prev.concat(cur); });

    If paths is an empty array calling reduce will throw that error. We should add better checks to detect that.

  • Forbidden at Login

    General Discussion
    0 Votes
    4 Posts
    3k Views

    Solved! Well, Uberspace ...

    Hope that will help other users to run NodeBB with Uberspace. The problem was the run-file I used for the daemon.

    This is my new code. ([USER]/etc/[YOUR-SERVICE]/run😞

    cd $HOME/[NODEBB-FOLDER] ./nodebb start

    In the official NodeBB documentation the preffered method to start is ./nodebb start.
    Don't follow third party tutorials in this case ... NodeBB seems unstable with other methods to start.

    I will test it further, but for now it seems to work pretty well.

  • 5 Votes
    43 Posts
    20k Views

    @a_5mith 0.6.0 compatible and crash reported by @Tanner is fixed.

    Will be in the next version which includes some other stuff @Tanner requested.

  • 2 Votes
    8 Posts
    5k Views

    Wow, that's pretty interesting... I did notice that chjj's marked was more of an "all or nothing" approach to HTML sanitization. It's good to know that your plugin can work safely alongside mine to provide an even better third option.