excalidraw refactoring & new jitsi version

This commit is contained in:
Mirco 2023-10-23 14:48:57 +02:00
parent 50a14f0d15
commit 388c4363af
6 changed files with 1838 additions and 5040 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{ {
"name": "excalidraw-backend", "name": "excalidraw-backend",
"version": "1.0.0", "version": "1.1.0",
"main": "src/index.js", "main": "src/index.js",
"description": "Excalidraw backend", "description": "Excalidraw backend",
"repository": { "repository": {
@ -9,22 +9,22 @@
}, },
"private": true, "private": true,
"engines": { "engines": {
"node": ">=14.0.0", "node": ">=18.0.0",
"npm": ">=7.0.0" "npm": ">=10.0.0"
}, },
"dependencies": { "dependencies": {
"@types/debug": "4.1.5", "@types/debug": "4.1.10",
"@types/express": "4.17.11", "@types/express": "4.17.20",
"@types/node": "14.14.31", "@types/ms": "0.7.33",
"@types/socket.io": "2.1.4", "@types/node": "20.8.7",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"debug": "4.3.1", "debug": "4.3.4",
"dotenv": "^10.0.0", "dotenv": "^16.0.0",
"express": "4.17.1", "express": "^4.18.2",
"socket.io": "^2.5.0", "socket.io": "^4.7.2",
"socket.io-prometheus-metrics": "^1.0.6", "prom-client": "^15.0.0",
"ts-node-dev": "^1.1.8", "ts-node-dev": "^2.0.0",
"typescript": "4.2.3" "typescript": "5.2.2"
}, },
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
@ -37,16 +37,15 @@
}, },
"devDependencies": { "devDependencies": {
"@jitsi/eslint-config": "^4.1.0", "@jitsi/eslint-config": "^4.1.0",
"@types/dotenv": "^8.2.0", "@typescript-eslint/eslint-plugin": "6.8.0",
"@typescript-eslint/eslint-plugin": "5.30.5", "@typescript-eslint/parser": "6.8.0",
"@typescript-eslint/parser": "5.30.4", "eslint": "^8.1.0",
"eslint": "8.1.0", "eslint-plugin-import": "2.28.1",
"eslint-plugin-import": "2.25.2", "eslint-plugin-jsdoc": "46.8.2",
"eslint-plugin-jsdoc": "37.0.3", "eslint-plugin-typescript-sort-keys": "^3.1.0"
"eslint-plugin-typescript-sort-keys": "^2.1.0"
}, },
"optionalDependencies": { "optionalDependencies": {
"bufferutil": "^4.0.6", "bufferutil": "^4.0.6",
"utf-8-validate": "^5.0.9" "utf-8-validate": "^6.0.3"
} }
} }

View file

@ -4,9 +4,18 @@ import debug from 'debug';
import dotenv from 'dotenv'; import dotenv from 'dotenv';
import express from 'express'; import express from 'express';
import http from 'http'; import http from 'http';
import socketIO from 'socket.io'; import {Server} from 'socket.io';
/*
import * as prometheus from 'socket.io-prometheus-metrics'; import * as prometheus from 'socket.io-prometheus-metrics';
do not use anymore, since 3 years no further progression, depends on debug 4.1.1,
wich is moderate vulnerable to regular expression denial of service when untrusted user
input is passed into the o formatter.
alternatively could be used prom-client
import
*/
const serverDebug = debug('server'); const serverDebug = debug('server');
dotenv.config( dotenv.config(
@ -28,25 +37,34 @@ server.listen(port, () => {
serverDebug(`listening on port: ${port}`); serverDebug(`listening on port: ${port}`);
}); });
const io = socketIO(server, { const io = require("socket.io")(Server, {
handlePreflightRequest: (req, res) => { cors: {
const headers = { origin: "https://meet.jit.si",
'Access-Control-Allow-Headers': 'Content-Type, Authorization', credentials: true
'Access-Control-Allow-Origin': req.header?.origin ?? 'https://meet.jit.si',
'Access-Control-Allow-Credentials': true
};
res.writeHead(200, headers);
res.end();
}, },
maxHttpBufferSize: 10e6, maxHttpBufferSize: 10e6,
pingTimeout: 10000 pingTimeout: 10000
}); });
// listens on host:9090/metrics // listens on host:9090/metrics
/* do not use
prometheus.metrics(io, { prometheus.metrics(io, {
collectDefaultMetrics: true collectDefaultMetrics: true
}); });
*/
/* alternatively could be used:
const client = require('prom-client');
const collectDefaultMetrics = client.collectDefaultMetrics;
const Registry = client.Registry;
const register = new Registry();
collectDefaultMetrics({ register });
or more:
https://codersociety.com/blog/articles/nodejs-application-monitoring-with-prometheus-and-grafana
*/
io.on('connection', socket => { io.on('connection', socket => {
serverDebug(`connection established! ${socket.conn.request.url}`); serverDebug(`connection established! ${socket.conn.request.url}`);

View file

@ -11,7 +11,8 @@
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"outDir": "dist" "outDir": "dist",
"noImplicitAny": false
} }
} }

View file

@ -1,4 +1,4 @@
FROM jitsi/web:stable-8922-1 FROM jitsi/web:stable-8960-1
# Prepare Configuration # Prepare Configuration
ADD resources /tmp ADD resources /tmp

View file

@ -17,7 +17,7 @@ spec:
spec: spec:
containers: containers:
- name: jicofo - name: jicofo
image: jitsi/jicofo:stable-8922-1 image: jitsi/jicofo:stable-8960-1
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
env: env:
- name: XMPP_SERVER - name: XMPP_SERVER
@ -37,7 +37,7 @@ spec:
- name: TZ - name: TZ
value: Europe/Berlin value: Europe/Berlin
- name: prosody - name: prosody
image: jitsi/prosody:stable-8922-1 image: jitsi/prosody:stable-8960-1
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
env: env:
- name: PUBLIC_URL - name: PUBLIC_URL
@ -102,7 +102,7 @@ spec:
- name: WHITEBOARD_COLLAB_SERVER_PUBLIC_URL - name: WHITEBOARD_COLLAB_SERVER_PUBLIC_URL
value: REPLACE_EXCALIDRAW_BACKEND_URL value: REPLACE_EXCALIDRAW_BACKEND_URL
- name: jvb - name: jvb
image: jitsi/jvb:stable-8922-1 image: jitsi/jvb:stable-8960-1
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
env: env:
- name: PUBLIC_URL - name: PUBLIC_URL
@ -132,7 +132,7 @@ spec:
- name: TZ - name: TZ
value: Europe/Berlin value: Europe/Berlin
- name: etherpad - name: etherpad
image: etherpad/etherpad:1.9.2 image: etherpad/etherpad:1.9.3
env: env:
- name: XMPP_SERVER - name: XMPP_SERVER
value: localhost value: localhost