delete tests hugo
This commit is contained in:
55
srcs/requirements/nginx/conf/.nfs000000000ef7127e000000f0
Normal file
55
srcs/requirements/nginx/conf/.nfs000000000ef7127e000000f0
Normal file
@@ -0,0 +1,55 @@
|
||||
server {
|
||||
listen 8080;
|
||||
listen [::]:8080;
|
||||
server_name localhost;
|
||||
|
||||
location /api/v2 {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://backend_dev:3000;
|
||||
}
|
||||
|
||||
location /chat {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
proxy_pass http://backend_dev:5000/chat;
|
||||
}
|
||||
|
||||
location /api/v2/game/gameserver {
|
||||
deny all;
|
||||
}
|
||||
|
||||
location /pong {
|
||||
proxy_pass http://game_server:8042/pong;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://frontend_dev:8080;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 35729 default_server;
|
||||
listen [::]:35729 default_server;
|
||||
server_name localhost;
|
||||
location / {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_pass http://frontend_dev:35729;
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
```
|
||||
fetch conversations
|
||||
___________________
|
||||
| _ |
|
||||
| no conversation | if len == 0
|
||||
| |
|
||||
| [join public] |
|
||||
| |
|
||||
| [start new] |
|
||||
| |
|
||||
|...................|
|
||||
| |
|
||||
|___________________|
|
||||
___________________
|
||||
| convs _ |
|
||||
|___________________| if len > 0
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
|___________________|
|
||||
| |send |
|
||||
|_____________|_____|
|
||||
___________________
|
||||
| convs _ |
|
||||
|_ ____________|
|
||||
| .list |
|
||||
| .of |
|
||||
| .convs |
|
||||
| |
|
||||
| |
|
||||
|___________________|
|
||||
| |send |
|
||||
|_____________|_____|
|
||||
___________________
|
||||
| [join public] _ |
|
||||
| | if join_public
|
||||
| .list | fetch public_conversations
|
||||
| .of |
|
||||
| .public |
|
||||
| .convs |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
|___________________|
|
||||
___________________
|
||||
| [start new] _ |
|
||||
| | if start_new
|
||||
| .list | fetch friends
|
||||
| .of |
|
||||
| .friends |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
|___________________|
|
||||
___________________
|
||||
| convs _ |
|
||||
|___________________| if click_on_list_element
|
||||
| .blablabla | fetch conversation(list_element)
|
||||
| blablabla. |
|
||||
| .bla | --server side--
|
||||
| blabla. | if conversation_exist
|
||||
| bla. | return text
|
||||
|___________________| else if is_allowed
|
||||
| |send | return "start conv"
|
||||
|_____________|_____|
|
||||
|
||||
```
|
||||
|
||||
### goals :
|
||||
- own messages are not sent to myself and directly printed
|
||||
- i can create a room
|
||||
- my messages are sent to other people in room
|
||||
- i can choose in which room to send the messages
|
||||
|
||||
### routes :
|
||||
- https://transcendance:8080/api/v2/chat/conversations
|
||||
- returns list of objects, each object contains :
|
||||
- id: unique conv identification
|
||||
- title: name of the conversation (name of other guy if direct message)
|
||||
-
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
https://www.youtube.com/watch?v=7xpLYk4q0Sg
|
||||
|
||||
npm install (to install packages)
|
||||
npm run start:dev
|
||||
|
||||
|
||||
- [ ] can create chat-rooms (public/private, password protected)
|
||||
- [ ] send direct messages
|
||||
- [ ] block other users
|
||||
- [ ] creators of chat-room are owners, untill they leave
|
||||
- [ ] chat-room owner can set, change, remove password
|
||||
- [ ] chat-room owner is administrator and can set other administrators
|
||||
- [ ] administrators can ban or mute for a time other users
|
||||
- [ ] send game invitation in chat
|
||||
- [ ] view user profiles from chat
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="./style/chat.css" type="text/css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<input type="checkbox" id="chat_input" style="display: none;"/>
|
||||
|
||||
<div class="chat_box">
|
||||
|
||||
<div class="chat_item controls_area">
|
||||
</div>
|
||||
|
||||
<label class="chat_item open_close button" for="chat_input">
|
||||
<p>chat</p>
|
||||
</label>
|
||||
|
||||
<div class="chat_item msg_thread">
|
||||
<div class="msg_box" id="msg_thread">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chat_item msg_write">
|
||||
<!--
|
||||
<textarea class="text_area" id="msg_write">
|
||||
</textarea>
|
||||
-->
|
||||
<div class="text_area" id="msg_write" contenteditable>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="chat_item msg_send button" onclick="submit_new_message()">
|
||||
<p>send</p>
|
||||
</button>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- https://socket.io/docs/v4/client-installation/ -->
|
||||
<!-- https://socket.io/docs/v4/client-api/ -->
|
||||
<script src="https://cdn.socket.io/4.5.3/socket.io.min.js" integrity="sha384-WPFUvHkB1aHA5TDSZi6xtDgkF0wXJcIIxXhC6h8OT8EH3fC5PWro5pWJ1THjcfEi" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
const socket = io("http://localhost:3000");
|
||||
socket.on("connect", () => {
|
||||
console.log("client: connection");
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="./chat_submit_msg.js"></script>
|
||||
<script src="./chat_receive_msg.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
socket.on('message', ({ data }) => {
|
||||
handle_new_message(data);
|
||||
});
|
||||
|
||||
const handle_new_message = (message) => {
|
||||
const div_thread = document.getElementById('msg_thread');
|
||||
|
||||
console.log("received message:");
|
||||
console.log(`[${message}]`);
|
||||
|
||||
div_thread.appendChild(build_new_message(message));
|
||||
}
|
||||
|
||||
const build_new_message = (message) => {
|
||||
const p = document.createElement("p");
|
||||
p.appendChild(document.createTextNode(message));
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
|
||||
const submit_new_message = () => {
|
||||
const div_msg = document.getElementById('msg_write');
|
||||
/*
|
||||
const msg = div_msg.value;
|
||||
const msg = div_msg.innerText;
|
||||
*/
|
||||
const msg = div_msg.innerText.trim();
|
||||
|
||||
console.log("msg:");
|
||||
console.log(`[${msg}]`);
|
||||
console.log(msg.length);
|
||||
|
||||
if (msg.length > 0)
|
||||
socket.emit('message', { data: msg });
|
||||
}
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
|
||||
@import 'msg_thread.css';
|
||||
@import 'msg_write.css';
|
||||
|
||||
/**
|
||||
* GRID
|
||||
*/
|
||||
|
||||
/* global settings */
|
||||
|
||||
.chat_box * {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.chat_box .chat_item.controls_area { grid-area: controls;}
|
||||
.chat_box .chat_item.open_close { grid-area: open_close;}
|
||||
.chat_box .chat_item.msg_thread { grid-area: msg_thread;}
|
||||
.chat_box .chat_item.msg_write { grid-area: msg_write;}
|
||||
.chat_box .chat_item.msg_send { grid-area: msg_send;}
|
||||
.chat_box {
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
display: grid;
|
||||
grid:
|
||||
' controls open_close ' auto
|
||||
' msg_thread msg_thread ' 1fr
|
||||
' msg_write msg_send ' auto
|
||||
/ 1fr auto;
|
||||
gap: 0px;
|
||||
padding: 0px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
|
||||
border: 1px solid green;
|
||||
}
|
||||
.chat_box .chat_item {
|
||||
/*
|
||||
border: 1px solid blue;
|
||||
*/
|
||||
}
|
||||
/* buttons settings */
|
||||
.chat_box .chat_item.button {
|
||||
display: flex;
|
||||
width: auto;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
border: none;
|
||||
background-color: rgb(220, 220, 220);
|
||||
}
|
||||
.chat_box .chat_item.button p {
|
||||
margin: auto;
|
||||
}
|
||||
.chat_box .chat_item.button:hover {
|
||||
background-color: rgb(200, 200, 200);
|
||||
}
|
||||
.chat_box .chat_item.button:active {
|
||||
background-color: rgb(220, 220, 220);
|
||||
}
|
||||
/* collapse settings */
|
||||
.chat_box .chat_item:not(.open_close) {
|
||||
display: none;
|
||||
}
|
||||
#chat_input:checked +
|
||||
.chat_box {
|
||||
gap: 5px;
|
||||
padding: 5px;
|
||||
width: 300px;
|
||||
height: 400px;
|
||||
}
|
||||
#chat_input:checked +
|
||||
.chat_box .chat_item {
|
||||
display: flex;
|
||||
}
|
||||
#chat_input:checked +
|
||||
.chat_box .chat_item.open_close p {
|
||||
display: none;
|
||||
}
|
||||
#chat_input:checked +
|
||||
.chat_box .chat_item.open_close {
|
||||
/*
|
||||
*/
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
padding: 0px;
|
||||
justify-self: end;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
#chat_input:checked +
|
||||
.chat_box .chat_item.open_close::before {
|
||||
--collapse_width: 20px;
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
height: 2px;
|
||||
width: 15px;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
.chat_box .chat_item .msg_box {
|
||||
width: 100%;
|
||||
border: 1px solid blue;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
.chat_box .text_area {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
min-height: 100%;
|
||||
max-height: 300px;
|
||||
/*
|
||||
resize: none;
|
||||
*/
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
background-color: white;
|
||||
border: 1px solid red;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir : __dirname,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
],
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
ignorePatterns: ['.eslintrc.js'],
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<p align="center">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
||||
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
||||
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
||||
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
|
||||
## Description
|
||||
|
||||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
## Running the app
|
||||
|
||||
```bash
|
||||
# development
|
||||
$ npm run start
|
||||
|
||||
# watch mode
|
||||
$ npm run start:dev
|
||||
|
||||
# production mode
|
||||
$ npm run start:prod
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
# unit tests
|
||||
$ npm run test
|
||||
|
||||
# e2e tests
|
||||
$ npm run test:e2e
|
||||
|
||||
# test coverage
|
||||
$ npm run test:cov
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
@@ -1,3 +0,0 @@
|
||||
export declare class AppController {
|
||||
place_holder(): void;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AppController = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
let AppController = class AppController {
|
||||
place_holder() { }
|
||||
};
|
||||
__decorate([
|
||||
(0, common_1.Get)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "place_holder", null);
|
||||
AppController = __decorate([
|
||||
(0, common_1.Controller)()
|
||||
], AppController);
|
||||
exports.AppController = AppController;
|
||||
//# sourceMappingURL=app.controller.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AAG1C,IAAM,aAAa,GAAnB,MAAM,aAAa;IAExB,YAAY,KAAI,CAAC;CAClB,CAAA;AAFC;IAAC,IAAA,YAAG,GAAE;;;;iDACW;AAFN,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAGzB;AAHY,sCAAa"}
|
||||
@@ -1,2 +0,0 @@
|
||||
export declare class AppModule {
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AppModule = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const chat_gateway_1 = require("./chat.gateway");
|
||||
let AppModule = class AppModule {
|
||||
};
|
||||
AppModule = __decorate([
|
||||
(0, common_1.Module)({
|
||||
providers: [chat_gateway_1.ChatGateway],
|
||||
})
|
||||
], AppModule);
|
||||
exports.AppModule = AppModule;
|
||||
//# sourceMappingURL=app.module.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,iDAA6C;AAKtC,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IAHrB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,0BAAW,CAAC;KACzB,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"}
|
||||
@@ -1,3 +0,0 @@
|
||||
export declare class AppService {
|
||||
getHello(): string;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AppService = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
let AppService = class AppService {
|
||||
getHello() {
|
||||
return 'Hello World!';
|
||||
}
|
||||
};
|
||||
AppService = __decorate([
|
||||
(0, common_1.Injectable)()
|
||||
], AppService);
|
||||
exports.AppService = AppService;
|
||||
//# sourceMappingURL=app.service.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.service.js","sourceRoot":"","sources":["../src/app.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAGrC,IAAM,UAAU,GAAhB,MAAM,UAAU;IACrB,QAAQ;QACN,OAAO,cAAc,CAAC;IACxB,CAAC;CACF,CAAA;AAJY,UAAU;IADtB,IAAA,mBAAU,GAAE;GACA,UAAU,CAItB;AAJY,gCAAU"}
|
||||
@@ -1,4 +0,0 @@
|
||||
export declare class ChatGateway {
|
||||
server: any;
|
||||
handleMessage(message: string): void;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ChatGateway = void 0;
|
||||
const websockets_1 = require("@nestjs/websockets");
|
||||
let ChatGateway = class ChatGateway {
|
||||
handleMessage(message) {
|
||||
console.log("message received:");
|
||||
console.log(`[${message}]`);
|
||||
this.server.emit('message', message);
|
||||
}
|
||||
};
|
||||
__decorate([
|
||||
(0, websockets_1.WebSocketServer)(),
|
||||
__metadata("design:type", Object)
|
||||
], ChatGateway.prototype, "server", void 0);
|
||||
__decorate([
|
||||
(0, websockets_1.SubscribeMessage)('message'),
|
||||
__param(0, (0, websockets_1.MessageBody)()),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", [String]),
|
||||
__metadata("design:returntype", void 0)
|
||||
], ChatGateway.prototype, "handleMessage", null);
|
||||
ChatGateway = __decorate([
|
||||
(0, websockets_1.WebSocketGateway)({
|
||||
cors: {
|
||||
origin: '*',
|
||||
},
|
||||
})
|
||||
], ChatGateway);
|
||||
exports.ChatGateway = ChatGateway;
|
||||
//# sourceMappingURL=chat.gateway.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"chat.gateway.js","sourceRoot":"","sources":["../src/chat.gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mDAK4B;AAOrB,IAAM,WAAW,GAAjB,MAAM,WAAW;IAKvB,aAAa,CAAgB,OAAe;QAC3C,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACjC,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACD,CAAA;AATA;IAAC,IAAA,4BAAe,GAAE;;2CACX;AAEP;IAAC,IAAA,6BAAgB,EAAC,SAAS,CAAC;IACb,WAAA,IAAA,wBAAW,GAAE,CAAA;;;;gDAI3B;AATW,WAAW;IALvB,IAAA,6BAAgB,EAAC;QACjB,IAAI,EAAE;YACL,MAAM,EAAE,GAAG;SACX;KACD,CAAC;GACW,WAAW,CAUvB;AAVY,kCAAW"}
|
||||
@@ -1 +0,0 @@
|
||||
export {};
|
||||
10
tests_hugo/chat_nest/chat_server/dist/main.js
vendored
10
tests_hugo/chat_nest/chat_server/dist/main.js
vendored
@@ -1,10 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core_1 = require("@nestjs/core");
|
||||
const app_module_1 = require("./app.module");
|
||||
async function bootstrap() {
|
||||
const app = await core_1.NestFactory.create(app_module_1.AppModule);
|
||||
await app.listen(3000);
|
||||
}
|
||||
bootstrap();
|
||||
//# sourceMappingURL=main.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AAEzC,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AACD,SAAS,EAAE,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/nest-cli",
|
||||
"collection": "@nestjs/schematics",
|
||||
"sourceRoot": "src"
|
||||
}
|
||||
14851
tests_hugo/chat_nest/chat_server/package-lock.json
generated
14851
tests_hugo/chat_nest/chat_server/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,74 +0,0 @@
|
||||
{
|
||||
"name": "chat",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "nest build",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "nest start",
|
||||
"start:dev": "nest start --watch",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
"start:prod": "node dist/main",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^9.0.0",
|
||||
"@nestjs/core": "^9.0.0",
|
||||
"@nestjs/platform-express": "^9.0.0",
|
||||
"@nestjs/platform-socket.io": "^9.2.0",
|
||||
"@nestjs/websockets": "^9.2.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.2.0",
|
||||
"socket.io": "^4.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^9.0.0",
|
||||
"@nestjs/schematics": "^9.0.0",
|
||||
"@nestjs/testing": "^9.0.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/jest": "28.1.8",
|
||||
"@types/node": "^16.0.0",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
"@typescript-eslint/parser": "^5.0.0",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"jest": "28.1.3",
|
||||
"prettier": "^2.3.2",
|
||||
"source-map-support": "^0.5.20",
|
||||
"supertest": "^6.1.3",
|
||||
"ts-jest": "28.0.8",
|
||||
"ts-loader": "^9.2.3",
|
||||
"ts-node": "^10.0.0",
|
||||
"tsconfig-paths": "4.1.0",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json",
|
||||
"ts"
|
||||
],
|
||||
"rootDir": "src",
|
||||
"testRegex": ".*\\.spec\\.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
},
|
||||
"collectCoverageFrom": [
|
||||
"**/*.(t|j)s"
|
||||
],
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
@Get()
|
||||
place_holder() {}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { ChatGateway } from './chat.gateway';
|
||||
|
||||
@Module({
|
||||
providers: [ChatGateway],
|
||||
})
|
||||
export class AppModule {}
|
||||
@@ -1,24 +0,0 @@
|
||||
import {
|
||||
WebSocketGateway,
|
||||
SubscribeMessage,
|
||||
WebSocketServer,
|
||||
MessageBody,
|
||||
} from '@nestjs/websockets';
|
||||
|
||||
@WebSocketGateway({
|
||||
cors: {
|
||||
origin: '*',
|
||||
},
|
||||
})
|
||||
export class ChatGateway {
|
||||
@WebSocketServer()
|
||||
server;
|
||||
|
||||
@SubscribeMessage('message')
|
||||
handleMessage(@MessageBody() message: string): void {
|
||||
console.log("message received:");
|
||||
console.log(`[${message}]`);
|
||||
this.server.emit('message', message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
await app.listen(3000);
|
||||
}
|
||||
bootstrap();
|
||||
@@ -1,24 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import * as request from 'supertest';
|
||||
import { AppModule } from './../src/app.module';
|
||||
|
||||
describe('AppController (e2e)', () => {
|
||||
let app: INestApplication;
|
||||
|
||||
beforeEach(async () => {
|
||||
const moduleFixture: TestingModule = await Test.createTestingModule({
|
||||
imports: [AppModule],
|
||||
}).compile();
|
||||
|
||||
app = moduleFixture.createNestApplication();
|
||||
await app.init();
|
||||
});
|
||||
|
||||
it('/ (GET)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/')
|
||||
.expect(200)
|
||||
.expect('Hello World!');
|
||||
});
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"moduleFileExtensions": ["js", "json", "ts"],
|
||||
"rootDir": ".",
|
||||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
"removeComments": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"target": "es2017",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"baseUrl": "./",
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitAny": false,
|
||||
"strictBindCallApply": false,
|
||||
"forceConsistentCasingInFileNames": false,
|
||||
"noFallthroughCasesInSwitch": false
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir : __dirname,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||
extends: [],
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
ignorePatterns: ['.eslintrc.js'],
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
<p align="center">
|
||||
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /></a>
|
||||
</p>
|
||||
|
||||
[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
|
||||
[circleci-url]: https://circleci.com/gh/nestjs/nest
|
||||
|
||||
<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
|
||||
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
|
||||
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
|
||||
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
|
||||
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
|
||||
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
|
||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
|
||||
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg"/></a>
|
||||
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
|
||||
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
|
||||
</p>
|
||||
<!--[](https://opencollective.com/nest#backer)
|
||||
[](https://opencollective.com/nest#sponsor)-->
|
||||
|
||||
## Description
|
||||
|
||||
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install
|
||||
```
|
||||
|
||||
## Running the app
|
||||
|
||||
```bash
|
||||
# development
|
||||
$ npm run start
|
||||
|
||||
# watch mode
|
||||
$ npm run start:dev
|
||||
|
||||
# production mode
|
||||
$ npm run start:prod
|
||||
```
|
||||
|
||||
## Test
|
||||
|
||||
```bash
|
||||
# unit tests
|
||||
$ npm run test
|
||||
|
||||
# e2e tests
|
||||
$ npm run test:e2e
|
||||
|
||||
# test coverage
|
||||
$ npm run test:cov
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
||||
|
||||
## Stay in touch
|
||||
|
||||
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
|
||||
- Website - [https://nestjs.com](https://nestjs.com/)
|
||||
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
||||
|
||||
## License
|
||||
|
||||
Nest is [MIT licensed](LICENSE).
|
||||
@@ -1,3 +0,0 @@
|
||||
export declare class AppController {
|
||||
getHello(): void;
|
||||
}
|
||||
27
tests_hugo/chat_nest_2/dist/app.controller.js
vendored
27
tests_hugo/chat_nest_2/dist/app.controller.js
vendored
@@ -1,27 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
var __metadata = (this && this.__metadata) || function (k, v) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AppController = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
let AppController = class AppController {
|
||||
getHello() { }
|
||||
};
|
||||
__decorate([
|
||||
(0, common_1.Get)(),
|
||||
__metadata("design:type", Function),
|
||||
__metadata("design:paramtypes", []),
|
||||
__metadata("design:returntype", void 0)
|
||||
], AppController.prototype, "getHello", null);
|
||||
AppController = __decorate([
|
||||
(0, common_1.Controller)()
|
||||
], AppController);
|
||||
exports.AppController = AppController;
|
||||
//# sourceMappingURL=app.controller.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.controller.js","sourceRoot":"","sources":["../src/app.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAiD;AAG1C,IAAM,aAAa,GAAnB,MAAM,aAAa;IAGxB,QAAQ,KAAI,CAAC;CACd,CAAA;AAFC;IAAC,IAAA,YAAG,GAAE;;;;6CACO;AAHF,aAAa;IADzB,IAAA,mBAAU,GAAE;GACA,aAAa,CAIzB;AAJY,sCAAa"}
|
||||
2
tests_hugo/chat_nest_2/dist/app.module.d.ts
vendored
2
tests_hugo/chat_nest_2/dist/app.module.d.ts
vendored
@@ -1,2 +0,0 @@
|
||||
export declare class AppModule {
|
||||
}
|
||||
22
tests_hugo/chat_nest_2/dist/app.module.js
vendored
22
tests_hugo/chat_nest_2/dist/app.module.js
vendored
@@ -1,22 +0,0 @@
|
||||
"use strict";
|
||||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.AppModule = void 0;
|
||||
const common_1 = require("@nestjs/common");
|
||||
const app_controller_1 = require("./app.controller");
|
||||
let AppModule = class AppModule {
|
||||
};
|
||||
AppModule = __decorate([
|
||||
(0, common_1.Module)({
|
||||
imports: [],
|
||||
controllers: [app_controller_1.AppController],
|
||||
providers: [],
|
||||
})
|
||||
], AppModule);
|
||||
exports.AppModule = AppModule;
|
||||
//# sourceMappingURL=app.module.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../src/app.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,qDAAiD;AAO1C,IAAM,SAAS,GAAf,MAAM,SAAS;CAAG,CAAA;AAAZ,SAAS;IALrB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,CAAC,8BAAa,CAAC;QAC5B,SAAS,EAAE,EAAE;KACd,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS"}
|
||||
1
tests_hugo/chat_nest_2/dist/main.d.ts
vendored
1
tests_hugo/chat_nest_2/dist/main.d.ts
vendored
@@ -1 +0,0 @@
|
||||
export {};
|
||||
10
tests_hugo/chat_nest_2/dist/main.js
vendored
10
tests_hugo/chat_nest_2/dist/main.js
vendored
@@ -1,10 +0,0 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core_1 = require("@nestjs/core");
|
||||
const app_module_1 = require("./app.module");
|
||||
async function bootstrap() {
|
||||
const app = await core_1.NestFactory.create(app_module_1.AppModule);
|
||||
await app.listen(8000);
|
||||
}
|
||||
bootstrap();
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
tests_hugo/chat_nest_2/dist/main.js.map
vendored
1
tests_hugo/chat_nest_2/dist/main.js.map
vendored
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,uCAA2C;AAC3C,6CAAyC;AAEzC,KAAK,UAAU,SAAS;IACtB,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAAC,sBAAS,CAAC,CAAC;IAChD,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AACD,SAAS,EAAE,CAAC"}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"$schema": "https://json.schemastore.org/nest-cli",
|
||||
"collection": "@nestjs/schematics",
|
||||
"sourceRoot": "src"
|
||||
}
|
||||
14605
tests_hugo/chat_nest_2/package-lock.json
generated
14605
tests_hugo/chat_nest_2/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"name": "chat_nest_2",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"author": "",
|
||||
"private": true,
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
"prebuild": "rimraf dist",
|
||||
"build": "nest build",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "nest start",
|
||||
"start:dev": "nest start --watch",
|
||||
"start:debug": "nest start --debug --watch",
|
||||
"start:prod": "node dist/main",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nestjs/common": "^9.0.0",
|
||||
"@nestjs/core": "^9.0.0",
|
||||
"@nestjs/platform-express": "^9.0.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rimraf": "^3.0.2",
|
||||
"rxjs": "^7.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nestjs/cli": "^9.0.0",
|
||||
"@nestjs/schematics": "^9.0.0",
|
||||
"@nestjs/testing": "^9.0.0",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/jest": "28.1.8",
|
||||
"@types/node": "^16.0.0",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^5.0.0",
|
||||
"@typescript-eslint/parser": "^5.0.0",
|
||||
"eslint": "^8.0.1",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
"eslint-plugin-prettier": "^4.0.0",
|
||||
"jest": "28.1.3",
|
||||
"prettier": "^2.3.2",
|
||||
"source-map-support": "^0.5.20",
|
||||
"supertest": "^6.1.3",
|
||||
"ts-jest": "28.0.8",
|
||||
"ts-loader": "^9.2.3",
|
||||
"ts-node": "^10.0.0",
|
||||
"tsconfig-paths": "4.1.0",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"jest": {
|
||||
"moduleFileExtensions": [
|
||||
"js",
|
||||
"json",
|
||||
"ts"
|
||||
],
|
||||
"rootDir": "src",
|
||||
"testRegex": ".*\\.spec\\.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
},
|
||||
"collectCoverageFrom": [
|
||||
"**/*.(t|j)s"
|
||||
],
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
import { Controller, Get } from '@nestjs/common';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
|
||||
@Get()
|
||||
getHello() {}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
|
||||
@Module({
|
||||
imports: [],
|
||||
controllers: [AppController],
|
||||
providers: [],
|
||||
})
|
||||
export class AppModule {}
|
||||
@@ -1,11 +0,0 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
app.enableCors(options:{
|
||||
origin: ['http://localhost:3000']
|
||||
});
|
||||
await app.listen(8000);
|
||||
}
|
||||
bootstrap();
|
||||
@@ -1,24 +0,0 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { INestApplication } from '@nestjs/common';
|
||||
import * as request from 'supertest';
|
||||
import { AppModule } from './../src/app.module';
|
||||
|
||||
describe('AppController (e2e)', () => {
|
||||
let app: INestApplication;
|
||||
|
||||
beforeEach(async () => {
|
||||
const moduleFixture: TestingModule = await Test.createTestingModule({
|
||||
imports: [AppModule],
|
||||
}).compile();
|
||||
|
||||
app = moduleFixture.createNestApplication();
|
||||
await app.init();
|
||||
});
|
||||
|
||||
it('/ (GET)', () => {
|
||||
return request(app.getHttpServer())
|
||||
.get('/')
|
||||
.expect(200)
|
||||
.expect('Hello World!');
|
||||
});
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"moduleFileExtensions": ["js", "json", "ts"],
|
||||
"rootDir": ".",
|
||||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"declaration": true,
|
||||
"removeComments": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"target": "es2017",
|
||||
"sourceMap": true,
|
||||
"outDir": "./dist",
|
||||
"baseUrl": "./",
|
||||
"incremental": true,
|
||||
"skipLibCheck": true,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitAny": false,
|
||||
"strictBindCallApply": false,
|
||||
"forceConsistentCasingInFileNames": false,
|
||||
"noFallthroughCasesInSwitch": false
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
- [socket io multi room chat](http://psitsmike.com/2011/10/node-js-and-socket-io-multiroom-chat-tutorial/)
|
||||
|
||||
first time :
|
||||
npm install --save express socket.io cors
|
||||
sudo npm install -g nodemon
|
||||
|
||||
next time :
|
||||
npm install
|
||||
|
||||
anytime :
|
||||
nodemon server
|
||||
|
||||
- [ ] don't send message to oneself
|
||||
- [ ] create a room
|
||||
- [ ] automatically add someone to a room
|
||||
- [ ] being able to accept or refuse to be added to a room
|
||||
- [ ] what to do with message not received ?
|
||||
|
||||
```
|
||||
-> create_public_conv( room_name );
|
||||
-> create_private_conv( room_name );
|
||||
-> create_protected_conv( room_name );
|
||||
-> create_direct_conv( room_name );
|
||||
|
||||
-> change_conv( room_name );
|
||||
|
||||
-> get_conv_history( room_name );
|
||||
-> get_last_conv();
|
||||
|
||||
-> get_my_convs_directs( );
|
||||
-> get_my_convs_rooms( );
|
||||
-> get_public_convs( );
|
||||
|
||||
[ list ][ create ][ join ]
|
||||
"directs" . [direct] (public and protected)
|
||||
"rooms" . [room]
|
||||
. public
|
||||
. private
|
||||
. protected
|
||||
|
||||
on connection :
|
||||
get_convs_directs();
|
||||
get_convs_rooms();
|
||||
last_conv = get_last_conv();
|
||||
if (last_conv)
|
||||
get_conv_history(last_conv);
|
||||
|
||||
|
||||
```
|
||||
## todo:
|
||||
- check if drop down menu works also with buttons instead of <div tabindex=0>
|
||||
- add window for option when select 'room'
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
*/
|
||||
let test = document.createElement('form');
|
||||
test.innerHTML = `
|
||||
<button onclick="chat_layout(this.innerText)" type="reset">close</button>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">home</button>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">room</button>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">new</button>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">settings</button>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">room_set</button>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">protected</button>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">create</button>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">user</button>
|
||||
<br><br><label><input onchange="chat_layout_toggle(this.nextElementSibling.innerText)" type="checkbox"><span>_blocked</span></label>
|
||||
<br><br><label><input onchange="chat_layout_toggle(this.nextElementSibling.innerText)" type="checkbox"><span>_admin</span></label>
|
||||
<br><br><label><input onchange="chat_layout_toggle(this.nextElementSibling.innerText)" type="checkbox"><span>_muted</span></label>
|
||||
<br><br><label><input onchange="chat_layout_replace('_settings', '_room_set')" type="radio" name="form_from"><span>_room_set</span></label>
|
||||
<br><br><label><input onchange="chat_layout_replace('_room_set', '_settings')" type="radio" name="form_from"><span>_settings</span></label>
|
||||
<br><br><button onclick="chat_layout(this.innerText)" type="reset">mute</button>
|
||||
`;
|
||||
|
||||
document.body.prepend(test);
|
||||
|
||||
function chat_layout_toggle(layout_class) {
|
||||
document.getElementById('chat_box').classList.toggle(layout_class);
|
||||
};
|
||||
function chat_layout_replace(_old, _new) {
|
||||
let chat = document.getElementById('chat_box');
|
||||
chat.classList.remove(_old);
|
||||
chat.classList.add(_new);
|
||||
};
|
||||
|
||||
@@ -1,444 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="./style/chat.css" type="text/css" rel="stylesheet">
|
||||
<script src="./_test_layouts.js" defer></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="close" id="chat_box">
|
||||
<!--
|
||||
classes:
|
||||
1. close -> layout close
|
||||
2. home -> layout home
|
||||
3. room -> layout room
|
||||
4. new -> layout new
|
||||
5. settings -> layout settings
|
||||
6. room_set -> layout room_set
|
||||
7. protected -> layout protected
|
||||
8. create -> layout create
|
||||
9. mute -> layout mute
|
||||
10. user -> layout user
|
||||
11. _blocked -> for user layout : user is blocked
|
||||
12. _muted -> for user layout : user is muted
|
||||
13. _admin -> for user layout : you are admin
|
||||
14. _room_set -> for user layout : comes from room_set
|
||||
15. _settings -> for user layout : comes from settings
|
||||
|
||||
classes for layout must replace the entire previous class
|
||||
but classes starting with "_" must be added to existing class
|
||||
-->
|
||||
|
||||
<button class="chat_item chat_chat btn" id="chat_chat" onclick="chat_layout('home')" ><p>chat</p></button>
|
||||
<button class="chat_item chat_close btn" id="chat_close" onclick="chat_layout('close')" title="close" ></button>
|
||||
<button class="chat_item chat_new btn" id="chat_new" onclick="chat_layout('new')" title="new" ><p>new</p></button>
|
||||
<button class="chat_item chat_settings btn" id="chat_settings" onclick="chat_layout('settings')" title="settings"><p>settings</p></button>
|
||||
<button class="chat_item chat_room_name btn" id="chat_room_name" onclick="chat_layout('room_set')" ><p><room_name></p></button>
|
||||
<p class="chat_item chat_create" id="chat_create" >create</p>
|
||||
<p class="chat_item chat_user" id="chat_user" ><user_name></p>
|
||||
|
||||
<div class="chat_item chat_back" id="chat_back"></button>
|
||||
<button class="btn back_room" onclick="chat_layout('room')" title="go back room"></button>
|
||||
<button class="btn back_home" onclick="chat_layout('home')" title="go back home"></button>
|
||||
<button class="btn back_new" onclick="chat_layout('new')" title="go back new"></button>
|
||||
<button class="btn back_user" onclick="chat_layout('user')" title="go back user"></button>
|
||||
<button class="btn back_settings" onclick="chat_layout('settings')" title="go back settings"></button>
|
||||
<button class="btn back_room_set" onclick="chat_layout('room_set')" title="go back room settings"></button>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- --------------------------------
|
||||
PANELS
|
||||
|
||||
- HOME
|
||||
- MSG
|
||||
- NEW
|
||||
- SETTINGS
|
||||
- ROOM SET
|
||||
- PROTECTED
|
||||
- CREATE
|
||||
- USER
|
||||
- MUTE
|
||||
- WRITE
|
||||
--------------------------------- -->
|
||||
|
||||
<!-- HOME -->
|
||||
<div class="chat_item chat_panel chat_panel_home" id="chat_panel_home">
|
||||
<p class="__center">list of your rooms :</p>
|
||||
<div id="chat_api_room_list" class="chat_api list_btn">
|
||||
<div class="chat_room_name __show_if_only_child">
|
||||
<p class="__center">/ you have no chat room yet /</p>
|
||||
</div>
|
||||
<!-- placeholders
|
||||
------------- -->
|
||||
<button class="chat_room_name btn" onclick="chat_layout('room')">
|
||||
<p class="__left">a room</p>
|
||||
</button>
|
||||
<button class="chat_room_name btn" onclick="chat_layout('room')">
|
||||
<p class="__left">another room</p>
|
||||
</button>
|
||||
<button class="chat_room_name btn" onclick="chat_layout('room')">
|
||||
<p class="__left">placeholder</p>
|
||||
</button>
|
||||
<!-- END placeholders -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- NEW -->
|
||||
<div class="chat_item chat_panel chat_panel_new" id="chat_panel_new">
|
||||
<button class="chat_create_btn btn"><p>create</p></button>
|
||||
<p>join room :</p>
|
||||
<div id="chat_api_publics_rooms" class="chat_api chat_public_rooms list_btn">
|
||||
<div class="__show_if_only_child">
|
||||
<p class="__center">/ there are no public rooms yet /</p>
|
||||
</div>
|
||||
<!-- placeholders
|
||||
------------- -->
|
||||
<button class="chat_room_name btn" onclick="chat_layout('room')">
|
||||
<p class="__left">join room</p>
|
||||
</button>
|
||||
<button class="chat_room_name btn" onclick="chat_layout('room')">
|
||||
<p class="__left">one room</p>
|
||||
</button>
|
||||
<button class="chat_room_name btn" onclick="chat_layout('room')">
|
||||
<p class="__left">another room</p>
|
||||
</button>
|
||||
<button class="chat_room_name btn" onclick="chat_layout('room')">
|
||||
<p class="__left">one more room</p>
|
||||
</button>
|
||||
<!-- END placeholders -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SETTINGS -->
|
||||
<div class="chat_item chat_panel chat_panel_settings" id="chat_panel_settings">
|
||||
<p>blocked users :</p>
|
||||
<div id="chat_api_blocked_users" class="chat_api chat_blocked_users list_btn">
|
||||
<!-- placeholders
|
||||
------------- -->
|
||||
<button class="chat_user btn" onclick="chat_layout('user _settings')">
|
||||
<p class="__left blocked">user 1</p>
|
||||
</button>
|
||||
<button class="chat_user btn" onclick="chat_layout('user _settings')">
|
||||
<p class="__left blocked">user 2</p>
|
||||
</button>
|
||||
<button class="chat_user btn" onclick="chat_layout('user _settings')">
|
||||
<p class="__left blocked">user 3</p>
|
||||
</button>
|
||||
<button class="chat_user btn" onclick="chat_layout('user _settings')">
|
||||
<p class="__left blocked">user 4</p>
|
||||
</button>
|
||||
<!-- END placeholders -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ROOM SET -->
|
||||
<div class="chat_item chat_panel chat_panel_room_set" id="chat_panel_room_set">
|
||||
<button class="chat_leave_btn btn"><p>leave</p></button>
|
||||
<p>room users :</p>
|
||||
<div id="chat_api_room_users" class="chat_api chat_room_users list_btn">
|
||||
<div class="chat_public_rooms __show_if_only_child">
|
||||
<p class="__center">/ there are no public rooms yet /</p>
|
||||
</div>
|
||||
<!-- placeholders
|
||||
------------- -->
|
||||
<button class="chat_room_name btn" onclick="chat_layout('user _room_set')">
|
||||
<p class="__left">user 1</p>
|
||||
</button>
|
||||
<button class="chat_room_name btn" onclick="chat_layout('user _room_set')">
|
||||
<p class="__left blocked">user 2</p>
|
||||
</button>
|
||||
<button class="chat_room_name btn" onclick="chat_layout('user _room_set')">
|
||||
<p class="__left">user 3</p>
|
||||
</button>
|
||||
<button class="chat_room_name btn" onclick="chat_layout('user _room_set')">
|
||||
<p class="__left">user 4</p>
|
||||
</button>
|
||||
<!-- END placeholders -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PROTECTED -->
|
||||
<div class="chat_item chat_panel chat_panel_protected" id="chat_panel_protected">
|
||||
<p class="__center" id="chat_protected_title">this room is protected</p>
|
||||
<form>
|
||||
<label for="chat_pswd"><p>password :</p></label>
|
||||
<input id="chat_pswd" type="password" required>
|
||||
<input type="submit" value="⮡">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- CREATE -->
|
||||
<div class="chat_item chat_panel chat_panel_create" id="chat_panel_create">
|
||||
<form>
|
||||
<!-- name: -->
|
||||
<label for="chat_name"><p>name :</p></label>
|
||||
<input id="chat_name" required>
|
||||
<!-- [ ] pubic -->
|
||||
<input id="chat_public" type="radio" name="chat_create_type" checked>
|
||||
<label for="chat_public" class="_radio"><p>public</p></label>
|
||||
<!-- [ ] private -->
|
||||
<input id="chat_private" type="radio" name="chat_create_type">
|
||||
<label for="chat_private" class="_radio"><p>private</p></label>
|
||||
<!-- [ ] protected -->
|
||||
<input id="chat_protected" class="_check_change_next" type="radio" name="chat_create_type">
|
||||
<label for="chat_protected" class="_radio"><p>protected</p></label>
|
||||
<!-- [x] protected -->
|
||||
<div class="__content _is_hidden">
|
||||
<label for="chat_pswd"><p>choose a password :</p></label>
|
||||
<input id="chat_pswd" type="password" placeholder="minimum 8 characters" minlength="8">
|
||||
<p>confirm password :</p>
|
||||
<input type="password">
|
||||
</div>
|
||||
<input type="submit" value="⮡">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- USER -->
|
||||
<div class="chat_item chat_panel chat_panel_user" id="chat_panel_user">
|
||||
<p class="__center">user options :</p>
|
||||
<div class="chat_user_btn_wrapper">
|
||||
<button class="chat_profile_btn btn"><p>view profile</p></button>
|
||||
<button class="chat_game_btn btn"><p>game invitation</p></button>
|
||||
<button class="chat_block_btn btn">
|
||||
<p id="chat_user_block">block</p>
|
||||
<p id="chat_user_unblock">unblock</p>
|
||||
</button>
|
||||
<div id="chat_user_admin">
|
||||
<button class="chat_admin_btn btn"><p>make admin</p></button>
|
||||
<button class="chat_mute_btn btn" id="chat_mute_btn">
|
||||
<p id="chat_user_mute">mute</p>
|
||||
<p id="chat_user_unmute">unmute</p>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- MUTE -->
|
||||
<div class="chat_item chat_panel chat_panel_mute" id="chat_panel_mute">
|
||||
<p class="__center">mute this user for a time :</p>
|
||||
<form>
|
||||
<!-- forever -->
|
||||
<input id="chat_mute_forever" type="checkbox" class="_check_change_next"></input>
|
||||
<label for="chat_mute_forever" class="_checkbox"><p>forever</p></label>
|
||||
<div class="__content _is_not_gray">
|
||||
<!-- minutes -->
|
||||
<label for="chat_mute_minutes" class="_select">
|
||||
<p>minutes :</p>
|
||||
<select id="chat_mute_minutes">
|
||||
<option value="01">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
<option value="24">24</option>
|
||||
<option value="25">25</option>
|
||||
<option value="26">26</option>
|
||||
<option value="27">27</option>
|
||||
<option value="30">30</option>
|
||||
<option value="31">31</option>
|
||||
<option value="32">32</option>
|
||||
<option value="33">33</option>
|
||||
<option value="34">34</option>
|
||||
<option value="35">35</option>
|
||||
<option value="36">36</option>
|
||||
<option value="37">37</option>
|
||||
<option value="40">40</option>
|
||||
<option value="41">41</option>
|
||||
<option value="42">42</option>
|
||||
<option value="43">43</option>
|
||||
<option value="44">44</option>
|
||||
<option value="45">45</option>
|
||||
<option value="46">46</option>
|
||||
<option value="47">47</option>
|
||||
<option value="50">50</option>
|
||||
<option value="51">51</option>
|
||||
<option value="52">52</option>
|
||||
<option value="53">53</option>
|
||||
<option value="54">54</option>
|
||||
<option value="55">55</option>
|
||||
<option value="56">56</option>
|
||||
<option value="57">57</option>
|
||||
<option value="60">60</option>
|
||||
</select>
|
||||
</label>
|
||||
<!-- hours -->
|
||||
<label for="chat_mute_hours" class="_select">
|
||||
<p>hours :</p>
|
||||
<select id="chat_mute_hours">
|
||||
<option value="01">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
<option value="24">24</option>
|
||||
<option value="25">25</option>
|
||||
<option value="26">26</option>
|
||||
<option value="27">27</option>
|
||||
<option value="30">30</option>
|
||||
<option value="31">31</option>
|
||||
<option value="32">32</option>
|
||||
<option value="33">33</option>
|
||||
<option value="34">34</option>
|
||||
<option value="35">35</option>
|
||||
<option value="36">36</option>
|
||||
<option value="37">37</option>
|
||||
<option value="40">40</option>
|
||||
<option value="41">41</option>
|
||||
<option value="42">42</option>
|
||||
<option value="43">43</option>
|
||||
<option value="44">44</option>
|
||||
<option value="45">45</option>
|
||||
<option value="46">46</option>
|
||||
<option value="47">47</option>
|
||||
<option value="50">50</option>
|
||||
<option value="51">51</option>
|
||||
<option value="52">52</option>
|
||||
<option value="53">53</option>
|
||||
<option value="54">54</option>
|
||||
<option value="55">55</option>
|
||||
<option value="56">56</option>
|
||||
<option value="57">57</option>
|
||||
<option value="60">60</option>
|
||||
</select>
|
||||
</label>
|
||||
<!-- days -->
|
||||
<label for="chat_mute_days" class="_select">
|
||||
<p>days :</p>
|
||||
<select id="chat_mute_days">
|
||||
<option value="00">00</option>
|
||||
<option value="01">01</option>
|
||||
<option value="02">02</option>
|
||||
<option value="03">03</option>
|
||||
<option value="04">04</option>
|
||||
<option value="05">05</option>
|
||||
<option value="06">06</option>
|
||||
<option value="07">07</option>
|
||||
<option value="10">10</option>
|
||||
<option value="11">11</option>
|
||||
<option value="12">12</option>
|
||||
<option value="13">13</option>
|
||||
<option value="14">14</option>
|
||||
<option value="15">15</option>
|
||||
<option value="16">16</option>
|
||||
<option value="17">17</option>
|
||||
<option value="20">20</option>
|
||||
<option value="21">21</option>
|
||||
<option value="22">22</option>
|
||||
<option value="23">23</option>
|
||||
<option value="24">24</option>
|
||||
<option value="25">25</option>
|
||||
<option value="26">26</option>
|
||||
<option value="27">27</option>
|
||||
<option value="30">30</option>
|
||||
<option value="31">31</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<input type="submit" value="⮡">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- MSG -->
|
||||
<div class="chat_item chat_panel chat_panel_msg" id="chat_panel_msg">
|
||||
<div id="chat_api_msg_thread" class="chat_api">
|
||||
<!-- placeholders
|
||||
------------- -->
|
||||
<div class="chat_msg bob">
|
||||
<p class="name">bob</p>
|
||||
<p class="msg">hello</p>
|
||||
</div>
|
||||
<div class="chat_msg me">
|
||||
<p class="name">me</p>
|
||||
<p class="msg">hello</p>
|
||||
</div>
|
||||
<!-- END placeholders -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- WRITE -->
|
||||
<div class="chat_item chat_panel chat_panel_write" id="chat_panel_write">
|
||||
<!--
|
||||
<textarea class="text_area" id="chat_msg_write" onkeypress="send_msg_if(event)" placeholder="type here"></textarea>
|
||||
-->
|
||||
<div class="text_area" id="chat_msg_write" onkeypress="send_msg_if(event)" contenteditable="true" ></div>
|
||||
</div>
|
||||
<!-- send -->
|
||||
<button class="chat_item chat_send btn" id="chat_send" onclick="send_msg()" title="send"><p>send</p></button>
|
||||
|
||||
|
||||
<!-- --------------------------------
|
||||
MODELS
|
||||
<div class="chat_model" id="chat_model_myroom_name">
|
||||
</div>
|
||||
<div class="chat_model" id="chat_model_msg">
|
||||
</div>
|
||||
<div class="chat_model" id="chat_model_room_name">
|
||||
</div>
|
||||
<div class="chat_model" id="chat_model_blocked_user">
|
||||
</div>
|
||||
<div class="chat_model" id="chat_model_room_user">
|
||||
</div>
|
||||
--------------------------------- -->
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
function chat_layout(layout_class) {
|
||||
document.getElementById('chat_box').className = layout_class;
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- https://socket.io/docs/v4/client-installation/ -->
|
||||
<script src="https://cdn.socket.io/4.5.3/socket.io.min.js" integrity="sha384-WPFUvHkB1aHA5TDSZi6xtDgkF0wXJcIIxXhC6h8OT8EH3fC5PWro5pWJ1THjcfEi" crossorigin="anonymous"></script>
|
||||
<script>
|
||||
const socket = io("http://localhost:3000");
|
||||
socket.on("connect", () => {
|
||||
console.log("client: connection");
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="./chat_connection.js"></script>
|
||||
<script src="./chat_send_msg.js"></script>
|
||||
<script src="./chat_add_msg.js"></script>
|
||||
<script src="./chat_create_room.js"></script>
|
||||
|
||||
<script src="./event_updatemsg.js"></script>
|
||||
<script src="./event_updaterooms.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,59 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<style>
|
||||
#chat_box * {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding: 0px;
|
||||
margin: auto;
|
||||
}
|
||||
#chat_box .chat_item {
|
||||
display: none;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.chat_item#chat_chat {
|
||||
grid-area: chat;
|
||||
}
|
||||
#chat_box {
|
||||
display: grid;
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
|
||||
gap: 5px;
|
||||
padding: 5px;
|
||||
width: 300px;
|
||||
height: 400px;
|
||||
|
||||
border: 1px solid black;
|
||||
}
|
||||
#chat_box.close {
|
||||
gap: 0px;
|
||||
padding: 0px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
grid:
|
||||
' chat ' auto
|
||||
/ auto ;
|
||||
}
|
||||
#chat_box.close .chat_item#chat_chat {
|
||||
display: flex;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="close" id="chat_box">
|
||||
<button class="chat_item chat_chat btn" id="chat_chat"><p>chat</p></button>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
const add_message = (from, message ) => {
|
||||
const div_thread = document.getElementById('chat_api_msg_thread');
|
||||
|
||||
div_thread.appendChild(build_new_message(from, message));
|
||||
}
|
||||
|
||||
const build_new_message = (from, message) => {
|
||||
const div = document.createElement("div");
|
||||
const p_name = document.createElement("p");
|
||||
const p_msg = document.createElement("p");
|
||||
|
||||
div.classList.add("chat_msg");
|
||||
div.classList.add(from);
|
||||
p_name.classList.add("name");
|
||||
p_msg.classList.add("msg");
|
||||
|
||||
p_name.appendChild(document.createTextNode(from + " :"));
|
||||
p_msg.appendChild(document.createTextNode(message));
|
||||
div.appendChild(p_name);
|
||||
div.appendChild(p_msg);
|
||||
|
||||
return div;
|
||||
}
|
||||
|
||||
/*
|
||||
<div class="chat_msg bob">
|
||||
<p class="name">bob</p>
|
||||
<p class="msg">hello</p>
|
||||
</div>
|
||||
*/
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
//const add_room = (rooms, newroom) => {
|
||||
//
|
||||
//};
|
||||
@@ -1,5 +0,0 @@
|
||||
socket.on('connect', () => {
|
||||
//socket.emit('adduser', prompt("what's your name ?"));
|
||||
socket.emit('adduser', "glurk");
|
||||
//socket.emit('joinlastroom');
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
let create_room = () => {
|
||||
let room_name = prompt("room name ?");
|
||||
|
||||
socket.emit('createroom', room_name);
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
function send_msg()
|
||||
{
|
||||
const div_msg = document.getElementById('chat_msg_write');
|
||||
let msg = "";
|
||||
if (div_msg.localName === "div")
|
||||
{
|
||||
msg = div_msg.innerText.trim();
|
||||
div_msg.innerText = "";
|
||||
}
|
||||
else if (div_msg.localName === "textarea")
|
||||
{
|
||||
msg = div_msg.value.trim();
|
||||
div_msg.value = "";
|
||||
}
|
||||
div_msg.focus();
|
||||
|
||||
console.log(msg);
|
||||
|
||||
if (msg.length > 0) {
|
||||
socket.emit('sendmsg', msg);
|
||||
add_message("me", msg);
|
||||
}
|
||||
}
|
||||
|
||||
function send_msg_if(evt)
|
||||
{
|
||||
if (evt.shiftKey && evt.key === "Enter")
|
||||
{
|
||||
evt.preventDefault();
|
||||
send_msg();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
socket.on('updatemsg', (from, data) => {
|
||||
console.log("data: " + data);
|
||||
add_message(from, data);
|
||||
});
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
socket.on('updaterooms', (rooms) => {
|
||||
let div_rooms = document.getElementById("rooms");
|
||||
|
||||
console.log("rooms: ");
|
||||
console.log(rooms);
|
||||
|
||||
// let div_room_count = div_rooms.childElementCount;
|
||||
// let div_room_list = document.getElementsByClassName("room_name");
|
||||
// console.log(".div_room_list: ");
|
||||
// console.log(div_room_list);
|
||||
// for(let room of div_room_list) {
|
||||
// console.log(room);
|
||||
// console.log(room.innerHTML);
|
||||
// }
|
||||
|
||||
div_rooms.innerHTML = "";
|
||||
for (let room of rooms) {
|
||||
//console.log(room.name);
|
||||
const label = document.createElement("label");
|
||||
const p = document.createElement("p");
|
||||
const p_content = document.createTextNode(room.name);
|
||||
label.setAttribute('for', "input_outside");
|
||||
p.className = "room_name";
|
||||
p.appendChild(p_content);
|
||||
label.appendChild(p);
|
||||
div_rooms.appendChild(label);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
|
||||
/*
|
||||
*/
|
||||
|
||||
@import 'chat__global.css';
|
||||
|
||||
@import 'layout_close.css';
|
||||
@import 'layout_home.css';
|
||||
@import 'layout_room.css';
|
||||
@import 'layout_new.css';
|
||||
@import 'layout_settings.css';
|
||||
@import 'layout_room_set.css';
|
||||
@import 'layout_protected.css';
|
||||
@import 'layout_create.css';
|
||||
@import 'layout_user.css';
|
||||
@import 'layout_mute.css';
|
||||
|
||||
@import 'chat_panels.css';
|
||||
@import 'chat_buttons.css';
|
||||
@import 'chat_back.css';
|
||||
@import 'chat_close.css';
|
||||
@import 'chat_write.css';
|
||||
@import 'chat_msg.css';
|
||||
@import 'chat_blocked.css';
|
||||
@import 'chat_form.css';
|
||||
|
||||
|
||||
/*
|
||||
GRID
|
||||
*/
|
||||
|
||||
#chat_box * {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
padding: 0px;
|
||||
margin: auto;
|
||||
}
|
||||
#chat_box .chat_item {
|
||||
display: none;
|
||||
/*
|
||||
border: 1px solid black;
|
||||
*/
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.chat_item#chat_chat { grid-area: chat;}
|
||||
.chat_item#chat_close { grid-area: close;}
|
||||
.chat_item#chat_new { grid-area: new;}
|
||||
.chat_item#chat_settings { grid-area: settings;}
|
||||
.chat_item#chat_room_name { grid-area: room_name;}
|
||||
.chat_item#chat_send { grid-area: send;}
|
||||
.chat_item#chat_create { grid-area: create;}
|
||||
.chat_item#chat_user { grid-area: user;}
|
||||
.chat_item#chat_back { grid-area: back;}
|
||||
.chat_item#chat_panel_home { grid-area: panel_home;}
|
||||
.chat_item#chat_panel_new { grid-area: panel_new;}
|
||||
.chat_item#chat_panel_msg { grid-area: panel_msg;}
|
||||
.chat_item#chat_panel_write { grid-area: panel_write;}
|
||||
.chat_item#chat_panel_settings { grid-area: panel_settings;}
|
||||
.chat_item#chat_panel_room_set { grid-area: panel_room_set;}
|
||||
.chat_item#chat_panel_protected { grid-area: panel_protected;}
|
||||
.chat_item#chat_panel_create { grid-area: panel_create;}
|
||||
.chat_item#chat_panel_user { grid-area: panel_user;}
|
||||
.chat_item#chat_panel_mute { grid-area: panel_mute;}
|
||||
|
||||
#chat_box {
|
||||
display: grid;
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
|
||||
gap: 5px;
|
||||
padding: 5px;
|
||||
width: 300px;
|
||||
height: 400px;
|
||||
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
|
||||
/* Hide scrollbar
|
||||
*/
|
||||
#chat_box * {
|
||||
-ms-overflow-style: none; /* IE and Edge */
|
||||
scrollbar-width: none; /* Firefox */
|
||||
}
|
||||
#chat_box *::-webkit-scrollbar {
|
||||
display: none; /* Chrome, Safari and Opera */
|
||||
}
|
||||
|
||||
|
||||
/* p in chat_box
|
||||
*/
|
||||
#chat_box p {
|
||||
padding: 10px;
|
||||
font-size: 15px;
|
||||
font-family: Cantarell;
|
||||
}
|
||||
|
||||
|
||||
/* show child only if it's alone
|
||||
*/
|
||||
#chat_box .__show_if_only_child {
|
||||
display: none;
|
||||
}
|
||||
#chat_box .__show_if_only_child:only-child {
|
||||
display: flex;
|
||||
color: rgb(100, 100, 100);
|
||||
}
|
||||
|
||||
|
||||
/* separation line under controls
|
||||
*/
|
||||
#chat_box .chat_item.chat_panel {
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
|
||||
/* text align
|
||||
*/
|
||||
#chat_box p.__center {
|
||||
text-align: center;
|
||||
}
|
||||
#chat_box p.__left {
|
||||
text-align: left;
|
||||
}
|
||||
#chat_box p.__right {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
/* default align items
|
||||
*/
|
||||
#chat_box .chat_item > * {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
|
||||
/* display content
|
||||
*/
|
||||
#chat_box .__content{
|
||||
display: content;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
|
||||
/*
|
||||
https://www.fileformat.info/info/unicode/category/So/list.htm
|
||||
U+1F512 LOCK 🔒
|
||||
U+1F513 OPEN LOCK 🔓
|
||||
*/
|
||||
|
||||
#chat_box .blocked {
|
||||
padding-left: 30px;
|
||||
}
|
||||
#chat_box .blocked::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: calc(50% - 2px);
|
||||
left: 10px;
|
||||
cursor: pointer;
|
||||
width: 13px;
|
||||
height: 10px;
|
||||
border-radius: 2px;
|
||||
/*
|
||||
*/
|
||||
background-color: rgb(110, 110, 110);
|
||||
}
|
||||
#chat_box .blocked::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: calc(50% - 9px);
|
||||
left: 12px;
|
||||
cursor: pointer;
|
||||
width: 9px;
|
||||
height: 13px;
|
||||
border-radius: 5px;
|
||||
box-sizing: border-box;
|
||||
/*
|
||||
background-color: red;
|
||||
*/
|
||||
border: 3px solid rgb(110, 110, 110);
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
|
||||
#chat_box button {
|
||||
display: flex;
|
||||
width: auto;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
border: none;
|
||||
background-color: rgb(220, 220, 220);
|
||||
}
|
||||
#chat_box button p {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
#chat_box button.chat_item:hover,
|
||||
#chat_box .chat_item button:hover {
|
||||
background-color: rgb(200, 200, 200);
|
||||
}
|
||||
#chat_box button.chat_item:active,
|
||||
#chat_box .chat_item button:active {
|
||||
background-color: rgb(190, 190, 190);
|
||||
}
|
||||
|
||||
|
||||
/* BTN LIST
|
||||
add or remove '.btn' to toggle the hover effect
|
||||
*/
|
||||
#chat_box .list_btn button {
|
||||
margin: 0px;
|
||||
background-color: transparent;
|
||||
}
|
||||
#chat_box .list_btn {
|
||||
background-color: rgb(240, 240, 240);
|
||||
}
|
||||
|
||||
|
||||
/* BACK
|
||||
*/
|
||||
#chat_box .chat_item.chat_back button {
|
||||
width: 30px;
|
||||
height: 100%;
|
||||
background-color: transparent;
|
||||
display: none;
|
||||
}
|
||||
#chat_box .chat_item.chat_back button::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: calc(50% - 6px - 1px);
|
||||
left: 6px;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
border-left: 1px solid black;
|
||||
border-bottom: 1px solid black;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#chat_box .chat_item#chat_close {
|
||||
width: 30px;
|
||||
}
|
||||
/* add or remove '.chat_item' to toggle the hover effect */
|
||||
#chat_box button.chat_item.chat_close {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
padding: 0px;
|
||||
background-color: transparent;
|
||||
}
|
||||
#chat_close::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: calc(50% - 1px);
|
||||
left: 5px;
|
||||
width: 20px;
|
||||
height: 2px;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
@@ -1,120 +0,0 @@
|
||||
|
||||
/* default element take all space on each line
|
||||
*/
|
||||
#chat_box .chat_item form {
|
||||
margin: 0px auto;
|
||||
}
|
||||
#chat_box .chat_item form * {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
|
||||
/* radio elements style check
|
||||
*/
|
||||
#chat_box .chat_item form input[type=radio] {
|
||||
display: none;
|
||||
}
|
||||
#chat_box .chat_item form label._radio {
|
||||
margin: 0px 0px 0px auto;
|
||||
padding-right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#chat_box .chat_item form label._radio::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: calc(50% - 6px);
|
||||
right: 0px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 6px;
|
||||
border: 2px solid rgb(150, 150, 150);
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
}
|
||||
#chat_box .chat_item form input[type=radio]:checked
|
||||
+ label._radio::after {
|
||||
background-color: rgb(200, 200, 200);
|
||||
}
|
||||
|
||||
|
||||
/* change next element on check
|
||||
*/
|
||||
#chat_box form ._check_change_next:checked ~ ._is_hidden {
|
||||
display: flex;
|
||||
}
|
||||
#chat_box form ._check_change_next:checked ~ ._is_not_gray {
|
||||
pointer-events: none;
|
||||
color: rgb(100, 100, 100);
|
||||
}
|
||||
#chat_box form ._is_hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* submit button
|
||||
https://www.fileformat.info/info/unicode/category/So/list.htm
|
||||
U+21AA RIGHTWARDS ARROW WITH HOOK ↪
|
||||
U+21B3 DOWNWARDS ARROW WITH TIP RIGHTWARDS ↳
|
||||
U+2BA1 DOWNWARDS TRIANGLE-HEADED ARROW WITH LONG TIP RIGHTWARDS ⮡
|
||||
U+2BB1 RIBBON ARROW DOWN RIGHT ⮱
|
||||
U+2BA9 BLACK CURVED DOWNWARDS AND RIGHTWARDS ARROW ⮩
|
||||
*/
|
||||
#chat_box .chat_item form input[type=submit] {
|
||||
padding: 0px 10px;
|
||||
border: none;
|
||||
margin: 10px 0px 0px auto;
|
||||
cursor: pointer;
|
||||
background-color: rgb(220, 220, 220);
|
||||
}
|
||||
#chat_box .chat_item form input[type=submit]:hover {
|
||||
background-color: rgb(200, 200, 200);
|
||||
}
|
||||
|
||||
|
||||
/* select
|
||||
*/
|
||||
#chat_box .chat_item form label._select {
|
||||
flex-direction: row;
|
||||
margin-left: auto;
|
||||
}
|
||||
#chat_box .chat_item form select {
|
||||
margin: auto 0px;
|
||||
background-color: rgb(220, 220, 220);
|
||||
border: none;
|
||||
padding: 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#chat_box .chat_item form select:hover {
|
||||
background-color: rgb(200, 200, 200);
|
||||
}
|
||||
|
||||
|
||||
/* checkbox
|
||||
<input id="chat_mute_forever" type="checkbox" class="_checkbox"></input>
|
||||
<label for="chat_mute_forever">forever</label>
|
||||
*/
|
||||
#chat_box .chat_item form input[type=checkbox] {
|
||||
display: none;
|
||||
}
|
||||
#chat_box .chat_item form label._checkbox {
|
||||
margin: 0px 0px 0px auto;
|
||||
padding-right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#chat_box .chat_item form label._checkbox::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: calc(50% - 6px);
|
||||
right: 0px;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border: 2px solid rgb(150, 150, 150);
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
}
|
||||
#chat_box .chat_item form input[type=checkbox]:checked
|
||||
+ label._checkbox::after {
|
||||
background-color: rgb(200, 200, 200);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
|
||||
#chat_box #chat_panel_msg {
|
||||
flex-direction: column-reverse;
|
||||
overflow: scroll;
|
||||
border: 1px solid black;
|
||||
}
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread {
|
||||
flex-direction: column;
|
||||
width: 100%;
|
||||
padding: 0px 5px;
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg {
|
||||
white-space: pre-wrap;
|
||||
margin: 5px auto;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * *
|
||||
ALL MSG
|
||||
*/
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg {
|
||||
margin-left: 0px;
|
||||
background-color: rgb(210, 210, 210);
|
||||
max-width: 80%;
|
||||
}
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg p {
|
||||
padding: 0px;
|
||||
}
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg p.name {
|
||||
margin: 0px;
|
||||
margin-bottom: 5px;
|
||||
font-size: 12px;
|
||||
color: rgb(100, 100, 100);
|
||||
}
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg p.msg {
|
||||
/*
|
||||
margin: 5px 0px;
|
||||
line-height: 8px;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * *
|
||||
MSG PERSO
|
||||
*/
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg.me {
|
||||
margin-right: 0px;
|
||||
margin-left: auto;
|
||||
background-color: rgb(210, 110, 10);
|
||||
}
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg.me p.name {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * *
|
||||
MSG SERVER
|
||||
*/
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg.SERVER {
|
||||
margin-left: auto;
|
||||
background-color: transparent;
|
||||
}
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg.SERVER p.name {
|
||||
display: none;
|
||||
}
|
||||
#chat_box #chat_panel_msg #chat_api_msg_thread .chat_msg.SERVER p.msg {
|
||||
margin: 0px auto;
|
||||
font-size: 12px;
|
||||
color: rgb(100, 100, 100);
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#chat_box .chat_panel {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
|
||||
#chat_box .chat_item#chat_panel_write {
|
||||
border: none;
|
||||
overflow: visible;
|
||||
}
|
||||
#chat_box .chat_item#chat_panel_write .text_area {
|
||||
display: block;
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
background-color: white;
|
||||
border: 1px solid black;
|
||||
}
|
||||
#chat_box .chat_item#chat_panel_write .text_area * {
|
||||
display: block ruby;
|
||||
}
|
||||
/* if .text_area is a contenteditable div
|
||||
*/
|
||||
#chat_box .chat_item#chat_panel_write .text_area {
|
||||
height: auto;
|
||||
min-height: 100%;
|
||||
max-height: 300px;
|
||||
}
|
||||
/* if .text_area is a textarea
|
||||
*/
|
||||
#chat_box .chat_item#chat_panel_write textarea.text_area {
|
||||
resize: none;
|
||||
height: 100px;
|
||||
}
|
||||
#chat_box .chat_item#chat_panel_write textarea.text_area:placeholder-shown {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
|
||||
#chat_box.close {
|
||||
gap: 0px;
|
||||
padding: 0px;
|
||||
width: auto;
|
||||
height: auto;
|
||||
grid:
|
||||
' chat ' auto
|
||||
/ auto ;
|
||||
}
|
||||
#chat_box.close .chat_item#chat_chat {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* COLLAPSE
|
||||
|
||||
.chat._item:not(.open_close) {
|
||||
display: none;
|
||||
}
|
||||
#chat_input:checked ~
|
||||
#chat_box {
|
||||
gap: 5px;
|
||||
padding: 5px;
|
||||
width: 300px;
|
||||
height: 400px;
|
||||
}
|
||||
#chat_input:checked ~
|
||||
#chat_box .chat._item {
|
||||
display: flex;
|
||||
}
|
||||
#chat_input:checked ~
|
||||
#chat_box .chat._item.open_close p {
|
||||
display: none;
|
||||
}
|
||||
#chat_input:checked ~
|
||||
#chat_box .chat._item.open_close {
|
||||
width: 30px;
|
||||
height: 20px;
|
||||
padding: 0px;
|
||||
justify-self: end;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
#chat_input:checked ~
|
||||
#chat_box .chat._item.open_close::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
height: 4px;
|
||||
width: 15px;
|
||||
background-color: black;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
|
||||
#chat_box.create {
|
||||
grid:
|
||||
' back create close ' auto
|
||||
' panel_create panel_create panel_create ' 1fr
|
||||
/ auto 1fr auto ;
|
||||
}
|
||||
#chat_box.create .chat_item#chat_back,
|
||||
#chat_box.create .chat_item#chat_create,
|
||||
#chat_box.create .chat_item#chat_close,
|
||||
#chat_box.create .chat_item#chat_panel_create {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* back btn
|
||||
*/
|
||||
#chat_box.create .chat_item.chat_back button.back_new {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* title "create" appearance
|
||||
*/
|
||||
#chat_box.create .chat_item.chat_create {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
|
||||
#chat_box.home {
|
||||
grid:
|
||||
' settings new close ' auto
|
||||
' panel_home panel_home panel_home ' 1fr
|
||||
/ auto 1fr auto ;
|
||||
}
|
||||
#chat_box.home .chat_item#chat_settings,
|
||||
#chat_box.home .chat_item#chat_new,
|
||||
#chat_box.home .chat_item#chat_close,
|
||||
#chat_box.home .chat_item#chat_panel_home {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* button "new" appearance
|
||||
*/
|
||||
/* add or remove '.chat_item' to toggle the hover effect */
|
||||
#chat_box.home button.chat_new {
|
||||
width: auto;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
/* button "settings" as 3 dots
|
||||
*/
|
||||
#chat_box.home .chat_item#chat_settings p {
|
||||
display: none;
|
||||
}
|
||||
#chat_box.home button.chat_item#chat_settings {
|
||||
width: 30px;
|
||||
height: 100%;
|
||||
padding: 0px;
|
||||
}
|
||||
/* add or remove '.chat_item' to toggle the hover effect */
|
||||
#chat_box.home button.chat_item#chat_settings {
|
||||
background-color: transparent;
|
||||
}
|
||||
#chat_box.home .chat_item#chat_settings::after {
|
||||
content: '\2807';
|
||||
font-size: 20px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0px;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
text-align: center;
|
||||
transform: translateY(-50%);
|
||||
cursor: pointer;
|
||||
/*
|
||||
background-color: black;
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
|
||||
#chat_box.mute {
|
||||
grid:
|
||||
' back user close ' auto
|
||||
' panel_mute panel_mute panel_mute ' 1fr
|
||||
/ auto 1fr auto ;
|
||||
}
|
||||
#chat_box.mute .chat_item#chat_back,
|
||||
#chat_box.mute .chat_item#chat_user,
|
||||
#chat_box.mute .chat_item#chat_close,
|
||||
#chat_box.mute .chat_item#chat_panel_mute {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* back btn
|
||||
*/
|
||||
#chat_box.mute .chat_item.chat_back button.back_user {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* title "mute" appearance
|
||||
*/
|
||||
#chat_box.mute .chat_item.chat_user {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
|
||||
#chat_box.new {
|
||||
grid:
|
||||
' back new close ' auto
|
||||
' panel_new panel_new panel_new ' 1fr
|
||||
/ auto 1fr auto ;
|
||||
}
|
||||
#chat_box.new .chat_item#chat_back,
|
||||
#chat_box.new .chat_item#chat_new,
|
||||
#chat_box.new .chat_item#chat_close,
|
||||
#chat_box.new .chat_item#chat_panel_new {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* back btn
|
||||
*/
|
||||
#chat_box.new .chat_item.chat_back button.back_home {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* button "new" appearance
|
||||
*/
|
||||
/* add or remove '.chat_item' to toggle the hover effect */
|
||||
#chat_box.new button.chat_item.chat_new {
|
||||
width: auto;
|
||||
background-color: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
/* button "create" appearance
|
||||
*/
|
||||
#chat_box.new .chat_item button.chat_create_btn {
|
||||
margin: 10px 0px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
|
||||
#chat_box.protected {
|
||||
grid:
|
||||
' back room_name close ' auto
|
||||
' panel_protected panel_protected panel_protected ' 1fr
|
||||
/ auto 1fr auto ;
|
||||
}
|
||||
#chat_box.protected .chat_item#chat_back,
|
||||
#chat_box.protected .chat_item#chat_room_name,
|
||||
#chat_box.protected .chat_item#chat_close,
|
||||
#chat_box.protected .chat_item#chat_panel_protected {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* back btn
|
||||
*/
|
||||
#chat_box.protected .chat_item.chat_back button.back_new {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* button "<room_name>" appearance
|
||||
add or remove '.chat_item' to toggle the hover effect
|
||||
*/
|
||||
#chat_box.protected button.chat_item.chat_room_name {
|
||||
width: auto;
|
||||
background-color: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#chat_box #chat_protected_title {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
#chat_box.room {
|
||||
grid:
|
||||
' back room_name room_name close ' auto
|
||||
' panel_msg panel_msg panel_msg panel_msg ' 1fr
|
||||
' panel_write panel_write send send ' auto
|
||||
/ auto 1fr auto auto ;
|
||||
}
|
||||
#chat_box.room .chat_item#chat_back,
|
||||
#chat_box.room .chat_item#chat_room_name,
|
||||
#chat_box.room .chat_item#chat_close,
|
||||
#chat_box.room .chat_item#chat_panel_msg,
|
||||
#chat_box.room .chat_item#chat_send,
|
||||
#chat_box.room .chat_item#chat_panel_write {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* back btn
|
||||
*/
|
||||
#chat_box.room .chat_item.chat_back button.back_home {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* button "<room_name>" appearance
|
||||
*/
|
||||
/* add or remove '.chat_item' to toggle the hover effect */
|
||||
#chat_box.room button.chat_room_name {
|
||||
width: auto;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
|
||||
#chat_box.room_set {
|
||||
grid:
|
||||
' back room_name close ' auto
|
||||
' panel_room_set panel_room_set panel_room_set ' 1fr
|
||||
/ auto 1fr auto ;
|
||||
}
|
||||
#chat_box.room_set .chat_item#chat_back,
|
||||
#chat_box.room_set .chat_item#chat_room_name,
|
||||
#chat_box.room_set .chat_item#chat_close,
|
||||
#chat_box.room_set .chat_item#chat_panel_room_set {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* back btn
|
||||
*/
|
||||
#chat_box.room_set .chat_item.chat_back button.back_room {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* button "<room_name>" appearance
|
||||
*/
|
||||
/* add or remove '.chat_item' to toggle the hover effect */
|
||||
#chat_box.room_set button.chat_item.chat_room_name {
|
||||
width: auto;
|
||||
background-color: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
/* button "leave" appearance
|
||||
*/
|
||||
#chat_box.room_set .chat_item button.chat_leave_btn {
|
||||
margin: 10px 0px;
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
|
||||
#chat_box.settings {
|
||||
grid:
|
||||
' back settings close ' auto
|
||||
' panel_settings panel_settings panel_settings ' 1fr
|
||||
/ auto 1fr auto ;
|
||||
}
|
||||
#chat_box.settings .chat_item#chat_back,
|
||||
#chat_box.settings .chat_item#chat_settings,
|
||||
#chat_box.settings .chat_item#chat_close,
|
||||
#chat_box.settings .chat_item#chat_panel_settings {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* back btn
|
||||
*/
|
||||
#chat_box.settings .chat_item.chat_back button.back_home {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* button "settings" appearance
|
||||
*/
|
||||
/* add or remove '.chat_item' to toggle the hover effect */
|
||||
#chat_box.settings button.chat_item.chat_settings {
|
||||
width: auto;
|
||||
background-color: transparent;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
|
||||
#chat_box.user {
|
||||
grid:
|
||||
' back user close ' auto
|
||||
' room_name room_name room_name ' auto
|
||||
' panel_user panel_user panel_user ' 1fr
|
||||
/ auto 1fr auto ;
|
||||
}
|
||||
#chat_box.user .chat_item#chat_back,
|
||||
#chat_box.user .chat_item#chat_user,
|
||||
#chat_box.user .chat_item#chat_close,
|
||||
#chat_box.user .chat_item#chat_panel_user {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
|
||||
/* title "user" appearance
|
||||
*/
|
||||
#chat_box.user .chat_item.chat_user {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
|
||||
/* for line height
|
||||
*/
|
||||
#chat_box.user .chat_item.chat_panel_user {
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
|
||||
/* room_name appearance
|
||||
*/
|
||||
#chat_box.user button.chat_item#chat_room_name {
|
||||
background-color: transparent;
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
|
||||
|
||||
/* back btn
|
||||
*/
|
||||
#chat_box.user .chat_item.chat_back button.back_home {display: flex;}
|
||||
/* from settings */
|
||||
#chat_box._settings .chat_item.chat_back button.btn {display: none;}
|
||||
#chat_box._settings .chat_item.chat_back button.back_settings {display: flex;}
|
||||
/* from room settings */
|
||||
#chat_box._room_set .chat_item.chat_back button.btn {display: none;}
|
||||
#chat_box._room_set .chat_item.chat_back button.back_room_set {display: flex;}
|
||||
|
||||
|
||||
/* buttons appearance
|
||||
*/
|
||||
#chat_box.user .chat_item.chat_panel_user .chat_user_btn_wrapper {
|
||||
margin: 0px auto;
|
||||
}
|
||||
#chat_box.user .chat_item.chat_panel_user button {
|
||||
margin: 10px;
|
||||
}
|
||||
#chat_box.user #chat_user_admin {
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
|
||||
/* toggle buttons according to chat_box class
|
||||
*/
|
||||
/* block/unblock */
|
||||
#chat_box.user #chat_user_unblock {display: none;}
|
||||
#chat_box.user._blocked #chat_user_block {display: none;}
|
||||
#chat_box.user._blocked #chat_user_unblock {display: flex;}
|
||||
/* admin if from room */
|
||||
#chat_box.user #chat_user_admin {display: none;}
|
||||
#chat_box.user._room_set._admin #chat_user_admin {display: flex;}
|
||||
/* room_name if from room */
|
||||
#chat_box.user #chat_room_name {display: none;}
|
||||
#chat_box.user._room_set #chat_room_name {display: flex;}
|
||||
/* mute/unmute */
|
||||
#chat_box.user #chat_user_unmute {display: none;}
|
||||
#chat_box.user._muted #chat_user_mute {display: none;}
|
||||
#chat_box.user._muted #chat_user_unmute {display: flex;}
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
const add_user = (socket, username, usernames, rooms) => {
|
||||
|
||||
//console.log(`adduser: ${username}, ${usernames[username]}`);
|
||||
|
||||
// store the username in the socket session for this client
|
||||
socket.username = username;
|
||||
// store the room name in the socket session for this client
|
||||
socket.room = 'room1';
|
||||
// add the client's username to the global list
|
||||
usernames[username] = username;
|
||||
// send client to room 1
|
||||
socket.join('room1');
|
||||
// echo to client they've connected
|
||||
socket.emit('updatemsg', 'SERVER', 'you have connected to room1');
|
||||
// echo to room 1 that a person has connected to their room
|
||||
socket.broadcast.to('room1').emit('updatemsg', 'SERVER', username + ' has connected to this room');
|
||||
socket.emit('updaterooms', rooms);
|
||||
};
|
||||
|
||||
module.exports = add_user;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
const create_room = (room_name) => {
|
||||
//console.log('createroom');
|
||||
let last_room = rooms[rooms.length - 1];
|
||||
rooms.push({ name: room_name, id: last_room.id + 1 });
|
||||
socket.emit('updaterooms', rooms);
|
||||
};
|
||||
|
||||
module.exports = create_room;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
const send_msg = (socket, msg) => {
|
||||
//console.log('message from: ' + socket.username);
|
||||
//console.log('message received: ' + msg);
|
||||
socket.to(socket.room).emit('updatemsg', socket.username, msg);
|
||||
};
|
||||
|
||||
module.exports = send_msg;
|
||||
|
||||
1360
tests_hugo/chat_node/chat_server/package-lock.json
generated
1360
tests_hugo/chat_node/chat_server/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"cors": "^2.8.5",
|
||||
"express": "^4.18.2",
|
||||
"socket.io": "^4.5.4"
|
||||
}
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const http = require('http');
|
||||
const server = http.createServer(app);
|
||||
const { Server } = require("socket.io");
|
||||
// https://socket.io/docs/v4/handling-cors/
|
||||
const io = new Server(server, {
|
||||
cors: {
|
||||
// change this for the real front origin
|
||||
origin: "*"
|
||||
}
|
||||
});
|
||||
const send_msg = require('./event_sendmsg');
|
||||
const add_user = require('./event_adduser');
|
||||
const create_room = require('./event_createroom');
|
||||
|
||||
let usernames = {};
|
||||
let rooms = [
|
||||
{ name: 'room1', id: 1 },
|
||||
{ name: 'room2', id: 2 },
|
||||
{ name: 'room3', id: 3 }
|
||||
];
|
||||
let last_room = 0;
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
|
||||
socket.on('adduser', (username) => {
|
||||
add_user(socket, username, usernames, rooms);
|
||||
});
|
||||
|
||||
socket.on('sendmsg', (msg) => {
|
||||
send_msg(socket, msg);
|
||||
});
|
||||
|
||||
socket.on('createroom', (room_name) => {
|
||||
create_room(room_name);
|
||||
});
|
||||
|
||||
socket.on('joinlastroom', () => {
|
||||
if (socket.room !== null)
|
||||
socket.emit('updaterooms', socket.room);
|
||||
});
|
||||
|
||||
socket.on('switchroom', function(newroom){
|
||||
// leave the current room (stored in session)
|
||||
socket.leave(socket.room);
|
||||
// join new room, received as function parameter
|
||||
socket.join(newroom);
|
||||
socket.emit('updatechat', 'SERVER', 'you have connected to '+ newroom);
|
||||
// sent message to OLD room
|
||||
socket.broadcast.to(socket.room).emit('updatechat', 'SERVER', socket.username+' has left this room');
|
||||
// update socket session room title
|
||||
socket.room = newroom;
|
||||
socket.broadcast.to(newroom).emit('updatechat', 'SERVER', socket.username+' has joined this room');
|
||||
// socket.emit('updaterooms', rooms, newroom);
|
||||
});
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
// remove the username from global usernames list
|
||||
delete usernames[socket.username];
|
||||
// update list of users in chat, client-side
|
||||
io.sockets.emit('updateusers', usernames);
|
||||
// echo globally that this client has left
|
||||
socket.broadcast.emit('updatechat', 'SERVER', socket.username + ' has disconnected');
|
||||
socket.leave(socket.room);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
server.listen(3000, function () {
|
||||
console.log('server running on 3000');
|
||||
})
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * *
|
||||
UTILITIES
|
||||
*/
|
||||
|
||||
function resolveAfter2Seconds() {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve(spent_time(ori_date) + 'lente');
|
||||
}, 2000);
|
||||
});
|
||||
}
|
||||
function resolveAfter1Seconds() {
|
||||
return new Promise(resolve => {
|
||||
setTimeout(() => {
|
||||
resolve(spent_time(ori_date) + 'rapide');
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
function print_time(my_date = new Date) {
|
||||
let my_time = my_date.getSeconds();
|
||||
my_time += ":";
|
||||
my_time += my_date.getMilliseconds();
|
||||
return '[' + my_time + '] ';
|
||||
}
|
||||
function spent_time(ori_date) {
|
||||
let my_date = new Date();
|
||||
|
||||
let my_seconds = my_date.getSeconds() - ori_date.getSeconds();
|
||||
if (my_seconds < 0 ) my_seconds += 60;
|
||||
|
||||
let my_millis = my_date.getMilliseconds() - ori_date.getMilliseconds();
|
||||
if (my_millis < 0 ) my_millis += 1000;
|
||||
|
||||
return '[' + my_seconds + ':' + my_millis + '] ';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * *
|
||||
TESTS
|
||||
/*
|
||||
|
||||
async function asyncCall() {
|
||||
console.log(spent_time(ori_date) + 'calling');
|
||||
const lente = await resolveAfter2Seconds();
|
||||
const rpide = await resolveAfter1Seconds();
|
||||
console.log(spent_time(ori_date) + lente);
|
||||
console.log(spent_time(ori_date) + rpide);
|
||||
}
|
||||
// "[0:1] calling"
|
||||
// "[0:4] after"
|
||||
// "[3:6] [2:4] lente"
|
||||
// "[3:15] [3:6] rapide"
|
||||
*/
|
||||
|
||||
/*
|
||||
function asyncCall() {
|
||||
console.log(spent_time(ori_date) + 'calling');
|
||||
const lente = resolveAfter2Seconds();
|
||||
const rpide = resolveAfter1Seconds();
|
||||
console.log(spent_time(ori_date) + lente);
|
||||
console.log(spent_time(ori_date) + rpide);
|
||||
}
|
||||
// "[0:1] calling"
|
||||
// "[0:4] [object Promise]"
|
||||
// "[0:12] [object Promise]"
|
||||
// "[0:19] after"
|
||||
*/
|
||||
|
||||
/*
|
||||
function asyncCall() {
|
||||
console.log(spent_time(ori_date) + 'calling');
|
||||
resolveAfter2Seconds().then(message => console.log(spent_time(ori_date) + message))
|
||||
.then(() => resolveAfter1Seconds()).then(message => console.log(spent_time(ori_date) + message));
|
||||
}
|
||||
// "[0:1] calling"
|
||||
// "[0:4] after"
|
||||
// "[2:4] [2:4] lente"
|
||||
// "[3:15] [3:15] rapide"
|
||||
*/
|
||||
|
||||
/*
|
||||
async function asyncCall() {
|
||||
console.log(spent_time(ori_date) + 'calling');
|
||||
const lente = await resolveAfter2Seconds();
|
||||
console.log(spent_time(ori_date) + 'middle');
|
||||
const rpide = await resolveAfter1Seconds();
|
||||
console.log(spent_time(ori_date) + lente);
|
||||
console.log(spent_time(ori_date) + rpide);
|
||||
}
|
||||
// "[0:1] calling"
|
||||
// "[0:2] after"
|
||||
// "[2:4] middle"
|
||||
// "[3:7] [2:4] lente"
|
||||
// "[3:8] [3:6] rapide"
|
||||
*/
|
||||
|
||||
async function asyncCall() {
|
||||
console.log(spent_time(ori_date) + 'calling');
|
||||
const lente = resolveAfter2Seconds();
|
||||
const rpide = resolveAfter1Seconds();
|
||||
console.log(spent_time(ori_date) + await lente);
|
||||
console.log(spent_time(ori_date) + await rpide);
|
||||
}
|
||||
// "[0:0] calling"
|
||||
// "[0:3] after"
|
||||
// "[0:3] [2:4] lente"
|
||||
// "[2:5] [1:3] rapide"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * *
|
||||
LAUNCH TEST
|
||||
*/
|
||||
|
||||
let ori_date = new Date();
|
||||
asyncCall();
|
||||
|
||||
console.log(spent_time(ori_date) + "after");
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
module.exports = {
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: 'tsconfig.json',
|
||||
tsconfigRootDir : __dirname,
|
||||
sourceType: 'module',
|
||||
},
|
||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||
extends: [
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:prettier/recommended',
|
||||
],
|
||||
root: true,
|
||||
env: {
|
||||
node: true,
|
||||
jest: true,
|
||||
},
|
||||
ignorePatterns: ['.eslintrc.js'],
|
||||
rules: {
|
||||
'@typescript-eslint/interface-name-prefix': 'off',
|
||||
'@typescript-eslint/explicit-function-return-type': 'off',
|
||||
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||
'@typescript-eslint/no-explicit-any': 'off',
|
||||
},
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user