1 |
- {"version":3,"sources":["../../src/tools/server-tool-listener.js"],"names":["ServerToolListner","server","port","serverTool","io","listen","on","socket","console","log","option","callback","getCurrentListAuthorizedPlayers","disconnect","updatePlayersFromDb","response","username","addPlayerDb","removePlayerDb","game","addGameDb","message","JSON","stringify","options","removeGameDb"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;AAEA;;IAEqBA,iB;AACnB,6BAAYC,MAAZ,EAAoB;AAAA;AAClB,SAAKA,MAAL,GAAcA,MAAd;AACD;;;;2BAEMC,I,EAAM;AACX,UAAID,MAAM,GAAG,KAAKA,MAAlB;AACA,WAAKE,UAAL,GAAkBC,gBAAGC,MAAH,CAAUH,IAAV,CAAlB;AACA,WAAKC,UAAL,CAAgBG,EAAhB,CAAmB,YAAnB,EAAiC,UAASC,MAAT,EAAiB;AAChDC,QAAAA,OAAO,CAACC,GAAR,CAAY,gBAAZ;AAEAF,QAAAA,MAAM,CAACD,EAAP,CAAU,SAAV,EAAqB,UAACI,MAAD,EAASC,QAAT,EAAsB;AACzCA,UAAAA,QAAQ,CAACV,MAAM,CAACW,+BAAP,EAAD,CAAR;AACAL,UAAAA,MAAM,CAACM,UAAP,CAAkB,KAAlB;AACD,SAHD;AAIAN,QAAAA,MAAM,CAACD,EAAP,CAAU,QAAV;AAAA,6FAAoB,iBAAOI,MAAP,EAAeC,QAAf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BACGV,MAAM,CAACa,mBAAP,EADH;;AAAA;AACdC,oBAAAA,QADc;AAElBJ,oBAAAA,QAAQ,CAACI,QAAD,CAAR;AACAR,oBAAAA,MAAM,CAACM,UAAP,CAAkB,KAAlB;;AAHkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAApB;;AAAA;AAAA;AAAA;AAAA;AAMAN,QAAAA,MAAM,CAACD,EAAP,CAAU,YAAV;AAAA,8FAAwB,kBAAOU,QAAP,EAAiBL,QAAjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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;AAAA;AAAA;AAWAN,QAAAA,MAAM,CAACD,EAAP,CAAU,aAAV;AAAA,8FAAyB,kBAAOkB,OAAP,EAAgBb,QAAhB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BACFV,MAAM,CAACwB,YAAP,OAAAxB,MAAM,mCAAiBuB,OAAjB,EADJ;;AAAA;AACnBT,oBAAAA,QADmB;AAEvBJ,oBAAAA,QAAQ,CAACI,QAAD,CAAR;AACAR,oBAAAA,MAAM,CAACM,UAAP,CAAkB,KAAlB;;AAHuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,WAAzB;;AAAA;AAAA;AAAA;AAAA;AAKD,OAxCD;AAyCD","sourcesContent":["'use strict';\n\nimport io from 'socket.io';\n\nexport default class ServerToolListner {\n constructor(server) {\n this.server = server;\n }\n\n listen(port) {\n let server = this.server;\n this.serverTool = io.listen(port);\n this.serverTool.on('connection', function(socket) {\n console.log('tool connected');\n\n socket.on('players', (option, callback) => {\n callback(server.getCurrentListAuthorizedPlayers());\n socket.disconnect(false);\n });\n socket.on('syncdb', async (option, callback) => {\n let response = await server.updatePlayersFromDb();\n callback(response);\n socket.disconnect(false);\n });\n\n socket.on('add-player', async (username, callback) => {\n let response = await server.addPlayerDb(...username);\n callback(response);\n socket.disconnect(false);\n });\n socket.on('remove-player', async (username, callback) => {\n let response = await server.removePlayerDb(...username);\n callback(response);\n socket.disconnect(false);\n });\n\n socket.on('add-game', async (game, callback) => {\n let response = '';\n try {\n response = await server.addGameDb(...game);\n response = 'OK - inserted at id :' + response;\n } catch (err) {\n response = 'KO ' + err.message;\n }\n callback(JSON.stringify(response));\n socket.disconnect(false);\n });\n socket.on('remove-game', async (options, callback) => {\n let response = await server.removeGameDb(...options);\n callback(response);\n socket.disconnect(false);\n });\n });\n }\n}\n"],"file":"server-tool-listener.js"}
|