23 Commits

Author SHA1 Message Date
AlecM33
befbeaa228 formatting 2024-11-11 15:01:56 -05:00
AlecM33
467a0a17de update role descriptions 2024-11-11 15:00:18 -05:00
AlecM33
0bbd696fba remove footer, update link to buymeacoffee 2024-11-11 14:32:39 -05:00
AlecM33
7c97001363 fix webpack compression exception 2024-11-10 13:10:04 -05:00
AlecM33
35d280d5ee update node version in dockerfile 2024-11-10 12:48:22 -05:00
AlecM33
0fe9432528 bump node version in package json 2024-11-10 12:35:36 -05:00
AlecM33
b5c610f9ab update node ci version 2024-11-08 13:37:24 -05:00
AlecM33
7cc87d9a48 reset package-lock 2024-11-08 13:32:11 -05:00
dependabot[bot]
ee4aa21a1d Bump ws and socket.io-adapter (#204)
Bumps [ws](https://github.com/websockets/ws) and [socket.io-adapter](https://github.com/socketio/socket.io-adapter). These dependencies needed to be updated together.

Updates `ws` from 8.11.0 to 8.17.1
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.11.0...8.17.1)

Updates `socket.io-adapter` from 2.5.2 to 2.5.5
- [Release notes](https://github.com/socketio/socket.io-adapter/releases)
- [Changelog](https://github.com/socketio/socket.io-adapter/blob/2.5.5/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io-adapter/compare/2.5.2...2.5.5)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
- dependency-name: socket.io-adapter
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-08 13:29:14 -05:00
dependabot[bot]
4d18ca0d42 Bump cookie, express and socket.io (#203)
Bumps [cookie](https://github.com/jshttp/cookie) to 0.7.1 and updates ancestor dependencies [cookie](https://github.com/jshttp/cookie), [express](https://github.com/expressjs/express) and [socket.io](https://github.com/socketio/socket.io). These dependencies need to be updated together.


Updates `cookie` from 0.4.2 to 0.7.1
- [Release notes](https://github.com/jshttp/cookie/releases)
- [Commits](https://github.com/jshttp/cookie/compare/v0.4.2...v0.7.1)

Updates `express` from 4.20.0 to 4.21.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.1/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.20.0...4.21.1)

Updates `socket.io` from 4.7.5 to 4.8.1
- [Release notes](https://github.com/socketio/socket.io/releases)
- [Changelog](https://github.com/socketio/socket.io/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io/compare/socket.io@4.7.5...socket.io@4.8.1)

---
updated-dependencies:
- dependency-name: cookie
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
- dependency-name: socket.io
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-08 13:24:07 -05:00
dependabot[bot]
47263c65a8 Bump body-parser and express (#202)
Bumps [body-parser](https://github.com/expressjs/body-parser) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.

Updates `body-parser` from 1.20.2 to 1.20.3
- [Release notes](https://github.com/expressjs/body-parser/releases)
- [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md)
- [Commits](https://github.com/expressjs/body-parser/compare/1.20.2...1.20.3)

Updates `express` from 4.19.2 to 4.21.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.0)

---
updated-dependencies:
- dependency-name: body-parser
  dependency-type: direct:production
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alec <leohfx@gmail.com>
2024-11-08 13:19:41 -05:00
dependabot[bot]
a7fb2afde1 Bump send and express (#201)
Bumps [send](https://github.com/pillarjs/send) to 0.19.0 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `send` from 0.18.0 to 0.19.0
- [Release notes](https://github.com/pillarjs/send/releases)
- [Changelog](https://github.com/pillarjs/send/blob/master/HISTORY.md)
- [Commits](https://github.com/pillarjs/send/compare/0.18.0...0.19.0)

Updates `express` from 4.19.2 to 4.21.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.0)

---
updated-dependencies:
- dependency-name: send
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alec <leohfx@gmail.com>
2024-11-08 13:16:02 -05:00
dependabot[bot]
d31999e06e Bump serve-static and express (#200)
* Bump serve-static and express

Bumps [serve-static](https://github.com/expressjs/serve-static) to 1.16.2 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `serve-static` from 1.15.0 to 1.16.2
- [Release notes](https://github.com/expressjs/serve-static/releases)
- [Changelog](https://github.com/expressjs/serve-static/blob/v1.16.2/HISTORY.md)
- [Commits](https://github.com/expressjs/serve-static/compare/v1.15.0...v1.16.2)

Updates `express` from 4.19.2 to 4.21.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/4.21.0/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.21.0)

---
updated-dependencies:
- dependency-name: serve-static
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update package-lock.json

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alec <leohfx@gmail.com>
2024-11-08 13:02:13 -05:00
dependabot[bot]
7b4a96a8fa Bump path-to-regexp and express (#199)
Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) to 0.1.10 and updates ancestor dependency [express](https://github.com/expressjs/express). These dependencies need to be updated together.


Updates `path-to-regexp` from 0.1.7 to 0.1.10
- [Release notes](https://github.com/pillarjs/path-to-regexp/releases)
- [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md)
- [Commits](https://github.com/pillarjs/path-to-regexp/compare/v0.1.7...v0.1.10)

Updates `express` from 4.19.2 to 4.20.0
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.19.2...4.20.0)

---
updated-dependencies:
- dependency-name: path-to-regexp
  dependency-type: indirect
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-08 12:35:35 -05:00
dependabot[bot]
c180897862 Bump webpack from 5.76.0 to 5.94.0 (#198)
Bumps [webpack](https://github.com/webpack/webpack) from 5.76.0 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.76.0...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-08 12:35:26 -05:00
dependabot[bot]
088e65c728 Bump ws, socket.io and socket.io-client (#197)
Bumps [ws](https://github.com/websockets/ws) to 8.18.0 and updates ancestor dependencies [ws](https://github.com/websockets/ws), [socket.io](https://github.com/socketio/socket.io) and [socket.io-client](https://github.com/socketio/socket.io-client). These dependencies need to be updated together.


Updates `ws` from 8.2.3 to 8.18.0
- [Release notes](https://github.com/websockets/ws/releases)
- [Commits](https://github.com/websockets/ws/compare/8.2.3...8.18.0)

Updates `socket.io` from 4.6.2 to 4.7.5
- [Release notes](https://github.com/socketio/socket.io/releases)
- [Changelog](https://github.com/socketio/socket.io/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io/compare/4.6.2...4.7.5)

Updates `socket.io-client` from 4.5.4 to 4.7.5
- [Release notes](https://github.com/socketio/socket.io-client/releases)
- [Changelog](https://github.com/socketio/socket.io-client/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io-client/compare/4.5.4...4.7.5)

---
updated-dependencies:
- dependency-name: ws
  dependency-type: indirect
- dependency-name: socket.io
  dependency-type: direct:production
- dependency-name: socket.io-client
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-08 12:35:16 -05:00
dependabot[bot]
718ad1b58e Bump braces from 3.0.2 to 3.0.3 (#195)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-04 11:05:09 -04:00
dependabot[bot]
69a2a88d74 Bump socket.io from 4.6.1 to 4.6.2 (#196)
Bumps [socket.io](https://github.com/socketio/socket.io) from 4.6.1 to 4.6.2.
- [Release notes](https://github.com/socketio/socket.io/releases)
- [Changelog](https://github.com/socketio/socket.io/blob/main/CHANGELOG.md)
- [Commits](https://github.com/socketio/socket.io/compare/4.6.1...4.6.2)

---
updated-dependencies:
- dependency-name: socket.io
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-04 11:05:01 -04:00
dependabot[bot]
5f819f8f17 Bump ejs from 3.1.8 to 3.1.10 (#194)
Bumps [ejs](https://github.com/mde/ejs) from 3.1.8 to 3.1.10.
- [Release notes](https://github.com/mde/ejs/releases)
- [Commits](https://github.com/mde/ejs/compare/v3.1.8...v3.1.10)

---
updated-dependencies:
- dependency-name: ejs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-10 09:09:13 -04:00
dependabot[bot]
4ad2d6c663 Bump express from 4.18.2 to 4.19.2 (#193)
Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](https://github.com/expressjs/express/compare/4.18.2...4.19.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-09 16:19:16 -04:00
Alec
01ed3c6842 Remove unload event (#192)
* use page hide event, manually reconnect

* comment

* lint
2024-03-26 22:01:39 -04:00
dependabot[bot]
1833bde903 Bump follow-redirects from 1.15.4 to 1.15.6 (#190)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-17 16:13:01 -04:00
Alec
915819bb15 Fix bug where we incorrectly added a user as a player instead of a spectator (#189)
* fix bug with failing to add as spectator for in-progress game

* refactor fix

* revert to previous fix
2024-03-12 22:59:05 -04:00
12 changed files with 533 additions and 5836 deletions

View File

@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
node-version: [14.x]
node-version: [20.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:

View File

@@ -1,6 +1,6 @@
# Use the official lightweight Node.js 14 image.
# https://hub.docker.com/_/node
FROM node:14-slim
FROM node:20-slim
# Create and change to the app directory.
WORKDIR /usr/src/app

View File

@@ -1,4 +1,4 @@
FROM node:14-slim
FROM node:20-slim
WORKDIR /usr/src/app

View File

@@ -2,17 +2,17 @@ export const defaultRoles = [
{
role: 'Villager',
team: 'good',
description: 'During the day, find the wolves and kill them.'
description: 'During the day, find the Werewolves and kill them.'
},
{
role: 'Werewolf',
team: 'evil',
description: "During the night, choose a villager to kill. Don't get killed."
description: 'During the night, choose a player to eliminate.'
},
{
role: 'Dream Wolf',
team: 'evil',
description: "You are a Werewolf, but you don't wake up with the other Werewolves until one of them dies."
description: 'You are a Werewolf, but you don\'t wake up with the other Werewolves until one of them dies.'
},
{
role: 'Sorceress',
@@ -22,12 +22,12 @@ export const defaultRoles = [
{
role: 'Knowing Minion',
team: 'evil',
description: 'You are an evil Villager, and you know who the Werewolves are.'
description: 'You are an evil Villager, and you know who the Werewolves are. You win if the Werewolves win.'
},
{
role: 'Blind Minion',
team: 'evil',
description: "You are an evil villager, but you don't know who the Werewolves are."
description: 'You are an evil villager, but you do NOT know who the Werewolves are. You win if the Werewolves win.'
},
{
role: 'Seer',
@@ -48,11 +48,11 @@ export const defaultRoles = [
{
role: 'Parity Hunter',
team: 'good',
description: 'You beat a werewolf in a 1v1 situation, winning the game for the village.'
description: 'If you and a Werewolf are the only two players remaining, the Village wins.'
},
{
role: 'Brutal Hunter',
team: 'good',
description: 'When you are eliminated, choose another player to go with you.'
description: 'When you are eliminated, choose another player to be eliminated with you.'
}
];

View File

@@ -44,6 +44,7 @@ function getNavbarLinks (page = null, device) {
'<a class="' + linkClass + '" href="/create">Create</a>' +
'<a class="' + linkClass + '" href="/how-to-use">How to Use</a>' +
'<a class="' + linkClass + ' "href="mailto:play.werewolf.contact@gmail.com?Subject=Werewolf App" target="_top">Feedback</a>' +
'<a class="' + linkClass + ' "href="https://buymeacoffee.com/alecm33" target="_top">Support Me</a>' +
'<a class="' + linkClass + ' "href="https://github.com/alecm33/Werewolf" target="_top">Github</a>';
}

View File

@@ -18,7 +18,7 @@ import { InProgress } from '../game_state/states/InProgress.js';
import { Ended } from '../game_state/states/Ended.js';
export const gameHandler = (socket, window, gameDOM) => {
window.onunload = () => {
window.onpagehide = () => {
socket.close();
};
document.body.innerHTML = gameDOM + document.body.innerHTML;
@@ -60,8 +60,11 @@ export const gameHandler = (socket, window, gameDOM) => {
toast(err, 'error', true, false);
});
socket.on('disconnect', () => {
socket.on('disconnect', (reason) => {
toast('Disconnected. Attempting reconnect...', 'error', true, false);
if (reason === 'io client disconnect') { // see https://socket.io/docs/v4/client-api/#event-disconnect
socket.connect();
}
});
setClientSocketHandlers(stateBucket, socket);
resolve();

View File

@@ -54,6 +54,10 @@ button#home-create-button {
margin: 0 15px;
}
#about-container div:nth-child(2) h2 {
margin-bottom: 2em;
}
#homepage-logos {
display: flex;
align-items: center;

View File

@@ -34,7 +34,7 @@
<button id="home-create-button" class="app-button">Create A Room</button>
</a>
<div id="join-container">
<label for="join-form">Join A Room</label>
<label>Join A Room</label>
<form id="join-form">
<div>
<label for="room-code">Room Code</label>
@@ -59,13 +59,6 @@
<h2>Create your own game with default or custom roles.</h2>
</div>
</div>
<footer id="footer">
<a href="https://www.buymeacoffee.com/alecm33"><img alt="Buy Me a Coffee" src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=alecm33&button_colour=252525&font_colour=d7d7d7&font_family=Lato&outline_colour=d7d7d7&coffee_colour=d7d7d7" /></a>
<div>
<a aria-label="view the project on Github" href="https://github.com/AlecM33/Werewolf"><img alt="Github" src='/images/GitHub-Mark-Light-120px-plus.png'/></a>
<a aria-label="email the creator with questions" href="mailto:play.werewolf.contact@gmail.com?Subject=Werewolf App" target="_top"><img alt="email" src='/images/email.svg'/></a>
</div>
</footer>
<script src="/dist/home-bundle.js.gz"></script>
</body>
</html>

View File

@@ -15,7 +15,7 @@ module.exports = {
path: path.resolve(__dirname, '../dist'),
filename: "[name]-bundle.js"
},
plugins: [new CompressionPlugin({ deleteOriginalAssets: true, exclude: [/521-bundle.js$/]})],
plugins: [new CompressionPlugin({ deleteOriginalAssets: true, exclude: [/\d+-bundle.js$/]})],
mode: "production",
node: false,
module: {

6312
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -21,24 +21,24 @@
},
"main": "index.js",
"engines": {
"node": ">= 14.0.0"
"node": ">= 20.0.0"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-loader": "^8.2.3",
"body-parser": "^1.20.1",
"body-parser": "^1.20.3",
"compression-webpack-plugin": "^10.0.0",
"cors": "^2.8.5",
"express": "^4.18.2",
"express": "^4.21.1",
"express-force-https": "^1.0.0",
"express-rate-limit": "^6.0.1",
"open": "^7.0.3",
"rate-limiter-flexible": "^2.3.6",
"redis": "^4.5.1",
"regenerator-runtime": "^0.13.9",
"socket.io": "^4.6.1",
"socket.io-client": "^4.5.4"
"socket.io": "^4.8.1",
"socket.io-client": "^4.7.5"
},
"devDependencies": {
"@babel/core": "^7.18.13",
@@ -59,7 +59,7 @@
"karma": "^6.3.16",
"karma-chrome-launcher": "^3.1.0",
"karma-jasmine": "^4.0.1",
"webpack": "^5.76.0",
"webpack": "^5.94.0",
"webpack-cli": "^4.9.1",
"webpack-remove-debug": "^0.1.0"
},

View File

@@ -191,7 +191,7 @@ class GameManager {
&& game.people.filter(person => person.userType === USER_TYPES.SPECTATOR).length === PRIMITIVES.MAX_SPECTATORS
) {
return Promise.reject({ status: 400, reason: 'There are too many people already spectating.' });
} else if (joinAsSpectator || this.isGameStartable(game)) {
} else if (joinAsSpectator || this.isGameStartable(game) || game.status === STATUS.IN_PROGRESS) {
return await addSpectator(game, name, this.logger, this.namespace, this.eventManager, this.instanceId, this.refreshGame);
}
let moderator, newPlayer;