This commit is contained in:
parent
332e550b08
commit
14d57184bf
3
.gitignore
vendored
3
.gitignore
vendored
@ -20,6 +20,9 @@ coverage
|
|||||||
# nyc test coverage
|
# nyc test coverage
|
||||||
.nyc_output
|
.nyc_output
|
||||||
|
|
||||||
|
tokens.json
|
||||||
|
|
||||||
|
|
||||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
.grunt
|
.grunt
|
||||||
|
|
||||||
|
72
src/main.js
72
src/main.js
@ -183,6 +183,11 @@ function startServer(client) {
|
|||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const path = require("path")
|
const path = require("path")
|
||||||
|
|
||||||
|
if(!fs.existsSync(__dirname + path.sep + "tokens.json")) {
|
||||||
|
|
||||||
|
fs.writeFileSync(__dirname + path.sep + "tokens.json", JSON.stringify({}, null, 2))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var link = null
|
var link = null
|
||||||
var discordlink = null
|
var discordlink = null
|
||||||
@ -208,6 +213,7 @@ function startServer(client) {
|
|||||||
|
|
||||||
function reimportUser() {
|
function reimportUser() {
|
||||||
|
|
||||||
|
|
||||||
const tokens = require(__dirname + path.sep + "tokens.json")
|
const tokens = require(__dirname + path.sep + "tokens.json")
|
||||||
|
|
||||||
users = new Map()
|
users = new Map()
|
||||||
@ -332,15 +338,20 @@ function startServer(client) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
socket.on("getState", (token) => {
|
socket.on("getState", (token) => {
|
||||||
reimportUser()
|
|
||||||
actualize()
|
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
"username":users.get(token).username + "#" + users.get(token).discriminator,
|
"username":users.get(token).username + "#" + users.get(token).discriminator,
|
||||||
"avatar": users.get(token).avatar,
|
"avatar": users.get(token).avatar,
|
||||||
"id": users.get(token).id,
|
"id": users.get(token).id,
|
||||||
}
|
}
|
||||||
socket.emit("updateState", data)
|
|
||||||
|
actualize()
|
||||||
|
|
||||||
|
socket.emit("updateState", data)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
socket.on("play", (token) => {
|
socket.on("play", (token) => {
|
||||||
@ -508,6 +519,33 @@ function startServer(client) {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
socket.on("moveQueue", (token, identifier) => {
|
||||||
|
|
||||||
|
if(users.has(token)) {
|
||||||
|
|
||||||
|
let player = client.manager.players.get("137291455336022018")
|
||||||
|
|
||||||
|
if(player) {
|
||||||
|
|
||||||
|
log.server("Déplacement (n°" + identifier + ") d'un morceau demandé par " + users.get(token).username + "#" + users.get(token).discriminator)
|
||||||
|
|
||||||
|
|
||||||
|
let elementToMove = player.queue[identifier];
|
||||||
|
|
||||||
|
player.queue.remove(identifier)
|
||||||
|
player.queue.unshift(elementToMove);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
actualize()
|
||||||
|
} else {
|
||||||
|
socket.emit("authFailed")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
socket.on("backward", (token) => {
|
socket.on("backward", (token) => {
|
||||||
|
|
||||||
if(users.has(token)) {
|
if(users.has(token)) {
|
||||||
@ -901,19 +939,19 @@ function startServer(client) {
|
|||||||
const tokens = require(__dirname + path.sep + "tokens.json")
|
const tokens = require(__dirname + path.sep + "tokens.json")
|
||||||
|
|
||||||
tokens[token] = response
|
tokens[token] = response
|
||||||
|
users.set(token, response)
|
||||||
|
|
||||||
await fs.writeFileSync(__dirname + path.sep + "tokens.json", JSON.stringify(tokens, null, 2))
|
await fs.writeFile(__dirname + path.sep + "tokens.json", JSON.stringify(tokens, null, 2), () => {
|
||||||
|
|
||||||
|
|
||||||
|
reimportUser()
|
||||||
|
socket.emit("successLogin", token)
|
||||||
|
actualize()
|
||||||
|
authTokenWait.delete(token)
|
||||||
|
|
||||||
await users.set(token, response)
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
socket.emit("successLogin", token)
|
|
||||||
actualize()
|
|
||||||
|
|
||||||
authTokenWait.delete(token)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
115
src/tokens.json
115
src/tokens.json
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"2780dd1a-9993-4b96-b495-98f970a624ab": {
|
"6bde63c8-6b74-4fb5-98d8-87c8c203c16b": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -16,7 +16,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"e2ceb6a4-d49c-4f27-b7a1-8c42966551eb": {
|
"3bdca403-b9d2-47b8-b9c4-3818b324a76f": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -33,92 +33,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"92107510-a256-4522-9d32-d30edf95fcfb": {
|
"aac35fb6-5c16-4d29-a1e6-6abc43ce5008": {
|
||||||
"id": "582966873201704960",
|
|
||||||
"username": "RaphX",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "d7292780a2f481a80413201ddeacb956",
|
|
||||||
"discriminator": "9459",
|
|
||||||
"public_flags": 0,
|
|
||||||
"flags": 0,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff0000",
|
|
||||||
"accent_color": 16711680,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": false,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"bb63b529-c234-4328-b47c-ab1dd28b6c2c": {
|
|
||||||
"id": "582966873201704960",
|
|
||||||
"username": "RaphX",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "d7292780a2f481a80413201ddeacb956",
|
|
||||||
"discriminator": "9459",
|
|
||||||
"public_flags": 0,
|
|
||||||
"flags": 0,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff0000",
|
|
||||||
"accent_color": 16711680,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": false,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"45c7f6d8-dc2f-4feb-a710-976f935425bb": {
|
|
||||||
"id": "582966873201704960",
|
|
||||||
"username": "RaphX",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "d7292780a2f481a80413201ddeacb956",
|
|
||||||
"discriminator": "9459",
|
|
||||||
"public_flags": 0,
|
|
||||||
"flags": 0,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff0000",
|
|
||||||
"accent_color": 16711680,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": false,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"1fee2fdf-fdfb-4790-a231-cb2ead01afe0": {
|
|
||||||
"id": "582966873201704960",
|
|
||||||
"username": "RaphX",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "d7292780a2f481a80413201ddeacb956",
|
|
||||||
"discriminator": "9459",
|
|
||||||
"public_flags": 0,
|
|
||||||
"flags": 0,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff0000",
|
|
||||||
"accent_color": 16711680,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": false,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"1514184b-ff27-4034-bbc6-aacc93825f9e": {
|
|
||||||
"id": "582966873201704960",
|
|
||||||
"username": "RaphX",
|
|
||||||
"global_name": null,
|
|
||||||
"display_name": null,
|
|
||||||
"avatar": "d7292780a2f481a80413201ddeacb956",
|
|
||||||
"discriminator": "9459",
|
|
||||||
"public_flags": 0,
|
|
||||||
"flags": 0,
|
|
||||||
"banner": null,
|
|
||||||
"banner_color": "#ff0000",
|
|
||||||
"accent_color": 16711680,
|
|
||||||
"locale": "fr",
|
|
||||||
"mfa_enabled": false,
|
|
||||||
"premium_type": 0,
|
|
||||||
"avatar_decoration": null
|
|
||||||
},
|
|
||||||
"7a1bb160-eb45-4bdb-9f31-a2c0f49753a0": {
|
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -135,7 +50,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"8b77d1fc-0d7f-4883-ac6c-a78ecbe1dba7": {
|
"750f0802-7d9c-4263-b2dd-f27d47029e8b": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -152,7 +67,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"cd6a0f1b-ab01-4e2f-b868-0dc799857d59": {
|
"c416c176-157e-40a9-ae32-23cfcf812dd4": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -169,7 +84,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"ad59b8e1-0a90-44fc-9af6-b64ade21e035": {
|
"5ef772f4-e729-4ccc-9c23-25d7cc4b2c64": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -186,7 +101,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"f4dd1141-cdae-493d-a165-69da5fa062fe": {
|
"b5b7d954-49b6-43b4-a237-08e41f3e6f58": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -203,7 +118,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"17e0433d-071a-457e-a71c-81a2434bf34a": {
|
"27e00135-65fa-43d5-820c-e35bb906d47c": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -220,7 +135,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"b3a615fc-3550-4012-a769-589ca46c2f1a": {
|
"04cb0b39-a29e-4dc2-a6e8-31651a4382a5": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -237,7 +152,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"1aa94dd6-5b28-4505-b8ab-17a29b651325": {
|
"e79cbf92-0e97-4522-9430-54e87a1998d3": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -254,7 +169,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"3daea0ef-f237-41b2-b711-37177ce7ac80": {
|
"da77741c-e550-43f0-b4e8-86060fd7e784": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -271,7 +186,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"1ea2812e-2af7-414e-ad3c-fd0c20b74746": {
|
"c89a8d5c-a5f7-409a-9ca5-3d27f40bc073": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -288,7 +203,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"f1562014-d19c-4e83-bbe2-30c62a23af24": {
|
"6726b668-25f4-4d3f-8440-b6a4cc002c7d": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -305,7 +220,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"6814dead-1a58-44bf-9b65-d20803df3d4b": {
|
"41769f38-1cab-44b9-b96f-09261fe5c3d0": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
@ -322,7 +237,7 @@
|
|||||||
"premium_type": 0,
|
"premium_type": 0,
|
||||||
"avatar_decoration": null
|
"avatar_decoration": null
|
||||||
},
|
},
|
||||||
"1e7c5225-13ea-4451-86be-e57a6c495229": {
|
"cc20f4c2-9b35-4846-9b00-e3d09be6e273": {
|
||||||
"id": "486943594893017119",
|
"id": "486943594893017119",
|
||||||
"username": "Raphix",
|
"username": "Raphix",
|
||||||
"global_name": null,
|
"global_name": null,
|
||||||
|
Loading…
Reference in New Issue
Block a user