CoD4X Webadmin Issues
-
Hey,
i tried setting up your webadmin tool.
So far everything worked and i can access the site.
Except when im trying to give my real user admin power from the dummy admin account. I get the following error:
I have logged the promise result in this function and appversion is null
getAdminHome: function(req, res, next) { BluebirdPromise.props({ appversion: Appversion.findOne({name:'CoD4x-WebAdmin'}).execAsync(), cod4xversion: Cod4xversion.findOne({name:'CoD4x-Server'}).execAsync(), local_servers: Servers.find({external_ip:false}).execAsync(), external_servers: Servers.find({external_ip: true}).execAsync(), sysinfo: Systemlogs.find({}).sort({createdAt: -1}).limit(30).execAsync(), colors: Color.find({}).execAsync() }).then (function(results){ const opsys = osName(os.platform()); if (S.startsWith(opsys, "Windows")==true){ addlocalServer = false; } else { addlocalServer = true; } res.render('admin/home/index.pug', {title: 'Admin Dashboard', results: results, addlocalServer: addlocalServer, csrfToken: req.csrfToken()}); }).catch(function(err) { console.log(err); res.redirect('/user/profile'); }); },
I have checked the mongodb cod4xwebadmin db and there is not even a schema for Appversion, so im a bit confused what went wrong.
Appreciate any help.
Best regards zeez.EDIT: I have figured it out but im still confused how noone else caught this or how anyone successfully used this app...
Basically in https://github.com/byNeHo/CoD4x-WebAdmin/blob/ce2b050edca2ce73739774f35bad21c337219097/app/seed/dbseed.js#L786
in the function exit() you close mongodb connection. However each insertion calls exit. So obviously all the other wont happen.
I commented out that line and closed the connection after all things are done and now it works just fine.
I would recommend refactoring that file -
@zeez will look at it in next update, there is another known issue with it
useUnifiedTopology: true
Since I already started some dependencies updates I will look at this to