mirror of
https://github.com/edumeet/edumeet.git
synced 2026-01-23 02:34:58 +00:00
Merge pull request #758 from alangecker/typescript
Adding Typescript Support
This commit is contained in:
commit
dc0777cd1a
31 changed files with 19295 additions and 23136 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -8,8 +8,9 @@ node_modules/
|
|||
!/server/config/config.example.js
|
||||
/server/public/
|
||||
/server/certs/
|
||||
/server/dist/
|
||||
!/server/certs/mediasoup-demo.localhost.*
|
||||
.vscode
|
||||
/app/public/config/*.pem
|
||||
yarn.lock
|
||||
yarn-error.log
|
||||
package-lock.json
|
||||
yarn-error.log
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -65,7 +65,7 @@ Currently edumeet will run on nodejs v14.x
|
|||
To install see here [here](https://github.com/nodesource/distributions/blob/master/README.md#debinstall).
|
||||
|
||||
```bash
|
||||
$ sudo apt install git npm build-essential redis libssl-dev openssl pkg-config
|
||||
$ sudo apt install git npm yarnpkg build-essential redis libssl-dev openssl pkg-config
|
||||
```
|
||||
|
||||
* Clone the project:
|
||||
|
|
@ -93,8 +93,8 @@ $ cp app/public/config/config.example.js app/public/config/config.js
|
|||
|
||||
```bash
|
||||
$ cd app
|
||||
$ npm install
|
||||
$ npm run build
|
||||
$ yarn
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
This will build the client application and copy everythink to `server/public` from where the server can host client code to browser requests.
|
||||
|
|
@ -104,7 +104,7 @@ This will build the client application and copy everythink to `server/public` fr
|
|||
```bash
|
||||
$ cd ..
|
||||
$ cd server
|
||||
$ npm install
|
||||
$ yarn
|
||||
```
|
||||
|
||||
## Run it locally
|
||||
|
|
@ -113,7 +113,7 @@ $ npm install
|
|||
|
||||
```bash
|
||||
$ cd server
|
||||
$ npm start
|
||||
$ yarn start
|
||||
```
|
||||
|
||||
* Note: Do not run the server as root. If you need to use port 80/443 make a iptables-mapping for that or use systemd configuration for that (see further down this doc).
|
||||
|
|
|
|||
2
app/.eslintignore
Normal file
2
app/.eslintignore
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
.eslintrc.js
|
||||
src/react-app-env.d.ts
|
||||
|
|
@ -4,6 +4,96 @@
|
|||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files":["**/*.{ts,tsx}"],
|
||||
"plugins": ["prettier", "@typescript-eslint"],
|
||||
"extends": ["airbnb-typescript", "react-app", "prettier"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"typescript": {
|
||||
"alwaysTryTypes": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"rules": {
|
||||
"object-curly-spacing": ["warn", "always"],
|
||||
"no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "none"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/semi": [
|
||||
"off"
|
||||
],
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "none"
|
||||
}
|
||||
],
|
||||
"max-len": [
|
||||
"warn",
|
||||
{
|
||||
"code": 100,
|
||||
"ignoreStrings": true,
|
||||
"ignoreTemplateLiterals": true,
|
||||
"ignoreComments": true
|
||||
}
|
||||
],
|
||||
"prefer-destructuring": [
|
||||
"error",
|
||||
{
|
||||
"VariableDeclarator": {
|
||||
"array": false,
|
||||
"object": true
|
||||
},
|
||||
"AssignmentExpression": {
|
||||
"array": false,
|
||||
"object": false
|
||||
}
|
||||
}, {
|
||||
"enforceForRenamedProperties": false
|
||||
}
|
||||
],
|
||||
|
||||
"no-plusplus": [
|
||||
"error",
|
||||
{
|
||||
"allowForLoopAfterthoughts": true
|
||||
}
|
||||
],
|
||||
"react/jsx-key": "error",
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": [
|
||||
"**/*.test.js",
|
||||
"**/*.test.jsx",
|
||||
"**/*.test.ts",
|
||||
"**/*.test.tsx",
|
||||
"src/tests/**/*"
|
||||
]
|
||||
}
|
||||
],
|
||||
"react/jsx-props-no-spreading": "off",
|
||||
"import/prefer-default-export": "off",
|
||||
"react/jsx-boolean-value": "off",
|
||||
"react/prop-types": "off",
|
||||
"react/no-unescaped-entities": "off",
|
||||
"react/jsx-one-expression-per-line": "off",
|
||||
"react/jsx-wrap-multilines": "off",
|
||||
"react/destructuring-assignment": "off"
|
||||
}
|
||||
}
|
||||
],
|
||||
"plugins": [
|
||||
"import",
|
||||
"react"
|
||||
|
|
|
|||
7
app/.prettierrc
Normal file
7
app/.prettierrc
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"trailingComma": "es5",
|
||||
"printWidth": 100,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"tabWidth": 2
|
||||
}
|
||||
18913
app/package-lock.json
generated
18913
app/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -19,6 +19,9 @@
|
|||
"@material-ui/icons": "^4.5.1",
|
||||
"@material-ui/lab": "^4.0.0-alpha.56",
|
||||
"@react-hook/window-size": "^3.0.7",
|
||||
"@types/node": "^14.14.37",
|
||||
"@types/react": "^17.0.3",
|
||||
"@types/react-dom": "^17.0.3",
|
||||
"bowser": "^2.7.0",
|
||||
"classnames": "^2.2.6",
|
||||
"create-torrent": "^4.4.1",
|
||||
|
|
@ -55,6 +58,7 @@
|
|||
"riek": "^1.1.0",
|
||||
"socket.io-client": "^2.4.0",
|
||||
"source-map-explorer": "^2.1.0",
|
||||
"typescript": "^4.2.3",
|
||||
"webtorrent": "^0.108.1"
|
||||
},
|
||||
"scripts": {
|
||||
|
|
@ -65,7 +69,8 @@
|
|||
"eject": "react-scripts eject",
|
||||
"electron": "electron --no-sandbox .",
|
||||
"dev": "nf start -p 3000",
|
||||
"lint": "eslint -c .eslintrc.json --ext .js src"
|
||||
"lint": "eslint -c .eslintrc.json --ext .js,.ts,.tsx src",
|
||||
"format": "prettier --write 'src/**/*.{ts,tsx}'"
|
||||
},
|
||||
"browserslist": [
|
||||
">0.2%",
|
||||
|
|
@ -74,9 +79,26 @@
|
|||
"not op_mini all"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^4.20.0",
|
||||
"@typescript-eslint/parser": "^4.20.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"electron": "^12.0.0",
|
||||
"eslint-plugin-react": "^7.19.0",
|
||||
"eslint-config-airbnb-typescript": "^12.3.1",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-config-react-app": "^6.0.0",
|
||||
"eslint-import-resolver-typescript": "^2.4.0",
|
||||
"eslint-plugin-flowtype": "^5.4.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-jest": "^24.3.3",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"eslint-plugin-react": "^7.23.1",
|
||||
"eslint-plugin-react-hooks": "^4.2.0",
|
||||
"eslint-webpack-plugin": "^2.5.3",
|
||||
"foreman": "^3.0.1",
|
||||
"prettier": "^2.2.1",
|
||||
"prettier-eslint": "^12.0.0",
|
||||
"prettier-eslint-cli": "^5.0.1",
|
||||
"redux-mock-store": "^1.5.3"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
1
app/src/react-app-env.d.ts
vendored
Normal file
1
app/src/react-app-env.d.ts
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/// <reference types="react-scripts" />
|
||||
|
|
@ -1,150 +0,0 @@
|
|||
const list = [
|
||||
{
|
||||
name : 'English',
|
||||
file : 'en',
|
||||
locale : [ 'en', 'en-en' ]
|
||||
},
|
||||
{
|
||||
name : 'Czech',
|
||||
file : 'cs',
|
||||
locale : [ 'cs', 'cs-cs' ]
|
||||
},
|
||||
{
|
||||
name : 'Chinese (Simplified)',
|
||||
file : 'cn',
|
||||
locale : [ 'zn', 'zn-zn', 'zn-cn' ]
|
||||
}, // hans
|
||||
{
|
||||
name : 'Chinese (Traditional)',
|
||||
file : 'tw',
|
||||
locale : [ 'zn-tw', 'zn-hk', 'zn-sg' ]
|
||||
}, // hant
|
||||
{
|
||||
name : 'Croatian',
|
||||
file : 'hr',
|
||||
locale : [ 'hr', 'hr-hr' ]
|
||||
},
|
||||
{
|
||||
name : 'Danish',
|
||||
file : 'dk',
|
||||
locale : [ 'dk', 'dk-dk' ]
|
||||
},
|
||||
{
|
||||
name : 'French',
|
||||
file : 'fr',
|
||||
locale : [ 'fr', 'fr-fr' ]
|
||||
},
|
||||
{
|
||||
name : 'German',
|
||||
file : 'de',
|
||||
locale : [ 'de', 'de-de' ]
|
||||
},
|
||||
{
|
||||
name : 'Greek',
|
||||
file : 'el',
|
||||
locale : [ 'el', 'el-el' ]
|
||||
},
|
||||
{
|
||||
name : 'Hindi',
|
||||
file : 'hi',
|
||||
locale : [ 'hi', 'hi-hi' ]
|
||||
},
|
||||
{
|
||||
name : 'Hungarian',
|
||||
file : 'hu',
|
||||
locale : [ 'hu', 'hu-hu' ]
|
||||
},
|
||||
{
|
||||
name : 'Italian',
|
||||
file : 'it',
|
||||
locale : [ 'it', 'it-it' ]
|
||||
},
|
||||
{
|
||||
name : 'Kazakh',
|
||||
file : 'kk',
|
||||
locale : [ 'kk', 'kk-kz ' ]
|
||||
},
|
||||
{
|
||||
name : 'Latvian',
|
||||
file : 'lv',
|
||||
locale : [ 'lv', 'lv-lv' ]
|
||||
},
|
||||
{
|
||||
name : 'Norwegian',
|
||||
file : 'nb',
|
||||
locale : [ 'nb', 'nb-no' ]
|
||||
},
|
||||
{
|
||||
name : 'Polish',
|
||||
file : 'pl',
|
||||
locale : [ 'pl', 'pl-pl' ]
|
||||
},
|
||||
{
|
||||
name : 'Portuguese',
|
||||
file : 'pt',
|
||||
locale : [ 'pt', 'pt-pt' ]
|
||||
},
|
||||
{
|
||||
name : 'Romanian',
|
||||
file : 'ro',
|
||||
locale : [ 'ro', 'ro-ro' ]
|
||||
},
|
||||
{
|
||||
name : 'Russian',
|
||||
file : 'ru',
|
||||
locale : [ 'ru', 'ru-ru' ]
|
||||
},
|
||||
{
|
||||
name : 'Spanish',
|
||||
file : 'es',
|
||||
locale : [ 'es', 'es-es' ]
|
||||
},
|
||||
{
|
||||
name : 'Turkish',
|
||||
file : 'tr',
|
||||
locale : [ 'tr', 'tr-tr' ]
|
||||
},
|
||||
{
|
||||
name : 'Ukrainian',
|
||||
file : 'uk',
|
||||
locale : [ 'uk', 'uk-uk' ]
|
||||
}
|
||||
];
|
||||
|
||||
export const detect = () =>
|
||||
{
|
||||
const localeFull = (navigator.language || navigator.browserLanguage).toLowerCase();
|
||||
|
||||
// const localeCountry = localeFull.split(/[-_]/)[0];
|
||||
|
||||
// const localeRegion = localeFull.split(/[-_]/)[1] || null;
|
||||
|
||||
return localeFull;
|
||||
};
|
||||
|
||||
export const getList = () => list;
|
||||
|
||||
export const loadOne = (locale) =>
|
||||
{
|
||||
let res = {};
|
||||
|
||||
try
|
||||
{
|
||||
res = list.filter((item) =>
|
||||
item.locale.includes(locale) || item.locale.includes(locale.split(/[-_]/)[0])
|
||||
)[0];
|
||||
|
||||
res.messages = require(`./${res.file}`);
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
|
||||
res = list.filter((item) => item.locale.includes('en'))[0];
|
||||
|
||||
res.messages = require(`./${res.file}`);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
};
|
||||
152
app/src/translations/locales.ts
Normal file
152
app/src/translations/locales.ts
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/* eslint-disable global-require */
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
|
||||
const list = [
|
||||
{
|
||||
name: 'English',
|
||||
file: 'en',
|
||||
locale: ['en', 'en-en'],
|
||||
},
|
||||
{
|
||||
name: 'Czech',
|
||||
file: 'cs',
|
||||
locale: ['cs', 'cs-cs'],
|
||||
},
|
||||
{
|
||||
name: 'Chinese (Simplified)',
|
||||
file: 'cn',
|
||||
locale: ['zn', 'zn-zn', 'zn-cn'],
|
||||
}, // hans
|
||||
{
|
||||
name: 'Chinese (Traditional)',
|
||||
file: 'tw',
|
||||
locale: ['zn-tw', 'zn-hk', 'zn-sg'],
|
||||
}, // hant
|
||||
{
|
||||
name: 'Croatian',
|
||||
file: 'hr',
|
||||
locale: ['hr', 'hr-hr'],
|
||||
},
|
||||
{
|
||||
name: 'Danish',
|
||||
file: 'dk',
|
||||
locale: ['dk', 'dk-dk'],
|
||||
},
|
||||
{
|
||||
name: 'French',
|
||||
file: 'fr',
|
||||
locale: ['fr', 'fr-fr'],
|
||||
},
|
||||
{
|
||||
name: 'German',
|
||||
file: 'de',
|
||||
locale: ['de', 'de-de'],
|
||||
},
|
||||
{
|
||||
name: 'Greek',
|
||||
file: 'el',
|
||||
locale: ['el', 'el-el'],
|
||||
},
|
||||
{
|
||||
name: 'Hindi',
|
||||
file: 'hi',
|
||||
locale: ['hi', 'hi-hi'],
|
||||
},
|
||||
{
|
||||
name: 'Hungarian',
|
||||
file: 'hu',
|
||||
locale: ['hu', 'hu-hu'],
|
||||
},
|
||||
{
|
||||
name: 'Italian',
|
||||
file: 'it',
|
||||
locale: ['it', 'it-it'],
|
||||
},
|
||||
{
|
||||
name: 'Kazakh',
|
||||
file: 'kk',
|
||||
locale: ['kk', 'kk-kz '],
|
||||
},
|
||||
{
|
||||
name: 'Latvian',
|
||||
file: 'lv',
|
||||
locale: ['lv', 'lv-lv'],
|
||||
},
|
||||
{
|
||||
name: 'Norwegian',
|
||||
file: 'nb',
|
||||
locale: ['nb', 'nb-no'],
|
||||
},
|
||||
{
|
||||
name: 'Polish',
|
||||
file: 'pl',
|
||||
locale: ['pl', 'pl-pl'],
|
||||
},
|
||||
{
|
||||
name: 'Portuguese',
|
||||
file: 'pt',
|
||||
locale: ['pt', 'pt-pt'],
|
||||
},
|
||||
{
|
||||
name: 'Romanian',
|
||||
file: 'ro',
|
||||
locale: ['ro', 'ro-ro'],
|
||||
},
|
||||
{
|
||||
name: 'Russian',
|
||||
file: 'ru',
|
||||
locale: ['ru', 'ru-ru'],
|
||||
},
|
||||
{
|
||||
name: 'Spanish',
|
||||
file: 'es',
|
||||
locale: ['es', 'es-es'],
|
||||
},
|
||||
{
|
||||
name: 'Turkish',
|
||||
file: 'tr',
|
||||
locale: ['tr', 'tr-tr'],
|
||||
},
|
||||
{
|
||||
name: 'Ukrainian',
|
||||
file: 'uk',
|
||||
locale: ['uk', 'uk-uk'],
|
||||
},
|
||||
]
|
||||
|
||||
export const detect = () => {
|
||||
const localeFull = (navigator.language || (navigator as any).browserLanguage).toLowerCase()
|
||||
|
||||
// const localeCountry = localeFull.split(/[-_]/)[0];
|
||||
|
||||
// const localeRegion = localeFull.split(/[-_]/)[1] || null;
|
||||
|
||||
return localeFull
|
||||
}
|
||||
|
||||
export const getList = () => list
|
||||
|
||||
export interface ILocale {
|
||||
name: string
|
||||
file: string
|
||||
locale: string[]
|
||||
messages: any
|
||||
}
|
||||
|
||||
export const loadOne = (locale: string): ILocale => {
|
||||
let res: any = {}
|
||||
|
||||
try {
|
||||
res = list.filter(
|
||||
(item) => item.locale.includes(locale) || item.locale.includes(locale.split(/[-_]/)[0])
|
||||
)[0]
|
||||
|
||||
res.messages = require(`./${res.file}`)
|
||||
} catch {
|
||||
res = list.filter((item) => item.locale.includes('en'))[0]
|
||||
|
||||
res.messages = require(`./${res.file}`)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
26
app/tsconfig.json
Normal file
26
app/tsconfig.json
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
14154
app/yarn.lock
Normal file
14154
app/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -3,10 +3,10 @@ const os = require('os');
|
|||
|
||||
const userRoles = require('../userRoles');
|
||||
|
||||
const {
|
||||
import {
|
||||
BYPASS_ROOM_LOCK,
|
||||
BYPASS_LOBBY
|
||||
} = require('../access');
|
||||
} from '../access';
|
||||
|
||||
const {
|
||||
CHANGE_ROOM_LOCK,
|
||||
|
|
|
|||
1
server/.eslintignore
Normal file
1
server/.eslintignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
dist
|
||||
|
|
@ -4,6 +4,89 @@
|
|||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files":["**/*.ts"],
|
||||
"plugins": ["prettier", "@typescript-eslint"],
|
||||
"extends": ["airbnb-typescript/base", "prettier"],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
// "settings": {
|
||||
// "import/resolver": {
|
||||
// "typescript": {
|
||||
// "alwaysTryTypes": true
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
"rules": {
|
||||
"no-underscore-dangle":"off",
|
||||
"object-curly-spacing": [
|
||||
"warn",
|
||||
"always"
|
||||
],
|
||||
"no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "none"
|
||||
}
|
||||
],
|
||||
"@typescript-eslint/semi": [
|
||||
"off"
|
||||
],
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "none"
|
||||
}
|
||||
],
|
||||
"max-len": [
|
||||
"warn",
|
||||
{
|
||||
"code": 100,
|
||||
"ignoreStrings": true,
|
||||
"ignoreTemplateLiterals": true,
|
||||
"ignoreComments": true
|
||||
}
|
||||
],
|
||||
"prefer-destructuring": [
|
||||
"error",
|
||||
{
|
||||
"VariableDeclarator": {
|
||||
"array": false,
|
||||
"object": true
|
||||
},
|
||||
"AssignmentExpression": {
|
||||
"array": false,
|
||||
"object": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"enforceForRenamedProperties": false
|
||||
}
|
||||
],
|
||||
"no-plusplus": [
|
||||
"error",
|
||||
{
|
||||
"allowForLoopAfterthoughts": true
|
||||
}
|
||||
],
|
||||
"import/no-extraneous-dependencies": [
|
||||
"error",
|
||||
{
|
||||
"devDependencies": [
|
||||
"**/*.test.js",
|
||||
"**/*.test.ts",
|
||||
"src/tests/**/*"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"extends":
|
||||
[
|
||||
"eslint:recommended"
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
module.exports = {
|
||||
// The role(s) will gain access to the room
|
||||
// even if it is locked (!)
|
||||
BYPASS_ROOM_LOCK : 'BYPASS_ROOM_LOCK',
|
||||
// The role(s) will gain access to the room without
|
||||
// going into the lobby. If you want to restrict access to your
|
||||
// server to only directly allow authenticated users, you could
|
||||
// add the userRoles.AUTHENTICATED to the user in the userMapping
|
||||
// function, and change to BYPASS_LOBBY : [ userRoles.AUTHENTICATED ]
|
||||
BYPASS_LOBBY : 'BYPASS_LOBBY'
|
||||
};
|
||||
10
server/access.ts
Normal file
10
server/access.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// The role(s) will gain access to the room
|
||||
// even if it is locked (!)
|
||||
export const BYPASS_ROOM_LOCK = "BYPASS_ROOM_LOCK";
|
||||
|
||||
// The role(s) will gain access to the room without
|
||||
// going into the lobby. If you want to restrict access to your
|
||||
// server to only directly allow authenticated users, you could
|
||||
// add the userRoles.AUTHENTICATED to the user in the userMapping
|
||||
// function, and change to BYPASS_LOBBY : [ userRoles.AUTHENTICATED ]
|
||||
export const BYPASS_LOBBY = "BYPASS_LOBBY";
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
import Logger from './Logger';
|
||||
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
const Logger = require('./Logger');
|
||||
|
||||
const logger = new Logger('Lobby');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
const debug = require('debug');
|
||||
|
||||
const APP_NAME = 'edumeet-server';
|
||||
|
||||
class Logger
|
||||
{
|
||||
constructor(prefix)
|
||||
{
|
||||
if (prefix)
|
||||
{
|
||||
this._debug = debug(`${APP_NAME}:${prefix}`);
|
||||
this._info = debug(`${APP_NAME}:INFO:${prefix}`);
|
||||
this._warn = debug(`${APP_NAME}:WARN:${prefix}`);
|
||||
this._error = debug(`${APP_NAME}:ERROR:${prefix}`);
|
||||
}
|
||||
else
|
||||
{
|
||||
this._debug = debug(APP_NAME);
|
||||
this._info = debug(`${APP_NAME}:INFO`);
|
||||
this._warn = debug(`${APP_NAME}:WARN`);
|
||||
this._error = debug(`${APP_NAME}:ERROR`);
|
||||
}
|
||||
|
||||
/* eslint-disable no-console */
|
||||
this._debug.log = console.info.bind(console);
|
||||
this._info.log = console.info.bind(console);
|
||||
this._warn.log = console.warn.bind(console);
|
||||
this._error.log = console.error.bind(console);
|
||||
/* eslint-enable no-console */
|
||||
}
|
||||
|
||||
get debug()
|
||||
{
|
||||
return this._debug;
|
||||
}
|
||||
|
||||
get info()
|
||||
{
|
||||
return this._info;
|
||||
}
|
||||
|
||||
get warn()
|
||||
{
|
||||
return this._warn;
|
||||
}
|
||||
|
||||
get error()
|
||||
{
|
||||
return this._error;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Logger;
|
||||
50
server/lib/Logger.ts
Normal file
50
server/lib/Logger.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import debug from "debug";
|
||||
|
||||
const APP_NAME = "edumeet-server";
|
||||
|
||||
export default class Logger {
|
||||
private _debug: debug.Debugger;
|
||||
|
||||
private _info: debug.Debugger;
|
||||
|
||||
private _warn: debug.Debugger;
|
||||
|
||||
private _error: debug.Debugger;
|
||||
|
||||
constructor(prefix: string) {
|
||||
if (prefix) {
|
||||
this._debug = debug(`${APP_NAME}:${prefix}`);
|
||||
this._info = debug(`${APP_NAME}:INFO:${prefix}`);
|
||||
this._warn = debug(`${APP_NAME}:WARN:${prefix}`);
|
||||
this._error = debug(`${APP_NAME}:ERROR:${prefix}`);
|
||||
} else {
|
||||
this._debug = debug(APP_NAME);
|
||||
this._info = debug(`${APP_NAME}:INFO`);
|
||||
this._warn = debug(`${APP_NAME}:WARN`);
|
||||
this._error = debug(`${APP_NAME}:ERROR`);
|
||||
}
|
||||
|
||||
/* eslint-disable no-console */
|
||||
this._debug.log = console.info.bind(console);
|
||||
this._info.log = console.info.bind(console);
|
||||
this._warn.log = console.warn.bind(console);
|
||||
this._error.log = console.error.bind(console);
|
||||
/* eslint-enable no-console */
|
||||
}
|
||||
|
||||
get debug() {
|
||||
return this._debug;
|
||||
}
|
||||
|
||||
get info() {
|
||||
return this._info;
|
||||
}
|
||||
|
||||
get warn() {
|
||||
return this._warn;
|
||||
}
|
||||
|
||||
get error() {
|
||||
return this._error;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import Logger from './Logger';
|
||||
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
const userRoles = require('../userRoles');
|
||||
const Logger = require('./Logger');
|
||||
|
||||
const logger = new Logger('Peer');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +1,18 @@
|
|||
import Logger from './Logger';
|
||||
|
||||
const EventEmitter = require('events').EventEmitter;
|
||||
const AwaitQueue = require('awaitqueue');
|
||||
const axios = require('axios');
|
||||
const Logger = require('./Logger');
|
||||
const Lobby = require('./Lobby');
|
||||
const { SocketTimeoutError, NotFoundInMediasoupError } = require('./errors');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const jwt = require('jsonwebtoken');
|
||||
const userRoles = require('../userRoles');
|
||||
|
||||
const {
|
||||
import {
|
||||
BYPASS_ROOM_LOCK,
|
||||
BYPASS_LOBBY
|
||||
} = require('../access');
|
||||
} from '../access';
|
||||
|
||||
const permissions = require('../permissions'), {
|
||||
CHANGE_ROOM_LOCK,
|
||||
|
|
|
|||
0
server/lib/configLoader.ts
Normal file
0
server/lib/configLoader.ts
Normal file
|
|
@ -1,9 +1,9 @@
|
|||
import Logger from '../Logger';
|
||||
|
||||
const promClient = require('prom-client');
|
||||
const pidusage = require('pidusage');
|
||||
const Stats = require('fast-stats').Stats;
|
||||
|
||||
const Logger = require('../Logger');
|
||||
|
||||
const logger = new Logger('metrics:aggregated');
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import Logger from '../Logger';
|
||||
|
||||
const { Resolver } = require('dns').promises;
|
||||
const prom = require('prom-client');
|
||||
const Logger = require('../Logger');
|
||||
|
||||
const logger = new Logger('metrics:default');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
import Logger from './Logger';
|
||||
|
||||
const express = require('express');
|
||||
const mediasoup = require('mediasoup');
|
||||
const promClient = require('prom-client');
|
||||
|
||||
const Logger = require('./Logger');
|
||||
const collectDefaultMetrics = require('./metrics/default');
|
||||
const RegisterAggregated = require('./metrics/aggregated');
|
||||
|
||||
|
|
|
|||
3984
server/package-lock.json
generated
3984
server/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -14,9 +14,12 @@
|
|||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"start": "node server.js",
|
||||
"connect": "node connect.js",
|
||||
"lint": "eslint -c .eslintrc.json --ext .js *.js lib/"
|
||||
"start": "npm run build && node dist/server.js",
|
||||
"build": "rm -rf dist && tsc && ln -s ../certs dist/certs",
|
||||
"dev": "nodemon --exec ts-node --ignore dist/ -e js,ts server.js",
|
||||
"connect": "ts-node connect.js",
|
||||
"lint": "eslint -c .eslintrc.json --ext .js,.ts *.js *.ts lib/",
|
||||
"format": "prettier --write '**/*.ts' && npm run lint --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"awaitqueue": "^1.0.0",
|
||||
|
|
@ -50,6 +53,32 @@
|
|||
"uuid": "^7.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "6.8.0"
|
||||
"@types/base-64": "^0.1.3",
|
||||
"@types/body-parser": "^1.19.0",
|
||||
"@types/compression": "^1.7.0",
|
||||
"@types/connect-redis": "^0.0.16",
|
||||
"@types/cookie-parser": "^1.4.2",
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/express": "^4.17.11",
|
||||
"@types/express-session": "^1.17.3",
|
||||
"@types/helmet": "^4.0.0",
|
||||
"@types/jsonwebtoken": "^8.5.1",
|
||||
"@types/node": "^14.14.37",
|
||||
"@types/passport": "^1.0.6",
|
||||
"@types/passport-local": "^1.0.33",
|
||||
"@types/redis": "^2.8.28",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.21.0",
|
||||
"@typescript-eslint/parser": "^4.21.0",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-airbnb-typescript": "^12.3.1",
|
||||
"eslint-config-prettier": "^8.1.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-prettier": "^3.3.1",
|
||||
"prettier": "^2.2.1",
|
||||
"prettier-cli": "^0.1.0",
|
||||
"prettier-eslint": "^12.0.0",
|
||||
"ts-node": "^9.1.1",
|
||||
"typescript": "^4.2.4"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
process.title = 'edumeet-server';
|
||||
|
||||
import Logger from './lib/Logger';
|
||||
|
||||
const bcrypt = require('bcrypt');
|
||||
const config = require('./config/config');
|
||||
const fs = require('fs');
|
||||
|
|
@ -13,7 +15,6 @@ const cookieParser = require('cookie-parser');
|
|||
const compression = require('compression');
|
||||
const mediasoup = require('mediasoup');
|
||||
const AwaitQueue = require('awaitqueue');
|
||||
const Logger = require('./lib/Logger');
|
||||
const Room = require('./lib/Room');
|
||||
const Peer = require('./lib/Peer');
|
||||
const base64 = require('base-64');
|
||||
|
|
|
|||
17
server/tsconfig.json
Normal file
17
server/tsconfig.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"allowJs": true,
|
||||
"moduleResolution": "node",
|
||||
"sourceMap": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"**/*.js"
|
||||
],
|
||||
}
|
||||
4619
server/yarn.lock
Normal file
4619
server/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue