Landing page is more of a prototype than a final version -- aka needs a lot of work -- but things are progressing.
mootzville
Posts
-
Who is using NodeBB? -
Invalid CSRF tokenI figured out my issue...
MongoDB user I was using had a
readWrite
role, but I guess it needs thedbAdmin
role as well. When I tried creating a new user in the nodebb admin area, then it would make things go wonky without thedbAdmin
role and result in invalid csrf tokens. -
Invalid CSRF tokenI'm also getting an invalid csrf error while trying to log in if anyone can help me out...
I'm runnning 0.5.7 and reset theme and plugins, but not luck. I looked at mongodb and the
sessions
collection grows by about 6-9 documents each page request...weird. This is a development instance, so I'm the only one...Also, I was logged in on Chrome and noticed I couldn't log in on Firefox...just Chrome for some reason. So, I cleared my cache in Chrome and it started giving me errors
-
December Reading List!@aixnr I'm currently reading 'A History of the Internet and the Digital Future' by Johnny Ryan
Great read so far...
-
mongodb management serviceI was at a mongodb meetup in Dublin the other night and they did a presentation on their mongodb management service (I'm not actually sure that's what it's called). Anyway, it's awesome and worth checking out, so I figured I'd mention it: https://mms.mongodb.com/
If you are on AWS, you will mess yourself when you see how simply you can set up a sharded cluster with replica sets.
-
Add menu items to Lavendar.@Chris Depending on what you want to do you can use hooks like @a_5mith suggested. The hook you'd want to use is: filter:header.build
What I don't like about the hook though is it just appends the new items to the end of the existing ones...I don't think you can change the order, or remove existing ones. I could be wrong though.
-- or --
The menu.tpl for lavender is actually being pulled in from the vanilla theme:
nodebb-theme-vanilla/templates/partials/menu.tpl
So, just copy the
menu.tpl
from vanilla to your lavender partials folder and change as needed. -
Understanding the templating engine & middlewareYa, so I was dumb...I have a local dev instance and a staging server. I was playing around with some things and forgot to switch the theme back to vanilla which explains why I was missing the navbar for the login screen...boo me.
But yes, thanks for pointing that out. The template engine and middleware are making a lot more sense now after looking through the source for the last 2 days...
I'm going to start looking to add/update the documentation here soon...some of the stuff can drive you crazy if you aren't familiar with the version changes.
Also, after reading through most of core at this point I have to say it's an impressive piece of kit. Thumbs up to the core devs. @julian @baris @psychobunny
EDIT: Also, anyone else who comes across this thread...if you really want to save yourself some time banging your head against the wall -- like I did -- take a few days to really dive into the nodebb source. It has been a good lesson in object-oriented javascript -- so many objects -- done right. I've realized I'm approaching things more from a functional perspective, so this has been an eye opener for me.
-
best method of programmatically adding usersWhat kind of changes?
-
Understanding the templating engine & middlewareOk, this may be obvious, but I just don't see it...
Why does the navbar (menu bar) not load on the login page?
It looks like it's set up the same way as the other routes & templates which means
header.tpl
would load which in turn would also loadpartials/menu.tpl
.What am I missing here?
EDIT: Maybe it's not so obvious after all...?
-
is it possible to configure daily email to send only if there is at least one event?@arasbm said:
There have been no active topics in the past day
I don't have an exact answer, but I can steer you in the right direction...
src/emailer.js
has this code in it:Plugins.fireHook('action:email.send', { to: results.email, from: meta.config['email:from'] || '[email protected]', subject: translated[2], html: translated[0], plaintext: translated[1], template: template, uid: uid });
A hacky way might be to wrap that method in an if statement like this:
if (translated[1] !== "There have been no active topics in the past day") { Plugins.fireHook('action:email.send', { to: results.email, from: meta.config['email:from'] || '[email protected]', subject: translated[2], html: translated[0], plaintext: translated[1], template: template, uid: uid }); }
THIS IS NOT AN EXACT ANSWER. I'm just throwing this out there to steer towards a solution. I have no idea what translated[1] would give you...
Using
grep
helps with this type of stuff...for example from your nodebb root you can do:grep -r "There have been no active topics in the past day"
It will search recursively through and spit out the file name and line of text wherever it finds the matched string...I use this a lot for tracing functionality through nodebb core. Really helpful if you are writing plugins and want to trace the hooks to their source...
-
Replace Homepage until logged in@a_5mith Cool, thanks.
-
Replace Homepage until logged in@a_5mith I see, but also where does this:
<!-- IF !loggedIn -->
come from? Not the loggedIn part, but the if condition itself? What is handling the logic? -
Replace Homepage until logged in@trevor Ok, thanks...yes, your way -- and @a_5mith's way -- is probably better. My solution isn't super complicated...it's actually achieving the same thing more or less and with a single line of code (plus, the template).
However, I do much prefer handling it within the theme rather than in core nodebb. Makes it easier to maintain over time.
My reference to the setupPageRoute function was more out of curiosity.
And, one last question...these conditionals that are used in the templates; where are they defined? Meaning, where do they come from? I hadn't seen them in html before using nodebb.
-
Replace Homepage until logged inJust to follow up...I ended up just replacing this:
res.render('home', data);
with this:
req.user ? res.render('home', data) : res.render('welcome');
in the src/controllers/index.js file.
This may or may not have side effects...not sure yet...
I tried to come up with other ways, but this seems the most straight forward. If there is an approach that this can be achieved via hooks I'd love to know...
Also, from src/routes/index.js can someone explain this:
function setupPageRoute(router, name, middleware, middlewares, controller) { middlewares = middlewares.concat([middleware.incrementPageViews, middleware.updateLastOnlineTime]); router.get(name, middleware.buildHeader, middlewares, controller); router.get('/api' + name, middlewares, controller); }
For the
router.get()
methods, are they like Express'app.get
? And if so, I thought unless you pass innext
to the method you can't provide more than 1 route? How is it getting the main route plus the api route? -
Replace Homepage until logged in@a_5mith Actually, that's not working for me...I have something like this:
<!-- IF !loggedIn --> <p>You ain't logged in fool!</p> <!-- ENDIF !loggedIn --> <!-- IF loggedIn --> <!-- home.tpl goes here --> <!-- ENDIF loggedIn -->
Any thoughts?
-
Replace Homepage until logged in@a_5mith Awesome, I'll try that. Thanks!
-
Replace Homepage until logged inWhen a user goes to mysite.com/ I want them to go to a Welcome (aka welcome.tpl) screen initially -- unless they are logged in. If they are logged in then mysite.com/ would be the nodebb home page (aka home.tpl).
What's the easiest way to go about this? Modify the '/' route call with an
if
condition? Or, use the app.load hook? Or maybe a redirect would be easiest?Thanks
-
Bug / Issue Report TemplateI like where this is going...
-
Bug / Issue Report TemplateI was submitting a bug report on Github, and thought it would be nice if there has a sticky topic on here with a template for submitting bug reports.
Something like this (keep it basic):
Attn: Before Submitting A Bug Report please confirm/try the following, if possible. Please note, after each step try starting in dev mode
./nodebb dev
and take note of any errors or warnings written to the console.-
Disable theme
./nodebb reset theme
-
Disable all plugins
./nodebb reset plugins
a. If you want to disable one at a time use this instead:./nodebb reset plugin="nodebb-plugin-PLUGIN_NAME_HERE"
-
Confirm all necessary services for your instance are running and available:
a. Database
b. Apache/Nginx (If you use them)
c. Make sure your port is open and accessible -
If you've updated to a newer version of nodebb make sure you did the following:
a.npm install
b../nodebb upgrade
If the above didn't work please use the template below to submit a bug report
- NodeBB Version
- Current Active Plugins (If any)
- Current Active Theme
- Bug Severity: 1 (lowest) - 5 (highest)
- Bug Description
- How to duplicate?
These are just some thoughts...would need to be more precise and formatted with some markdown. Just wanted to throw the idea out there...
-
-
What editor do you use?Sublime for desktop / nano in shell. Though, there is a fairly new command line editor called 'slap' I've been meaning to try: https://www.npmjs.org/package/slap
It's supposed to be a sublime-like editor and has mouse support...sounds kind of amazing.
If anyone has used it let me know what you think. I might actually mess around with today now that I'm writing about it...