Skip to content
  • 4 Votes
    4 Posts
    633 Views
    julianJ

    Hah, already possible to lock your forum down using privileges, and let paying members in 💰

  • 3 Votes
    1 Posts
    151 Views
    oplik0O

    (a development post by a contributor, not a team member 🙂 )

    NodeBB currently works with docker... technically.
    I mean, the default image is fine if you set it up correctly - but that's a pretty big if and there wasn't any good documentation. The existing docker-compose file had some tiny pain points like:

    not exposing any ports by default it recommends setting up a reverse proxy like traefik, which can be a good idea and avoids a small docker security footgun (ports exposed by containers can bypass some firewall configurations, e.g. ufw) but also means that running docker compose up just starts up a container you can't connect to by default! You'll need to modify the config, whether you want to expose a port or set up Traefik... not setting up volumes I hope you like redoing all your configuration when updating the image! also, hope you installed some plugin for storing uploads remotely, since even they'll be gone when you delete and recreate the container you can also, again, edit it to resolve that issue not creating any database in the mongodb container using admin works, but is really not intuitive!

    And when I said the image was fine, I mean that it's acceptable, not that it's great. It always builds NodeBB before startup, installing and activating plugins in a way that will persist properly requires using arcane configuration options that are not mentioned in the docs (and it results in not being able to install or remove any plugins at runtime), and - again - setting up volumes is entirely up to the user.

    However, quite some time ago, @stevefan1999-personal made a pull request that addressed many of these issues, and over time came to address almost everything I mentioned here. And finally we're getting close to landing these changes, and some other small improvements, in NodeBB/NodeBB#12031

    So what will change?

    Running docker compose --profile mongo up is now all you need to start a working instance of NodeBB in a container. Initially it'll launch the web installer, with already populated database configuration, leaving you just to set up the NodeBB URL and admin account. Then just waiting a bit for setup to finish and you're done - NodeBB is running under port 4567. You can now use some reverse proxy on host, modify the compose file to expose it under port 80 or add a containerized reverse proxy and remove the default port binding. If you use the default compose file you'll notice that configuration and - more importantly - uploads are now mounted in .docker directory, so they'll persist when recreating the container There are some additional env variables that can affect the image startup behavior - e.g. you can now choose if NodeBB will run a build before starting.

    There's another nice change that you might've thought of if you saw the initial PR title - docker image size. And it's a fairly large difference. Some numbers:

    current image: 601MiB compressed/1.62GiB uncompressed original alpine PR: 315MiB compressed/986MiB uncompressed new PR (slim debian build): 211MiB compressed/674MiB uncompressed

    For reference, now the official MongoDB image is actually larger than NodeBB, and combined (even with redis added to the mix) they're still e.g. almost 2x smaller than Discourse slim image (747MiB compressed/2.02GiB uncompressed).
    And MongoDB is the largest of the supported databases - Postgres clocks at only 150MiB compressed and offers a 94MiB compressed alpine version, and Redis clocks in at 49MiB compressed for a debian image and just 15MiB for alpine.

    The result is that when running NodeBB with postgres the images will end up taking less than 1GB of disk space, basically half of what they do currently. All while offering much better user experience and configurability.

    And finally, Docker is graduating to being mentioned in official docs with NodeBB/docs#78 🙂

  • 9 Votes
    36 Posts
    3k Views
    S

    @sharonyue said in [nodebb-plugin-meilisearch] use MeiliSearch as a full-text search backend:

    I confirmed it was done automatically. Right now nodebb-meilisearch looks 100% perfect on my site! Excellent!

    Can somebody explain me if this currently is "the best search engine" and recommened to use or is there still a big disclaimer? And if so, what is needed?

  • Optimizing Benchpress

    NodeBB Blog
    8
    6 Votes
    8 Posts
    1k Views
    volanarV

    @julian said in Optimizing Benchpress:

    Are you saying we should build RustBB?

    Looks like lemmy developers are trying to do it based on their platform 🙄 🙄
    https://github.com/Nutomic/lemmyBB

  • 4 Votes
    2 Posts
    637 Views
    julianJ

    Awesome work! Always nice to see new widgets be created 😄

  • 1 Votes
    1 Posts
    226 Views
    oplik0O

    I'll soon be creating a custom theme and some plugins for a forum that is already in use and I'm thinking about running second instance on beta.forum.url with the new theme and plugins enabled when it's close to being ready (but in need of testing), that I'd like to work with the same database as the main forum - so that users can just use beta if they want to preview new features while still using the same forum as others.

    Now, I know that the list of themes/plugins enabled is stored in database, so I'd probably need to do something about that, but is there anything else that would stop me from running two instances with a bit different configs off one database? Some sync issue with posts/topics or something like that?

    EDIT: actually, since I might as well help others, would it be a good idea to add an option to add some instance identifier to db plugin entries to core? Perhaps in config.json? So that if it's set NodeBB would look for plugins:<instance>:active for example.

  • 1 Votes
    2 Posts
    526 Views
    D

    I'd love to use this plug-in, but when I installed it with Lavender theme, it created issues with categories (invalid category IDs, unable to create new categories, unable to post in existing categories).

    Once I uninstalled this plug-in, all was fine.

    Is there perhaps a newer version that works with Lavender?

  • 5 Votes
    16 Posts
    2k Views
    volanarV

    @crazycells said in nodebb-plugin-customize: Customize NodeBB Translations and Templates:

    @pitaj said in nodebb-plugin-customize: Customize NodeBB Translations and Templates:

    @crazycells the plugin only knows about keys that are already in the NodeBB system. You could try coopting an unused key from something else.

    If I understood correctly from what you wrote on the Github issue below, you are planning to add a new property to this plugin...
    creating a new "translation token"

    Am I right?

    The issue with multilingual content has been resolved. This works by default

  • 8 Votes
    1 Posts
    6k Views
    PitaJP

    This FAQ is applicable for the following situations:

    You're receiving the following error in the Javascript console: WebSocket connection to 'wss://<site>/socket.io/?EIO=3&transport=websocket' failed: Error during WebSocket handshake: Unexpected response code: 400 The "Looks like your connection to NodeBB was lost, please wait while we try to reconnect." alert box and the spinner in the navbar consistently appear You want your users to be able to access NodeBB from multiple subdomains on your site Background

    By default, NodeBB only allows websocket connections from the "url" value in config.json. This is because of what is called Cross-Site Websocket Hijacking. By restricting the origin at which sockets can connect, we prevent this attack from taking place.

    Diagnosis

    To make sure that your issue is in fact caused by an origin mismatch, try this:

    Stop the NodeBB server: ./nodebb stop Start NodeBB in dev mode: ./nodebb dev Visit your site, and see if the issue is resolved. Ctrl+C to exit dev mode

    If the issue disappeared when visiting your site running in dev mode, then your problem is in fact an origin mismatch. If not, it is likely something else, so look around or ask a question here on the forum.

    Solutions

    The easiest solution is to set the "url" value in config.json to exactly the URL at which you access your NodeBB forum. For instance, the configuration for this site is

    { "url": "https://community.nodebb.org", ... }

    If you want your forum to work from multiple origins (like www.yoursite.com and yoursite.com) the preferred option is to just redirect one to the other. For instance, redirect www.yoursite.com to yoursite.com within your reverse proxy.

    If you absolutely must have full access from multiple origins, you can configure the accepted origins directly. As documented here, you can add a socket.io:origins property to config.json.

    For example, to allow accessing the forum sockets from the main NodeBB site, nodebb.org, the following would be added to our config:

    { ... "socket.io": { "origins": "https://community.nodebb.org:* https://nodebb.org:*" } }

    Make sure your original site is included in the new origins property, and that you add :*, otherwise it's invalid.

    Still having issues?

    It's likely a reverse proxy configuration issue. Take a look at the proxy documentation for examples. If you still have issues, ask a question here on the forum.

  • 5 Votes
    3 Posts
    1k Views
    yariplusY

    Updated to 1.1.0

    Fixes a crash with newer node versions. Added the query protocol to the game dropdown.
  • 3 Votes
    8 Posts
    5k Views
    PitaJP

    @phit that error should be fixed now. Try it out.

  • 10 Votes
    17 Posts
    9k Views
    attisA

    There's one more breaking change that I did not find documented anywhere.
    For our theme we had to change:

    var templates = require('templates.js'); templates.registerHelper('generateCategoryBorder', helpers.generateCategoryBorder);

    to

    var Benchpress = require('benchpressjs'); Benchpress.registerHelper('generateCategoryBorder', helpers.generateCategoryBorder);

    Not a big deal but some folks might struggle to see why their template helpers don't work on server side.

  • New Persona Mobile Menus

    Moved NodeBB Development
    15
    7 Votes
    15 Posts
    7k Views
    E

    good job, seems to work very nice
    only problem with chats one is it appears the date of each chat and then dissapears

  • 2 Votes
    22 Posts
    5k Views
    yariplusY
    Version 1.6.0 !! Now works with 1.13.x! Re-wrote code to use new hooks and promises. Compatibility changed to >=1.10.0
  • 5 Votes
    68 Posts
    24k Views
    yariplusY

    I published v1.11.0 for v3. Still has a lot of work to do.

    Styles aren't quite right. Widgets don't work at all. Using a custom template doesn't work. Pagination is weird.

    Adding, deleting, and editing lists works. The default news and blog pages work. Shouldn't crash too often.

    I'll be keeping an eye on this page.

  • 0 Votes
    2 Posts
    1k Views
    yariplusY

    Hmm, idk, some parts of the code could use better adherence to a style for consistency, and it may encourage new contributors.

    I feel like styles are largely based on opinion though. And in situations where a style does help, such as avoiding confusing/ambiguous expressions, NodeBB rarely suffers from these problems.

    I am against tabs though. I hate them. Used to love them, but after using spaces, i can never go back. (I really really hate semicolons too.)

  • 0 Votes
    1 Posts
    1k Views
    PitaJP

    I propose to either add a new ability for
    the const keyword or use the reserved word final to make
    non-writable object and class members.

    Note: The TypeErrors are thrown following the behavior of Object.freeze or
    a { configurable: false, writable: false } property descriptor. They
    will be thrown in a "use strict"; environment, but usually not
    otherwise.

    Constant Class or Object members / properties / fields / methods

    Use final, since it is an unused reserved word, or possibly const to define constant Class or Object members:

    class X { // const / final now makes static class properties // non-writable, and non-configurable static const abc = 123; static final abc = 123; // also works to make constant private properties const #def = 456; final #def = 456; // as well as constant normal class fields, if you're into that const ghi = 789; final ghi = 789; // and constant private / static / normal methods static const doSomething() { } static final doSomething() { } const #somethingPrivate() { } final #somethingPrivate() { } const cantChangeMe() { } final cantChangeMe() { } constructor(a = 3) { const somethingPrivate = this.#somethingPrivate; // throws new TypeError('Assignment to constant property.') this.#somethingPrivate = function () { return a; } this.#somethingPrivate === somethingPrivate // true const def = this.#def; // throws new TypeError('Assignment to constant property.') this.#def = 1000; this.#def === def // true } } const x = new X(); const ghi = x.ghi; // throws new TypeError('Assignment to constant property.') x.ghi = 2000; x.ghi === ghi // true const doSomething = X.doSomething; // throws new TypeError('Assignment to constant property.') X.doSomething = function doSomethingElse() { }; X.doSomething === doSomething // true const cantChangeMe = X.prototype.cantChangeMe; // throws new TypeError('Assignment to constant property.') X.prototype.cantChangeMe = function yesICan() { }; X.prototype.cantChangeMe === cantChangeMe // true const o = { // const / final can be used in normal object literals, too const things() { }, final things() { }, const prop: 5, final prop: 5, }; const things = o.things; // throws new TypeError('Assignment to constant property.') o.things = function stuff() { }; o.things === things // true const prop = o.prop; // throws new TypeError('Assignment to constant property.') o.prop = 11; o.prop === prop // true

    This could be transpiled by simply using Object.defineProperty like so,
    at least on public members:

    class X { static abc = 123; static doSomething() { } cantChangeMe() { } constructor() { } } ['abc', 'doSomething', 'cantChangeMe'].forEach(key => Object.defineProperty(X, key, { configurable: false, writable: false }) ); const o = { things() { }, prop: 5, }; ['things', 'prop'].forEach(key => Object.defineProperty(o, key, { configurable: false, writable: false }) ); Shorthand for Immutable Classes and Objects

    Defining everything as final or const in a Class or Object doesn't quiet
    do the job. What if we want true immutability?

    I've also looked into some kind of special syntax for creating immutable
    objects and making classes return immutable objects. Maybe we could use
    final for that, as well?

    // The static members and prototype of this class are shallow immutable. // Any object it returns is also shallow immutable, // similar to `return Object.freeze(this)` as the last line in the constructor, // though since it uses a keyword, it could throw an error on an attempt to override final class ConstantObject { static abc = 123; static doSomething() { } cantChangeMe() { } constructor() { this.d = 8; } } const constantObject = new ConstantObject(); const c = constantObject.c; // throws new TypeError('Assignment to constant property.') constantObject.c = 321; constantObject.c = c // true const doSomething = ConstantObject.doSomething; // throws new TypeError('Assignment to constant property.') ConstantObject.doSomething = function doSomethingElse() { }; ConstantObject.doSomething === doSomething // true const cantChangeMe = ConstantObject.prototype.cantChangeMe; // throws new TypeError('Assignment to constant property.') ConstantObject.prototype.cantChangeMe = function yesICan() { }; ConstantObject.prototype.cantChangeMe === cantChangeMe // true // No members can be added / modified / deleted from this shallow immutable object. const finalObject = final { prop: 5, things() { }, }; const things = finalObject.things; // throws new TypeError('Assignment to constant property.') finalObject.things = function stuff() { }; finalObject.things === things // true const prop = finalObject.prop; // throws new TypeError('Assignment to constant property.') finalObject.prop = 11; finalObject.prop === prop // true

    This could be transpiled essentially by just using Object.freeze and Object.defineProperty:

    const ConstantObject = (() => { class ConstantObject { static abc = 123; static doSomething() { } cantChangeMe() { } constructor() { this.d = 8; return Object.freeze(this); } } Object.defineProperty(ConstantObject, 'prototype', { value: Object.freeze(ConstantObject.prototype), }); return Object.freeze(ConstantObject); })(); const finalObject = Object.freeze({ prop: 5, things() { }, });

    What do you think? I'm currently leaning towards using the final keyword for everything.
    Both sides have pros and cons.

    const final Pros • Meaningful word • Unused • Fits existing syntax; AKA const x = 5 -> const x: 5 • Meaning could be closer if devs want to initialize after definition • Familiar to Java devs Cons • Could be overloaded in usage • Less meaningful to C / JS devs, could be confusing
  • 1 Votes
    1 Posts
    1k Views
    PitaJP

    I'm thinking it would be good if we establish some best practices for NodeBB plugin development.

    Feel free to contribute by replying and I'll add it to the list.

    Database keys should start with plugin:[your-plugin-name]: ex: if the plugin is nodebb-plugin-mentions then the database keys would start with plugin:mentions: Use sockets instead of ajax Use CSS transitions instead of jQuery animations, trigger them by toggling classes on the elements Use Bootstrap elements as much as possible or not at all your suggestion here
  • 3 Votes
    3 Posts
    1k Views
    julianJ

    Glad to see others making rewards plugins 😄

    Hopefully you and @psychobunny can debug this issue...

  • 10 Votes
    40 Posts
    41k Views
    yariplusY
    New Release 1.5.1

    Back from the dead with a bunch of bug fixes, code rewrite to current node and NodeBB, and new pictures for the guide topic!

    Fixed crash if camo was not installed locally. Fixed crash if an incorrect url was specified. Fixed crash if installed on windows. Fixed settings not changeable after original setup. Removed old or useless hooks. Removed babel. Corrected dead links and emails. Changed compatibility to >= NodeBB 1.0.0 New docs!