dirty initial commit
This commit is contained in:
commit
2351c93677
24 changed files with 2203 additions and 0 deletions
11
.editorconfig
Normal file
11
.editorconfig
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_size = 2
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/server/node_modules
|
||||
78
game/Bitmap.js
Normal file
78
game/Bitmap.js
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
import BoundingRectangle from './BoundingRectangle.js'
|
||||
|
||||
export default class Bitmap {
|
||||
constructor(width, height, rgba = null) {
|
||||
this._w = width
|
||||
this._h = height
|
||||
this._com = 4 // number of components per pixel (RGBA)
|
||||
this._boundingRect = new BoundingRectangle(0, this._w - 1, 0, this._h -1)
|
||||
const len = this._w * this._h * this._com
|
||||
this._data = new Uint8ClampedArray(len)
|
||||
if (rgba) {
|
||||
for (let i = 0; i < len; i+=4) {
|
||||
this._data[i] = rgba[0]
|
||||
this._data[i + 1] = rgba[1]
|
||||
this._data[i + 2] = rgba[2]
|
||||
this._data[i + 3] = rgba[3]
|
||||
}
|
||||
}
|
||||
|
||||
// public
|
||||
this.width = this._w
|
||||
this.height = this._h
|
||||
}
|
||||
|
||||
toImage() {
|
||||
const canvas = document.createElement('canvas');
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
canvas.width = this._w;
|
||||
canvas.height = this._h;
|
||||
|
||||
const imgData = ctx.createImageData(canvas.width, canvas.height);
|
||||
imgData.data.set(this._data);
|
||||
ctx.putImageData(imgData, 0, 0);
|
||||
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
||||
const img = document.createElement('img')
|
||||
img.onload = () => {
|
||||
resolve(img)
|
||||
}
|
||||
img.src = canvas.toDataURL()
|
||||
return img
|
||||
})
|
||||
}
|
||||
|
||||
getPix(x, y, out) {
|
||||
if (x < 0 || y < 0 || x >= this._w || y >= this._h) {
|
||||
return false;
|
||||
}
|
||||
x = Math.round(x)
|
||||
y = Math.round(y)
|
||||
const idx = (y * 4 * this._w) + (x * 4)
|
||||
out[0] = this._data[idx]
|
||||
out[1] = this._data[idx + 1]
|
||||
out[2] = this._data[idx + 2]
|
||||
out[3] = this._data[idx + 3]
|
||||
return true
|
||||
}
|
||||
|
||||
putPix(x, y, rgba) {
|
||||
if (x < 0 || y < 0 || x >= this._w || y >= this._h) {
|
||||
return;
|
||||
}
|
||||
x = Math.round(x)
|
||||
y = Math.round(y)
|
||||
const idx = (y * this._com * this._w) + (x * this._com)
|
||||
this._data[idx] = rgba[0]
|
||||
this._data[idx + 1] = rgba[1]
|
||||
this._data[idx + 2] = rgba[2]
|
||||
this._data[idx + 3] = rgba[3]
|
||||
}
|
||||
|
||||
getBoundingRect() {
|
||||
return this._boundingRect
|
||||
}
|
||||
}
|
||||
46
game/BoundingRectangle.js
Normal file
46
game/BoundingRectangle.js
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import Point from './Point.js'
|
||||
|
||||
export default class BoundingRectangle {
|
||||
constructor(x0, x1, y0, y1) {
|
||||
this.x0 = x0
|
||||
this.x1 = x1
|
||||
this.y0 = y0
|
||||
this.y1 = y1
|
||||
this.width = (x1 - x0) + 1
|
||||
this.height = (y1 - y0) + 1
|
||||
}
|
||||
|
||||
div(d) {
|
||||
this.x0 /= d
|
||||
this.x1 /= d
|
||||
this.y0 /= d
|
||||
this.y1 /= d
|
||||
}
|
||||
|
||||
move(x, y) {
|
||||
this.x0 += x
|
||||
this.x1 += x
|
||||
this.y0 += y
|
||||
this.y1 += y
|
||||
}
|
||||
|
||||
moved(x, y) {
|
||||
return new BoundingRectangle(
|
||||
this.x0 + x,
|
||||
this.x1 + x,
|
||||
this.y0 + y,
|
||||
this.y1 + y
|
||||
)
|
||||
}
|
||||
|
||||
center() {
|
||||
return new Point(
|
||||
this.x0 + this.width / 2,
|
||||
this.y0 + this.height / 2,
|
||||
)
|
||||
}
|
||||
|
||||
centerDistance(other) {
|
||||
return this.center().distance(other.center())
|
||||
}
|
||||
}
|
||||
77
game/Camera.js
Normal file
77
game/Camera.js
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
import BoundingRectangle from "./BoundingRectangle.js"
|
||||
|
||||
export default class Camera {
|
||||
constructor(canvas) {
|
||||
this.x = 0
|
||||
this.y = 0
|
||||
|
||||
// TODO: when canvas resizes, this should
|
||||
// syncronize with the cam
|
||||
this.width = canvas.width
|
||||
this.height = canvas.height
|
||||
|
||||
this.zoom = 1
|
||||
this.minZoom = .2
|
||||
this.maxZoom = 6
|
||||
this.zoomStep = .05
|
||||
}
|
||||
|
||||
rect() {
|
||||
// when no zoom is relevant:
|
||||
return new BoundingRectangle(
|
||||
this.x,
|
||||
this.x + this.width - 1,
|
||||
this.y,
|
||||
this.y + this.height - 1
|
||||
)
|
||||
|
||||
// when zoom is relevant:
|
||||
// TODO: check if still true
|
||||
const w_final = this.width * this.zoom
|
||||
const h_final = this.height * this.zoom
|
||||
return new BoundingRectangle(
|
||||
this.x + (this.width - w_final) / 2,
|
||||
this.x + (this.width + w_final) / 2,
|
||||
this.y + (this.height - h_final) / 2,
|
||||
this.y + (this.height + h_final) / 2
|
||||
)
|
||||
}
|
||||
|
||||
move(x, y) {
|
||||
this.x += x / this.zoom
|
||||
this.y += y / this.zoom
|
||||
}
|
||||
|
||||
zoomOut() {
|
||||
const newzoom = Math.max(this.zoom - this.zoomStep, this.minZoom)
|
||||
if (newzoom !== this.zoom) {
|
||||
// centered zoom
|
||||
this.x -= ((this.width / this.zoom) - (this.width / newzoom)) / 2
|
||||
this.y -= ((this.height / this.zoom) - (this.height / newzoom)) / 2
|
||||
|
||||
this.zoom = newzoom
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
zoomIn() {
|
||||
const newzoom = Math.min(this.zoom + this.zoomStep, this.maxZoom)
|
||||
if (newzoom !== this.zoom) {
|
||||
// centered zoom
|
||||
this.x -= ((this.width / this.zoom) - (this.width / newzoom)) / 2
|
||||
this.y -= ((this.height / this.zoom) - (this.height / newzoom)) / 2
|
||||
|
||||
this.zoom = newzoom
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
translateMouse(mouse) {
|
||||
return {
|
||||
x: (mouse.x / this.zoom) - this.x,
|
||||
y: (mouse.y / this.zoom) - this.y,
|
||||
}
|
||||
}
|
||||
}
|
||||
58
game/CanvasAdapter.js
Normal file
58
game/CanvasAdapter.js
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
import BoundingRectangle from './BoundingRectangle.js'
|
||||
|
||||
export default class CanvasAdapter {
|
||||
constructor(canvas) {
|
||||
this._canvas = canvas
|
||||
this._ctx = this._canvas.getContext('2d')
|
||||
this._w = this._canvas.width
|
||||
this._h = this._canvas.height
|
||||
this._boundingRect = new BoundingRectangle(0, this._w - 1, 0, this._h - 1)
|
||||
|
||||
this._imageData = this._ctx.createImageData(this._w, this._h)
|
||||
this._data = this._imageData.data
|
||||
|
||||
this.width = this._w
|
||||
this.height = this._h
|
||||
}
|
||||
|
||||
clear() {
|
||||
this._imageData = this._ctx.createImageData(this._w, this._h)
|
||||
this._data = this._imageData.data
|
||||
this.apply()
|
||||
}
|
||||
|
||||
getPix(x, y, out) {
|
||||
if (x < 0 || y < 0 || x >= this._w || y >= this._h) {
|
||||
return false;
|
||||
}
|
||||
x = Math.round(x)
|
||||
y = Math.round(y)
|
||||
const idx = (y * 4 * this._w) + (x * 4)
|
||||
out[0] = this._data[idx]
|
||||
out[1] = this._data[idx + 1]
|
||||
out[2] = this._data[idx + 2]
|
||||
out[3] = this._data[idx + 3]
|
||||
return true
|
||||
}
|
||||
|
||||
putPix(x, y, rgba) {
|
||||
if (x < 0 || y < 0 || x >= this._w || y >= this._h) {
|
||||
return null;
|
||||
}
|
||||
x = Math.round(x)
|
||||
y = Math.round(y)
|
||||
const idx = (y * 4 * this._w) + (x * 4)
|
||||
this._data[idx] = rgba[0]
|
||||
this._data[idx + 1] = rgba[1]
|
||||
this._data[idx + 2] = rgba[2]
|
||||
this._data[idx + 3] = rgba[3]
|
||||
}
|
||||
|
||||
getBoundingRect() {
|
||||
return this._boundingRect
|
||||
}
|
||||
|
||||
apply() {
|
||||
this._ctx.putImageData(this._imageData, 0, 0)
|
||||
}
|
||||
}
|
||||
22
game/Color.js
Normal file
22
game/Color.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export function tint(c, f) {
|
||||
return [
|
||||
Math.max(0, Math.min(255, Math.round((255 - c[0]) * f))),
|
||||
Math.max(0, Math.min(255, Math.round((255 - c[1]) * f))),
|
||||
Math.max(0, Math.min(255, Math.round((255 - c[2]) * f))),
|
||||
c[3]
|
||||
]
|
||||
}
|
||||
|
||||
export function shade(c, f) {
|
||||
return [
|
||||
Math.max(0, Math.min(255, Math.round(c[0] * f))),
|
||||
Math.max(0, Math.min(255, Math.round(c[1] * f))),
|
||||
Math.max(0, Math.min(255, Math.round(c[2] * f))),
|
||||
c[3]
|
||||
]
|
||||
}
|
||||
|
||||
export default {
|
||||
tint,
|
||||
shade
|
||||
}
|
||||
38
game/EventAdapter.js
Normal file
38
game/EventAdapter.js
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
export default class EventAdapter {
|
||||
constructor(canvas) {
|
||||
this._mouseEvts = []
|
||||
canvas.addEventListener('mousedown', this._mouseDown.bind(this))
|
||||
canvas.addEventListener('mouseup', this._mouseUp.bind(this))
|
||||
canvas.addEventListener('mousemove', this._mouseMove.bind(this))
|
||||
canvas.addEventListener('wheel', this._wheel.bind(this))
|
||||
}
|
||||
|
||||
consumeAll() {
|
||||
if (this._mouseEvts.length === 0) {
|
||||
return []
|
||||
}
|
||||
const all = this._mouseEvts.slice()
|
||||
this._mouseEvts = []
|
||||
return all
|
||||
}
|
||||
|
||||
_mouseDown(e) {
|
||||
if (e.button === 0) {
|
||||
this._mouseEvts.push({type: 'down', x: e.offsetX, y: e.offsetY})
|
||||
}
|
||||
}
|
||||
|
||||
_mouseUp(e) {
|
||||
if (e.button === 0) {
|
||||
this._mouseEvts.push({type: 'up', x: e.offsetX, y: e.offsetY})
|
||||
}
|
||||
}
|
||||
|
||||
_mouseMove(e) {
|
||||
this._mouseEvts.push({type: 'move', x: e.offsetX, y: e.offsetY})
|
||||
}
|
||||
|
||||
_wheel(e) {
|
||||
this._mouseEvts.push({type: 'wheel', y: e.deltaY})
|
||||
}
|
||||
}
|
||||
27
game/Point.js
Normal file
27
game/Point.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
export default class Point {
|
||||
constructor(x,y) {
|
||||
this.x = x
|
||||
this.y = y
|
||||
}
|
||||
move(x, y) {
|
||||
this.x += x
|
||||
this.y += y
|
||||
}
|
||||
add(other) {
|
||||
return new Point(
|
||||
this.x + other.x,
|
||||
this.y + other.y
|
||||
)
|
||||
}
|
||||
sub(other) {
|
||||
return new Point(
|
||||
this.x - other.x,
|
||||
this.y - other.y
|
||||
)
|
||||
}
|
||||
distance(other) {
|
||||
const diffX = this.x - other.x
|
||||
const diffY = this.y - other.y
|
||||
return Math.sqrt(diffX * diffX + diffY * diffY)
|
||||
}
|
||||
}
|
||||
64
game/WsClient.js
Normal file
64
game/WsClient.js
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
import WsWrapper from './WsWrapper.js'
|
||||
|
||||
export default class WsClient extends WsWrapper {
|
||||
constructor(addr, protocols) {
|
||||
super(addr, protocols)
|
||||
this._on = {}
|
||||
this.onopen = (e) => {
|
||||
this._dispatch('socket', 'open', e)
|
||||
}
|
||||
this.onmessage = (e) => {
|
||||
this._dispatch('socket', 'message', e)
|
||||
if (!!this._on['message']) {
|
||||
const d = this._parseMessageData(e.data)
|
||||
if (d.event) {
|
||||
this._dispatch('message', d.event, d.data)
|
||||
}
|
||||
}
|
||||
}
|
||||
this.onclose = (e) => {
|
||||
this._dispatch('socket', 'close', e)
|
||||
}
|
||||
}
|
||||
|
||||
onSocket(tag, callback) {
|
||||
this.addEventListener('socket', tag, callback)
|
||||
}
|
||||
|
||||
onMessage(tag, callback) {
|
||||
this.addEventListener('message', tag, callback)
|
||||
}
|
||||
|
||||
addEventListener(type, tag, callback) {
|
||||
const tags = Array.isArray(tag) ? tag : [tag]
|
||||
this._on[type] = this._on[type] || {}
|
||||
for (const t of tags) {
|
||||
this._on[type][t] = this._on[type][t] || []
|
||||
this._on[type][t].push(callback)
|
||||
}
|
||||
}
|
||||
|
||||
_parseMessageData(data) {
|
||||
try {
|
||||
const d = JSON.parse(data)
|
||||
if (d.event) {
|
||||
return {event: d.event, data: d.data || null}
|
||||
}
|
||||
} catch {
|
||||
}
|
||||
return {event: null, data: null}
|
||||
}
|
||||
|
||||
_dispatch(type, tag, ...args) {
|
||||
const t = this._on[type] || {}
|
||||
const callbacks = (t[tag] || [])
|
||||
if (callbacks.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log(`ws dispatch ${type} ${tag}`)
|
||||
for (const callback of callbacks) {
|
||||
callback(...args)
|
||||
}
|
||||
}
|
||||
}
|
||||
55
game/WsWrapper.js
Normal file
55
game/WsWrapper.js
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/**
|
||||
* Wrapper around ws that
|
||||
* - buffers 'send' until a connection is available
|
||||
* - automatically tries to reconnect on close
|
||||
*/
|
||||
export default class WsWrapper {
|
||||
// actual ws handle
|
||||
handle = null
|
||||
|
||||
// timeout for automatic reconnect
|
||||
reconnectTimeout = null
|
||||
|
||||
// buffer for 'send'
|
||||
sendBuffer = []
|
||||
|
||||
constructor(addr, protocols) {
|
||||
this.addr = addr
|
||||
this.protocols = protocols
|
||||
|
||||
this.onopen = () => {}
|
||||
this.onclose = () => {}
|
||||
this.onmessage = () => {}
|
||||
}
|
||||
|
||||
send (txt) {
|
||||
if (this.handle) {
|
||||
this.handle.send(txt)
|
||||
} else {
|
||||
this.sendBuffer.push(txt)
|
||||
}
|
||||
}
|
||||
|
||||
connect() {
|
||||
let ws = new WebSocket(this.addr, this.protocols)
|
||||
ws.onopen = (e) => {
|
||||
if (this.reconnectTimeout) {
|
||||
clearTimeout(this.reconnectTimeout)
|
||||
}
|
||||
this.handle = ws
|
||||
// should have a queue worker
|
||||
while (this.sendBuffer.length > 0) {
|
||||
this.handle.send(this.sendBuffer.shift())
|
||||
}
|
||||
this.onopen(e)
|
||||
}
|
||||
ws.onmessage = (e) => {
|
||||
this.onmessage(e)
|
||||
}
|
||||
ws.onclose = (e) => {
|
||||
this.handle = null
|
||||
this.reconnectTimeout = setTimeout(() => { this.connect() }, 1000)
|
||||
this.onclose(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
game/example-images/132-2048x1365.jpg
Normal file
BIN
game/example-images/132-2048x1365.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 603 KiB |
BIN
game/example-images/ima_86ec3fa.jpeg
Normal file
BIN
game/example-images/ima_86ec3fa.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 320 KiB |
BIN
game/example-images/saechsische_schweiz.jpg
Normal file
BIN
game/example-images/saechsische_schweiz.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 657 KiB |
31
game/gameloop.js
Normal file
31
game/gameloop.js
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
export const run = options => {
|
||||
const fps = options.fps || 60
|
||||
const slow = options.slow || 1
|
||||
const update = options.update
|
||||
const render = options.render
|
||||
const raf = window.requestAnimationFrame
|
||||
const step = 1 / fps
|
||||
const slowStep = slow * step
|
||||
|
||||
let now
|
||||
let dt = 0
|
||||
let last = window.performance.now()
|
||||
|
||||
const frame = () => {
|
||||
now = window.performance.now()
|
||||
dt = dt + Math.min(1, (now - last) / 1000) // duration capped at 1.0 seconds
|
||||
while (dt > slowStep) {
|
||||
dt = dt - slowStep
|
||||
update(step)
|
||||
}
|
||||
render(dt / slow)
|
||||
last = now
|
||||
raf(frame)
|
||||
}
|
||||
|
||||
raf(frame)
|
||||
}
|
||||
|
||||
export default {
|
||||
run
|
||||
}
|
||||
11
game/index.html
Normal file
11
game/index.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<html>
|
||||
<head>
|
||||
<style>
|
||||
html,body {margin: 0; overflow: hidden;}
|
||||
html, body, #main { background: #222 }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script src="index.js" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
1073
game/index.js
Normal file
1073
game/index.js
Normal file
File diff suppressed because it is too large
Load diff
25
game/util.js
Normal file
25
game/util.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
// get a random int between min and max (inclusive)
|
||||
export const randomInt = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min
|
||||
|
||||
// get one random item from the given array
|
||||
export const choice = (array) => array[randomInt(0, array.length - 1)]
|
||||
|
||||
// return a shuffled (shallow) copy of the given array
|
||||
export const shuffle = (array) => {
|
||||
let arr = array.slice()
|
||||
for (let i = 0; i <= arr.length - 2; i++)
|
||||
{
|
||||
const j = randomInt(i, arr.length -1);
|
||||
const tmp = arr[i];
|
||||
arr[i] = arr[j];
|
||||
arr[j] = tmp;
|
||||
}
|
||||
return arr
|
||||
}
|
||||
|
||||
export default {
|
||||
randomInt,
|
||||
choice,
|
||||
shuffle,
|
||||
}
|
||||
18
run
Executable file
18
run
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
RUN_BIN="$(realpath "$0")"
|
||||
RUN_DIR=$(dirname "$RUN_BIN")
|
||||
|
||||
export RUN_BIN
|
||||
export RUN_DIR
|
||||
|
||||
TASK="$1"
|
||||
[ $# -gt 0 ] && shift
|
||||
|
||||
# Map task to scripts here
|
||||
if [ -f "$RUN_DIR/scripts/$TASK" ]; then
|
||||
exec "$RUN_DIR/scripts/$TASK" "$@"
|
||||
else
|
||||
echo "Task not found: $TASK" >&2
|
||||
exit 2
|
||||
fi
|
||||
5
scripts/server
Executable file
5
scripts/server
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd "$RUN_DIR/server"
|
||||
|
||||
nodemon index.js
|
||||
92
server/WebSocketServer.js
Normal file
92
server/WebSocketServer.js
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
import WebSocket from 'ws'
|
||||
|
||||
/*
|
||||
Example config
|
||||
|
||||
config = {
|
||||
hostname: 'localhost',
|
||||
port: 1338,
|
||||
connectstring: `ws://localhost:1338/ws`,
|
||||
}
|
||||
*/
|
||||
|
||||
class EvtBus {
|
||||
constructor() {
|
||||
this._on = {}
|
||||
}
|
||||
|
||||
on(type, callback) {
|
||||
this._on[type] = this._on[type] || []
|
||||
this._on[type].push(callback)
|
||||
}
|
||||
|
||||
dispatch(type, ...args) {
|
||||
(this._on[type] || []).forEach(cb => {
|
||||
cb(...args)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
class WebSocketServer {
|
||||
constructor(config) {
|
||||
this.config = config
|
||||
this._websocketserver = null
|
||||
this._interval = null
|
||||
|
||||
this.evt = new EvtBus()
|
||||
}
|
||||
|
||||
on(type, callback) {
|
||||
this.evt.on(type, callback)
|
||||
}
|
||||
|
||||
listen() {
|
||||
this._websocketserver = new WebSocket.Server(this.config)
|
||||
this._websocketserver.on('connection', (socket, request, client) => {
|
||||
const pathname = new URL(this.config.connectstring).pathname
|
||||
if (request.url.indexOf(pathname) !== 0) {
|
||||
console.log('bad request url: ', request.url)
|
||||
socket.close()
|
||||
return
|
||||
}
|
||||
|
||||
socket.isAlive = true
|
||||
socket.on('pong', function () {
|
||||
this.isAlive = true;
|
||||
})
|
||||
|
||||
socket.on('message', (data) => {
|
||||
console.log(`ws| `, data)
|
||||
this.evt.dispatch('message', {socket, data})
|
||||
})
|
||||
})
|
||||
|
||||
this._interval = setInterval(() => {
|
||||
this._websocketserver.clients.forEach((socket) => {
|
||||
if (socket.isAlive === false) {
|
||||
return socket.terminate()
|
||||
}
|
||||
socket.isAlive = false
|
||||
socket.ping(() => { })
|
||||
})
|
||||
}, 30000)
|
||||
|
||||
this._websocketserver.on('close', () => {
|
||||
clearInterval(this._interval)
|
||||
})
|
||||
}
|
||||
|
||||
notifyOne(data, socket) {
|
||||
if (socket.isAlive) {
|
||||
socket.send(JSON.stringify(data))
|
||||
}
|
||||
}
|
||||
|
||||
notifyAll(data) {
|
||||
this._websocketserver.clients.forEach((socket) => {
|
||||
this.notifyOne(data, socket)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
export default WebSocketServer
|
||||
87
server/index.js
Normal file
87
server/index.js
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
import WebSocketServer from './WebSocketServer.js'
|
||||
|
||||
import express from 'express'
|
||||
|
||||
const httpConfig = {
|
||||
hostname: 'localhost',
|
||||
port: 1337,
|
||||
}
|
||||
const port = httpConfig.port
|
||||
const hostname = httpConfig.hostname
|
||||
const app = express()
|
||||
app.use('/', express.static('./../game/'))
|
||||
app.listen(port, hostname, () => console.log(`server running on ${hostname}:${port}`))
|
||||
|
||||
|
||||
const players = {
|
||||
|
||||
}
|
||||
const games = {}
|
||||
|
||||
|
||||
const wssConfig = {
|
||||
hostname: 'localhost',
|
||||
port: 1338,
|
||||
connectstring: `ws://localhost:1338/ws`,
|
||||
}
|
||||
const wss = new WebSocketServer(wssConfig);
|
||||
|
||||
|
||||
const notify = (data) => {
|
||||
// TODO: throttle
|
||||
wss.notifyAll(data)
|
||||
console.log('notify', data)
|
||||
}
|
||||
|
||||
wss.on('message', ({socket, data}) => {
|
||||
try {
|
||||
const proto = socket.protocol.split('|')
|
||||
const uid = proto[0]
|
||||
const gid = proto[1]
|
||||
const parsed = JSON.parse(data)
|
||||
switch (parsed.type) {
|
||||
case 'init': {
|
||||
// a new player (or previous player) joined
|
||||
players[uid] = players[uid] || {}
|
||||
players[uid].id = uid
|
||||
players[uid].tiles = players[uid].tiles || 0
|
||||
players[uid].m_x = players[uid].x || null
|
||||
players[uid].m_y = players[uid].y || null
|
||||
players[uid].m_d = false
|
||||
console.log('init', players)
|
||||
const puzzle = games[gid] ? games[gid].puzzle : null
|
||||
console.log('init', games[gid])
|
||||
wss.notifyOne({type: 'init', puzzle: puzzle}, socket)
|
||||
} break;
|
||||
|
||||
case 'init_puzzle': {
|
||||
games[gid] = {
|
||||
puzzle: parsed.puzzle,
|
||||
}
|
||||
} break;
|
||||
|
||||
case 'state': {
|
||||
players[uid].m_x = parsed.state.m_x
|
||||
players[uid].m_y = parsed.state.m_y
|
||||
players[uid].m_d = parsed.state.m_d
|
||||
} break;
|
||||
|
||||
case 'change_tile': {
|
||||
let idx = parsed.idx
|
||||
let z = parsed.z
|
||||
let finished = parsed.finished
|
||||
let pos = { x: parsed.pos.x, y: parsed.pos.y }
|
||||
let group = parsed.group
|
||||
// games[gid].puzzle.tiles[idx] = games[gid].puzzle.tiles[idx] || {}
|
||||
games[gid].puzzle.tiles[idx].pos = pos
|
||||
games[gid].puzzle.tiles[idx].z = z
|
||||
games[gid].puzzle.tiles[idx].finished = finished
|
||||
games[gid].puzzle.tiles[idx].group = group
|
||||
notify({type:'tile_changed', origin: uid, idx, pos, z, finished, group})
|
||||
} break;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
wss.listen()
|
||||
377
server/package-lock.json
generated
Normal file
377
server/package-lock.json
generated
Normal file
|
|
@ -0,0 +1,377 @@
|
|||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"accepts": {
|
||||
"version": "1.3.7",
|
||||
"resolved": "https://npm.stroeermediabrands.de/accepts/-/accepts-1.3.7.tgz",
|
||||
"integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
|
||||
"requires": {
|
||||
"mime-types": "~2.1.24",
|
||||
"negotiator": "0.6.2"
|
||||
}
|
||||
},
|
||||
"array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.19.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/body-parser/-/body-parser-1.19.0.tgz",
|
||||
"integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==",
|
||||
"requires": {
|
||||
"bytes": "3.1.0",
|
||||
"content-type": "~1.0.4",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"http-errors": "1.7.2",
|
||||
"iconv-lite": "0.4.24",
|
||||
"on-finished": "~2.3.0",
|
||||
"qs": "6.7.0",
|
||||
"raw-body": "2.4.0",
|
||||
"type-is": "~1.6.17"
|
||||
}
|
||||
},
|
||||
"bytes": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/bytes/-/bytes-3.1.0.tgz",
|
||||
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://npm.stroeermediabrands.de/content-disposition/-/content-disposition-0.5.3.tgz",
|
||||
"integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==",
|
||||
"requires": {
|
||||
"safe-buffer": "5.1.2"
|
||||
}
|
||||
},
|
||||
"content-type": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://npm.stroeermediabrands.de/content-type/-/content-type-1.0.4.tgz",
|
||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
||||
},
|
||||
"cookie": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/cookie/-/cookie-0.4.0.tgz",
|
||||
"integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg=="
|
||||
},
|
||||
"cookie-signature": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://npm.stroeermediabrands.de/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.9",
|
||||
"resolved": "https://npm.stroeermediabrands.de/debug/-/debug-2.6.9.tgz",
|
||||
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/depd/-/depd-1.1.2.tgz",
|
||||
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
|
||||
},
|
||||
"destroy": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://npm.stroeermediabrands.de/destroy/-/destroy-1.0.4.tgz",
|
||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"encodeurl": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/encodeurl/-/encodeurl-1.0.2.tgz",
|
||||
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
|
||||
},
|
||||
"escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://npm.stroeermediabrands.de/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
||||
},
|
||||
"etag": {
|
||||
"version": "1.8.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/etag/-/etag-1.8.1.tgz",
|
||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
|
||||
},
|
||||
"express": {
|
||||
"version": "4.17.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/express/-/express-4.17.1.tgz",
|
||||
"integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==",
|
||||
"requires": {
|
||||
"accepts": "~1.3.7",
|
||||
"array-flatten": "1.1.1",
|
||||
"body-parser": "1.19.0",
|
||||
"content-disposition": "0.5.3",
|
||||
"content-type": "~1.0.4",
|
||||
"cookie": "0.4.0",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"finalhandler": "~1.1.2",
|
||||
"fresh": "0.5.2",
|
||||
"merge-descriptors": "1.0.1",
|
||||
"methods": "~1.1.2",
|
||||
"on-finished": "~2.3.0",
|
||||
"parseurl": "~1.3.3",
|
||||
"path-to-regexp": "0.1.7",
|
||||
"proxy-addr": "~2.0.5",
|
||||
"qs": "6.7.0",
|
||||
"range-parser": "~1.2.1",
|
||||
"safe-buffer": "5.1.2",
|
||||
"send": "0.17.1",
|
||||
"serve-static": "1.14.1",
|
||||
"setprototypeof": "1.1.1",
|
||||
"statuses": "~1.5.0",
|
||||
"type-is": "~1.6.18",
|
||||
"utils-merge": "1.0.1",
|
||||
"vary": "~1.1.2"
|
||||
}
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/finalhandler/-/finalhandler-1.1.2.tgz",
|
||||
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"on-finished": "~2.3.0",
|
||||
"parseurl": "~1.3.3",
|
||||
"statuses": "~1.5.0",
|
||||
"unpipe": "~1.0.0"
|
||||
}
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.1.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/forwarded/-/forwarded-0.1.2.tgz",
|
||||
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
|
||||
},
|
||||
"fresh": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/fresh/-/fresh-0.5.2.tgz",
|
||||
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.7.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/http-errors/-/http-errors-1.7.2.tgz",
|
||||
"integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==",
|
||||
"requires": {
|
||||
"depd": "~1.1.2",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.1.1",
|
||||
"statuses": ">= 1.5.0 < 2",
|
||||
"toidentifier": "1.0.0"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.24",
|
||||
"resolved": "https://npm.stroeermediabrands.de/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||
"requires": {
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://npm.stroeermediabrands.de/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ipaddr.js": {
|
||||
"version": "1.9.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
|
||||
},
|
||||
"media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
||||
},
|
||||
"merge-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
|
||||
},
|
||||
"methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/mime/-/mime-1.6.0.tgz",
|
||||
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.44.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/mime-db/-/mime-db-1.44.0.tgz",
|
||||
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.27",
|
||||
"resolved": "https://npm.stroeermediabrands.de/mime-types/-/mime-types-2.1.27.tgz",
|
||||
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
|
||||
"requires": {
|
||||
"mime-db": "1.44.0"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"negotiator": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/negotiator/-/negotiator-0.6.2.tgz",
|
||||
"integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw=="
|
||||
},
|
||||
"on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/on-finished/-/on-finished-2.3.0.tgz",
|
||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
||||
"requires": {
|
||||
"ee-first": "1.1.1"
|
||||
}
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://npm.stroeermediabrands.de/parseurl/-/parseurl-1.3.3.tgz",
|
||||
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://npm.stroeermediabrands.de/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://npm.stroeermediabrands.de/proxy-addr/-/proxy-addr-2.0.6.tgz",
|
||||
"integrity": "sha512-dh/frvCBVmSsDYzw6n926jv974gddhkFPfiN8hPOi30Wax25QZyZEGveluCgliBnqmuM+UJmBErbAUFIoDbjOw==",
|
||||
"requires": {
|
||||
"forwarded": "~0.1.2",
|
||||
"ipaddr.js": "1.9.1"
|
||||
}
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/qs/-/qs-6.7.0.tgz",
|
||||
"integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ=="
|
||||
},
|
||||
"range-parser": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/range-parser/-/range-parser-1.2.1.tgz",
|
||||
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/raw-body/-/raw-body-2.4.0.tgz",
|
||||
"integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==",
|
||||
"requires": {
|
||||
"bytes": "3.1.0",
|
||||
"http-errors": "1.7.2",
|
||||
"iconv-lite": "0.4.24",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"safer-buffer": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||
},
|
||||
"send": {
|
||||
"version": "0.17.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/send/-/send-0.17.1.tgz",
|
||||
"integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==",
|
||||
"requires": {
|
||||
"debug": "2.6.9",
|
||||
"depd": "~1.1.2",
|
||||
"destroy": "~1.0.4",
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"etag": "~1.8.1",
|
||||
"fresh": "0.5.2",
|
||||
"http-errors": "~1.7.2",
|
||||
"mime": "1.6.0",
|
||||
"ms": "2.1.1",
|
||||
"on-finished": "~2.3.0",
|
||||
"range-parser": "~1.2.1",
|
||||
"statuses": "~1.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/ms/-/ms-2.1.1.tgz",
|
||||
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"serve-static": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/serve-static/-/serve-static-1.14.1.tgz",
|
||||
"integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==",
|
||||
"requires": {
|
||||
"encodeurl": "~1.0.2",
|
||||
"escape-html": "~1.0.3",
|
||||
"parseurl": "~1.3.3",
|
||||
"send": "0.17.1"
|
||||
}
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/setprototypeof/-/setprototypeof-1.1.1.tgz",
|
||||
"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw=="
|
||||
},
|
||||
"statuses": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/statuses/-/statuses-1.5.0.tgz",
|
||||
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
|
||||
},
|
||||
"toidentifier": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/toidentifier/-/toidentifier-1.0.0.tgz",
|
||||
"integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
|
||||
},
|
||||
"type-is": {
|
||||
"version": "1.6.18",
|
||||
"resolved": "https://npm.stroeermediabrands.de/type-is/-/type-is-1.6.18.tgz",
|
||||
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||
"requires": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "~2.1.24"
|
||||
}
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://npm.stroeermediabrands.de/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
|
||||
},
|
||||
"utils-merge": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
|
||||
},
|
||||
"vary": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://npm.stroeermediabrands.de/vary/-/vary-1.1.2.tgz",
|
||||
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
|
||||
},
|
||||
"ws": {
|
||||
"version": "7.3.1",
|
||||
"resolved": "https://npm.stroeermediabrands.de/ws/-/ws-7.3.1.tgz",
|
||||
"integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA=="
|
||||
}
|
||||
}
|
||||
}
|
||||
7
server/package.json
Normal file
7
server/package.json
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"express": "^4.17.1",
|
||||
"ws": "^7.3.1"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue