Navigation

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups
    1. Home
    2. dogs
    • Profile
    • Following 1
    • Followers 1
    • Topics 20
    • Posts 50
    • Best 9
    • Groups 1

    dogs

    @dogs

    12
    Reputation
    15
    Profile views
    50
    Posts
    1
    Followers
    1
    Following
    Joined Last Online

    dogs Follow
    GNU/Linux

    Best posts made by dogs

    • RE: Use Websockets in own Plugin

      I still have a question. Everything works fine at the moment. Send data from the client to the server isn't a problem now.

      But how can I emit a event to all connected clients serverside?

      Something e.g

      myPlugin.emit('plugins.publishMessage', {data: "Some data"}, function(err, result) {
      			console.log(result);
      	});
      

      After one hour spending searching different topics and some code I found the solution.

      Besides the custom clientside Sockets

      const myPluginSockets = require.main.require('./src/socket.io/plugins');
      

      you have to define the Server Sockets too

      const myPluginSockets = require.main.require('./src/socket.io/plugins');
      const serverSockets = require.main.require('./src/socket.io');
      

      Now you can emit events from server side to the clients:

      serverSockets.server.sockets.emit('messageReceive', data);
      

      to receive the event clientside, you can use following in ur main.js file:

      socket.on('messageReceive', function(data){
            console.log(data);
      });
      

      Client console output:
      {msg: "my message"}


      Maybe I'll write a little Tutorial on this because I am probably not the only one who does not understand it so easily.

      posted in Plugin Development
      dogs
      dogs
    • RE: Execute Custom JS on Infinite Scroll

      @aleksei

      Did you take a look at

      https://github.com/NodeBB/NodeBB/wiki/Hooks#client-side-hooks

      maybe something like

      action:posts.loaded
      

      to trigger your function?

      posted in NodeBB Development
      dogs
      dogs
    • How to use Third-Party libraries?

      Whats the right way to use third party libraries?

      I tried to do it descriped in the docs:

      Using Third-Party Libraries - NodeBB Documentation

      But it doenst work.

      I want to use Swiper in my Theme:

      I tried it with

      "modules": {
         "swiper.js": "node_modules/swiper/swiper-bundle.min.js"
      }
      

      in client.js i used:

      require(['swiper'], function (Swiper) {
      	
      	
      	var mySwiper = new Swiper('.swiper-container', {
      		// Optional parameters
      		direction: 'vertical',
      		loop: true,
      	  
      		// If we need pagination
      		pagination: {
      		  el: '.swiper-pagination',
      		},
      	  
      		// Navigation arrows
      		navigation: {
      		  nextEl: '.swiper-button-next',
      		  prevEl: '.swiper-button-prev',
      		},
      	  
      		// And if we need scrollbar
      		scrollbar: {
      		  el: '.swiper-scrollbar',
      		},
      	  })
      
      });
      

      The Javascript from Swiper does not load.

      Can you help me?

      I also treid to import it directly via html

      <link rel="stylesheet" href="https://unpkg.com/swiper/swiper-bundle.min.css">
      <script src="https://unpkg.com/swiper/swiper-bundle.min.js"></script>
      

      and I also copied the contents of:
      https://unpkg.com/swiper@6.4.5/swiper-bundle.js

      and createt a file unter /lib/swiper-bundle.min.js. Nothing worked for me. The JS is still not loading...

      Looking forward to your answers! 🙂


      I fixed it.

      I am sorry. In my development I use grunt. But it seems that I doesnt load new libraries if installen. So I determinated the process Ctrl+C and restarted it using grunt. The librariers are loaded and the third party library works well now using:

      "modules": {
         "swiper.js": "node_modules/swiper/swiper-bundle.min.js"
      }
      
      require(['swiper'], function (Swiper) {
      
         var mySwiper = new Swiper('.swiper-container', {
            ...
            ...
            ...
         })
      }
      
      posted in Plugin Development
      dogs
      dogs
    • RE: NodeBB 1.13.0: a little snow won't slow us down

      Nice 👌🏼

      posted in NodeBB Blog
      dogs
      dogs
    • RE: Persona - nodebb v1.6 - problem with expanding menu on mobile version

      @nadiaeugenia Did you fork the quickstart Theme?

      https://github.com/NodeBB/nodebb-theme-quickstart

      Then you have to check the plugin.json.

      In quickstart theme it is currently:

      "scripts": [
      		"lib/client.js",
      		"../nodebb-theme-persona/lib/persona.js",
      		"../nodebb-theme-persona/lib/modules/nprogress.js",
      		"../nodebb-theme-persona/lib/modules/autohidingnavbar.min.js",
      		"../nodebb-theme-persona/lib/modules/quickreply.js"
      	],
      

      you have to edit the path from /lib/ to /public/.

      Also the file nprogress.js isn't available anymore.

      Take a look at https://github.com/NodeBB/nodebb-theme-persona/tree/master/public

      maybe @baris could update the quickstart theme repo? 🙂

      @nadiaEugenia your plugin.json should look like this to get sidebar working:

      "scripts": [
      		"lib/client.js",
      		"../nodebb-theme-persona/public/persona.js",
      		"../nodebb-theme-persona/public/modules/autohidingnavbar.min.js",
      		"../nodebb-theme-persona/public/modules/quickreply.js"
      	],
      

      I have had the same issue but fixed it yesterday.
      Don't forget to add your custom scripts eg "lib/client.js"

      posted in Bug Reports
      dogs
      dogs
    • RE: Use Websockets in own Plugin

      @pitaj Thank you for your fast response.

      Could you give mit a litte example how to emit and receive messages? I'm new to javascript and also new to nodebb. It is hard for me to follow the programming language especially in plugin dev.

      I have this in socket.io documentation

      socket.on('chat message', (msg) => {
          console.log('message: ' + msg);
        });
      

      something comeplete different .... 😕 than

      pluginSockets.calendar = {};
      pluginSockets.calendar.canPostEvent = async ({ uid }, { pid, tid, cid, isMain }) => {
        const neither = {
          canPost: false,
          canPostMandatory: false,
        };
      
        if (!isMain && await getSetting('mainPostOnly')) {
          return neither;
        }
      
        if (!(pid || tid || cid)) {
          return neither;
        }
      
        let promises;
      
        if (pid) {
          promises = [
            can.posts(privilegeNames.canPost, pid, uid),
            can.posts(privilegeNames.canMandatoryPost, pid, uid),
          ];
        }
        if (tid) {
          promises = [
            can.topics(privilegeNames.canPost, tid, uid),
            can.topics(privilegeNames.canMandatoryPost, tid, uid),
          ];
        }
        if (cid) {
          promises = [
            can.categories(privilegeNames.canPost, cid, uid),
            can.categories(privilegeNames.canMandatoryPost, cid, uid),
          ];
        }
      
        const [canPost, canPostMandatory] = await Promise.all(promises);
        return {
          canPost,
          canPostMandatory,
        };
      };
      

      Could you give me a little introduction? I'm sorry - I am a noob 🙉 but I really want to learn....


      I got it

      1. Import custom Sockets via
      const chatSockets = require.main.require('./src/socket.io/plugins');
      
      1. Define a test socket
      chatSockets.sendMessage = function(socket, data, callback) {
      	console.log("Working?");
      	console.log(data);
      	callback(null, "It worked!");
      }
      
      1. Go into Browser and Emit an Event
      socket.emit('plugins.sendMessage', {data: "Some data"}, function(err, result) {
      	alert(result);
      });
      

      U can use this snipped in your main.js client script file:

      socket.emit('plugins.sendMessage', {data: "Some data"}, function(err, result) {
      			alert(result);
      	});
      
      posted in Plugin Development
      dogs
      dogs
    • RE: Which is the nodebb community theme

      @onur-baran Should be https://github.com/NodeBB/nodebb-theme-persona

      posted in Technical Support
      dogs
      dogs
    • RE: phpBB NodeBB Flarum Laravel.io who is better Forum?

      @鄭宇佋 NodeBB is my favorite because with this core I think I can create everything I want it to be.

      Endless possibilities 😎

      I use NodeBB because I don't want "just a forum" I want to built something unique in some ways. And therefore NodeBB is my choose.

      posted in General Discussion
      dogs
      dogs
    • RE: Remove login button

      The only idea I have is to remove the login button in the template.

      The only problem what I see is that the login ist bound to many buttons ins the template eg on the categories view Login to post a topic, ...

      So maybe you could replace the login button in the login.tpl.

      https://github.com/NodeBB/nodebb-theme-persona/blob/master/templates/login.tpl

      I search in ACP for "login" but I couldn't find any setting to disable login global on the forum.

      posted in Technical Support
      dogs
      dogs

    Latest posts made by dogs

    • RE: CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

      take a look:

      https://community.nodebb.org/topic/14664/read-api-access-via-javascript-jquery

      posted in Technical Support
      dogs
      dogs
    • RE: Is there a way to grant users access to just the Forum Traffic chart?

      @patsanch you can try this

      847D9780-A870-4621-8D7A-7ECBD247073C.jpeg

      posted in General Discussion
      dogs
      dogs
    • RE: Persona - nodebb v1.6 - problem with expanding menu on mobile version

      @nadiaeugenia

      Small supplement:

      Got the same error after upgrading NodeBB to 1.16.1. Endless loading spinner on mobile view.

      Solution:

      I installed and activated another theme. In my case it was:

      After activating the plugin I ran

      ./nodebb build
      ./nodebb start

      after that I switched back to nodebb-theme-persona via the ACP.

      again:

      ./nodebb build
      ./nodebb start

      After that my sidebar is working on mobile again.

      Hope this helps. 🙂

      posted in Bug Reports
      dogs
      dogs
    • RE: Can't use <!-- IF thumb --> in header.tpl file

      @pitaj said in Can't use <!-- IF thumb --> in header.tpl file:

      accomplish

      I just wanted to display the thumbnail as a full with header image outside of the div.container which is boxed. Theme Persona.

      I thought that would be the easiest solution to put it in the header above the div.container starts.

      posted in Plugin Development
      dogs
      dogs
    • error: Error: [[error:group-name-too-long]] on NodeBB Upgrade

      After upgrading NodeBB from 1.13.x to 1.16.1 I received the following error after the first start of the NodeBB instance:

        → [2020/10/13] Create verified/unverified user groups...Error occurred
      2021-01-16T13:12:18.178Z [4567/28540] - error: Error: [[error:group-name-too-long]]
          at Object.Groups.validateGroupName (/home/makesmartnodebb/example.net/src/groups/create.js:84:10)
          at Groups.create (/home/makesmartnodebb/example.net/src/groups/create.js:19:10)
          at Object.wrapperCallback [as create] (/home/makesmartnodebb/example.net/src/promisify.js:48:18)
          at Object.method (/home/makesmartnodebb/example.net/src/upgrades/1.15.0/verified_users_group.js:31:17)
          at process._tickCallback (internal/process/next_tick.js:68:7)
      [cluster] Child Process (28540) has exited (code: 0, signal: null)
      

      The key message was:

      error: Error: [[error:group-name-too-long]]
      

      So I used a MongoDB client - such as MongoDB Compass - to fix the displayed error.

      At first I used following filter to get the config of NodeBB.

         {_key:"config"}
      

      I found the config object with following Key/Value Pair:

      maximumGroupNameLength: 15
      

      I changed it to:

      maximumGroupNameLength: 30
      

      So I was able to start NodeBB again.

      I think the created groups within the upgrade caused this error.

      I just write this topic to help people who are searching for this error. This is the fix. 👍

      posted in Bug Reports
      dogs
      dogs
    • Can't use <!-- IF thumb --> in header.tpl file

      Hey guys!

      I want to display the thumbnail in the topic.

      If I use it in topic.tpl it works fine:

      <!-- IF thumb -->
      <p>Thumb is here</p>
      <!-- ENDIF thumb -->
      

      But I want to use it in header.tpl to get out of div.container. But it do not work. My text wont display ... I dont know why. Is there anything I should kno about header.tpl or anything else?

      Looking forward! 🙂

      posted in Plugin Development
      dogs
      dogs
    • RE: phpBB NodeBB Flarum Laravel.io who is better Forum?

      @鄭宇佋 NodeBB is my favorite because with this core I think I can create everything I want it to be.

      Endless possibilities 😎

      I use NodeBB because I don't want "just a forum" I want to built something unique in some ways. And therefore NodeBB is my choose.

      posted in General Discussion
      dogs
      dogs
    • RE: How to authenticate for the Read API?

      @greyteapot I'm sorry. Blame on me. I thought that community.nodebb.org ist just an alias for your own instance.

      Authentication is handled either via HTTP Bearer Token or JSON Web Token, as generated/specified in the Write API.

      https://github.com/NodeBB/nodebb-plugin-write-api#authentication

      So I think there is no way for you to read user specific data on community.nodebb.org.

      But for your own instance you would use the generated bearer token.

      posted in General Discussion
      dogs
      dogs
    • RE: How to authenticate for the Read API?

      Try to generate a master token within the ACP. This master token is used as a bearer token to identify.

      Genrate your API-Token here:
      http://192.168.178.115:4567/admin/settings/api

      Bildschirmfoto 2021-01-14 um 13.08.48.png

      This snippted should work (not tested):

      Token: 67f25233-9f8a-4974-b209-5e9a2a5c5ce0

      import requests
      
      headers = {"Authorization": "Bearer 67f25233-9f8a-4974-b209-5e9a2a5c5ce0"}
      
      url = 'https://community.nodebb.org/api/unread'
      
      print(requests.get(endpoint, headers=headers).json())
      

      Token for a specific user could be generated via write api and the master token.

      Take a look here:
      https://community.nodebb.org/topic/15271/generating-bearer-token-with-write-api/2?_=1610625824799

      posted in General Discussion
      dogs
      dogs
    • RE: Remove login button

      The only idea I have is to remove the login button in the template.

      The only problem what I see is that the login ist bound to many buttons ins the template eg on the categories view Login to post a topic, ...

      So maybe you could replace the login button in the login.tpl.

      https://github.com/NodeBB/nodebb-theme-persona/blob/master/templates/login.tpl

      I search in ACP for "login" but I couldn't find any setting to disable login global on the forum.

      posted in Technical Support
      dogs
      dogs