• HOME
    • PRODUCT
    • PRICING
    • ABOUT
    • COMMUNITY
    Menu
    • HOME
    • PRODUCT
    • PRICING
    • ABOUT
    • COMMUNITY
    Get in touch
    Get in touch
    Menu
    • HOME
    • PRODUCT
    • PRICING
    • ABOUT
    • COMMUNITY
    • Sign in
    • Start free trial
    • Get in touch
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    • Users
    • Groups
    • Documentation
      • Home
      • Read API
      • Write API
      • Plugin Development
    1. Home
    2. TheBronx
    3. Best
    • Profile
    • Following 3
    • Followers 3
    • Topics 6
    • Posts 47
    • Best 21
    • Controversial 0
    • Groups 1

    Best posts made by TheBronx

    • RE: hundreds of polling requests

      @baris said:

      @TheBronx Hey that 10s leads me to believe it might be this piece of code.

      https://github.com/NodeBB/NodeBB/blob/master/src/webserver.js#L44-L46

      Try commenting it out or increasing it and see if it works.

      WHAT THE FUCK IS THAAAAAT haha, it works!!!!!!!!!!!!!!!!!!!!!!!!!
      you guys are gonna pay for this xD

      posted in NodeBB Development
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      v1.0.3 released
      Works with NodeBB 1.0.x and also 0.7, 0.8 and 0.9 versions as far as I know.

      Whats new:

      • Plugin configuration panel completely reworked, now looks more material, following the NodeBB ACP design style
      • New feature: downvotes can have weigh too. This means that downvotes can remove more than just "1" points to the one being downvoted, depending on the user reputation.
      • New feature: downvotes can now remove a custom number of points from the user who votes. It is called "downvote penalization". You can set this to zero to disable it.
      • New feature: you can set a maximum number of extra points for upvotes, cause "upvote weigh" is a percentage of user's reputation, and that can grow to very very high numbers, so now you can limit it.
      • New feature: downvotes can also be limited, same as previous point.

      Here is a screenshot of all the options you can configure from the ACP:
      alt text

      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • RE: find objects with wildcard

      In case someone comes to this thread in the future, here is the solution I came up with: https://github.com/exo-do/nodebb-plugin-reputation-rules/blob/master/ReputationManager.js

      A main object and 3 sets as I said, nothing complex (in fact working with sets is pretty easy) but a bit confusing.
      When I save or update the main object I have to also call 3 times db.setAdd() or db.setRemove() depending on vote type (upvote, downvote or undo) but thats all.

      Thanks again for your help guys 😄

      posted in Plugin Development
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      I've been improving error messages a bit, now they include some important bits of information depending on the error:
      english3.png english2.png english.png

      Same for the Spanish translation of course:
      spanish.png

      I will be including these changes in the next release.

      Edit: v1.2.3 was released with these changes

      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      v1.2.0 has been published
      Not much has changed:

      • Added compatibility with NodeBB v1.18.2
      • Fixed a bug where "Max upvote weight" and "Max downvote weight" were actually being used as a min, instead of a max 🙃
      • I've removed the "Reload" button from the settings panel as that is no longer required for the changes to apply

      I should probably remove the setting "Max downvotes per day" as that is now supported by NodeBB out of the box, or maybe try and change the main setting from the plugin instead of having two different values doing the same.
      But for now it will stay. You can just set it to zero in one place and the configure the other, not that big of a deal.

      Let me know if everything works.

      @zandertrek @phenomlab

      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      @zandertrek yes, that is a plugin generated message.

      If you go to the plugin settings, right below Global configuration there is a message (more than an option) that says how that number is calculated.
      It is a formula: max votes per day is one tenth of the user reputation, with a minimum of 5 votes per day and a max of 50.
      This is fixed, cannot be configured right now.

      How would you like to override this setting? Would you like to set a fixed number of votes instead? Would you prefer to alter it to 20% or 50% of user's reputation?

      The idea behind this being a formula was that the higher the user reputation the less likely that user would be to abuse the system. In other words, low reputation and high number of votes per day was the most risky combination that would allow spam accounts and multi-accounts to take advantage of the system.
      But that of course is quite arbitrary. Why 5 votes minimum? Or 50 max? Why 10%?

      So yeah, what would you like the plugin to behave?

      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • autoban for low reputation?

      Auto-ban for low reputation was an option in the ACP, am I wrong? Now I can't find it (v0.7.2). Also there is no banUserForLowReputation() in the code. The settings had meta.config['autoban:downvote'] and meta.config['autoban:downvote:threshold'] properties, now I can't find them.

      Any good reason to remove this functionality? Just curious.

      posted in General Discussion
      TheBronx
      TheBronx
    • hundreds of polling requests

      Hi there guys!
      We finally launched our NodeBB board a few days ago (exo.do), but we are having trouble with long polling.
      We are behind Cloudflare (because of DDoS attacks) so we cannot use websockets yet. But long polling doesn't seem to be working properly, it is causing an enormous load on the server, due to the big amout of requests made per client:
      requests.png

      just open the website, stay in the home page for a few seconds with the network console opened, and wait for the party to begin.
      is that normal? what's going on there?

      Thank you!

      EDIT: here is a gif also:
      bestia.gif

      posted in NodeBB Development
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      plugin almost finished, what's missing right now:

      • rule 5: Reputation can be disabled in certain subforums
      • admin control panel
      • translations for error messages

      we are now testing all functionality.

      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • RE: NodeBB and ads - A never ending story

      Don't know if the problem is the same, but a few years ago I did a custom ad network (because I didn't like DFP) to serve custom banners and Adsense ads. And I had a problem with document.write() too.

      The problem was solved overriding the document.write function. Kinda tricky, but worked: before loading the adsense ad, the document.write function is replaced with a custom function that inserts the content into an element, instead of writing it to the dom directly. After inserting the content, the original document.write function is restored.
      That is, a one time function replacement.

      Here is some code:

      var originalFunction = document.write;
      
      overrideDocumentWriteFunction = function(container) {
      	document.write = function(content) {
      		container.innerHTML = content;
      		document.write = originalFunction;
      	};
      };
      

      And I used it like this:

      var div = document.getElementById('adPlacement');
      overrideDocumentWriteFunction(div);
      
      var script = document.createElement('script');
      script.type = 'text/javascript';
      script.innerHTML = '{adsense script content}'
      document.body.appendChild(script);
      

      This way the document.write function was customized to ensure the Adsense script worked after the page was loaded.

      I haven't tried DFP on NodeBB but maybe this helps.

      posted in General Discussion
      TheBronx
      TheBronx
    • how to create and use a template helper

      Building a custom theme based on vanilla:
      I want to show the posts.index for each post in the topic.tpl template
      The problem is that the first post is, obviously, #0, and I want it to display #1. Also the href should be /1, and not /0

      Well, as far as I know, you can't just do {posts.index+1}, you need a template helper. How should a theme register and use a custom template helper? Should I edit public/src/helpers.js manually???

      I can't find an example, hope you guys can help.
      Thanks in advance, and great job with nodebb, it is clearly a next-generation forum platform.

      posted in NodeBB Development
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      @phenomlab said in [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB:

      @thebronx Awesome - thanks ! If it helps, the current version throws this in the log

      2021-09-09T15:50:00.663Z [4567/164128] - error: Error: Cannot find module './database'
      Require stack:
      - /home/sudonix/nodebb/src/plugins/index.js
      - /home/sudonix/nodebb/src/meta/configs.js
      - /home/sudonix/nodebb/src/meta/index.js
      - /home/sudonix/nodebb/src/start.js
      - /home/sudonix/nodebb/require-main.js
      - /home/sudonix/nodebb/app.js
          at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
          at Function.Module._load (node:internal/modules/cjs/loader:778:27)
          at Module.require (node:internal/modules/cjs/loader:1005:19)
          at Object.<anonymous> (/home/sudonix/nodebb/node_modules/nodebb-plugin-reputation-rules/library.js:4:24)
          at Module._compile (node:internal/modules/cjs/loader:1101:14)
          at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
          at Module.load (node:internal/modules/cjs/loader:981:32)
          at Function.Module._load (node:internal/modules/cjs/loader:822:12)
          at Module.require (node:internal/modules/cjs/loader:1005:19)
          at require (node:internal/modules/cjs/helpers:94:18)
      
      

      Yep, that was solved in that old PR.
      I have the plugin running in the latest version of NodeBB locally, not much has changed since last time.

      Gonna try and debug the thing with reversing votes cause I am not sure why it didn't work last time. If it works I can release a new version today.

      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • find objects with wildcard

      is it possible to retrieve all objects with a _key matching a regular expression? I know it is possible with MongoDB, but I'm not sure how to do it with NodeBB.

      I'm storing documents with the following key scheme:
      reputationLog:{userId}:{authorId}:{threadId}:{postId}

      What I want to do is, for example, retrieve all logs with userId=1 and threadId=4:
      db.getCollection('objects').find({_key:/reputationLog:1:.*:4:.*/})

      How can I do this with NodeBB? db.getObjects doesn't seem to be working like that.

      Thanks!

      posted in Plugin Development
      TheBronx
      TheBronx
    • RE: how to create and use a template helper

      @psychobunny understood. now we understand a lot of things regarding templates. thank you too!

      posted in NodeBB Development
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      @zandertrek those are great ideas!
      The first one should be in NodeBB or another plugin probably, as this plugin is more about upvoting/downvoting and not about other privileges.
      But the idea of showing notifications like "you have X votes left this month" or "no more votes remaining today" and things like that could be a good way of educating users on the limits of reputation instead of just error messages.
      Regarding the second one, not sure if the error popups have enough space for more detailed messages, or if there is another way of showing feedback but it would be really nice to have that. Definitely worth exploring.

      Thank you for the suggestions. Not sure if I will implement them at this point but I will dedicate some time to think and mess around to see how far I can go.

      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • mongodb single collection?

      I've found that NodeBB, when configured to use MongoDB, uses one single collection for all documents (users, posts...). And uses the _key field to differentiate between them.

      Well, my first impression is: WTF? Why not using different collections, with different indexes for each? Is there any reason to avoid separate collections? Are there any performance implications on using a single collection?

      I'm not saying this is bad, it is just that I'm surprised, as I haven't seen this before. Could you please explain the reason/s behind this decision?

      posted in General Discussion
      TheBronx
      TheBronx
    • RE: hundreds of polling requests

      Ok, this is the sample ws server: https://github.com/exo-do/misc/blob/master/multiple instance ws server/ws/index.js
      I've started two servers, ports 9090 and 9091, and placed nginx on top of it, WITHOUT ip_hash. This is what happens:
      without sticky sessions.gif

      Well, it is normal, long polling is jumping from one instance to the other. Now if I enable ip_hash:
      with ip hash.png

      So it seems there is no bug in socket.io long polling. Here is the nginx config I'm using in this test:

      upstream io_nodes {
      	ip_hash;
      	server 127.0.0.1:9090;
      	server 127.0.0.1:9091;
      }
      server {
      		listen   8080; ## listen for ipv4; this line is default and implied
      		listen   [::]:8080 default ipv6only=on; ## listen for ipv6
      
      		server_name ws.blablablabla.com;
      		
      		location / {
      			proxy_set_header Upgrade $http_upgrade;
      			proxy_set_header Connection "upgrade";
      			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      			proxy_set_header Host $host;
      			proxy_http_version 1.1;
      			proxy_pass http://io_nodes;
      		}
      }
      

      I've used the default config, and added just what socket.io says you have to add: http://socket.io/docs/using-multiple-nodes/#

      We will have to check again and see if our nginx config is exactly the same I'm using here in the test.

      posted in NodeBB Development
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      We have had a lot of problems with translations server-side. It was working on v0.7.0, but stopped working on v0.7.2 without any warnings/errors in the console... So we have implemented our own translator.

      Rule #5 has been implemented, and we are now working on the ACP.

      So, no more TODOs, feel free to test it, we are now going to publish it to npm.

      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      v1.1.0 released

      • Now you can disable votes on messages that are "too old" (you can configure this in number of days, or 0 to disable)
      • Added nbbpm compatibility 1.0.x and 1.1.x (it should work in older versions, but I am not sure)
      posted in NodeBB Plugins
      TheBronx
      TheBronx
    • RE: [nodebb-plugin-reputation-rules] Reputation Rules Plugin for NodeBB

      @zandertrek @phenomlab

      I haven't updated the plugin in a while. It's been a year since I spent some time on it, maybe this branch is more "compatible" but I found a bug while developing that feature and ran out of time so it was never merged: https://github.com/exo-do/nodebb-plugin-reputation-rules/pull/6

      Handling the logs, so that each vote is registered with the amount of reputation added/substracted to both the voter and the autor of the post, was quite complex. And then undoing votes. And then handling opposite votes (undo current vote and then handle the opposite vote). And testing it hehe.

      I can try again and see how it goes, hopefully plugins haven't changed too much since v1.13

      TheBronx created this issue in exo-do/nodebb-plugin-reputation-rules

      closed max downvotes per day #5 #6

      posted in NodeBB Plugins
      TheBronx
      TheBronx

    Get Started

    • Product
    • Pricing

    Resources

    • Demo Site
    • Answers
    • Docs
    • Bug Bounty

    Company

    • About
    • Blog
    • Contact
    Start Free Trial
    Github Facebook Instagram Twitter
    © 2014 – 2022 NodeBB, Inc. — Made in Canada.
    • Terms
    • Privacy
    • GDPR
    • DMCA
    • Contact
    Menu
    • Terms
    • Privacy
    • GDPR
    • DMCA
    • Contact