Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups
    1. Home
    2. KnickKnack
    K
    • Profile
    • Following 0
    • Followers 1
    • Topics 14
    • Posts 37
    • Best 4
    • Groups 0

    KnickKnack

    @KnickKnack

    5
    Reputation
    222
    Profile views
    37
    Posts
    1
    Followers
    0
    Following
    Joined Last Online

    KnickKnack Follow

    Best posts made by KnickKnack

    • RE: Who is using NodeBB?

      @baris: MAXON with his PluginCafé discussion board for Cinema 4D plugins external developers.

      Cheers, KK

      posted in General Discussion
      K
      KnickKnack
    • Issue on reaching out to new routes established using the WriteAPI

      Hi community first and foremost thank for your valuable support.

      I need to retrieve custom data I've written to mongoDB and I'd like them to be returned as JSON string via a custom WriteAPI-enabled route.

      A few notes to give a better context:

      • I'm currently on Ubuntu 18 / nodebb 1.16.2 / Mongo DB 4.0.22 / npm 6.14.10

      • I've already read

        • extends nodebb write-api?
        • Extending routes into the write api plugin
      • I've looked at

        • nodebb-plugin-friends on GitHub
        • WriteAPI doc
        • ReadAPI doc
      • and, in the end, I've created an API Access token bound to the forum administrator which works nicely to read and write in the forum (e.g. retrieving the topics or creating a new one)

      Issues:

      • Upon installing nodebb-plugin-friends (clone and npm link) and activating in a pristine test forum I can see the hook in Advanced -> Hooks but:
        • why looking at the nodebb log (run as ./nodebb dev) I can't see [plugins/friends] Write API integration enabled, routes added. as specified here?
        • assuming I'm using Postman for testing purposes how should i reach these routes? (none of these - <url/to/nodebb>/api/v3/friends/:uid, <url/to/nodebb>/api/friends/:uid, <url/to/nodebb>/friends/:uid, <url/to/nodebb>api/v3/plugins/friends/:uid - worked for me)
      • Upon creating a test plugin (see below library.js and plugin.json) I'm not able to reach any of the established new routes (as much as reported above): how can I debug the issue? Log is silent and

      library.js

      'use strict';
      
      (function(routes) {
      
        routes.initWriteRoutes = function(data, callback) {
      
          data.router.get('/route1', data.apiMiddleware.requireUser, data.apiMiddleware.requireAdmin, middleware.verifyUserExists, function(req, res) {
            console.log("/route1 reached via get");
            res.sendStatus(200);
          });
      
          data.router.post('/route2', data.apiMiddleware.requireUser, middleware.verifyUserExists, function(req, res) {
            console.log("/route2 reached via post");
            res.sendStatus(200);
          });
      
          data.router.delete('/route3', data.apiMiddleware.requireUser, middleware.verifyUserExists, function(req, res) {
            console.log("/route3 reached via delete");
            res.sendStatus(200);
          });
      
          console.log('[plugins/test] Write API integration enabled, routes added.');
          callback(null, data);
        };
      
      }(module.exports));
      

      plugin.json

      
      {
        "library": "./library.js",
        "hooks": [
            { "hook": "filter:plugin.write-api.routes", "method": "initWriteRoutes" }
        ]
      }
      
      • assuming nodebb-plugin-friends is installed why the log reports info: [api] Adding 0 route(s) to 'api/v3/plugins' with 0 new routes? Shouldn't it include at least the new routes coming with this plugin?

      I apologise for the length of this post, but I think this might help you to steer me in the right direction.

      Best, Riccardo

      posted in NodeBB Plugins
      K
      KnickKnack
    • Searching for multiple tags in Tags page

      Hi community,

      is it possible to specify multiple tags in the Tags page or to even define boolean expression with (AND, OR, NOT)?

      Best, KK

      posted in General Discussion
      K
      KnickKnack
    • RE: Issue on reaching out to new routes established using the WriteAPI

      @julian that's awesome thanks a lot!

      posted in NodeBB Plugins
      K
      KnickKnack

    Latest posts made by KnickKnack

    • RE: session mismatch error after deleting user

      @baris thanks a lot! You brought me into the right direction.

      I've queried the DB for db.getCollection('objects').find({"_key":{$regex:'maxonIDId:uid'}}) and deleted the found object. This just made the trick and disconnected the retuned OAuthID from the actual nodebb uid.

      Thanks a lot for looking at the thread and also checking the my code!

      Really appreciated you're awesome guys!

      posted in Technical Support
      K
      KnickKnack
    • RE: session mismatch error after deleting user

      Looking at one of the sessions object I've spotted
      "registration\":{\"returnTo\":\"/\",\"uid\":8},\"passport\":{\"user\":8}}"

      which seems like it's referring to the same uid that my user had before getting deleted. Looks like that re-registering myself with the same account tries to use the same uid.

      Does it make any sense to you gurus?

      Cheers, R

      posted in Technical Support
      K
      KnickKnack
    • RE: session mismatch error after deleting user

      @pitaj already done and sadly no better results

      posted in Technical Support
      K
      KnickKnack
    • RE: session mismatch error after deleting user

      @baris said in session mismatch error after deleting user:

      Also can you try with this change https://github.com/NodeBB/NodeBB/commit/beb14273876406b69bb202ab2805926862e27879

      @baris change done but no good result

      posted in Technical Support
      K
      KnickKnack
    • RE: session mismatch error after deleting user

      @baris

      config.json looks like

      {
          "url": "https://aaa.bbb.ccc.ddd",
          "secret": "xxxxxxxxxxxxxxxxxxxxxxx",
          "database": "mongo",
          "mongo": {
              "uri": "mongodb://nodebb:nodebb-pass@localhost/nodebb",
      	    "uri_long": "mongodb://nodebb:nodebb-pass@localhost/nodebb"
          },
          "port": "4567",
          "socket.io": {
              "origins": "https://aaa.bbb.ccc.ddd:*"
          },
      

      and looking in the DB I see in the sessions collections

      /* 1 */
      {
          "_id" : "bzuVRBphBzKSUZ3Yt9VxEQUPuJoU5nKh",
          "expires" : ISODate("2021-03-05T15:41:25.409Z"),
          "session" : "{\"cookie\":{\"originalMaxAge\":1209600000,\"expires\":\"2021-03-05T15:41:17.902Z\",\"secure\":true,\"httpOnly\":true,\"path\":\"/\",\"sameSite\":\"Lax\"},\"returnTo\":\"/\",\"flash\":{},\"passport\":{\"user\":8}}"
      }
      
      /* 2 */
      {
          "_id" : "mqBJSla7h9jDaRjbdpEsCpbIaXpZxKIX",
          "expires" : ISODate("2021-03-05T17:02:35.259Z"),
          "session" : "{\"cookie\":{\"originalMaxAge\":1209600000,\"expires\":\"2021-03-05T17:02:34.250Z\",\"secure\":true,\"httpOnly\":true,\"path\":\"/\",\"sameSite\":\"Lax\"},\"returnTo\":\"/\",\"flash\":{},\"registration\":{\"returnTo\":\"/\",\"uid\":8},\"passport\":{\"user\":8}}"
      }
      

      I've tried already to delete anything in the sessions collection but with no better luck

      To give better context consider that my user is attempting to authenticate using this OAuth2 plugin I've developed and nodebb get stuck as soon as I'm authenticated against my identity provider and I'm going to set my privacy settings
      6803b2c6-898b-406f-90a6-56de201624b5-image.png

      Thanks for any help

      posted in Technical Support
      K
      KnickKnack
    • RE: session mismatch error after deleting user

      @baris said in session mismatch error after deleting user:

      app.logout()

      Thanks @baris running app.logout() just stops the pop-up to show up cause an actual logout takes place, but as soon as I attempt to login the pop-up starts again and again

      posted in Technical Support
      K
      KnickKnack
    • session mismatch error after deleting user

      Hi guys,

      I need to get out of a trouble I really can't figure out how to.

      This morning in order to get my forum cleaned up for an internal testing phase, I have deleted all the users (and their posts) from via the administration panel. Everything went well and the forum got cleaned up except for the admin account.

      I'm now trying to re-register myself with my previous credentials I used as standard user but after the initial success of the registration I've nodebb constantly showing up this "Session Mismatch" pop-up.
      281092fd-b0a5-48fe-842b-e99d47075d73-image.png
      I've trie with cleaning the browser cache, I've tried with a different browser, I've tried to clean-up also the sessions collections in the Mongo DB but I still get the pop-up.

      Do you have an idea how I can get it fixed? Or the sole option I have is to restore the database before the users clean-up phase?

      Thanks, Riccardo

      posted in Technical Support
      K
      KnickKnack
    • RE: Issue on reaching out to new routes established using the WriteAPI

      @julian that's awesome thanks a lot!

      posted in NodeBB Plugins
      K
      KnickKnack
    • RE: Issue on reaching out to new routes established using the WriteAPI

      Thanks a lot @PitaJ and @julian, changing the hook worked.

      Moving to api/v3 looks like I can't use what @julian mentioned

      It passes in router, apiMiddleware, middleware, and errorHandler, so given that you can style your own routes like I do in the write api, e.g.:

      var addRoutes = function(data, callback) {
        data.router.get('/awesome', apiMiddleware.requireUser, function(req, res) {
          console.log('lorem ipsum!');
          res.sendStatus(200);
        });
      
        callback(null, data);
      });
      

      In the above example, I used the requireUser middleware, which, provided by the write-api, means you have to pass in an user/master token just like the other routes. It also sets req.user.uid for you to use.

      How can I check that the bearer Token coming with the req.header is valid and corresponds to a certain user to which the bearer token is bound to?

      Any snippet to look at?

      Thanks, Riccardo

      posted in NodeBB Plugins
      K
      KnickKnack
    • Issue on reaching out to new routes established using the WriteAPI

      Hi community first and foremost thank for your valuable support.

      I need to retrieve custom data I've written to mongoDB and I'd like them to be returned as JSON string via a custom WriteAPI-enabled route.

      A few notes to give a better context:

      • I'm currently on Ubuntu 18 / nodebb 1.16.2 / Mongo DB 4.0.22 / npm 6.14.10

      • I've already read

        • extends nodebb write-api?
        • Extending routes into the write api plugin
      • I've looked at

        • nodebb-plugin-friends on GitHub
        • WriteAPI doc
        • ReadAPI doc
      • and, in the end, I've created an API Access token bound to the forum administrator which works nicely to read and write in the forum (e.g. retrieving the topics or creating a new one)

      Issues:

      • Upon installing nodebb-plugin-friends (clone and npm link) and activating in a pristine test forum I can see the hook in Advanced -> Hooks but:
        • why looking at the nodebb log (run as ./nodebb dev) I can't see [plugins/friends] Write API integration enabled, routes added. as specified here?
        • assuming I'm using Postman for testing purposes how should i reach these routes? (none of these - <url/to/nodebb>/api/v3/friends/:uid, <url/to/nodebb>/api/friends/:uid, <url/to/nodebb>/friends/:uid, <url/to/nodebb>api/v3/plugins/friends/:uid - worked for me)
      • Upon creating a test plugin (see below library.js and plugin.json) I'm not able to reach any of the established new routes (as much as reported above): how can I debug the issue? Log is silent and

      library.js

      'use strict';
      
      (function(routes) {
      
        routes.initWriteRoutes = function(data, callback) {
      
          data.router.get('/route1', data.apiMiddleware.requireUser, data.apiMiddleware.requireAdmin, middleware.verifyUserExists, function(req, res) {
            console.log("/route1 reached via get");
            res.sendStatus(200);
          });
      
          data.router.post('/route2', data.apiMiddleware.requireUser, middleware.verifyUserExists, function(req, res) {
            console.log("/route2 reached via post");
            res.sendStatus(200);
          });
      
          data.router.delete('/route3', data.apiMiddleware.requireUser, middleware.verifyUserExists, function(req, res) {
            console.log("/route3 reached via delete");
            res.sendStatus(200);
          });
      
          console.log('[plugins/test] Write API integration enabled, routes added.');
          callback(null, data);
        };
      
      }(module.exports));
      

      plugin.json

      
      {
        "library": "./library.js",
        "hooks": [
            { "hook": "filter:plugin.write-api.routes", "method": "initWriteRoutes" }
        ]
      }
      
      • assuming nodebb-plugin-friends is installed why the log reports info: [api] Adding 0 route(s) to 'api/v3/plugins' with 0 new routes? Shouldn't it include at least the new routes coming with this plugin?

      I apologise for the length of this post, but I think this might help you to steer me in the right direction.

      Best, Riccardo

      posted in NodeBB Plugins
      K
      KnickKnack