@baris Thank you!
@jiangcaiyang Yes, I have a few things in mind. That looks cool. I wish I could read it.
Can someone make a plugin that has a page with a list of game servers. It would have to let us add them in the admin control panel. It would have to say if it was online/offline and how many people are playing on it.
Thanks!
@MatthewHawley You've got a lot of missing information here. For which games are you trying to include? Each one could have different ways of displaying or communicating server information, which presents a problem for someone who would potentially make such a plugin.
Usually there are ways that already exist for you to display server information; why not create a custom page and put all of them there, rather than creating a separate plugin to do so?
Edit: a widget would suffice as well.
Already working on this with @bentael
We are developing here: https://github.com/xCausxn/nodebb-widget-gameservers
List of game can be found there also!
Currently working on it as you can see (from the hostname being loading :P)
@xCausxn Whoa! That's awesome.
v0.7
error:
29/4 19:15 [2337] - warn: [plugins/nodebb-widget-gameservers] This plugin may not be compatible with your version of NodeBB. This may cause unintended behaviour or crashing.
29/4 19:15 [2337] - warn: [plugins/nodebb-widget-gameservers] In the event of an unresponsive NodeBB caused by this plugin, run ./nodebb reset plugin="nodebb-widget-gameservers".
29/4 19:15 [2337] - error: Error: Cannot find module '../public/src/templates'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at /root/nodebb/nodebb/node_modules/nodebb-widget-gameservers/library.js:10:35
at Object.<anonymous> (/root/nodebb/nodebb/node_modules/nodebb-widget-gameservers/library.js:261:2)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
29/4 19:15 [2337] - warn: [plugins.reload] Library not found for plugin: nodebb-widget-gameservers
well
fixed in library.js this
templates = module.parent.require('../public/src/templates'),
to
templates = module.parent.require('templates.js'),
but there are another error
29/4 22:57 [17913] - error: [plugins] Error executing 'static:app.load' in plugin 'nodebb-widget-gameservers'
29/4 22:57 [17913] - error: TypeError: Object #<Object> has no method 'get'
at Object.Widget.settings (/root/nodebb/nodebb/node_modules/nodebb-widget-gameservers/library.js:65:25)
at Object.Widget.init [as method] (/root/nodebb/nodebb/node_modules/nodebb-widget-gameservers/library.js:247:16)
at /root/nodebb/nodebb/src/plugins/hooks.js:127:14
at /root/nodebb/nodebb/node_modules/async/lib/async.js:125:13
at Array.forEach (native)
at _each (/root/nodebb/nodebb/node_modules/async/lib/async.js:46:24)
at Object.async.each (/root/nodebb/nodebb/node_modules/async/lib/async.js:124:9)
at fireStaticHook (/root/nodebb/nodebb/src/plugins/hooks.js:116:9)
at Object.Plugins.fireHook (/root/nodebb/nodebb/src/plugins/hooks.js:72:5)
at Object.Plugins.reloadRoutes (/root/nodebb/nodebb/src/plugins.js:129:11)
it about meta.js
try replacing the init function with
Widget.init = function(data, callback) {
var templatesToLoad = ['gameservers.tpl', 'admin/gameservers.tpl'];
function loadTemplate(template, next) {
fs.readFile(path.resolve(__dirname, './public/templates/' + template), function (err, data) {
if (err) {
return next(err);
}
Widget.templates[template] = data.toString();
next(null);
});
}
Widget.settings(function() {
async.each(templatesToLoad, loadTemplate);
var prefix = '/api/admin/widgets/gameservers';
data.router.get(prefix + '/fetchserver', Widget.fetchserver);
data.router.get(prefix + '/fetchallservers', Widget.fetchallservers);
data.router.post(prefix + '/addserver', data.middleware.admin.isAdmin, Widget.addserver);
data.router.post(prefix + '/rmserver', data.middleware.admin.isAdmin, Widget.rmserver);
callback();
});
};
Havent worked on this in a while due to some other commitments, i will try to look into it a bit more soon.
i`ve tried to install this plugin, but dosent show in widgets... what the problem can be?