• Categories
    • Unread
    • Recent
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Home
    2. Schamper
    3. Posts
    Offline
    • Profile
    • Following 0
    • Followers 2
    • Topics 17
    • Posts 155
    • Groups 1

    Posts

    Recent
    • RE: Android Wear

      It’s those 2 seconds that take too long for me when checking the time though.
      Looking at my wrist is just easier and quicker.

      posted in General Computing
      SchamperS
      Schamper
    • RE: Upgrades and Backups

      @Scuzz said:

      @Schamper You also said the NPM release should still be compatible with 0.3.2.

      Sorry, installing 0.0.7 from NPM will work.

      posted in Announcements
      SchamperS
      Schamper
    • RE: Upgrades and Backups

      @Scuzz Hence why I said “the latest NodeBB” :)

      posted in Announcements
      SchamperS
      Schamper
    • RE: Android Wear

      http://bitbangers.co.uk/topic/21/watches

      posted in General Computing
      SchamperS
      Schamper
    • Watches

      Just for the heck of it, what watch do you regularly wear or do you own?

      I’m currently sporting this $10 baby (time is only displayed on the press of a button)
      img here

      Previously this one
      another

      All because I’m still to lazy to get the battery replaced in my “main” watch, which I can’t find a picture of.

      posted in The lounge
      SchamperS
      Schamper
    • RE: Upgrades and Backups

      Master branch of Github is now compatible with the latest NodeBB.

      The NPM release should still be compatible with 0.3.2.

      posted in Announcements
      SchamperS
      Schamper
    • RE: Android Wear

      @Leo said:

      Even when I’m using the Xbox One with friends over my house, they still forget that they have to shut the fuck up when I’m navigating using voice commands.

      Me showing someone a voice command
      Sea-
      Other person
      Hey what are you doing?
      …
      I don’t understand “seahawk what are you doing”

      posted in General Computing
      SchamperS
      Schamper
    • RE: Upgrades and Backups

      @Leo chill out man, I’m working on it (soon’ish)

      posted in Announcements
      SchamperS
      Schamper
    • RE: Upgrades and Backups

      Was wondering why I couldn’t login, realized the backup is pre-Schamper.

      posted in Announcements
      SchamperS
      Schamper
    • Using websockets in your plugin

      The Problem

      Say you want your plugin to communicate between client and server using websockets. There isn’t a documented (or “official”) way on how to hook into the websockets API of NodeBB.
      I was facing this issue with the Shoutbox plugin, and had to find a clever way to get it to work. The way I found is a bit “hackish” but actually works really well and is now actually being used by a core developer in one of his plugins.

      The Process of finding a Solution

      When digging around a bit in the NodeBB source you can see how their socket implementation works. For this we navigate to src/socket.io. In this folder we see some files. You can quickly see that index.js is controlling everything, and that all the other files are socket “namespaces” (e.g. all the socket calls that have the user prefix will be handled by the user.js file. I won’t go into too many details on how this works, you’ll just have to believe me on this :)
      When playing around with this, you find out that when you add another js file in that folder, you’ll have working sockets on that namespace! But we don’t want to change anything in core… We want to do this from a plugin!

      We will further investigate one of these files. I chose the modules file because I thought it would fit a Shoutbox the most.
      It’s some pretty basic stuff in here. SocketModules is defined as a new object, and so is every “module”, like SocketModules.composer. At the very end you can see that this file sets the module.exports to the SocketModules object. This means that when you require(..) this file, you’ll have access to everything in the SocketModules object, but nothing outside of it. This gave me an idea.

      Exploring the Idea

      From your plugin you can require(..) files from NodeBB using module.parent.require(..). In this way you can also require the modules.js file like so:

      var ModulesSockets = module.parent.require('./socket.io/modules');
      

      ModulesSockets will now be whatever this file has given us as their export. In our case, the SocketModules object, which includes everything that was defined in the modules.js file, which are basically all the socket handlers for the composer, chat, etc…
      Here I enter my idea: What happens if I add my own custom sockets to this object? I simply tested this with something like this (from within my plugin):

      var ModulesSockets = module.parent.require('./socket.io/modules');
      ModulesSockets.test = function(socket, data, callback) {
          console.log("Working?");
          console.log(data);
          callback(null, "It worked!");
      }
      

      Then, on the client, I entered something like this in the console:

      socket.emit('modules.test', {data: "Some data"}, function(err, result) {
          alert(result);
      });
      

      And hit enter.

      And it worked! I saw the logs in the NodeBB log and was alerted with “It worked!”.
      Using all this information I came up with the following solution.

      #The Solution
      So the solution is quite easy. All you have to do is require the namespace you want to extend, and add your custom handlers. You could even replace the default handlers with your own in this way!
      In a bit of code:

      var ModulesSockets = module.parent.require('./socket.io/modules');
      ...
      //I prefer to execute this in the "action:app.load" handler method
      ModulesSockets.shoutbox = Shoutbox.sockets; //in this case, my handlers will listen to "modules.shoutbox.*"
      ...
      Shoutbox.sockets = {
          //Bunch of socket handlers here
      }
      

      I hope you guys learned something from this :D If you have any corrections or enhancements please call me out on it :P

      posted in General Computing
      SchamperS
      Schamper
    • RE: nodebb-plugin-shoutbox

      You’ll have to clear your cache since I updated the CSS + client side JS.

      posted in Development and Coding
      SchamperS
      Schamper
    • nodebb-plugin-buzzer

      So for the sake of creating something silly I made this little plugin. It’s add a nice button called ‘Buzz’ next to the Send button in the chat modal. When pressed, the other user will have their modal shaken all about and an annoying little nostalgic sound will play!

      To prevent users from losing their sanity these are the limitations:

      • You can only buzz a user if you both have the chat window open (this is very much intentional to keep it from being too annoying)
      • A buzz will last about 1 second, and you can only buzz every 2 seconds. (this is very much intentional to keep it annoying, but not too annoying)

      Have fun :D

      npm install nodebb-plugin-buzzer

      Source: https://github.com/MrWaffle/nodebb-plugin-buzzer

      posted in Development and Coding
      SchamperS
      Schamper
    • Project Honeypot plugin?

      It looks like the NodeBB community really wants an anti-spam plugin. (http://community.nodebb.org/topic/150/nodebb-anti-spam)
      Perhaps we can develop a plugin that utilises Project Honeypot?

      IP that users register with should already be available.

      posted in Development and Coding
      SchamperS
      Schamper
    • RE: nodebb-plugin-shoutbox

      Vanilla install ;) Found a sneaky way to hook into the hooks (heh) from a plugin!

      posted in Development and Coding
      SchamperS
      Schamper
    • nodebb-plugin-shoutbox

      After having it integrated at first, I thought it’d be way better if this was a plugin, so here we go!
      Source:
      https://github.com/MrWaffle/nodebb-plugin-shoutbox

      Can be installed from npm:

      npm install nodebb-plugin-shoutbox
      

      After installation has to be enabled in admincp.

      It’s still a work in progress. I plan to add a load of features/settings. See this as a PoC that it can work from a plugin ;)

      posted in Development and Coding
      SchamperS
      Schamper
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 8 / 8