From d6a0e11b8026394f36401a1165c59edbf937ac4e Mon Sep 17 00:00:00 2001 From: Jeff Heiges Date: Tue, 11 Mar 2025 07:20:05 +0000 Subject: Update packages due to them being deprecated or vulnerable. --- diplomacy/web/package.json | 76 ++++++++++++++++++------ diplomacy/web/src/gui/utils/map_data.js | 100 -------------------------------- 2 files changed, 57 insertions(+), 119 deletions(-) delete mode 100644 diplomacy/web/src/gui/utils/map_data.js diff --git a/diplomacy/web/package.json b/diplomacy/web/package.json index 3084ae1..60d3c41 100644 --- a/diplomacy/web/package.json +++ b/diplomacy/web/package.json @@ -1,30 +1,68 @@ { - "name": "web", - "version": "0.1.0", - "homepage": ".", - "private": true, - "dependencies": { - "@primer/octicons-react": "^9.1.1", - "bootstrap": "^4.3.1", - "jquery": "^3.4.1", - "popper.js": "^1.15.0", - "prop-types": "^15.7.2", - "react": "^16.8.6", - "react-confirm-alert": "^2.4.1", - "react-dom": "^16.8.6", - "react-helmet": "^5.2.1", - "react-scripts": "3.0.1", - "react-scrollchor": "^6.0.0", - "react-shortcut": "^1.0.6" - }, + "name": "diplomacy-game", + "version": "1.0.0", + "description": "Diplomacy game implementation", + "main": "index.js", "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject" }, + "dependencies": { + "@popperjs/core": "^2.11.8", + "@primer/octicons-react": "^19.15.1", + "axios": "^1.6.7", + "babel-types": "^6.26.0", + "bootstrap": "^5.3.3", + "core-js": "^3.37.0", + "cors": "^2.8.5", + "eslint-webpack-plugin": "^4.0.2", + "eta": "^3.5.0", + "express": "^4.18.2", + "fs-extra": "^11.2.0", + "glob": "^10.3.10", + "html-webpack-plugin": "^5.5.3", + "joi": "^17.10.0", + "jquery": "^3.7.1", + "lodash": "^4.17.21", + "lru-cache": "^10.0.0", + "node-fetch": "^3.3.2", + "react": "^18.2.0", + "react-confirm-alert": "^3.0.6", + "react-dom": "^18.2.0", + "react-helmet": "^6.1.0", + "react-scripts": "^5.0.1", + "react-scrollchor": "^7.0.2", + "react-shortcut": "^2.0.9", + "rimraf": "6.0.1", + "socket.io": "^4.7.2", + "uuid": "^9.0.1", + "webpack": "^5.89.0", + "webpack-cli": "^5.1.4", + "webpack-dev-server": "^4.13.0", + "workbox-background-sync": "^6.6.0", + "workbox-webpack-plugin": "^6.2.5" + }, "devDependencies": { - "eslint-plugin-react": "^7.14.2" + "@babel/core": "^7.24.1", + "@babel/eslint-parser": "^7.24.1", + "@babel/plugin-transform-async-generator-functions": "^7.24.1", + "@babel/plugin-transform-class-properties": "^7.24.1", + "@babel/plugin-transform-dynamic-import": "^7.24.1", + "@babel/plugin-transform-json-strings": "^7.24.1", + "@babel/plugin-transform-object-rest-spread": "^7.24.1", + "@babel/plugin-transform-optional-catch-binding": "^7.24.1", + "@babel/plugin-transform-unicode-property-regex": "^7.24.1", + "@babel/preset-env": "^7.24.1", + "@babel/preset-react": "^7.24.1", + "@eslint/config-array": "0.19.2", + "@eslint/object-schema": "^2.1.0", + "@jridgewell/sourcemap-codec": "1.5.0", + "@rollup/plugin-terser": "^0.4.4", + "eslint": "^9.3.0", + "jscodeshift": "^17.1.2", + "webpack-bundle-analyzer": "^4.9.0" }, "browserslist": { "production": [ diff --git a/diplomacy/web/src/gui/utils/map_data.js b/diplomacy/web/src/gui/utils/map_data.js deleted file mode 100644 index 1c48af0..0000000 --- a/diplomacy/web/src/gui/utils/map_data.js +++ /dev/null @@ -1,100 +0,0 @@ -// ============================================================================== -// Copyright (C) 2019 - Philip Paquette, Steven Bocco -// -// This program is free software: you can redistribute it and/or modify it under -// the terms of the GNU Affero General Public License as published by the Free -// Software Foundation, either version 3 of the License, or (at your option) any -// later version. -// -// This program is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more -// details. -// -// You should have received a copy of the GNU Affero General Public License along -// with this program. If not, see . -// ============================================================================== -import {Province} from "./province"; - -export class MapData { - constructor(mapInfo, game) { - // mapInfo: {powers: [], supply_centers: [], aliases: {alias: name}, loc_type: {loc => type}, loc_abut: {loc => [abuts]}} - // game: a NetworkGame object. - this.game = game; - this.powers = new Set(mapInfo.powers); - this.supplyCenters = new Set(mapInfo.supply_centers); - this.aliases = Object.assign({}, mapInfo.aliases); - this.provinces = {}; - for (let entry of Object.entries(mapInfo.loc_type)) { - const provinceName = entry[0]; - const provinceType = entry[1]; - this.provinces[provinceName] = new Province(provinceName, provinceType, this.supplyCenters.has(provinceName)); - } - for (let entry of Object.entries(mapInfo.loc_abut)) { - this.getProvince(entry[0]).setNeighbors(entry[1].map(name => this.getProvince(name))); - } - for (let province of Object.values(this.provinces)) { - province.setCoasts(this.provinces); - } - for (let power of Object.values(this.game.powers)) { - for (let center of power.centers) { - this.getProvince(center).setController(power.name, 'C'); - } - for (let loc of power.influence) { - this.getProvince(loc).setController(power.name, 'I'); - } - for (let unit of power.units) { - this.__add_unit(unit, power.name); - } - for (let unit of Object.keys(power.retreats)) { - this.__add_retreat(unit, power.name); - } - } - for (let entry of Object.entries(this.aliases)) { - const alias = entry[0]; - const provinceName = entry[1]; - const province = this.getProvince(provinceName); - if (province) - province.aliases.push(alias); - } - } - - __add_unit(unit, power_name) { - const splitUnit = unit.split(/ +/); - const unitType = splitUnit[0]; - const location = splitUnit[1]; - const province = this.getProvince(location); - province.setController(power_name, 'U'); - province.unit = unitType; - } - - __add_retreat(unit, power_name) { - const splitUnit = unit.split(/ +/); - const location = splitUnit[1]; - const province = this.getProvince(location); - province.retreatController = power_name; - province.retreatUnit = unit; - } - - getProvince(abbr) { - if (abbr === '') - return null; - if (abbr[0] === '_') - abbr = abbr.substr(1, 3); - if (!abbr) - return null; - if (this.provinces.hasOwnProperty(abbr)) - return this.provinces[abbr]; - if (this.provinces.hasOwnProperty(abbr.toUpperCase())) - return this.provinces[abbr.toUpperCase()]; - if (this.provinces.hasOwnProperty(abbr.toLowerCase())) - return this.provinces[abbr.toLowerCase()]; - if (this.aliases.hasOwnProperty(abbr)) - return this.provinces[this.aliases[abbr]]; - if (this.aliases.hasOwnProperty(abbr.toUpperCase())) - return this.provinces[this.aliases[abbr.toUpperCase()]]; - if (this.aliases.hasOwnProperty(abbr.toLowerCase())) - return this.provinces[this.aliases[abbr.toLowerCase()]]; - return null; - } -} -- cgit v1.2.3