From d08ea168bb187f33019c7df6470650c8ab54afed Mon Sep 17 00:00:00 2001 From: marsilainen Date: Thu, 5 Feb 2026 22:50:20 +0200 Subject: [PATCH] Initial commit --- .gitattributes | 2 + .gitignore | 130 +++++ package-lock.json | 1061 +++++++++++++++++++++++++++++++++++++++++ package.json | 16 + public/index.html | 1166 +++++++++++++++++++++++++++++++++++++++++++++ server.js | 837 ++++++++++++++++++++++++++++++++ 6 files changed, 3212 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100755 package-lock.json create mode 100755 package.json create mode 100755 public/index.html create mode 100755 server.js diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6bba59 --- /dev/null +++ b/.gitignore @@ -0,0 +1,130 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* diff --git a/package-lock.json b/package-lock.json new file mode 100755 index 0000000..501384a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1061 @@ +{ + "name": "cawings", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "cawings", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "express": "^5.1.0", + "socket.io": "^4.8.1" + } + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz", + "integrity": "sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==" + }, + "node_modules/@types/cors": { + "version": "2.8.19", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.19.tgz", + "integrity": "sha512-mFNylyeyqN93lfe/9CSxOGREz8cpzAhH+E93xJ4xWQf62V8sQ/24reV2nyzUWM6H6Xji+GGHpkbLe7pVoUEskg==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "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/body-parser": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz", + "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.0", + "http-errors": "^2.0.0", + "iconv-lite": "^0.6.3", + "on-finished": "^2.4.1", + "qs": "^6.14.0", + "raw-body": "^3.0.0", + "type-is": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "engines": { + "node": ">=6.6.0" + } + }, + "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.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/engine.io": { + "version": "6.6.4", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.4.tgz", + "integrity": "sha512-ZCkIjSYNDyGn0R6ewHDtXgns/Zre/NT6Agvq1/WobF7JXgFff4SeDroKiCO3fNJreU9YG429Sc81o4w5ok/W5g==", + "dependencies": { + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", + "accepts": "~1.3.4", + "base64id": "2.0.0", + "cookie": "~0.7.2", + "cors": "~2.8.5", + "debug": "~4.3.1", + "engine.io-parser": "~5.2.1", + "ws": "~8.17.1" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/engine.io-parser": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.3.tgz", + "integrity": "sha512-HqD3yTBfnBxIrbnM1DoD6Pcq8NECnh8d4As1Qgh0z5Gg3jRRIqijury0CL3ghu/edArpUYiYqQiDUQBIs4np3Q==", + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/engine.io/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/engine.io/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/engine.io/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/engine.io/node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/express": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz", + "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==", + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.0", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/finalhandler": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz", + "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "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": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz", + "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.14.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", + "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.1.tgz", + "integrity": "sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA==", + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.7.0", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/raw-body/node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/raw-body/node_modules/iconv-lite": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/raw-body/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/send": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz", + "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==", + "dependencies": { + "debug": "^4.3.5", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "mime-types": "^3.0.1", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/serve-static": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz", + "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/socket.io": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.8.1.tgz", + "integrity": "sha512-oZ7iUCxph8WYRHHcjBEc9unw3adt5CmSNlppj/5Q4k2RIrhl8Z5yY2Xr4j9zj0+wzVZ0bxmYoGSzKJnRl6A4yg==", + "dependencies": { + "accepts": "~1.3.4", + "base64id": "~2.0.0", + "cors": "~2.8.5", + "debug": "~4.3.2", + "engine.io": "~6.6.0", + "socket.io-adapter": "~2.5.2", + "socket.io-parser": "~4.2.4" + }, + "engines": { + "node": ">=10.2.0" + } + }, + "node_modules/socket.io-adapter": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.5.5.tgz", + "integrity": "sha512-eLDQas5dzPgOWCk9GuuJC2lBqItuhKI4uxGgo9aIV7MYbk2h9Q6uULEh8WBzThoI7l+qU9Ast9fVUmkqPP9wYg==", + "dependencies": { + "debug": "~4.3.4", + "ws": "~8.17.1" + } + }, + "node_modules/socket.io-adapter/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-parser": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.4.tgz", + "integrity": "sha512-/GbIKmo8ioc+NIWIhwdecY0ge+qVBSMdgxGygevmdHj24bsfgtCmcUUcQ5ZzcylGFHsN3k4HB4Cgkl96KVnuew==", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", + "debug": "~4.3.1" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io/node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", + "dependencies": { + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/socket.io/node_modules/debug": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io/node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/socket.io/node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/socket.io/node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + } + } +} diff --git a/package.json b/package.json new file mode 100755 index 0000000..e4cf2be --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "cawings", + "version": "1.0.0", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "express": "^5.1.0", + "socket.io": "^4.8.1" + } +} diff --git a/public/index.html b/public/index.html new file mode 100755 index 0000000..c63815c --- /dev/null +++ b/public/index.html @@ -0,0 +1,1166 @@ + + + + + Vector Void + + + + + + +
+

Vector Void

+ + +
+
+ + +
+ + +
+
+ + +
+
+ + +
+
+

Active Rooms

+
+
+
+ + + + + + +
+

YOU WON

+ +
+ + + +
+
<
+
>
+ +
▲
+
A
+
B
+
+ + + + + + \ No newline at end of file diff --git a/server.js b/server.js new file mode 100755 index 0000000..7d0e9aa --- /dev/null +++ b/server.js @@ -0,0 +1,837 @@ +const express = require('express'); +const http = require('http'); +const socketIo = require('socket.io'); + +const app = express(); +const server = http.createServer(app); + +const io = socketIo(server, { + cors: { + origin: "*", // Allow connection from any IP or Domain + methods: ["GET", "POST"] + } +}); + +//const io = socketIo(server); + +app.use(express.static('public')); + +const gameRooms = {}; + +const WIDTH = 1600; +const HEIGHT = 1200; +const gravity = 0.02; +const maxSpeed = 3; // Reduced max speed + +// --- MAP GENERATOR FACTORY --- +// Returns a unique set of terrain data for a specific room +function generateCaveLevel() { + const roofPoints = []; + const floorPoints = []; + const leftWallPoints = []; + const rightWallPoints = []; + const islands = []; + + const step = 40; + const roofInitialHeight = HEIGHT / 8; + const floorInitialHeight = HEIGHT * 7 / 8; + const verticalDrift = 30; + const horizontalDrift = 15; + const islandCount = 15; + const minGap = 500; + + let y_roof = roofInitialHeight; + let y_floor = floorInitialHeight; + + // Horizontal terrain generation + for (let x = 0; x <= WIDTH + step; x += step) { + y_roof += (Math.random() - 0.5) * verticalDrift; + y_floor += (Math.random() - 0.5) * verticalDrift; + y_roof = Math.max(20, Math.min(y_roof, HEIGHT - minGap)); + y_floor = Math.min(HEIGHT - 20, Math.max(y_floor, y_roof + minGap)); + roofPoints.push({ x, y: y_roof }); + floorPoints.push({ x, y: y_floor }); + } + + // Vertical wall generation + let x_left = 50; + let x_right = WIDTH - 50; + for (let y = 0; y <= HEIGHT + step; y += step) { + x_left += (Math.random() - 0.5) * horizontalDrift; + x_right += (Math.random() - 0.5) * horizontalDrift; + x_left = Math.max(20, Math.min(x_left, 80)); + x_right = Math.min(WIDTH - 20, Math.max(x_right, WIDTH - 80)); + leftWallPoints.push({ x: x_left, y }); + rightWallPoints.push({ x: x_right, y }); + } + + // Island generation + for (let i = 0; i < islandCount; i++) { + const islandCenterX = Math.random() * (WIDTH - 600) + 300; + // Helper functions are defined below, but hoisted, so this works + const roofAtX = getTerrainHeight(islandCenterX, roofPoints); + const floorAtX = getTerrainHeight(islandCenterX, floorPoints); + const islandCenterY = Math.random() * (floorAtX - roofAtX - 400) + (roofAtX + 200); + + const islandPoints = []; + const islandSegments = Math.floor(Math.random() * 12) + 10; + const minRadius = 50, maxRadius = 120; + + for (let j = 0; j < islandSegments; j++) { + const angle = (j / islandSegments) * Math.PI * 2; + const radius = Math.random() * (maxRadius - minRadius) + minRadius; + const x = islandCenterX + Math.cos(angle) * radius; + const y = islandCenterY + Math.sin(angle) * radius; + islandPoints.push({ x, y }); + } + islands.push(islandPoints); + } + + // Create Landing Zone + const landingZoneWidth = 100; + const lzStartIndex = Math.floor(Math.random() * (floorPoints.length - (landingZoneWidth / step) - 10)) + 5; // avoid edges + const lzEndIndex = lzStartIndex + Math.round(landingZoneWidth / step); + let landingZone = null; + if (lzEndIndex < floorPoints.length) { + const avgY = floorPoints.slice(lzStartIndex, lzEndIndex).reduce((sum, p) => sum + p.y, 0) / (lzEndIndex - lzStartIndex); + + for(let i = lzStartIndex; i < lzEndIndex; i++) { + floorPoints[i].y = avgY; // Flatten the floor segment + } + + landingZone = { + x: floorPoints[lzStartIndex].x, + y: avgY, + width: floorPoints[lzEndIndex].x - floorPoints[lzStartIndex].x, + height: 40 // For visualization on client + }; + } + + return { roofPoints, floorPoints, leftWallPoints, rightWallPoints, islands, landingZone }; +} + +// --- HELPER FUNCTIONS --- + +const PLAYER_EMOJIS = ['🚀', '👾', '🤖', 'đŸ‘Ŋ', '⭐', 'đŸ’Ģ', 'đŸ’Ĩ', '✨', 'â˜„ī¸', 'đŸĒ']; + +function makeId(length) { + var result = ''; + var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + var charactersLength = characters.length; + for (var i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + } + return result; +} + +function getTerrainHeight(x, points) { + if (!points || points.length === 0) return 0; + if (x <= points[0].x) return points[0].y; + if (x >= points[points.length - 1].x) return points[points.length - 1].y; + + let p1, p2; + for (let i = 0; i < points.length - 1; i++) { + if (x >= points[i].x && x < points[i+1].x) { + p1 = points[i]; + p2 = points[i+1]; + break; + } + } + + if (!p1) return points[0].y; + + const t = (x - p1.x) / (p2.x - p1.x); + return p1.y + t * (p2.y - p1.y); +} + +function getTerrainWidth(y, points) { + if (!points || points.length === 0) return 0; + if (y <= points[0].y) return points[0].x; + if (y >= points[points.length - 1].y) return points[points.length - 1].x; + + let p1, p2; + for (let i = 0; i < points.length - 1; i++) { + if (y >= points[i].y && y < points[i+1].y) { + p1 = points[i]; + p2 = points[i+1]; + break; + } + } + + if (!p1) return points[0].x; + + const t = (y - p1.y) / (p2.y - p1.y); + return p1.x + t * (p2.x - p1.x); +} + +function isPointInPolygon(point, polygon) { + let isInside = false; + for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) { + const xi = polygon[i].x, yi = polygon[i].y; + const xj = polygon[j].x, yj = polygon[j].y; + + const intersect = ((yi > point.y) !== (yj > point.y)) + && (point.x < (xj - xi) * (point.y - yi) / (yj - yi) + xi); + if (intersect) isInside = !isInside; + } + return isInside; +} + +function getSafeSpawnPoint(mapData) { + const { roofPoints, floorPoints, leftWallPoints, rightWallPoints, islands } = mapData; + const shipRadius = 20; // Slightly larger than actual radius for safety + let newX, newY, isSafe; + let attempts = 0; + + do { + attempts++; + newX = Math.random() * (WIDTH - 200) + 100; + newY = Math.random() * (HEIGHT / 2) + (HEIGHT / 4); + isSafe = true; + + if (newY - shipRadius < getTerrainHeight(newX, roofPoints) || + newY + shipRadius > getTerrainHeight(newX, floorPoints) || + newX - shipRadius < getTerrainWidth(newY, leftWallPoints) || + newX + shipRadius > getTerrainWidth(newY, rightWallPoints)) { + isSafe = false; + } + + if(isSafe) { + for (const island of islands) { + if (isPointInPolygon({x: newX, y: newY}, island)) { + isSafe = false; + break; + } + } + } + + // Fallback if stuck + if (attempts > 50) { + return { x: WIDTH/2, y: HEIGHT/2 }; + } + } while (!isSafe); + + return { x: newX, y: newY }; +} + +// --- ROOM LIST HELPER --- +function getRoomList() { + const rooms = []; + for (const code in gameRooms) { + rooms.push({ + code: code, + count: Object.keys(gameRooms[code].players).length + }); + } + return rooms; +} + +function broadcastRoomList() { + io.emit('roomListUpdate', getRoomList()); +} + +// --- SOCKET IO LOGIC --- + +io.on('connection', (socket) => { + console.log('A user connected:', socket.id); + socket.emit('roomListUpdate', getRoomList()); // Send list immediately on connect + + socket.on('createGame', (data) => { + let roomCode = makeId(4); + while (gameRooms[roomCode]) { + roomCode = makeId(4); + } + + // Generate Unique Map for this room + const levelData = generateCaveLevel(); + + gameRooms[roomCode] = { + players: {}, + pellets: [], + mines: [], + pickups: [], // Init pickups + missiles: [], // Init missiles + map: levelData, // Store map in the room object + wallCollisionsEnabled: data.enableWallCollisions, // Store setting + winScore: data.winScore || 10 // Store win score + }; + + socket.join(roomCode); + socket.roomCode = roomCode; + + const spawn = getSafeSpawnPoint(levelData); + const player = { + x: spawn.x, + y: spawn.y, + rotation: 0, velocityX: 0, velocityY: 0, id: socket.id, + score: 0, isDead: false, respawnTimer: 0, + name: data.playerName, + isLanded: false, + secondaryType: 'mine', // Default weapon + secondaryAmmo: 3, // Default ammo + emoji: PLAYER_EMOJIS[Math.floor(Math.random() * PLAYER_EMOJIS.length)] // Assign random emoji + }; + gameRooms[roomCode].players[socket.id] = player; + + socket.emit('gameStarted', roomCode); + + // Send THIS room's map data + socket.emit('currentPlayers', { + players: gameRooms[roomCode].players, + roof: levelData.roofPoints, + floor: levelData.floorPoints, + islands: levelData.islands, + landingZone: levelData.landingZone, + leftWall: levelData.leftWallPoints, + rightWall: levelData.rightWallPoints, + mapWidth: WIDTH, mapHeight: HEIGHT, + winScore: gameRooms[roomCode].winScore + }); + broadcastRoomList(); // Update everyone + }); + + socket.on('joinRoom', (data) => { + const roomCode = data.roomCode; + if (!gameRooms[roomCode]) { + socket.emit('unknownGame'); + return; + } + + socket.join(roomCode); + socket.roomCode = roomCode; + + const room = gameRooms[roomCode]; // Reference the specific room + + const spawn = getSafeSpawnPoint(room.map); + const player = { + x: spawn.x, + y: spawn.y, + rotation: 0, velocityX: 0, velocityY: 0, id: socket.id, + score: 0, isDead: false, respawnTimer: 0, + name: data.playerName, + isLanded: false, + secondaryType: 'mine', // Default weapon + secondaryAmmo: 3, // Default ammo + emoji: PLAYER_EMOJIS[Math.floor(Math.random() * PLAYER_EMOJIS.length)] // Assign random emoji + }; + room.players[socket.id] = player; + + socket.emit('gameStarted', roomCode); + + // Send THIS room's map data + socket.emit('currentPlayers', { + players: room.players, + roof: room.map.roofPoints, + floor: room.map.floorPoints, + islands: room.map.islands, + landingZone: room.map.landingZone, + leftWall: room.map.leftWallPoints, + rightWall: room.map.rightWallPoints, + mapWidth: WIDTH, mapHeight: HEIGHT, + winScore: room.winScore + }); + socket.to(roomCode).emit('newPlayer', player); + broadcastRoomList(); // Update everyone + }); + + socket.on('playerMovement', (movementData) => { + const roomCode = socket.roomCode; + if (roomCode && gameRooms[roomCode] && gameRooms[roomCode].players[socket.id]) { + const player = gameRooms[roomCode].players[socket.id]; + if(player.isDead) return; + + if (player.isLanded) { + // LANDED STATE: + // Only listen for UP to take off + if (movementData.up) { + player.isLanded = false; + player.y -= 2; // CRITICAL: Nudge up so we don't immediately re-land + player.velocityY = -2; // Give initial pop + } + // Ignore left/right while landed to prevent spinning on the ground + return; + } + + // AIRBORNE STATE: + if (movementData.isTouch) { + const touchRotationSpeed = 0.04; // Slower rotation for touch + if (movementData.left) player.rotation -= touchRotationSpeed; + if (movementData.right) player.rotation += touchRotationSpeed; + } else { + // Keyboard or other input + if (movementData.left) player.rotation -= 0.1; + if (movementData.right) player.rotation += 0.1; + } + + if (movementData.up) { + const thrust = 0.1; // Reduced thrust + player.velocityX += Math.cos(player.rotation) * thrust; + player.velocityY += Math.sin(player.rotation) * thrust; + } + } + }); + + socket.on('shoot', () => { + const roomCode = socket.roomCode; + if (roomCode && gameRooms[roomCode] && gameRooms[roomCode].players[socket.id]) { + const player = gameRooms[roomCode].players[socket.id]; + if(player.isDead) return; + const pelletSpeed = 7; + gameRooms[roomCode].pellets.push({ + x: player.x + Math.cos(player.rotation) * 18, + y: player.y + Math.sin(player.rotation) * 18, + velocityX: Math.cos(player.rotation) * pelletSpeed + player.velocityX, + velocityY: Math.sin(player.rotation) * pelletSpeed + player.velocityY, + ownerId: player.id, + }); + } + }); + + socket.on('fireSecondary', () => { + const roomCode = socket.roomCode; + if (roomCode && gameRooms[roomCode] && gameRooms[roomCode].players[socket.id]) { + const player = gameRooms[roomCode].players[socket.id]; + if(player.isDead || player.secondaryAmmo <= 0) return; + + if (player.secondaryType === 'mine') { + player.secondaryAmmo--; + gameRooms[roomCode].mines.push({ + x: player.x, + y: player.y, + ownerId: player.id, + age: 0 + }); + } else if (player.secondaryType === 'missile') { + player.secondaryAmmo--; + const speed = 10; + gameRooms[roomCode].missiles.push({ + x: player.x + Math.cos(player.rotation) * 20, + y: player.y + Math.sin(player.rotation) * 20, + velocityX: Math.cos(player.rotation) * speed + player.velocityX, + velocityY: Math.sin(player.rotation) * speed + player.velocityY, + rotation: player.rotation, + ownerId: player.id, + age: 0 + }); + } + } + }); + + socket.on('disconnect', () => { + console.log('User disconnected:', socket.id); + const roomCode = socket.roomCode; + if (roomCode && gameRooms[roomCode]) { + delete gameRooms[roomCode].players[socket.id]; + io.to(roomCode).emit('playerDisconnected', socket.id); + + if (Object.keys(gameRooms[roomCode].players).length === 0) { + console.log(`Room ${roomCode} is empty, deleting.`); + delete gameRooms[roomCode]; + } + broadcastRoomList(); // Update everyone + } + }); +}); + + +// --- GAME LOOP --- + +function updateGameState() { + for (const roomCode in gameRooms) { + const room = gameRooms[roomCode]; + + // CRITICAL: Destructure this room's specific map data + // All physics checks below now use these local variables instead of globals + const { roofPoints, floorPoints, leftWallPoints, rightWallPoints, islands } = room.map; + + // --- UPDATE PICKUPS --- + if (!room.pickups) room.pickups = []; + // Spawn chance: 0.5% per frame if less than 3 pickups + if (room.pickups.length < 3 && Math.random() < 0.005) { + let px, py, valid = false; + let attempts = 0; + while (!valid && attempts < 10) { + attempts++; + px = Math.random() * (WIDTH - 200) + 100; + py = Math.random() * (HEIGHT - 200) + 100; + + const rY = getTerrainHeight(px, roofPoints); + const fY = getTerrainHeight(px, floorPoints); + const lX = getTerrainWidth(py, leftWallPoints); + const rX = getTerrainWidth(py, rightWallPoints); + + // Check boundaries + if (py > rY + 30 && py < fY - 30 && px > lX + 30 && px < rX - 30) { + valid = true; + // Check islands + for (const island of islands) { + if (isPointInPolygon({x: px, y: py}, island)) { + valid = false; + break; + } + } + } + } + + if (valid) { + room.pickups.push({ + x: px, + y: py, + type: 'missile', + id: Math.random().toString(36).substring(7) + }); + } + } + + for (let i = room.pickups.length - 1; i >= 0; i--) { + const pickup = room.pickups[i]; + // Check collision with players + for (const pid in room.players) { + const p = room.players[pid]; + if (p.isDead) continue; + const dist = Math.sqrt((p.x - pickup.x)**2 + (p.y - pickup.y)**2); + if (dist < 30) { // Pickup radius + // Award Weapon + if (pickup.type === 'missile') { + p.secondaryType = 'missile'; + p.secondaryAmmo = 2; // Give 2 missiles + } + io.to(roomCode).emit('pickupCollected', { x: pickup.x, y: pickup.y, playerId: p.id, type: pickup.type }); + room.pickups.splice(i, 1); + break; // Pickup consumed + } + } + } + + // --- UPDATE MISSILES --- + if (!room.missiles) room.missiles = []; + for (let i = room.missiles.length - 1; i >= 0; i--) { + const missile = room.missiles[i]; + missile.x += missile.velocityX; + missile.y += missile.velocityY; + missile.age++; + + if (missile.age > 120) { // 2 seconds life + room.missiles.splice(i, 1); + continue; + } + + // Check Terrain Collision + const roofY = getTerrainHeight(missile.x, roofPoints); + const floorY = getTerrainHeight(missile.x, floorPoints); + const leftX = getTerrainWidth(missile.y, leftWallPoints); + const rightX = getTerrainWidth(missile.y, rightWallPoints); + + let hit = false; + if (missile.y < roofY || missile.y > floorY || missile.x < leftX || missile.x > rightX) hit = true; + else { + for (const island of islands) { + if (isPointInPolygon(missile, island)) { hit = true; break; } + } + } + + if (!hit) { + // Check Player Collision + for (const pid in room.players) { + const p = room.players[pid]; + if (p.isDead) continue; + if (missile.ownerId === p.id && missile.age < 10) continue; // Safety + + const dist = Math.sqrt((p.x - missile.x)**2 + (p.y - missile.y)**2); + if (dist < 20) { + hit = true; + io.to(roomCode).emit('playerDestroyed', { x: p.x, y: p.y, playerId: p.id }); + p.isDead = true; + p.isLanded = false; + p.respawnTimer = 180; + if (missile.ownerId !== p.id) { + const killer = room.players[missile.ownerId]; + if (killer) killer.score++; + } + break; + } + } + } + + if (hit) { + io.to(roomCode).emit('pelletImpact', { x: missile.x, y: missile.y }); + room.missiles.splice(i, 1); + } + } + + // 0. Update Mines + if (!room.mines) room.mines = []; // Safety init if missing + for (let i = room.mines.length - 1; i >= 0; i--) { + const mine = room.mines[i]; + mine.age++; + + // Self-destroy after 10 seconds (600 frames) + if (mine.age > 600) { + io.to(roomCode).emit('pelletImpact', { x: mine.x, y: mine.y }); // Show explosion + room.mines.splice(i, 1); + continue; + } + + // Check collision with all players + let hit = false; + for (const pid in room.players) { + const p = room.players[pid]; + if (p.isDead) continue; + + // Safety: Don't kill owner immediately + if (mine.ownerId === p.id && mine.age < 60) continue; + + const dx = p.x - mine.x; + const dy = p.y - mine.y; + const dist = Math.sqrt(dx*dx + dy*dy); + + if (dist < 20) { // Mine radius + hit = true; + io.to(roomCode).emit('playerDestroyed', { x: p.x, y: p.y, playerId: p.id }); + p.isDead = true; + p.isLanded = false; + p.respawnTimer = 180; + + // Award point to mine owner (even if they killed themselves?) + // Let's say suicide doesn't give points, but kills you. + if (mine.ownerId !== p.id) { + const killer = room.players[mine.ownerId]; + if (killer) killer.score++; + } + } + } + if (hit) { + io.to(roomCode).emit('pelletImpact', { x: mine.x, y: mine.y }); // Use impact effect for mine too + room.mines.splice(i, 1); + } + } + + // 1. Update pellets + for (let i = room.pellets.length - 1; i >= 0; i--) { + const pellet = room.pellets[i]; + pellet.x += pellet.velocityX; + pellet.y += pellet.velocityY; + + // Check collisions using local map data + const roofY = getTerrainHeight(pellet.x, roofPoints); + const floorY = getTerrainHeight(pellet.x, floorPoints); + const leftX = getTerrainWidth(pellet.y, leftWallPoints); + const rightX = getTerrainWidth(pellet.y, rightWallPoints); + let collided = false; + + if (pellet.y < roofY || pellet.y > floorY || pellet.x < leftX || pellet.x > rightX) { + collided = true; + } else { + for (const island of islands) { + if (isPointInPolygon(pellet, island)) { + collided = true; + break; + } + } + } + + if (collided) { + io.to(roomCode).emit('pelletImpact', { x: pellet.x, y: pellet.y }); + room.pellets.splice(i, 1); + } + } + + // 2. Update players + for (const playerId in room.players) { + const player = room.players[playerId]; + const shipRadius = 15; + + // --- DEAD STATE --- + if (player.isDead) { + player.respawnTimer--; + if (player.respawnTimer <= 0) { + const spawn = getSafeSpawnPoint(room.map); + + player.isDead = false; + player.isLanded = false; // Ensure they respawn airborne + player.x = spawn.x; + player.y = spawn.y; + player.velocityX = 0; + player.velocityY = 0; + } + continue; + } + + // --- LANDED STATE --- + if (player.isLanded) { + // Force physics to stop. + // This prevents "jitter" where gravity pulls it down and collision snaps it up. + player.velocityX *= 0.9; // Friction to stop sliding + player.velocityY = 0; + player.rotation = -Math.PI / 2; // Force upright visual (pointing Up) + + // Check if they are still over the landing zone (in case they slid off) + const lz = room.map.landingZone; + if (lz) { + // Hard snap to surface to prevent sinking + player.y = (lz.y - lz.height) - shipRadius; + + // If they slid off the edge, wake them up + if (player.x < lz.x || player.x > lz.x + lz.width) { + player.isLanded = false; + } + } + + // Skip the rest of physics, but still check for bullet collisions later + } + // --- AIRBORNE STATE --- + else { + // Apply inputs and physics + player.velocityY += gravity; + player.x += player.velocityX; + player.y += player.velocityY; + + const speed = Math.sqrt(player.velocityX ** 2 + player.velocityY ** 2); + if (speed > maxSpeed) { + player.velocityX = (player.velocityX / speed) * maxSpeed; + player.velocityY = (player.velocityY / speed) * maxSpeed; + } + } + + // 3. Check for collisions and deaths (Using local map data) + const roofY = getTerrainHeight(player.x, roofPoints); + const floorY = getTerrainHeight(player.x, floorPoints); + const leftX = getTerrainWidth(player.y, leftWallPoints); + const rightX = getTerrainWidth(player.y, rightWallPoints); + let hasDied = false; + + // Collision Flags + let hitFloor = false, hitRoof = false, hitLeft = false, hitRight = false, hitIsland = false; + + // Only check terrain collision if NOT landed (or if we slid off) + if (!player.isLanded) { + if (player.y + shipRadius > floorY) hitFloor = true; + else if (player.y - shipRadius < roofY) hitRoof = true; + else if (player.x - shipRadius < leftX) hitLeft = true; + else if (player.x + shipRadius > rightX) hitRight = true; + else { + for (const island of islands) { + if (isPointInPolygon(player, island)) { hitIsland = true; break; } + } + } + + if (hitFloor || hitRoof || hitLeft || hitRight || hitIsland) { + // LANDING LOGIC (Always check first) + let landed = false; + if (hitFloor) { + const lz = room.map.landingZone; + const speed = Math.sqrt(player.velocityX ** 2 + player.velocityY ** 2); + const isOverLZ = lz && player.x > lz.x && player.x < lz.x + lz.width; + const isUpright = Math.sin(player.rotation) < -0.9; + + if (isOverLZ && speed < 2.0 && isUpright) { + landed = true; + player.isLanded = true; + player.secondaryType = 'mine'; // Reset to default + player.secondaryAmmo = 3; // Restock + player.velocityX = 0; + player.velocityY = 0; + player.rotation = 0; + player.y = (lz.y - lz.height) - shipRadius; // Snap perfectly to top + } + } + + if (!landed) { + if (room.wallCollisionsEnabled) { + hasDied = true; + } else { + // SAFE MODE: Resolve Collision (Bounce) + const bounceDamp = 0.5; + if (hitFloor) { + player.y = floorY - shipRadius; + player.velocityY = -Math.abs(player.velocityY) * bounceDamp; + } else if (hitRoof) { + player.y = roofY + shipRadius; + player.velocityY = Math.abs(player.velocityY) * bounceDamp; + } else if (hitLeft) { + player.x = leftX + shipRadius; + player.velocityX = Math.abs(player.velocityX) * bounceDamp; + } else if (hitRight) { + player.x = rightX - shipRadius; + player.velocityX = -Math.abs(player.velocityX) * bounceDamp; + } else if (hitIsland) { + // Simple reverse for islands + player.x -= player.velocityX * 1.5; + player.y -= player.velocityY * 1.5; + player.velocityX *= -bounceDamp; + player.velocityY *= -bounceDamp; + } + // Add impact sound/effect even if safe + if (Math.abs(player.velocityX) > 1 || Math.abs(player.velocityY) > 1) { + io.to(roomCode).emit('pelletImpact', { x: player.x, y: player.y }); + } + } + } + } + } + + if (hasDied) { + io.to(roomCode).emit('playerDestroyed', { x: player.x, y: player.y, playerId: player.id }); + player.isDead = true; + player.isLanded = false; + player.respawnTimer = 180; + } + + // Pellet-player collision (unchanged) + for (let i = room.pellets.length - 1; i >= 0; i--) { + const pellet = room.pellets[i]; + if (pellet.ownerId !== playerId && !player.isDead) { + const distance = Math.sqrt((player.x - pellet.x) ** 2 + (player.y - pellet.y) ** 2); + if (distance < shipRadius) { + io.to(roomCode).emit('playerDestroyed', { x: player.x, y: player.y, playerId: player.id }); + player.isDead = true; + player.isLanded = false; + player.respawnTimer = 180; + + const killer = room.players[pellet.ownerId]; + if (killer) killer.score++; + + room.pellets.splice(i, 1); + break; + } + } + } + } + + // 4. Check for win condition + let winnerId = null; + for (const playerId in room.players) { + if (room.players[playerId].score >= room.winScore) { + winnerId = playerId; + break; + } + } + + if (winnerId) { + io.to(roomCode).emit('gameOver', winnerId); + for (const playerId in room.players) room.players[playerId].score = 0; + } + + // 5. Emit state (Pellets and Scores - Map data is static and sent on join) + // We create a lightweight room object to send, we don't need to resend the map every frame + io.to(roomCode).emit('gameState', { + players: room.players, + pellets: room.pellets, + mines: room.mines, + pickups: room.pickups, + missiles: room.missiles + }); + } +} + +setInterval(updateGameState, 1000 / 60); + + +const PORT = process.env.PORT || 3001; + +// UPDATED: Added '0.0.0.0' as the second argument +server.listen(PORT, '0.0.0.0', () => { + console.log(`Server listening on port ${PORT}`); + console.log(`Access locally via: http://localhost:${PORT}`); + console.log(`Access via LAN via: https://192.168.1.64:${PORT}`); // (Or whatever your IP is) +}); \ No newline at end of file