Adjusted code to the new game mechanics

This commit is contained in:
bitscuit 2021-03-13 10:02:53 +01:00
parent 1db5081e6a
commit e67a331d33
6 changed files with 502 additions and 98 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
# ---> Vim
*.swp
# ---> Node # ---> Node
# Logs # Logs
logs logs

View File

@ -17,3 +17,12 @@ tr.clickable:hover{
color: #aaa; color: #aaa;
text-align: center; text-align: center;
} }
.story{
text-align: center;
margin-bottom: 30px;
}
.story h5{
margin: 0px;
}

View File

@ -13,11 +13,11 @@
You should have received a copy of the GNU General Public License along with You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>. this program. If not, see <https://www.gnu.org/licenses/>.
This project is hosted on https://git.bitscuit.be/bitscuit/ReverseQuiz This project is hosted on https://git.bitscuit.be/bitscuit/Scrawl
--> -->
<html> <html>
<head> <head>
<title>Reverse Quiz</title> <title>Scrawl</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
@ -31,14 +31,14 @@
</head> </head>
<body style="padding-top: 10px;"> <body style="padding-top: 10px;">
<div id="main" class="container" style="text-align:center;"> <div id="main" class="container" style="text-align:center;">
<h1>Reverse Quiz</h1> <h1>Scrawl</h1>
<p>Please enter a username to get started with the game.</p> <p>Please enter a username to get started with the game.</p>
<input id="input_username" type="text" placeholder="Your username" /> <input id="input_username" type="text" placeholder="Your username" />
<button id="button_username" class="button button-primary"><i class="fas fa-check"></i></button> <button id="button_username" class="button button-primary"><i class="fas fa-check"></i></button>
</div> </div>
<div class="footer"> <div class="footer">
<p>Copyright &copy; 2021 Thomas Van Acker<br/>Project hosted on <a href="https://git.bitscuit.be/bitscuit/ReverseQuiz">Gitscuit</a></p> <p>Copyright &copy; 2021 Thomas Van Acker<br/>Project hosted on <a href="https://git.bitscuit.be/bitscuit/Scrawl">Gitscuit</a></p>
</div> </div>
@ -85,7 +85,7 @@ socket.on("LOBBY", function(users){
} }
// Disable button if not enough players // Disable button if not enough players
if(users.length < 2){ if(users.length < 3){
document.getElementById("button_lobby_start").style.display = "none"; document.getElementById("button_lobby_start").style.display = "none";
} }
}); });
@ -94,7 +94,7 @@ socket.on("LOBBY", function(users){
socket.on("LOBBY_CLOSED", function(){ socket.on("LOBBY_CLOSED", function(){
// When game busy // When game busy
var page = ""; var page = "";
page += "<h1>Reverse Quiz</h1><p>The lobby is currently closed. Please come back in a few moments.</p>"; page += "<h1>Scrawl</h1><p>The lobby is currently closed. Please come back in a few moments.</p>";
document.getElementById("main").innerHTML = page; document.getElementById("main").innerHTML = page;
}); });
@ -114,8 +114,6 @@ socket.on("START", function(data){
page += "<h1>Get ready!</h1>"; page += "<h1>Get ready!</h1>";
page += "<p>The game is about to begin.</p>"; page += "<p>The game is about to begin.</p>";
page += "<p>Come up with false answers to a trivia quiz question to fool the other players. Afterwards, find the correct answer to the question, but don't get fooled by your friends wrong answers.</p>";
page += "<p>If you answer a question correctly, you gain 3 points. If someone else thought your false answer was correct, you gain 1 point. Get the most points to win the game!</p>";
page += "<button id='button_ok' class='button button-primary' onclick='button_ok()'><i class='fas fa-arrow-right'></i>&nbsp;&nbsp;&nbsp;Let's begin!</button>"; page += "<button id='button_ok' class='button button-primary' onclick='button_ok()'><i class='fas fa-arrow-right'></i>&nbsp;&nbsp;&nbsp;Let's begin!</button>";
// Show page // Show page
@ -128,10 +126,16 @@ socket.on("WRITE", function(data){
var page = ""; var page = "";
page += "<p>Question "+data.questionNr+" of "+data.questionsTotal+"</p>"; page += "<p>Line "+data.lineNr+" of "+data.linesTotal+"</p>";
page += "<h4>"+data.question+"</h4>";
page += "<p>Enter a <b>false</b> answer.</p>"; page += "<div class='story'>";
page += "<input type='text' placeholder='Wrong answer' id='input_write' /><br/>"; for(var i=0; i<data.lineNr-1; i++){
page += "<h5>"+data.lines[i]+"</h5>";
}
page += "</div>";
page += "<p>Enter the next line.</p>";
page += "<input type='text' placeholder='The Next Line' id='input_write' /><br/>";
page += "<p id='text_write_error' style='display: none; color: #BB2266; '></p>"; page += "<p id='text_write_error' style='display: none; color: #BB2266; '></p>";
page += "<button id='button_ok' class='button button-primary' onclick='button_write()'><i class='fas fa-check'></i>&nbsp;&nbsp;&nbsp;Submit</button>"; page += "<button id='button_ok' class='button button-primary' onclick='button_write()'><i class='fas fa-check'></i>&nbsp;&nbsp;&nbsp;Submit</button>";
@ -171,18 +175,22 @@ socket.on("PICK", function(data){
var page = ""; var page = "";
page += "<p>Question "+data.questionNr+" of "+data.questionsTotal+"</p>"; page += "<p>Line "+data.lineNr+" of "+data.linesTotal+"</p>";
page += "<h4>"+data.question+"</h4>"; page += "<div class='story'>";
for(var i=0; i<data.lineNr-1; i++){
page += "<h5>"+data.lines[i]+"</h5>";
}
page += "</div>";
page += "<div id='pick_buttons'>"; page += "<div id='pick_buttons'>";
page += "<p>Select the <b>correct</b> answer.</p>"; page += "<p>Select the line you prefer.</p>";
for(y=0; y<data.answers.length/4+1; y++){ for(y=0; y<data.submissions.length/3+1; y++){
page += "<div class='row'>"; page += "<div class='row'>";
for(x=0; x<Math.min(4, data.answers.length-y*4); x++){ for(x=0; x<Math.min(3, data.submissions.length-y*3); x++){
page += "<div class='three columns'>"; page += "<div class='four columns'>";
page += "<button class='button button-primary u-full-width' onclick='button_pick("+(y*4+x)+")'>"; page += "<button class='button button-primary u-full-width' onclick='button_pick("+(y*3+x)+")'>";
page += data.answers[y*4+x]; page += data.submissions[y*3+x];
page += "</button>"; page += "</button>";
page += "</div>"; page += "</div>";
@ -210,16 +218,20 @@ socket.on("ANSWER", function(data){
var page = ""; var page = "";
page += "<p>Question "+data.questionNr+" of "+data.questionsTotal+"</p>"; page += "<p>Line "+data.lineNr+" of "+data.linesTotal+"</p>";
page += "<h4>"+data.question+"</h4>"; page += "<div class='story'>";
page += "<p>Correct answer: <b>"+data.answers[data.correctAnswer]+"</b></p>"; for(var i=0; i<data.lineNr-1; i++){
page += "<h5>"+data.lines[i]+"</h5>";
}
page += "</div>";
page += "<p>Preferred submission:<br/><b>"+data.submissions[data.bestLine]+"</b></p>";
// Table with results // Table with results
page += "<table class='u-full-width'>"; page += "<table class='u-full-width'>";
page += "<thead>"; page += "<thead>";
page += "<th></th>"; page += "<th></th>";
page += "<th></th>"; page += "<th></th>";
page += "<th>Answered</th>"; page += "<th>Picked</th>";
page += "<th>Wrote</th>"; page += "<th>Wrote</th>";
page += "<th>Change</th>"; page += "<th>Change</th>";
page += "<th>Points</th>"; page += "<th>Points</th>";
@ -229,8 +241,8 @@ socket.on("ANSWER", function(data){
for(i=0; i<data.usernames.length; i++){ for(i=0; i<data.usernames.length; i++){
page += "<tr>"; page += "<tr>";
page += "<td>"+data.usernames[i]+"</td>"; page += "<td>"+data.usernames[i]+"</td>";
page += "<td>"+(data.userPick[i] == data.correctAnswer ? "<i class='fas fa-check' style='color: #22BB66;'></i>" : "<i class='fas fa-times' style='color: #BB2266;'></i>")+"</td>"; page += "<td>"+(data.userWrite[i] == data.submissions[data.bestLine] ? "<i class='fas fa-trophy' style='color: #FFD700;'></i>" : "")+"</td>";
page += "<td>"+data.answers[data.userPick[i]]+"</td>"; page += "<td>"+data.submissions[data.userPick[i]]+"</td>";
page += "<td>"+data.userWrite[i]+"</td>"; page += "<td>"+data.userWrite[i]+"</td>";
page += "<td>+"+data.pointsDiff[i]+"</td>"; page += "<td>+"+data.pointsDiff[i]+"</td>";
page += "<td>"+data.userPoints[i]+"</td>"; page += "<td>"+data.userPoints[i]+"</td>";
@ -255,7 +267,7 @@ socket.on("STOP", function(data){
var page = ""; var page = "";
page += "<h1>We're done!</h1>"; page += "<h1>We're done!</h1>";
page += "<p>All questions were answered. Let's see who's the winner!</p>"; page += "<p>All lines were scrawled. Let's see who's the winner!</p>";
// Scoreboard // Scoreboard
page += "<table class='u-full-width'>"; page += "<table class='u-full-width'>";
@ -276,6 +288,14 @@ socket.on("STOP", function(data){
page += "</tbody>"; page += "</tbody>";
page += "</table>"; page += "</table>";
page += "<div class='new-section story'>";
page += "<p>The final scrawl:</p>";
for(var i=0; i<data.lineNr-1; i++){
page += "<h5>"+data.lines[i]+"</h5>";
}
page += "</div>";
page += "<button class='button button-primary' onclick='button_restart()'><i class='fas fa-redo'></i>&nbsp;&nbsp;&nbsp;Restart game</button>"; page += "<button class='button button-primary' onclick='button_restart()'><i class='fas fa-redo'></i>&nbsp;&nbsp;&nbsp;Restart game</button>";
document.getElementById("main").innerHTML = page; document.getElementById("main").innerHTML = page;

115
main.js
View File

@ -13,7 +13,7 @@
* You should have received a copy of the GNU General Public License along with * You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>. * this program. If not, see <https://www.gnu.org/licenses/>.
* *
* This project is hosted on https://git.bitscuit.be/bitscuit/ReverseQuiz * This project is hosted on https://git.bitscuit.be/bitscuit/Scrawl
* *
*/ */
@ -22,17 +22,16 @@ const http = require("http");
const url = require("url"); const url = require("url");
const fs = require("fs"); const fs = require("fs");
const util = require("util"); const util = require("util");
const fetch = require("node-fetch");
// Vars // Vars
const hostname = "192.168.0.128"; // Enter your local IP address here const hostname = "localhost"; // Enter your local IP address here
const port = 3000; // Enter a port number here const port = 5000; // Enter a port number here
const STATE_LOBBY = 0; const STATE_LOBBY = 0;
const STATE_MANUAL = 10; const STATE_MANUAL = 10;
const STATE_WRITE = 20; const STATE_WRITE = 20;
const STATE_PICK = 30; const STATE_PICK = 30;
const STATE_ANSWER = 40; const STATE_RESULT = 40;
const STATE_END = 50; const STATE_END = 50;
var state = STATE_LOBBY; var state = STATE_LOBBY;
@ -40,12 +39,10 @@ var userSockets = [];
var userNames = []; var userNames = [];
var userOK = []; var userOK = [];
var questionNr = 0; // Current question var lines = [];
var questionsTotal = 10; // Total nr of questions var lineNr = 0; // Current line
var questionData = {}; var linesTotal = 10; // Total nr of lines before game ends
var questionCorrectAnswerIndex; var submissions = [];
var answers;
const QUESTION_CATEGORIES = [9,15,16,17,18,19,20,22,23,27,28,30];
var userWrite = []; var userWrite = [];
var userPick = []; var userPick = [];
@ -137,14 +134,15 @@ io.on("connection", (socket) => {
state = STATE_MANUAL; state = STATE_MANUAL;
// Reset vars // Reset vars
questionNr = 0; lines = [];
lineNr = 0;
userPoints = []; userPoints = [];
for(i=0; i<userSockets.length; i++){ for(i=0; i<userSockets.length; i++){
userPoints.push(0); userPoints.push(0);
} }
// Send game data // Send game data
var dataUser = {usernames:userNames, questionsTotal:questionsTotal}; var dataUser = {usernames:userNames, linesTotal:linesTotal};
for(i=0; i<userSockets.length; i++){ for(i=0; i<userSockets.length; i++){
userSockets[i].emit("START", dataUser); userSockets[i].emit("START", dataUser);
} }
@ -170,26 +168,10 @@ io.on("connection", (socket) => {
// Check if empty // Check if empty
if(data.write == ""){ if(data.write == ""){
socket.emit("WRITE_REPLY", {error:"Please enter a false answer!"}); socket.emit("WRITE_REPLY", {error:"Please enter some text!"});
return; return;
} }
// Check if valid
var valid = true;
valid = valid && data.write.toUpperCase() != questionData.correct_answer.toUpperCase();
for(i=0; i<questionData.incorrect_answers.length; i++){
valid = valid && data.write.toUpperCase() != questionData.incorrect_answers[i].toUpperCase();
}
for(i=0; i<userWrite.length; i++){
valid = valid && data.write.toUpperCase() != userWrite[i].toUpperCase();
}
// Send error message if invalid
if(!valid){
socket.emit("WRITE_REPLY", {error:"This answer already exists!"});
return;
}
// Add to list // Add to list
userWrite[userSockets.indexOf(socket)] = data.write; userWrite[userSockets.indexOf(socket)] = data.write;
@ -227,12 +209,12 @@ function next(){
userSockets.forEach(function(s){s.emit("LOADING");}); userSockets.forEach(function(s){s.emit("LOADING");});
if(state == STATE_MANUAL || state == STATE_ANSWER){ if(state == STATE_MANUAL || state == STATE_RESULT){
// Write // Write
state = STATE_WRITE; state = STATE_WRITE;
// Update vars // Update vars
questionNr++; lineNr++;
userWrite = []; userWrite = [];
for(i=0; i<userSockets.length; i++){ for(i=0; i<userSockets.length; i++){
userWrite.push(""); userWrite.push("");
@ -243,7 +225,7 @@ function next(){
} }
// Stop if got all questions // Stop if got all questions
if(questionNr > questionsTotal){ if(lineNr > linesTotal){
// End // End
state = STATE_END; state = STATE_END;
@ -268,7 +250,7 @@ function next(){
console.log(ranks); console.log(ranks);
// Send data // Send data
var data = {ranks:ranks}; var data = {ranks:ranks, lineNr:lineNr, lines:lines};
userSockets.forEach(function(s){s.emit("STOP", data);}); userSockets.forEach(function(s){s.emit("STOP", data);});
// Reset vars // Reset vars
@ -278,24 +260,8 @@ function next(){
}else{ }else{
// Load new question // Load data for new line
console.log("Loading new question..."); userSockets.forEach(function(s){s.emit("WRITE", {lineNr:lineNr, linesTotal:linesTotal, lines:lines});});
var category = QUESTION_CATEGORIES[rand(0, QUESTION_CATEGORIES.length)];
fetch("https://opentdb.com/api.php?amount=1&type=multiple&category="+category)
.then(res => res.json()) // Convert to JSON
.then(json => {
// Question loaded
console.log("Question loaded!");
console.log(json);
// TODO: check response code
// Save data
questionData = json.results[0];
// Send question to players
userSockets.forEach(function(s){s.emit("WRITE", {questionNr:questionNr, questionsTotal:questionsTotal, question:questionData.question});});
});
} }
@ -304,20 +270,15 @@ function next(){
state = STATE_PICK; state = STATE_PICK;
console.log("Preparing PICK"); console.log("Preparing PICK");
// Send question and answers to players // Send story and all writes to players
answers = []; submissions = [];
for(i=0; i<questionData.incorrect_answers.length; i++){
answers.splice(rand(0, answers.length+1), 0, questionData.incorrect_answers[i]);
}
for(i=0; i<userWrite.length; i++){ for(i=0; i<userWrite.length; i++){
answers.splice(rand(0, answers.length+1), 0, userWrite[i]); submissions.splice(rand(0, submissions.length+1), 0, userWrite[i]);
} }
questionCorrectAnswerIndex = rand(0, answers.length+1); console.log(submissions);
answers.splice(questionCorrectAnswerIndex, 0, questionData.correct_answer);
console.log(answers);
// Send // Send
var data = {questionNr:questionNr, questionsTotal:questionsTotal, question:questionData.question, answers:answers}; var data = {lineNr:lineNr, linesTotal:linesTotal, lines:lines, submissions:submissions};
userSockets.forEach(function(s){s.emit("PICK", data);}); userSockets.forEach(function(s){s.emit("PICK", data);});
console.log(data); console.log(data);
@ -325,7 +286,7 @@ function next(){
}else if(state == STATE_PICK){ }else if(state == STATE_PICK){
// Answer // Answer
state = STATE_ANSWER; state = STATE_RESULT;
console.log("Preparing ANSWER"); console.log("Preparing ANSWER");
// Update points // Update points
@ -334,23 +295,35 @@ function next(){
pointsDiff.push(0); pointsDiff.push(0);
} }
for(i=0; i<userSockets.length; i++){ for(i=0; i<userSockets.length; i++){
// Check if correct
if(userPick[i] == questionCorrectAnswerIndex){
userPoints[i] += 3;
pointsDiff[i] += 3;
}
// Check writes // Check writes
for(j=0; j<userWrite.length; j++){ for(j=0; j<userWrite.length; j++){
if(answers[userPick[i]].toUpperCase() == userWrite[j].toUpperCase() && i != j){ if(submissions[userPick[i]].toUpperCase() == userWrite[j].toUpperCase() && i != j){
userPoints[j] += 1; userPoints[j] += 1;
pointsDiff[j] += 1; pointsDiff[j] += 1;
} }
} }
} }
// Get line with most votes
var bestLine = 0;
var lineVotes = [];
for(i=0; i<userSockets.length; i++){
lineVotes.push(0);
}
for(i=0; i<userSockets.length; i++){
lineVotes[userPick[i]] += 1;
}
for(i=0; i<userSockets.length; i++){
if(lineVotes[i] > lineVotes[bestLine]){
bestLine = i;
}
}
// Add bestLine to lines
lines.push(submissions[bestLine]);
// Send data to players // Send data to players
var data = {questionNr:questionNr, questionsTotal:questionsTotal, question:questionData.question, answers:answers, correctAnswer:questionCorrectAnswerIndex, userPick:userPick, userWrite:userWrite, userPoints:userPoints, pointsDiff:pointsDiff, usernames:userNames}; var data = {lineNr:lineNr, linesTotal:linesTotal, lines:lines, submissions:submissions, bestLine:bestLine, userPick:userPick, userWrite:userWrite, userPoints:userPoints, pointsDiff:pointsDiff, usernames:userNames};
userSockets.forEach(function(s){s.emit("ANSWER", data);}); userSockets.forEach(function(s){s.emit("ANSWER", data);});
console.log(data); console.log(data);

394
package-lock.json generated Normal file
View File

@ -0,0 +1,394 @@
{
"name": "Scrawl",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"socket.io": "^4.0.0"
}
},
"node_modules/@types/component-emitter": {
"version": "1.2.10",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.10.tgz",
"integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg=="
},
"node_modules/@types/cookie": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-y7mImlc/rNkvCRmg8gC3/lj87S7pTUIJ6QGjwHR9WQJcFs+ZMTOaoPrkdFA/YdbuqVEmEbb5RdhVxMkAcgOnpg=="
},
"node_modules/@types/cors": {
"version": "2.8.10",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz",
"integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ=="
},
"node_modules/@types/node": {
"version": "14.14.34",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz",
"integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA=="
},
"node_modules/accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"dependencies": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/base64-arraybuffer": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz",
"integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=",
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/base64id": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==",
"engines": {
"node": "^4.5.0 || >= 5.9"
}
},
"node_modules/component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
},
"node_modules/cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"dependencies": {
"object-assign": "^4",
"vary": "^1"
},
"engines": {
"node": ">= 0.10"
}
},
"node_modules/debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"dependencies": {
"ms": "2.1.2"
},
"engines": {
"node": ">=6.0"
},
"peerDependenciesMeta": {
"supports-color": {
"optional": true
}
}
},
"node_modules/engine.io": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-5.0.0.tgz",
"integrity": "sha512-BATIdDV3H1SrE9/u2BAotvsmjJg0t1P4+vGedImSs1lkFAtQdvk4Ev1y4LDiPF7BPWgXWEG+NDY+nLvW3UrMWw==",
"dependencies": {
"accepts": "~1.3.4",
"base64id": "2.0.0",
"cookie": "~0.4.1",
"cors": "~2.8.5",
"debug": "~4.3.1",
"engine.io-parser": "~4.0.0",
"ws": "~7.4.2"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/engine.io-parser": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-4.0.2.tgz",
"integrity": "sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg==",
"dependencies": {
"base64-arraybuffer": "0.1.4"
},
"engines": {
"node": ">=8.0.0"
}
},
"node_modules/mime-db": {
"version": "1.46.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz",
"integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.29",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz",
"integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==",
"dependencies": {
"mime-db": "1.46.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/socket.io": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.0.0.tgz",
"integrity": "sha512-/c1riZMV/4yz7KEpaMhDQbwhJDIoO55whXaRKgyEBQrLU9zUHXo9rzeTMvTOqwL9mbKfHKdrXcMoCeQ/1YtMsg==",
"dependencies": {
"@types/cookie": "^0.4.0",
"@types/cors": "^2.8.8",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",
"base64id": "~2.0.0",
"debug": "~4.3.1",
"engine.io": "~5.0.0",
"socket.io-adapter": "~2.2.0",
"socket.io-parser": "~4.0.3"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/socket.io-adapter": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.2.0.tgz",
"integrity": "sha512-rG49L+FwaVEwuAdeBRq49M97YI3ElVabJPzvHT9S6a2CWhDKnjSFasvwAwSYPRhQzfn4NtDIbCaGYgOCOU/rlg=="
},
"node_modules/socket.io-parser": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
"integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
"dependencies": {
"@types/component-emitter": "^1.2.10",
"component-emitter": "~1.3.0",
"debug": "~4.3.1"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/ws": {
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz",
"integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==",
"engines": {
"node": ">=8.3.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": "^5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
}
},
"dependencies": {
"@types/component-emitter": {
"version": "1.2.10",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.10.tgz",
"integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg=="
},
"@types/cookie": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.0.tgz",
"integrity": "sha512-y7mImlc/rNkvCRmg8gC3/lj87S7pTUIJ6QGjwHR9WQJcFs+ZMTOaoPrkdFA/YdbuqVEmEbb5RdhVxMkAcgOnpg=="
},
"@types/cors": {
"version": "2.8.10",
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz",
"integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ=="
},
"@types/node": {
"version": "14.14.34",
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.34.tgz",
"integrity": "sha512-dBPaxocOK6UVyvhbnpFIj2W+S+1cBTkHQbFQfeeJhoKFbzYcVUGHvddeWPSucKATb3F0+pgDq0i6ghEaZjsugA=="
},
"accepts": {
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
"requires": {
"mime-types": "~2.1.24",
"negotiator": "0.6.2"
}
},
"base64-arraybuffer": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz",
"integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI="
},
"base64id": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz",
"integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog=="
},
"component-emitter": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz",
"integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg=="
},
"cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
},
"cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
"requires": {
"object-assign": "^4",
"vary": "^1"
}
},
"debug": {
"version": "4.3.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz",
"integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==",
"requires": {
"ms": "2.1.2"
}
},
"engine.io": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-5.0.0.tgz",
"integrity": "sha512-BATIdDV3H1SrE9/u2BAotvsmjJg0t1P4+vGedImSs1lkFAtQdvk4Ev1y4LDiPF7BPWgXWEG+NDY+nLvW3UrMWw==",
"requires": {
"accepts": "~1.3.4",
"base64id": "2.0.0",
"cookie": "~0.4.1",
"cors": "~2.8.5",
"debug": "~4.3.1",
"engine.io-parser": "~4.0.0",
"ws": "~7.4.2"
}
},
"engine.io-parser": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-4.0.2.tgz",
"integrity": "sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg==",
"requires": {
"base64-arraybuffer": "0.1.4"
}
},
"mime-db": {
"version": "1.46.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz",
"integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ=="
},
"mime-types": {
"version": "2.1.29",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz",
"integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==",
"requires": {
"mime-db": "1.46.0"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"negotiator": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
},
"socket.io": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.0.0.tgz",
"integrity": "sha512-/c1riZMV/4yz7KEpaMhDQbwhJDIoO55whXaRKgyEBQrLU9zUHXo9rzeTMvTOqwL9mbKfHKdrXcMoCeQ/1YtMsg==",
"requires": {
"@types/cookie": "^0.4.0",
"@types/cors": "^2.8.8",
"@types/node": ">=10.0.0",
"accepts": "~1.3.4",
"base64id": "~2.0.0",
"debug": "~4.3.1",
"engine.io": "~5.0.0",
"socket.io-adapter": "~2.2.0",
"socket.io-parser": "~4.0.3"
}
},
"socket.io-adapter": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.2.0.tgz",
"integrity": "sha512-rG49L+FwaVEwuAdeBRq49M97YI3ElVabJPzvHT9S6a2CWhDKnjSFasvwAwSYPRhQzfn4NtDIbCaGYgOCOU/rlg=="
},
"socket.io-parser": {
"version": "4.0.4",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz",
"integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==",
"requires": {
"@types/component-emitter": "^1.2.10",
"component-emitter": "~1.3.0",
"debug": "~4.3.1"
}
},
"vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
},
"ws": {
"version": "7.4.4",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.4.tgz",
"integrity": "sha512-Qm8k8ojNQIMx7S+Zp8u/uHOx7Qazv3Yv4q68MiWWWOJhiwG5W3x7iqmRtJo8xxrciZUY4vRxUTJCKuRnF28ZZw==",
"requires": {}
}
}
}

5
package.json Normal file
View File

@ -0,0 +1,5 @@
{
"dependencies": {
"socket.io": "^4.0.0"
}
}