add compression for stuff served via express

This commit is contained in:
Zutatensuppe 2021-05-29 13:08:42 +02:00
parent ede95ff16c
commit e803945d23
7 changed files with 146 additions and 4 deletions

View file

@ -268,7 +268,7 @@ export async function main(
log: [],
logPointer: 0,
logIdx: 0,
speeds: [0.5, 1, 2, 5, 10, 20, 50],
speeds: [0.5, 1, 2, 5, 10, 20, 50, 100, 250, 500],
speedIdx: 1,
paused: false,
lastRealTs: 0,

View file

@ -1,6 +1,7 @@
import WebSocketServer from './WebSocketServer'
import WebSocket from 'ws'
import express from 'express'
import compression from 'compression'
import multer from 'multer'
import Protocol from './../common/Protocol'
import Util, { logger } from './../common/Util'
@ -17,7 +18,6 @@ import {
DB_PATCHES_DIR,
PUBLIC_DIR,
UPLOAD_DIR,
UPLOAD_URL
} from './Dirs'
import { GameSettings, ScoreMode } from '../common/GameCommon'
import GameStorage from './GameStorage'
@ -47,6 +47,8 @@ const port = config.http.port
const hostname = config.http.hostname
const app = express()
app.use(compression())
const storage = multer.diskStorage({
destination: UPLOAD_DIR,
filename: function (req, file, cb) {