nbot

A clone of the eBot by @deStrO fully based on node.js with build in Web Page - WIP
git clone git://archive.git.mtrnord.blog/MTRNord/nbot.git
Log | Files | Refs | README | LICENSE

commit 608db0c40f54261b45a2230865ad4472dd76296b
parent 1a11a4ae94223b9adfdf119fe727c57188333e09
Author: MTRNord <mtrnord1@gmail.com>
Date:   Mon, 11 Apr 2016 17:57:54 +0200

fix(codeClimate) change some code to fix things listed by codeclimate

Diffstat:
M.codeclimate.yml | 2++
Mweb/server.js | 22+++++++++++-----------
Mweb/theme/js/serverConnect.js | 4+---
3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/.codeclimate.yml b/.codeclimate.yml @@ -14,6 +14,8 @@ engines: enabled: true fixme: enabled: true + exclude_fingerprints: + - ac297346e9db41fdbef7644b8e9c5c43 ratings: paths: - "**.css" diff --git a/web/server.js b/web/server.js @@ -23,17 +23,17 @@ var server = module.exports = {}; */ server.start = function () { app.get('/', function(req, res){ - res.sendFile(__dirname + '/theme/index.html'); + res.sendFile(path.join(__dirname, '/theme/index.html')); }); app.get('/index', function(req, res){ - res.sendFile(__dirname + '/theme/index.html'); + res.sendFile(path.join(__dirname, '/theme/index.html')); }); app.get('/pluginManager', function(req, res){ - res.sendFile(__dirname + '/theme/pluginManager.html'); + res.sendFile(path.join(__dirname, '/theme/pluginManager.html')); }); - app.use('/css', express.static(__dirname + '/theme/css')); - app.use('/js', express.static(__dirname + '/theme/js')); - app.use('/fonts', express.static(__dirname + '/theme/fonts')); + app.use('/css', express.static(path.join(__dirname, '/theme/css'))); + app.use('/js', express.static(path.join(__dirname, '/theme/js'))); + app.use('/fonts', express.static(path.join(__dirname, '/theme/fonts'))); http.listen((process.env.PORT || 5000), "0.0.0.0", function(){ console.log('listening on *:3001'); }); @@ -49,20 +49,20 @@ var server = module.exports = {}; //Informationen vom User holen socket.on('command', function (command) { console.log(command.command); - if (command.command == "restartgame") { + if (command.command === "restartgame") { rcon.restart_game() }else { - if (command.command == "live_on") { + if (command.command === "live_on") { rcon.live_on() }else { - if (command.command == "status") { + if (command.command === "status") { rcon.status().then(result => console.log('Got status', result)) //socket.emit('status_alert', {response: result}) }else { - if (command.command == "add_server") { + if (command.command === "add_server") { addserver.start() }else { - if (command.command == "refreshSourcemod") { + if (command.command === "refreshSourcemod") { console.log("here"); console.log(typeof pluginManager.getSourcemodVersions()) socket.emit('SourcemodList', {response: pluginManager.getSourcemodVersions(), command: command.command}) diff --git a/web/theme/js/serverConnect.js b/web/theme/js/serverConnect.js @@ -18,7 +18,7 @@ $(document).off('click', '#live_on').on('click', '#live_on', function (e) { e.preventDefault(); }); socket.on('alert', function (message) { - if (message.command == "live_on") { + if (message.command === "live_on") { PNotify.desktop.permission(); (new PNotify({ title: 'LIVE!!!', @@ -31,8 +31,6 @@ socket.on('alert', function (message) { if ($('.ui-pnotify-closer, .ui-pnotify-sticker, .ui-pnotify-closer *, .ui-pnotify-sticker *').is(e.target)) return; alert('Hey! You clicked the desktop notification!'); }); - }else { - } }); socket.on('status_alert', function (message) {