merge
This commit is contained in:
commit
d01db3ed20
7
chat/package-lock.json
generated
7
chat/package-lock.json
generated
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
<<<<<<< HEAD
|
||||||
"name": "chat",
|
"name": "chat",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
@ -8343,4 +8344,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
=======
|
||||||
|
"name": "app",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
>>>>>>> apommier
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 767 B |
@ -53,6 +53,12 @@ export class AppController {
|
|||||||
return req.user;
|
return req.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@UseGuards(JwtAuthGuard)
|
||||||
|
@Get('/user')
|
||||||
|
async getUser( @Body() data: any) {
|
||||||
|
return await this.userService.findOne(data.username);
|
||||||
|
}
|
||||||
|
|
||||||
@UseGuards(JwtAuthGuard)
|
@UseGuards(JwtAuthGuard)
|
||||||
@Post('/win')
|
@Post('/win')
|
||||||
async addWin(@Request() req, @Body() data: any) {
|
async addWin(@Request() req, @Body() data: any) {
|
||||||
@ -131,9 +137,67 @@ export class AppController {
|
|||||||
console.log("User quit");
|
console.log("User quit");
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Get('/chat')
|
@Post('/conv')
|
||||||
// async Chat(@Res() res) {
|
async createConv(@Request() req, @Body() data: any) {
|
||||||
// const messages = await this.chatService.getMessages();
|
///create conv and return it ? id?
|
||||||
// res.json(messages);
|
console.log(`data post /conv= ${data}`);
|
||||||
// }
|
// let test = {id: 2, members: "cc"};
|
||||||
|
return await this.chatService.createConv(data);
|
||||||
|
// res.json(messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @UseGuards(JwtAuthGuard)
|
||||||
|
@Get('/conv')
|
||||||
|
async getConv(@Request() req, @Body() data: any) {
|
||||||
|
///create conv and return it ? id?
|
||||||
|
// console.log(`data get /conv= ${data}`);
|
||||||
|
// let test = {id: 2, members: "cc"};
|
||||||
|
|
||||||
|
// let tab = [data.member, "test"];
|
||||||
|
// console.log(`tab= ${tab}`);
|
||||||
|
return await this.chatService.getConv(data.member);
|
||||||
|
// return await this.chatService.getConv(req.user.username);
|
||||||
|
|
||||||
|
|
||||||
|
// res.json(messages);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @UseGuards(JwtAuthGuard)
|
||||||
|
@Post('/message')
|
||||||
|
async postMessage(@Request() req, @Body() data: any) {
|
||||||
|
//if i can post post ?
|
||||||
|
let message =
|
||||||
|
{
|
||||||
|
convid: data.convId,
|
||||||
|
sender: data.sender,
|
||||||
|
text: data.text,
|
||||||
|
// createdAt: null,
|
||||||
|
id: null,
|
||||||
|
}
|
||||||
|
console.log(data);
|
||||||
|
return await this.chatService.createMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post('/member')
|
||||||
|
async getMember(@Body() data: any) {
|
||||||
|
console.log(data);
|
||||||
|
console.log(`get member= ${data.convId}`);
|
||||||
|
return await this.chatService.findConv(data.convId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post('/getMessage')
|
||||||
|
async getMessage(@Body() data: any) {
|
||||||
|
console.log(data);
|
||||||
|
// console.log(req.query)
|
||||||
|
console.log(`data get /conv= ${data.convId}`);
|
||||||
|
// let test = {id: 2, members: "cc"};
|
||||||
|
|
||||||
|
|
||||||
|
return await this.chatService.getMessages(data.convId);
|
||||||
|
// return await this.chatService.getConv(req.user.username);
|
||||||
|
|
||||||
|
|
||||||
|
// res.json(messages);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -8,13 +8,15 @@ import { ChatService} from './chat.service';
|
|||||||
|
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { getTypeOrmConfig } from '../config/config.service';
|
import { getTypeOrmConfig } from '../config/config.service';
|
||||||
import { Chat } from '../model/chat.entity';
|
import { Conv } from '../model/chat.entity';
|
||||||
|
import { Message } from '../model/chat.entity';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports:
|
imports:
|
||||||
[
|
[
|
||||||
TypeOrmModule.forRoot(getTypeOrmConfig()),
|
TypeOrmModule.forRoot(getTypeOrmConfig()),
|
||||||
TypeOrmModule.forFeature([Chat]),
|
TypeOrmModule.forFeature([Conv]),
|
||||||
|
TypeOrmModule.forFeature([Message]),
|
||||||
// TypeOrmModule.forFeature([UserRepository]),
|
// TypeOrmModule.forFeature([UserRepository]),
|
||||||
],
|
],
|
||||||
providers:[ChatService],
|
providers:[ChatService],
|
||||||
|
|||||||
@ -1,22 +1,99 @@
|
|||||||
// import { Injectable } from '@nestjs/common';
|
// import { Injectable } from '@nestjs/common';
|
||||||
|
|
||||||
// @Injectable()
|
// @Injectable()
|
||||||
// export class ChatService {}
|
// export class ConvService {}
|
||||||
|
|
||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable } from '@nestjs/common';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { Chat } from '../model/chat.entity';
|
import { Conv } from '../model/chat.entity';
|
||||||
|
import { Message } from '../model/chat.entity';
|
||||||
|
|
||||||
|
import { ArrayContains } from "typeorm"
|
||||||
|
import { query } from 'express';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ChatService {
|
export class ChatService {
|
||||||
constructor(@InjectRepository(Chat) private chatRepository: Repository<Chat>,) {}
|
constructor(@InjectRepository(Conv) private chatRepository: Repository<Conv>,
|
||||||
|
@InjectRepository(Message) private messageRepository: Repository<Message>,
|
||||||
|
) {}
|
||||||
|
|
||||||
async createMessage(chat: Chat): Promise<Chat> {
|
async createConv(conv: Conv): Promise<Conv> {
|
||||||
return await this.chatRepository.save(chat);
|
return await this.chatRepository.save(conv);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getMessages(): Promise<Chat[]> {
|
|
||||||
return await this.chatRepository.find();
|
|
||||||
}
|
// SELECT "conv"."id" AS "conv_id", "conv"."members" AS "conv_members", "conv"."name" AS "conv_name", "conv"."banned" AS "conv_banned", "conv"."admin" AS "conv_admin", "conv"."messages" AS "conv_messages" FROM "conv" "conv" WHERE $1 = ANY("conv"."members")
|
||||||
|
|
||||||
|
|
||||||
|
// import { createConnection } from 'typeorm';
|
||||||
|
|
||||||
|
async getConv(username: string): Promise<Conv[]>{
|
||||||
|
username = "apommier"
|
||||||
|
const convs = await this.chatRepository.query("SELECT * FROM \"conv\" WHERE $1 = ANY (ARRAY[members]);", [username])
|
||||||
|
console.log(`convs= ${convs}`)
|
||||||
|
return convs;
|
||||||
|
}
|
||||||
|
|
||||||
|
async findConv(number: number){
|
||||||
|
// username = "apommier"
|
||||||
|
console.log(`fincConv; ${number}`)
|
||||||
|
const conv = await this.chatRepository.findOneBy({id: number})
|
||||||
|
return conv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage
|
||||||
|
// const user = 'user1';
|
||||||
|
// findConvsContainingUser(user)
|
||||||
|
// .then((convs) => {
|
||||||
|
// console.log('Convs containing user:', convs);
|
||||||
|
// })
|
||||||
|
// .catch((error) => {
|
||||||
|
// console.error('Error:', error);
|
||||||
|
// });
|
||||||
|
// return await this.chatRepository.findOneBy({
|
||||||
|
// members: { $in: [username] },
|
||||||
|
// });
|
||||||
|
|
||||||
|
// return await this.chatRepository.find()
|
||||||
|
|
||||||
|
|
||||||
|
// return await this.chatRepository.findOneBy({
|
||||||
|
// members: ArrayContains(["apommier"]),
|
||||||
|
// })
|
||||||
|
|
||||||
|
// console.log(`get conv username= ${username} `)
|
||||||
|
// let test = await this.chatRepository.find({
|
||||||
|
// where : {
|
||||||
|
// members: { $all: ["apommier"] },
|
||||||
|
// }})
|
||||||
|
// console.log(`test= ${test}`)
|
||||||
|
// return test
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// message
|
||||||
|
//
|
||||||
|
|
||||||
|
async createMessage(message: Message): Promise<Message> {
|
||||||
|
return await this.messageRepository.save(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getMessages(convId: number): Promise<Message[]> {
|
||||||
|
// return await this.messageRepository.find({
|
||||||
|
// where: {
|
||||||
|
// convId: convId,
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
const convs = await this.chatRepository
|
||||||
|
.query("SELECT * FROM \"message\" WHERE $1 = message.convid;", [convId])
|
||||||
|
|
||||||
|
return (convs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,12 +6,13 @@
|
|||||||
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/04/09 14:53:49 by apommier #+# #+# */
|
/* Created: 2023/04/09 14:53:49 by apommier #+# #+# */
|
||||||
/* Updated: 2023/05/05 23:11:44 by apommier ### ########.fr */
|
/* Updated: 2023/06/01 13:07:12 by apommier ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
||||||
export const getTypeOrmConfig = (): TypeOrmModuleOptions => ({
|
|
||||||
|
export const getTypeOrmConfig = (): TypeOrmModuleOptions => ({
|
||||||
type: 'postgres',
|
type: 'postgres',
|
||||||
host: 'postgresql',
|
host: 'postgresql',
|
||||||
port: 5432,
|
port: 5432,
|
||||||
@ -25,4 +26,4 @@ import { TypeOrmModuleOptions } from '@nestjs/typeorm';
|
|||||||
migrations: ['src/migration/*.ts'],
|
migrations: ['src/migration/*.ts'],
|
||||||
ssl: process.env.MODE !== 'DEV',
|
ssl: process.env.MODE !== 'DEV',
|
||||||
synchronize: true,
|
synchronize: true,
|
||||||
});
|
});
|
||||||
@ -1,18 +1,35 @@
|
|||||||
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, BaseEntity } from 'typeorm';
|
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, BaseEntity } from 'typeorm';
|
||||||
|
|
||||||
@Entity()
|
@Entity()
|
||||||
export class Chat{
|
export class Conv{
|
||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn()
|
||||||
id: number;
|
id: number;
|
||||||
|
|
||||||
@Column()
|
@Column('text', { array: true, nullable: true })
|
||||||
email: string;
|
members: string[];
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
name: string
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
group: boolean
|
||||||
|
|
||||||
|
// @Column()
|
||||||
|
// members: string;// arry ??? one to many ???
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
banned: string;// arry ??? one to many ???
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
admin: string;// arry ??? one to many ???
|
||||||
|
|
||||||
|
@Column({ nullable: true })
|
||||||
|
messages: string;
|
||||||
|
|
||||||
|
// @CreateDateColumn()
|
||||||
|
// createdAt: Date;
|
||||||
|
|
||||||
@Column({ unique: true })
|
|
||||||
text: string;
|
|
||||||
|
|
||||||
@CreateDateColumn()
|
|
||||||
createdAt: Date;
|
|
||||||
|
|
||||||
//ban user
|
//ban user
|
||||||
//user list
|
//user list
|
||||||
@ -21,3 +38,23 @@ import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, BaseEntity }
|
|||||||
//a way to stock conv ?
|
//a way to stock conv ?
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class Message{
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column({nullable: true})
|
||||||
|
convid: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
sender: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
text: string;
|
||||||
|
|
||||||
|
|
||||||
|
@CreateDateColumn({ nullable: true })
|
||||||
|
createdAt?: Date;
|
||||||
|
|
||||||
|
}
|
||||||
595
containers/chat/package-lock.json
generated
595
containers/chat/package-lock.json
generated
@ -1,21 +1,23 @@
|
|||||||
{
|
{
|
||||||
"name": "chat",
|
"name": "pong",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "chat",
|
"name": "pong",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nestjs/common": "^9.0.0",
|
"@nestjs/common": "^9.0.0",
|
||||||
"@nestjs/core": "^9.0.0",
|
"@nestjs/core": "^9.0.0",
|
||||||
"@nestjs/platform-express": "^9.0.0",
|
"@nestjs/platform-express": "^9.0.0",
|
||||||
|
"@nestjs/platform-socket.io": "^9.4.0",
|
||||||
"@nestjs/websockets": "^9.4.0",
|
"@nestjs/websockets": "^9.4.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rxjs": "^7.2.0",
|
"rxjs": "^7.2.0",
|
||||||
"socket.io": "^4.6.1",
|
"socket.io-client": "^4.6.1",
|
||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -1406,199 +1408,6 @@
|
|||||||
"node": ">= 12.9.0"
|
"node": ">= 12.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/ast": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@webassemblyjs/helper-numbers": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/floating-point-hex-parser": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/helper-api-error": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/helper-buffer": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/helper-numbers": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@webassemblyjs/floating-point-hex-parser": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-api-error": "1.11.1",
|
|
||||||
"@xtuc/long": "4.2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/helper-wasm-bytecode": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/helper-wasm-section": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@webassemblyjs/ast": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-buffer": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
|
|
||||||
"@webassemblyjs/wasm-gen": "1.11.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/ieee754": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@xtuc/ieee754": "^1.2.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/leb128": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@xtuc/long": "4.2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/utf8": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/wasm-edit": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@webassemblyjs/ast": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-buffer": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-wasm-section": "1.11.1",
|
|
||||||
"@webassemblyjs/wasm-gen": "1.11.1",
|
|
||||||
"@webassemblyjs/wasm-opt": "1.11.1",
|
|
||||||
"@webassemblyjs/wasm-parser": "1.11.1",
|
|
||||||
"@webassemblyjs/wast-printer": "1.11.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/wasm-gen": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@webassemblyjs/ast": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
|
|
||||||
"@webassemblyjs/ieee754": "1.11.1",
|
|
||||||
"@webassemblyjs/leb128": "1.11.1",
|
|
||||||
"@webassemblyjs/utf8": "1.11.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/wasm-opt": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@webassemblyjs/ast": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-buffer": "1.11.1",
|
|
||||||
"@webassemblyjs/wasm-gen": "1.11.1",
|
|
||||||
"@webassemblyjs/wasm-parser": "1.11.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/wasm-parser": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@webassemblyjs/ast": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-api-error": "1.11.1",
|
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
|
|
||||||
"@webassemblyjs/ieee754": "1.11.1",
|
|
||||||
"@webassemblyjs/leb128": "1.11.1",
|
|
||||||
"@webassemblyjs/utf8": "1.11.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/@webassemblyjs/wast-printer": {
|
|
||||||
"version": "1.11.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz",
|
|
||||||
"integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@webassemblyjs/ast": "1.11.1",
|
|
||||||
"@xtuc/long": "4.2.2"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/cli/node_modules/webpack": {
|
|
||||||
"version": "5.79.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz",
|
|
||||||
"integrity": "sha512-3mN4rR2Xq+INd6NnYuL9RC9GAmc1ROPKJoHhrZ4pAjdMFEkJJWrsPw8o2JjCIyQyTu7rTXYn4VG6OpyB3CobZg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"@types/eslint-scope": "^3.7.3",
|
|
||||||
"@types/estree": "^1.0.0",
|
|
||||||
"@webassemblyjs/ast": "1.11.1",
|
|
||||||
"@webassemblyjs/wasm-edit": "1.11.1",
|
|
||||||
"@webassemblyjs/wasm-parser": "1.11.1",
|
|
||||||
"acorn": "^8.7.1",
|
|
||||||
"acorn-import-assertions": "^1.7.6",
|
|
||||||
"browserslist": "^4.14.5",
|
|
||||||
"chrome-trace-event": "^1.0.2",
|
|
||||||
"enhanced-resolve": "^5.10.0",
|
|
||||||
"es-module-lexer": "^1.2.1",
|
|
||||||
"eslint-scope": "5.1.1",
|
|
||||||
"events": "^3.2.0",
|
|
||||||
"glob-to-regexp": "^0.4.1",
|
|
||||||
"graceful-fs": "^4.2.9",
|
|
||||||
"json-parse-even-better-errors": "^2.3.1",
|
|
||||||
"loader-runner": "^4.2.0",
|
|
||||||
"mime-types": "^2.1.27",
|
|
||||||
"neo-async": "^2.6.2",
|
|
||||||
"schema-utils": "^3.1.0",
|
|
||||||
"tapable": "^2.1.1",
|
|
||||||
"terser-webpack-plugin": "^5.3.7",
|
|
||||||
"watchpack": "^2.4.0",
|
|
||||||
"webpack-sources": "^3.2.3"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"webpack": "bin/webpack.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=10.13.0"
|
|
||||||
},
|
|
||||||
"funding": {
|
|
||||||
"type": "opencollective",
|
|
||||||
"url": "https://opencollective.com/webpack"
|
|
||||||
},
|
|
||||||
"peerDependenciesMeta": {
|
|
||||||
"webpack-cli": {
|
|
||||||
"optional": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@nestjs/common": {
|
"node_modules/@nestjs/common": {
|
||||||
"version": "9.4.0",
|
"version": "9.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-9.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@nestjs/common/-/common-9.4.0.tgz",
|
||||||
@ -1688,6 +1497,24 @@
|
|||||||
"@nestjs/core": "^9.0.0"
|
"@nestjs/core": "^9.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@nestjs/platform-socket.io": {
|
||||||
|
"version": "9.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@nestjs/platform-socket.io/-/platform-socket.io-9.4.0.tgz",
|
||||||
|
"integrity": "sha512-pk5uWItnsrFKzvQrFcAmyfcb8cpGgoj4yR4+vbA5H/MLcv+8vGqruQO8riN8jAYGNPN9Y02ihBKbIvQqn92M5g==",
|
||||||
|
"dependencies": {
|
||||||
|
"socket.io": "4.6.1",
|
||||||
|
"tslib": "2.5.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/nest"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@nestjs/common": "^9.0.0",
|
||||||
|
"@nestjs/websockets": "^9.0.0",
|
||||||
|
"rxjs": "^7.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@nestjs/schematics": {
|
"node_modules/@nestjs/schematics": {
|
||||||
"version": "9.1.0",
|
"version": "9.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/@nestjs/schematics/-/schematics-9.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@nestjs/schematics/-/schematics-9.1.0.tgz",
|
||||||
@ -2019,9 +1846,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/estree": {
|
"node_modules/@types/estree": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.0.tgz",
|
||||||
"integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==",
|
"integrity": "sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/express": {
|
"node_modules/@types/express": {
|
||||||
@ -2188,15 +2015,15 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||||
"version": "5.59.0",
|
"version": "5.58.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.59.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.58.0.tgz",
|
||||||
"integrity": "sha512-p0QgrEyrxAWBecR56gyn3wkG15TJdI//eetInP3zYRewDh0XS+DhB3VUAd3QqvziFsfaQIoIuZMxZRB7vXYaYw==",
|
"integrity": "sha512-vxHvLhH0qgBd3/tW6/VccptSfc8FxPQIkmNTVLWcCOVqSBvqpnKkBTYrhcGlXfSnd78azwe+PsjYFj0X34/njA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/regexpp": "^4.4.0",
|
"@eslint-community/regexpp": "^4.4.0",
|
||||||
"@typescript-eslint/scope-manager": "5.59.0",
|
"@typescript-eslint/scope-manager": "5.58.0",
|
||||||
"@typescript-eslint/type-utils": "5.59.0",
|
"@typescript-eslint/type-utils": "5.58.0",
|
||||||
"@typescript-eslint/utils": "5.59.0",
|
"@typescript-eslint/utils": "5.58.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"grapheme-splitter": "^1.0.4",
|
"grapheme-splitter": "^1.0.4",
|
||||||
"ignore": "^5.2.0",
|
"ignore": "^5.2.0",
|
||||||
@ -2222,14 +2049,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/parser": {
|
"node_modules/@typescript-eslint/parser": {
|
||||||
"version": "5.59.0",
|
"version": "5.58.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.59.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.58.0.tgz",
|
||||||
"integrity": "sha512-qK9TZ70eJtjojSUMrrEwA9ZDQ4N0e/AuoOIgXuNBorXYcBDk397D2r5MIe1B3cok/oCtdNC5j+lUUpVB+Dpb+w==",
|
"integrity": "sha512-ixaM3gRtlfrKzP8N6lRhBbjTow1t6ztfBvQNGuRM8qH1bjFFXIJ35XY+FC0RRBKn3C6cT+7VW1y8tNm7DwPHDQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/scope-manager": "5.59.0",
|
"@typescript-eslint/scope-manager": "5.58.0",
|
||||||
"@typescript-eslint/types": "5.59.0",
|
"@typescript-eslint/types": "5.58.0",
|
||||||
"@typescript-eslint/typescript-estree": "5.59.0",
|
"@typescript-eslint/typescript-estree": "5.58.0",
|
||||||
"debug": "^4.3.4"
|
"debug": "^4.3.4"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -2249,13 +2076,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/scope-manager": {
|
"node_modules/@typescript-eslint/scope-manager": {
|
||||||
"version": "5.59.0",
|
"version": "5.58.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.59.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.58.0.tgz",
|
||||||
"integrity": "sha512-tsoldKaMh7izN6BvkK6zRMINj4Z2d6gGhO2UsI8zGZY3XhLq1DndP3Ycjhi1JwdwPRwtLMW4EFPgpuKhbCGOvQ==",
|
"integrity": "sha512-b+w8ypN5CFvrXWQb9Ow9T4/6LC2MikNf1viLkYTiTbkQl46CnR69w7lajz1icW0TBsYmlpg+mRzFJ4LEJ8X9NA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.59.0",
|
"@typescript-eslint/types": "5.58.0",
|
||||||
"@typescript-eslint/visitor-keys": "5.59.0"
|
"@typescript-eslint/visitor-keys": "5.58.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@ -2266,13 +2093,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/type-utils": {
|
"node_modules/@typescript-eslint/type-utils": {
|
||||||
"version": "5.59.0",
|
"version": "5.58.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.59.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.58.0.tgz",
|
||||||
"integrity": "sha512-d/B6VSWnZwu70kcKQSCqjcXpVH+7ABKH8P1KNn4K7j5PXXuycZTPXF44Nui0TEm6rbWGi8kc78xRgOC4n7xFgA==",
|
"integrity": "sha512-FF5vP/SKAFJ+LmR9PENql7fQVVgGDOS+dq3j+cKl9iW/9VuZC/8CFmzIP0DLKXfWKpRHawJiG70rVH+xZZbp8w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/typescript-estree": "5.59.0",
|
"@typescript-eslint/typescript-estree": "5.58.0",
|
||||||
"@typescript-eslint/utils": "5.59.0",
|
"@typescript-eslint/utils": "5.58.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"tsutils": "^3.21.0"
|
"tsutils": "^3.21.0"
|
||||||
},
|
},
|
||||||
@ -2293,9 +2120,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/types": {
|
"node_modules/@typescript-eslint/types": {
|
||||||
"version": "5.59.0",
|
"version": "5.58.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.59.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.58.0.tgz",
|
||||||
"integrity": "sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA==",
|
"integrity": "sha512-JYV4eITHPzVQMnHZcYJXl2ZloC7thuUHrcUmxtzvItyKPvQ50kb9QXBkgNAt90OYMqwaodQh2kHutWZl1fc+1g==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||||
@ -2306,13 +2133,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/typescript-estree": {
|
"node_modules/@typescript-eslint/typescript-estree": {
|
||||||
"version": "5.59.0",
|
"version": "5.58.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.58.0.tgz",
|
||||||
"integrity": "sha512-sUNnktjmI8DyGzPdZ8dRwW741zopGxltGs/SAPgGL/AAgDpiLsCFLcMNSpbfXfmnNeHmK9h3wGmCkGRGAoUZAg==",
|
"integrity": "sha512-cRACvGTodA+UxnYM2uwA2KCwRL7VAzo45syNysqlMyNyjw0Z35Icc9ihPJZjIYuA5bXJYiJ2YGUB59BqlOZT1Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.59.0",
|
"@typescript-eslint/types": "5.58.0",
|
||||||
"@typescript-eslint/visitor-keys": "5.59.0",
|
"@typescript-eslint/visitor-keys": "5.58.0",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"globby": "^11.1.0",
|
"globby": "^11.1.0",
|
||||||
"is-glob": "^4.0.3",
|
"is-glob": "^4.0.3",
|
||||||
@ -2333,17 +2160,17 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/utils": {
|
"node_modules/@typescript-eslint/utils": {
|
||||||
"version": "5.59.0",
|
"version": "5.58.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.59.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.58.0.tgz",
|
||||||
"integrity": "sha512-GGLFd+86drlHSvPgN/el6dRQNYYGOvRSDVydsUaQluwIW3HvbXuxyuD5JETvBt/9qGYe+lOrDk6gRrWOHb/FvA==",
|
"integrity": "sha512-gAmLOTFXMXOC+zP1fsqm3VceKSBQJNzV385Ok3+yzlavNHZoedajjS4UyS21gabJYcobuigQPs/z71A9MdJFqQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eslint-community/eslint-utils": "^4.2.0",
|
"@eslint-community/eslint-utils": "^4.2.0",
|
||||||
"@types/json-schema": "^7.0.9",
|
"@types/json-schema": "^7.0.9",
|
||||||
"@types/semver": "^7.3.12",
|
"@types/semver": "^7.3.12",
|
||||||
"@typescript-eslint/scope-manager": "5.59.0",
|
"@typescript-eslint/scope-manager": "5.58.0",
|
||||||
"@typescript-eslint/types": "5.59.0",
|
"@typescript-eslint/types": "5.58.0",
|
||||||
"@typescript-eslint/typescript-estree": "5.59.0",
|
"@typescript-eslint/typescript-estree": "5.58.0",
|
||||||
"eslint-scope": "^5.1.1",
|
"eslint-scope": "^5.1.1",
|
||||||
"semver": "^7.3.7"
|
"semver": "^7.3.7"
|
||||||
},
|
},
|
||||||
@ -2359,12 +2186,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@typescript-eslint/visitor-keys": {
|
"node_modules/@typescript-eslint/visitor-keys": {
|
||||||
"version": "5.59.0",
|
"version": "5.58.0",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.58.0.tgz",
|
||||||
"integrity": "sha512-qZ3iXxQhanchCeaExlKPV3gDQFxMUmU35xfd5eCXB6+kUw1TUAbIy2n7QIrwz9s98DQLzNWyHp61fY0da4ZcbA==",
|
"integrity": "sha512-/fBraTlPj0jwdyTwLyrRTxv/3lnU2H96pNTVM6z3esTWLtA5MZ9ghSMJ7Rb+TtUAdtEw9EyJzJ0EydIMKxQ9gA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": "5.59.0",
|
"@typescript-eslint/types": "5.58.0",
|
||||||
"eslint-visitor-keys": "^3.3.0"
|
"eslint-visitor-keys": "^3.3.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
@ -2376,163 +2203,148 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/ast": {
|
"node_modules/@webassemblyjs/ast": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.11.1.tgz",
|
||||||
"integrity": "sha512-LHY/GSAZZRpsNQH+/oHqhRQ5FT7eoULcBqgfyTB5nQHogFnK3/7QoN7dLnwSE/JkUAF0SrRuclT7ODqMFtWxxQ==",
|
"integrity": "sha512-ukBh14qFLjxTQNTXocdyksN5QdM28S1CxHt2rdskFyL+xFV7VremuBLVbmCePj+URalXBENx/9Lm7lnhihtCSw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/helper-numbers": "1.11.5",
|
"@webassemblyjs/helper-numbers": "1.11.1",
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.5"
|
"@webassemblyjs/helper-wasm-bytecode": "1.11.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/floating-point-hex-parser": {
|
"node_modules/@webassemblyjs/floating-point-hex-parser": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.11.1.tgz",
|
||||||
"integrity": "sha512-1j1zTIC5EZOtCplMBG/IEwLtUojtwFVwdyVMbL/hwWqbzlQoJsWCOavrdnLkemwNoC/EOwtUFch3fuo+cbcXYQ==",
|
"integrity": "sha512-iGRfyc5Bq+NnNuX8b5hwBrRjzf0ocrJPI6GWFodBFzmFnyvrQ83SHKhmilCU/8Jv67i4GJZBMhEzltxzcNagtQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-api-error": {
|
"node_modules/@webassemblyjs/helper-api-error": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.11.1.tgz",
|
||||||
"integrity": "sha512-L65bDPmfpY0+yFrsgz8b6LhXmbbs38OnwDCf6NpnMUYqa+ENfE5Dq9E42ny0qz/PdR0LJyq/T5YijPnU8AXEpA==",
|
"integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-buffer": {
|
"node_modules/@webassemblyjs/helper-buffer": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.11.1.tgz",
|
||||||
"integrity": "sha512-fDKo1gstwFFSfacIeH5KfwzjykIE6ldh1iH9Y/8YkAZrhmu4TctqYjSh7t0K2VyDSXOZJ1MLhht/k9IvYGcIxg==",
|
"integrity": "sha512-gwikF65aDNeeXa8JxXa2BAk+REjSyhrNC9ZwdT0f8jc4dQQeDQ7G4m0f2QCLPJiMTTO6wfDmRmj/pW0PsUvIcA==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-numbers": {
|
"node_modules/@webassemblyjs/helper-numbers": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz",
|
||||||
"integrity": "sha512-DhykHXM0ZABqfIGYNv93A5KKDw/+ywBFnuWybZZWcuzWHfbp21wUfRkbtz7dMGwGgT4iXjWuhRMA2Mzod6W4WA==",
|
"integrity": "sha512-vDkbxiB8zfnPdNK9Rajcey5C0w+QJugEglN0of+kmO8l7lDb77AnlKYQF7aarZuCrv+l0UvqL+68gSDr3k9LPQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/floating-point-hex-parser": "1.11.5",
|
"@webassemblyjs/floating-point-hex-parser": "1.11.1",
|
||||||
"@webassemblyjs/helper-api-error": "1.11.5",
|
"@webassemblyjs/helper-api-error": "1.11.1",
|
||||||
"@xtuc/long": "4.2.2"
|
"@xtuc/long": "4.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-wasm-bytecode": {
|
"node_modules/@webassemblyjs/helper-wasm-bytecode": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.11.1.tgz",
|
||||||
"integrity": "sha512-oC4Qa0bNcqnjAowFn7MPCETQgDYytpsfvz4ujZz63Zu/a/v71HeCAAmZsgZ3YVKec3zSPYytG3/PrRCqbtcAvA==",
|
"integrity": "sha512-PvpoOGiJwXeTrSf/qfudJhwlvDQxFgelbMqtq52WWiXC6Xgg1IREdngmPN3bs4RoO83PnL/nFrxucXj1+BX62Q==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/helper-wasm-section": {
|
"node_modules/@webassemblyjs/helper-wasm-section": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.11.1.tgz",
|
||||||
"integrity": "sha512-uEoThA1LN2NA+K3B9wDo3yKlBfVtC6rh0i4/6hvbz071E8gTNZD/pT0MsBf7MeD6KbApMSkaAK0XeKyOZC7CIA==",
|
"integrity": "sha512-10P9No29rYX1j7F3EVPX3JvGPQPae+AomuSTPiF9eBQeChHI6iqjMIwR9JmOJXwpnn/oVGDk7I5IlskuMwU/pg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.11.5",
|
"@webassemblyjs/ast": "1.11.1",
|
||||||
"@webassemblyjs/helper-buffer": "1.11.5",
|
"@webassemblyjs/helper-buffer": "1.11.1",
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.5",
|
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
|
||||||
"@webassemblyjs/wasm-gen": "1.11.5"
|
"@webassemblyjs/wasm-gen": "1.11.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/ieee754": {
|
"node_modules/@webassemblyjs/ieee754": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.11.1.tgz",
|
||||||
"integrity": "sha512-37aGq6qVL8A8oPbPrSGMBcp38YZFXcHfiROflJn9jxSdSMMM5dS5P/9e2/TpaJuhE+wFrbukN2WI6Hw9MH5acg==",
|
"integrity": "sha512-hJ87QIPtAMKbFq6CGTkZYJivEwZDbQUgYd3qKSadTNOhVY7p+gfP6Sr0lLRVTaG1JjFj+r3YchoqRYxNH3M0GQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xtuc/ieee754": "^1.2.0"
|
"@xtuc/ieee754": "^1.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/leb128": {
|
"node_modules/@webassemblyjs/leb128": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.11.1.tgz",
|
||||||
"integrity": "sha512-ajqrRSXaTJoPW+xmkfYN6l8VIeNnR4vBOTQO9HzR7IygoCcKWkICbKFbVTNMjMgMREqXEr0+2M6zukzM47ZUfQ==",
|
"integrity": "sha512-BJ2P0hNZ0u+Th1YZXJpzW6miwqQUGcIHT1G/sf72gLVD9DZ5AdYTqPNbHZh6K1M5VmKvFXwGSWZADz+qBWxeRw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@xtuc/long": "4.2.2"
|
"@xtuc/long": "4.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/utf8": {
|
"node_modules/@webassemblyjs/utf8": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.11.1.tgz",
|
||||||
"integrity": "sha512-WiOhulHKTZU5UPlRl53gHR8OxdGsSOxqfpqWeA2FmcwBMaoEdz6b2x2si3IwC9/fSPLfe8pBMRTHVMk5nlwnFQ==",
|
"integrity": "sha512-9kqcxAEdMhiwQkHpkNiorZzqpGrodQQ2IGrHHxCy+Ozng0ofyMA0lTqiLkVs1uzTRejX+/O0EOT7KxqVPuXosQ==",
|
||||||
"dev": true,
|
"dev": true
|
||||||
"peer": true
|
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/wasm-edit": {
|
"node_modules/@webassemblyjs/wasm-edit": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.11.1.tgz",
|
||||||
"integrity": "sha512-C0p9D2fAu3Twwqvygvf42iGCQ4av8MFBLiTb+08SZ4cEdwzWx9QeAHDo1E2k+9s/0w1DM40oflJOpkZ8jW4HCQ==",
|
"integrity": "sha512-g+RsupUC1aTHfR8CDgnsVRVZFJqdkFHpsHMfJuWQzWU3tvnLC07UqHICfP+4XyL2tnr1amvl1Sdp06TnYCmVkA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.11.5",
|
"@webassemblyjs/ast": "1.11.1",
|
||||||
"@webassemblyjs/helper-buffer": "1.11.5",
|
"@webassemblyjs/helper-buffer": "1.11.1",
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.5",
|
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
|
||||||
"@webassemblyjs/helper-wasm-section": "1.11.5",
|
"@webassemblyjs/helper-wasm-section": "1.11.1",
|
||||||
"@webassemblyjs/wasm-gen": "1.11.5",
|
"@webassemblyjs/wasm-gen": "1.11.1",
|
||||||
"@webassemblyjs/wasm-opt": "1.11.5",
|
"@webassemblyjs/wasm-opt": "1.11.1",
|
||||||
"@webassemblyjs/wasm-parser": "1.11.5",
|
"@webassemblyjs/wasm-parser": "1.11.1",
|
||||||
"@webassemblyjs/wast-printer": "1.11.5"
|
"@webassemblyjs/wast-printer": "1.11.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/wasm-gen": {
|
"node_modules/@webassemblyjs/wasm-gen": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.11.1.tgz",
|
||||||
"integrity": "sha512-14vteRlRjxLK9eSyYFvw1K8Vv+iPdZU0Aebk3j6oB8TQiQYuO6hj9s4d7qf6f2HJr2khzvNldAFG13CgdkAIfA==",
|
"integrity": "sha512-F7QqKXwwNlMmsulj6+O7r4mmtAlCWfO/0HdgOxSklZfQcDu0TpLiD1mRt/zF25Bk59FIjEuGAIyn5ei4yMfLhA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.11.5",
|
"@webassemblyjs/ast": "1.11.1",
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.5",
|
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
|
||||||
"@webassemblyjs/ieee754": "1.11.5",
|
"@webassemblyjs/ieee754": "1.11.1",
|
||||||
"@webassemblyjs/leb128": "1.11.5",
|
"@webassemblyjs/leb128": "1.11.1",
|
||||||
"@webassemblyjs/utf8": "1.11.5"
|
"@webassemblyjs/utf8": "1.11.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/wasm-opt": {
|
"node_modules/@webassemblyjs/wasm-opt": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.11.1.tgz",
|
||||||
"integrity": "sha512-tcKwlIXstBQgbKy1MlbDMlXaxpucn42eb17H29rawYLxm5+MsEmgPzeCP8B1Cl69hCice8LeKgZpRUAPtqYPgw==",
|
"integrity": "sha512-VqnkNqnZlU5EB64pp1l7hdm3hmQw7Vgqa0KF/KCNO9sIpI6Fk6brDEiX+iCOYrvMuBWDws0NkTOxYEb85XQHHw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.11.5",
|
"@webassemblyjs/ast": "1.11.1",
|
||||||
"@webassemblyjs/helper-buffer": "1.11.5",
|
"@webassemblyjs/helper-buffer": "1.11.1",
|
||||||
"@webassemblyjs/wasm-gen": "1.11.5",
|
"@webassemblyjs/wasm-gen": "1.11.1",
|
||||||
"@webassemblyjs/wasm-parser": "1.11.5"
|
"@webassemblyjs/wasm-parser": "1.11.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/wasm-parser": {
|
"node_modules/@webassemblyjs/wasm-parser": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.11.1.tgz",
|
||||||
"integrity": "sha512-SVXUIwsLQlc8srSD7jejsfTU83g7pIGr2YYNb9oHdtldSxaOhvA5xwvIiWIfcX8PlSakgqMXsLpLfbbJ4cBYew==",
|
"integrity": "sha512-rrBujw+dJu32gYB7/Lup6UhdkPx9S9SnobZzRVL7VcBH9Bt9bCBLEuX/YXOOtBsOZ4NQrRykKhffRWHvigQvOA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.11.5",
|
"@webassemblyjs/ast": "1.11.1",
|
||||||
"@webassemblyjs/helper-api-error": "1.11.5",
|
"@webassemblyjs/helper-api-error": "1.11.1",
|
||||||
"@webassemblyjs/helper-wasm-bytecode": "1.11.5",
|
"@webassemblyjs/helper-wasm-bytecode": "1.11.1",
|
||||||
"@webassemblyjs/ieee754": "1.11.5",
|
"@webassemblyjs/ieee754": "1.11.1",
|
||||||
"@webassemblyjs/leb128": "1.11.5",
|
"@webassemblyjs/leb128": "1.11.1",
|
||||||
"@webassemblyjs/utf8": "1.11.5"
|
"@webassemblyjs/utf8": "1.11.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@webassemblyjs/wast-printer": {
|
"node_modules/@webassemblyjs/wast-printer": {
|
||||||
"version": "1.11.5",
|
"version": "1.11.1",
|
||||||
"resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.5.tgz",
|
"resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.11.1.tgz",
|
||||||
"integrity": "sha512-f7Pq3wvg3GSPUPzR0F6bmI89Hdb+u9WXrSKc4v+N0aV0q6r42WoF92Jp2jEorBEBRoRNXgjp53nBniDXcqZYPA==",
|
"integrity": "sha512-IQboUWM4eKzWW+N/jij2sRatKMh99QEelo3Eb2q0qXkvPRISAj8Qxtmw5itwqK+TTkBuUIE45AxYPToqPtL5gg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@webassemblyjs/ast": "1.11.5",
|
"@webassemblyjs/ast": "1.11.1",
|
||||||
"@xtuc/long": "4.2.2"
|
"@xtuc/long": "4.2.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -3092,9 +2904,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/caniuse-lite": {
|
"node_modules/caniuse-lite": {
|
||||||
"version": "1.0.30001480",
|
"version": "1.0.30001478",
|
||||||
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001480.tgz",
|
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001478.tgz",
|
||||||
"integrity": "sha512-q7cpoPPvZYgtyC4VaBSN0Bt+PJ4c4EYRf0DrduInOz2SkFpHD5p3LnvEpqBp7UnJn+8x1Ogl1s38saUxe+ihQQ==",
|
"integrity": "sha512-gMhDyXGItTHipJj2ApIvR+iVB5hd0KP3svMWWXDvZOmjzJJassGLMfxRkQCSYgGd2gtdL/ReeiyvMSFD1Ss6Mw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -3592,9 +3404,9 @@
|
|||||||
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
|
||||||
},
|
},
|
||||||
"node_modules/electron-to-chromium": {
|
"node_modules/electron-to-chromium": {
|
||||||
"version": "1.4.368",
|
"version": "1.4.362",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.368.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.362.tgz",
|
||||||
"integrity": "sha512-e2aeCAixCj9M7nJxdB/wDjO6mbYX+lJJxSJCXDzlr5YPGYVofuJwGN9nKg2o6wWInjX6XmxRinn3AeJMK81ltw==",
|
"integrity": "sha512-PYzAoScDfUcAwZfJQvr6hK2xXzLsMocj/Wuz6LpW6TZQNVv9TflBSB+UoEPuFujc478BgAxCoCFarcVPmjzsog==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/emittery": {
|
"node_modules/emittery": {
|
||||||
@ -3652,6 +3464,18 @@
|
|||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/engine.io-client": {
|
||||||
|
"version": "6.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.4.0.tgz",
|
||||||
|
"integrity": "sha512-GyKPDyoEha+XZ7iEqam49vz6auPnNJ9ZBfy89f+rMMas8AuiMWOZ9PVzu8xb9ZC6rafUqiGHSCfu22ih66E+1g==",
|
||||||
|
"dependencies": {
|
||||||
|
"@socket.io/component-emitter": "~3.1.0",
|
||||||
|
"debug": "~4.3.1",
|
||||||
|
"engine.io-parser": "~5.0.3",
|
||||||
|
"ws": "~8.11.0",
|
||||||
|
"xmlhttprequest-ssl": "~2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/engine.io-parser": {
|
"node_modules/engine.io-parser": {
|
||||||
"version": "5.0.6",
|
"version": "5.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz",
|
||||||
@ -3669,9 +3493,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/enhanced-resolve": {
|
"node_modules/enhanced-resolve": {
|
||||||
"version": "5.13.0",
|
"version": "5.12.0",
|
||||||
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.12.0.tgz",
|
||||||
"integrity": "sha512-eyV8f0y1+bzyfh8xAwW/WTSZpLbjhqc4ne9eGSH4Zo2ejdyiNG9pU6mf9DG8a7+Auk6MFTlNOT4Y2y/9k8GKVg==",
|
"integrity": "sha512-QHTXI/sZQmko1cbDoNAa3mJ5qhWUUNAq3vR0/YiD379fWQrcfuoX1+HW2S0MTt7XmoPLapdaDKUtelUSPic7hQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"graceful-fs": "^4.2.4",
|
"graceful-fs": "^4.2.4",
|
||||||
@ -6369,9 +6193,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/path-scurry": {
|
"node_modules/path-scurry": {
|
||||||
"version": "1.7.0",
|
"version": "1.6.4",
|
||||||
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.6.4.tgz",
|
||||||
"integrity": "sha512-UkZUeDjczjYRE495+9thsgcVgsaCPkaw80slmfVFgllxY+IO8ubTsOpFVjDPROBqJdHfVPUFRHPBV/WciOVfWg==",
|
"integrity": "sha512-Qp/9IHkdNiXJ3/Kon++At2nVpnhRiPq/aSvQN+H3U1WZbvNRK0RIQK/o4HMqPoXjpuGJUEWpHSs6Mnjxqh3TQg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lru-cache": "^9.0.0",
|
"lru-cache": "^9.0.0",
|
||||||
@ -6385,9 +6209,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/path-scurry/node_modules/lru-cache": {
|
"node_modules/path-scurry/node_modules/lru-cache": {
|
||||||
"version": "9.1.0",
|
"version": "9.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.2.tgz",
|
||||||
"integrity": "sha512-qFXQEwchrZcMVen2uIDceR8Tii6kCJak5rzDStfEM0qA3YLMswaxIEZO0DhIbJ3aqaJiDjt+3crlplOb0tDtKQ==",
|
"integrity": "sha512-7zYMKApzQ9qQE13xQUzbXVY3p2C5lh+9V+bs8M9fRf1TF59id+8jkljRWtIPfBfNP4yQAol5cqh/e8clxatdXw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "14 || >=16.14"
|
"node": "14 || >=16.14"
|
||||||
@ -6984,9 +6808,9 @@
|
|||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"node_modules/schema-utils": {
|
"node_modules/schema-utils": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.1.1.tgz",
|
||||||
"integrity": "sha512-pvjEHOgWc9OWA/f/DE3ohBWTD6EleVLf7iFUkoSwAxttdBhB9QUebQgxER2kWueOvRJXPHNnyrvvh9eZINB8Eg==",
|
"integrity": "sha512-Y5PQxS4ITlC+EahLuXaY86TXfR7Dc5lw294alXOq86JAHCihAIZfqv8nNCWvaEJvaC51uN9hbLGeV0cFBdH+Fw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/json-schema": "^7.0.8",
|
"@types/json-schema": "^7.0.8",
|
||||||
@ -7033,9 +6857,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
"version": "7.5.0",
|
"version": "7.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz",
|
||||||
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
|
"integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
@ -7230,6 +7054,20 @@
|
|||||||
"ws": "~8.11.0"
|
"ws": "~8.11.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/socket.io-client": {
|
||||||
|
"version": "4.6.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-4.6.1.tgz",
|
||||||
|
"integrity": "sha512-5UswCV6hpaRsNg5kkEHVcbBIXEYoVbMQaHJBXJCyEQ+CiFPV1NIOY0XOFWG4XR4GZcB8Kn6AsRs/9cy9TbqVMQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@socket.io/component-emitter": "~3.1.0",
|
||||||
|
"debug": "~4.3.2",
|
||||||
|
"engine.io-client": "~6.4.0",
|
||||||
|
"socket.io-parser": "~4.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/socket.io-parser": {
|
"node_modules/socket.io-parser": {
|
||||||
"version": "4.2.2",
|
"version": "4.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz",
|
||||||
@ -7483,9 +7321,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/terser": {
|
"node_modules/terser": {
|
||||||
"version": "5.17.1",
|
"version": "5.16.9",
|
||||||
"resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz",
|
"resolved": "https://registry.npmjs.org/terser/-/terser-5.16.9.tgz",
|
||||||
"integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==",
|
"integrity": "sha512-HPa/FdTB9XGI2H1/keLFZHxl6WNvAI4YalHGtDQTlMnJcoqSab1UwL4l1hGEhs6/GmLHBZIg/YgB++jcbzoOEg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jridgewell/source-map": "^0.3.2",
|
"@jridgewell/source-map": "^0.3.2",
|
||||||
@ -7916,9 +7754,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/update-browserslist-db": {
|
"node_modules/update-browserslist-db": {
|
||||||
"version": "1.0.11",
|
"version": "1.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz",
|
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz",
|
||||||
"integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==",
|
"integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@ -7928,10 +7766,6 @@
|
|||||||
{
|
{
|
||||||
"type": "tidelift",
|
"type": "tidelift",
|
||||||
"url": "https://tidelift.com/funding/github/npm/browserslist"
|
"url": "https://tidelift.com/funding/github/npm/browserslist"
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "github",
|
|
||||||
"url": "https://github.com/sponsors/ai"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -7939,7 +7773,7 @@
|
|||||||
"picocolors": "^1.0.0"
|
"picocolors": "^1.0.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"update-browserslist-db": "cli.js"
|
"browserslist-lint": "cli.js"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"browserslist": ">= 4.21.0"
|
"browserslist": ">= 4.21.0"
|
||||||
@ -8046,22 +7880,21 @@
|
|||||||
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
"integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ=="
|
||||||
},
|
},
|
||||||
"node_modules/webpack": {
|
"node_modules/webpack": {
|
||||||
"version": "5.80.0",
|
"version": "5.79.0",
|
||||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.80.0.tgz",
|
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz",
|
||||||
"integrity": "sha512-OIMiq37XK1rWO8mH9ssfFKZsXg4n6klTEDL7S8/HqbAOBBaiy8ABvXvz0dDCXeEF9gqwxSvVk611zFPjS8hJxA==",
|
"integrity": "sha512-3mN4rR2Xq+INd6NnYuL9RC9GAmc1ROPKJoHhrZ4pAjdMFEkJJWrsPw8o2JjCIyQyTu7rTXYn4VG6OpyB3CobZg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"peer": true,
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/eslint-scope": "^3.7.3",
|
"@types/eslint-scope": "^3.7.3",
|
||||||
"@types/estree": "^1.0.0",
|
"@types/estree": "^1.0.0",
|
||||||
"@webassemblyjs/ast": "^1.11.5",
|
"@webassemblyjs/ast": "1.11.1",
|
||||||
"@webassemblyjs/wasm-edit": "^1.11.5",
|
"@webassemblyjs/wasm-edit": "1.11.1",
|
||||||
"@webassemblyjs/wasm-parser": "^1.11.5",
|
"@webassemblyjs/wasm-parser": "1.11.1",
|
||||||
"acorn": "^8.7.1",
|
"acorn": "^8.7.1",
|
||||||
"acorn-import-assertions": "^1.7.6",
|
"acorn-import-assertions": "^1.7.6",
|
||||||
"browserslist": "^4.14.5",
|
"browserslist": "^4.14.5",
|
||||||
"chrome-trace-event": "^1.0.2",
|
"chrome-trace-event": "^1.0.2",
|
||||||
"enhanced-resolve": "^5.13.0",
|
"enhanced-resolve": "^5.10.0",
|
||||||
"es-module-lexer": "^1.2.1",
|
"es-module-lexer": "^1.2.1",
|
||||||
"eslint-scope": "5.1.1",
|
"eslint-scope": "5.1.1",
|
||||||
"events": "^3.2.0",
|
"events": "^3.2.0",
|
||||||
@ -8071,7 +7904,7 @@
|
|||||||
"loader-runner": "^4.2.0",
|
"loader-runner": "^4.2.0",
|
||||||
"mime-types": "^2.1.27",
|
"mime-types": "^2.1.27",
|
||||||
"neo-async": "^2.6.2",
|
"neo-async": "^2.6.2",
|
||||||
"schema-utils": "^3.1.2",
|
"schema-utils": "^3.1.0",
|
||||||
"tapable": "^2.1.1",
|
"tapable": "^2.1.1",
|
||||||
"terser-webpack-plugin": "^5.3.7",
|
"terser-webpack-plugin": "^5.3.7",
|
||||||
"watchpack": "^2.4.0",
|
"watchpack": "^2.4.0",
|
||||||
@ -8262,6 +8095,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/xmlhttprequest-ssl": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/xtend": {
|
"node_modules/xtend": {
|
||||||
"version": "4.0.2",
|
"version": "4.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "chat",
|
"name": "pong",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "",
|
"author": "",
|
||||||
@ -23,10 +23,12 @@
|
|||||||
"@nestjs/common": "^9.0.0",
|
"@nestjs/common": "^9.0.0",
|
||||||
"@nestjs/core": "^9.0.0",
|
"@nestjs/core": "^9.0.0",
|
||||||
"@nestjs/platform-express": "^9.0.0",
|
"@nestjs/platform-express": "^9.0.0",
|
||||||
|
"@nestjs/platform-socket.io": "^9.4.0",
|
||||||
"@nestjs/websockets": "^9.4.0",
|
"@nestjs/websockets": "^9.4.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"reflect-metadata": "^0.1.13",
|
"reflect-metadata": "^0.1.13",
|
||||||
"rxjs": "^7.2.0",
|
"rxjs": "^7.2.0",
|
||||||
"socket.io": "^4.6.1",
|
"socket.io-client": "^4.6.1",
|
||||||
"uuid": "^9.0.0"
|
"uuid": "^9.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -5,7 +5,13 @@ import { v4 as uuidv4 } from 'uuid';
|
|||||||
@WebSocketGateway({ cors: true })
|
@WebSocketGateway({ cors: true })
|
||||||
export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect {
|
export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewayDisconnect {
|
||||||
|
|
||||||
|
@WebSocketServer()
|
||||||
|
server: Server;
|
||||||
|
|
||||||
private clients: Record<string, Socket> = {};
|
private clients: Record<string, Socket> = {};
|
||||||
|
// private clientsNames: Record<string, Socket[]> = {};
|
||||||
|
private clientsNames: Map<string, string[]> = new Map();
|
||||||
|
// private games: Map<string, Socket[]> = new Map();// Chat en cours, identifiées par un ID
|
||||||
|
|
||||||
afterInit(server: Server)
|
afterInit(server: Server)
|
||||||
{
|
{
|
||||||
@ -15,30 +21,212 @@ export class ChatGateway implements OnGatewayInit, OnGatewayConnection, OnGatewa
|
|||||||
handleConnection(client: Socket, ...args: any[])
|
handleConnection(client: Socket, ...args: any[])
|
||||||
{
|
{
|
||||||
console.log(`Client connected: ${client.id}`);
|
console.log(`Client connected: ${client.id}`);
|
||||||
|
// console.log(`Client connected: ${args[0].username}`);
|
||||||
|
|
||||||
const clientId = uuidv4();
|
// const clientId = args[0].username;
|
||||||
|
const clientId = client.id;
|
||||||
this.clients[clientId] = client;
|
this.clients[clientId] = client;
|
||||||
client.emit('chat:clientId', clientId);
|
// client.emit('chat:clientId', clientId);
|
||||||
|
|
||||||
console.log(`Total connected clients: ${Object.keys(this.clients).length}`);
|
console.log(`Total connected clients: ${Object.keys(this.clients).length}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDisconnect(client: Socket)
|
handleDisconnect(client: Socket)
|
||||||
{
|
{
|
||||||
console.log(`Client disconnected: ${client.id}`);
|
console.log(`Client want to deco: ${client.id}`);
|
||||||
|
|
||||||
const disconnectedClientId = Object.keys(this.clients).find(clientId => this.clients[clientId] === client);
|
// const disconnectedClientId = Object.keys(this.clients).find(clientId => this.clients[clientId] === client);
|
||||||
|
const disconnectedClientId = client.id
|
||||||
if (disconnectedClientId)
|
if (disconnectedClientId)
|
||||||
{
|
{
|
||||||
|
this.clientsNames.forEach((clientArray, clientName) =>
|
||||||
|
{
|
||||||
|
// clientArray.
|
||||||
|
console.log(`Clients with name ${clientName}:`);
|
||||||
|
console.log(`array= ${clientArray}`)
|
||||||
|
console.log(`lenght= ${clientArray.length}`)
|
||||||
|
clientArray.forEach((targetClient, index) =>
|
||||||
|
{
|
||||||
|
console.log(`index= ${index}`)
|
||||||
|
console.log(`lenght2= ${clientArray.length}`)
|
||||||
|
if (targetClient === disconnectedClientId)
|
||||||
|
{
|
||||||
|
console.log("find it")
|
||||||
|
console.log(`target= ${clientArray[index]}`)
|
||||||
|
// delete this.clientsNames[clientName][index];
|
||||||
|
if (clientArray.length === 1)
|
||||||
|
{
|
||||||
|
console.log("delete true")
|
||||||
|
this.clientsNames.delete(clientName);
|
||||||
|
return
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const newArray = clientArray.filter(item => item !== targetClient);
|
||||||
|
this.clientsNames.delete(clientName);
|
||||||
|
this.clientsNames.set(clientName, newArray);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// this.clientsNames[clientName].delete(index);
|
||||||
|
// else
|
||||||
|
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
delete this.clients[disconnectedClientId];
|
delete this.clients[disconnectedClientId];
|
||||||
|
// delete this.clientsNames;
|
||||||
console.log(`Client disconnected: ${disconnectedClientId}`);
|
console.log(`Client disconnected: ${disconnectedClientId}`);
|
||||||
console.log(`Total connected clients: ${Object.keys(this.clients).length}`);
|
console.log(`Total connected clients: ${Object.keys(this.clients).length}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SubscribeMessage('connection')
|
||||||
@SubscribeMessage('message')
|
connectClient(client: any, payload: any): void {
|
||||||
handleMessage(client: any, payload: any): string {
|
console.log("connect client")
|
||||||
return 'Hello world!';
|
if (this.clientsNames.has(payload.username)) {
|
||||||
|
console.log("get it")
|
||||||
|
const clientArray = this.clientsNames.get(payload.username); // Retrieve the array
|
||||||
|
clientArray.push(client.id); // Add the new client to the array
|
||||||
|
} else {
|
||||||
|
console.log("create")
|
||||||
|
this.clientsNames.set(payload.username, [client.id]); // Create a new array with the new client as the value
|
||||||
}
|
}
|
||||||
}
|
// let clientLenght = Object.keys(this.clientsNames[payload.username]).length
|
||||||
|
// const clientArray = this.clientsNames.get(payload.username)
|
||||||
|
// let clientLenght = clientArray.
|
||||||
|
// console.log(`lenght= ${clientLenght}`)
|
||||||
|
|
||||||
|
// this.clientsNames[payload.username][clientLenght] = this.clients[client.id];
|
||||||
|
// console.log(`clients: ${Object.keys(this.clientsNames).length}`)
|
||||||
|
// this.clients[clientId] = client;
|
||||||
|
|
||||||
|
//add a new client with socket and name for key
|
||||||
|
//payload.username
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @SubscribeMessage('sendMessage')
|
||||||
|
// handleMessage(user: any, payload: any): void {
|
||||||
|
// console.log(`message recceveid: ${payload}`)
|
||||||
|
// console.log(`message recceveid: ${payload.sender}`)
|
||||||
|
// console.log(`message recceveid: ${payload.convId}`)
|
||||||
|
// console.log(`message recceveid: ${payload.members}`)
|
||||||
|
|
||||||
|
// console.log(`client id: ${user.id}`)
|
||||||
|
|
||||||
|
// this.clientsNames.forEach((clientArray, clientName) => {
|
||||||
|
// console.log(`Clients with name ${clientName}:`);
|
||||||
|
|
||||||
|
// // clientArray.forEach((client) => {
|
||||||
|
// this.clientsNames[clientName]
|
||||||
|
// // .forEach(client => {
|
||||||
|
// // // if(client.id != user.id)
|
||||||
|
// // // {
|
||||||
|
// // console.log("send to someone")
|
||||||
|
// // console.log(client); // Perform actions on each client
|
||||||
|
// // // clients.emit('message', payload)
|
||||||
|
// // client.emit('message')
|
||||||
|
// // // }
|
||||||
|
// // });
|
||||||
|
|
||||||
|
// // .forEach((client) => {
|
||||||
|
// // if(client.id != user.id)
|
||||||
|
// // {
|
||||||
|
// // console.log("send to someone")
|
||||||
|
// // console.log(client); // Perform actions on each client
|
||||||
|
// // // clients.emit('message', payload)
|
||||||
|
// // client.emit('message')
|
||||||
|
// // }
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
|
||||||
|
@SubscribeMessage('sendMessage')
|
||||||
|
handleMessage(client: Socket, payload: any): void {
|
||||||
|
// console.log(`message received: ${payload}`);
|
||||||
|
console.log(`message sender: ${payload.sender}`);
|
||||||
|
console.log(`client id: ${client.id}`);
|
||||||
|
console.log(`conversation ID: ${payload.convId}`);
|
||||||
|
console.log(`members: ${payload.members}`);
|
||||||
|
|
||||||
|
this.clientsNames.forEach((clientArray, clientName) =>
|
||||||
|
{
|
||||||
|
console.log(` 5Clients with name ${clientName}:`);
|
||||||
|
if (payload.members.includes(clientName))
|
||||||
|
{
|
||||||
|
clientArray.forEach((targetClient, index) =>
|
||||||
|
{
|
||||||
|
console.log(`client id: ${client.id}`);
|
||||||
|
console.log(`target: ${targetClient}`);
|
||||||
|
console.log(`target id: ${targetClient}`);
|
||||||
|
if (targetClient && targetClient !== client.id)
|
||||||
|
{
|
||||||
|
console.log("Sending to someone");
|
||||||
|
console.log(`index= ${index}`);
|
||||||
|
console.log(`target: ${targetClient}`); // Perform actions on each target client
|
||||||
|
// targetClient.emit('message')
|
||||||
|
// this.clientsNames[clientName].emit('message')
|
||||||
|
// this.clientsNames["apommier"].emit('message')
|
||||||
|
this.clients[targetClient].emit('message', payload)
|
||||||
|
// console.log(test)
|
||||||
|
// console.log(test)
|
||||||
|
// this.clientsNames[clientName][index].emit('message');
|
||||||
|
// const socket = this.server.sockets.sockets.get(targetClient.id);
|
||||||
|
// if (socket) {
|
||||||
|
// socket.emit('message', payload);
|
||||||
|
// } else {
|
||||||
|
// console.log(`Socket with ID ${client.id} not found.`);
|
||||||
|
// }
|
||||||
|
// targetClient.emit('message', payload);
|
||||||
|
// targetClient.emit('message', payload);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("not sending");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// for (let key in this.clientsNames) {
|
||||||
|
// if (payload.members.includes(key)) {
|
||||||
|
// console.log("Key exists in the array");
|
||||||
|
// // if (key !== payload.sender)
|
||||||
|
// // {
|
||||||
|
// for (let key2 in this.clientsNames[key])
|
||||||
|
// {
|
||||||
|
// if (client.id !== this.clientsNames[key][key2])
|
||||||
|
// {
|
||||||
|
// console.log("send to someone")
|
||||||
|
// this.clientsNames[key][key2].emit('message', payload)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // }
|
||||||
|
// //if member socket different from mine
|
||||||
|
// //send
|
||||||
|
// } else {
|
||||||
|
// console.log("Key does not exist in the array");
|
||||||
|
// }
|
||||||
|
//if key is in member
|
||||||
|
|
||||||
|
// let socket = this.clients[key];
|
||||||
|
// console.log("Clé:", key);
|
||||||
|
// console.log("Socket:", socket);
|
||||||
|
// }
|
||||||
|
// payload.convId // conv user instead ?
|
||||||
|
//find user to send message to
|
||||||
|
//const res = {
|
||||||
|
//convId: payload.convId
|
||||||
|
//sender: payload.sender
|
||||||
|
|
||||||
|
// }
|
||||||
|
//while (user of conv)//how to get conv user
|
||||||
|
// if (user connected)
|
||||||
|
//send res to user
|
||||||
|
// }
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,21 @@
|
|||||||
import { NestFactory } from '@nestjs/core';
|
import { NestFactory } from '@nestjs/core';
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
|
import * as cors from 'cors';
|
||||||
|
import { Server } from 'socket.io';
|
||||||
import * as socketio from 'socket.io';
|
import * as socketio from 'socket.io';
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
const app = await NestFactory.create(AppModule, {
|
const app = await NestFactory.create(AppModule, {
|
||||||
cors:
|
cors: {
|
||||||
{
|
|
||||||
origin: '*',
|
origin: '*',
|
||||||
methods: '*',
|
methods: '*',
|
||||||
|
// preflightContinue: false,
|
||||||
|
// optionsSuccessStatus: 204,
|
||||||
|
// credentials: true,
|
||||||
allowedHeaders: '*',
|
allowedHeaders: '*',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
// const app = await NestFactory.create(AppModule);
|
||||||
|
|
||||||
const httpServer = app.getHttpServer();
|
const httpServer = app.getHttpServer();
|
||||||
const io = new socketio.Server(httpServer);
|
const io = new socketio.Server(httpServer);
|
||||||
@ -33,4 +38,5 @@ async function bootstrap() {
|
|||||||
|
|
||||||
await app.listen(4001);
|
await app.listen(4001);
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrap();
|
bootstrap();
|
||||||
|
|||||||
23
containers/old_react/.gitignore
vendored
23
containers/old_react/.gitignore
vendored
@ -1,23 +0,0 @@
|
|||||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
/.pnp
|
|
||||||
.pnp.js
|
|
||||||
|
|
||||||
# testing
|
|
||||||
/coverage
|
|
||||||
|
|
||||||
# production
|
|
||||||
/build
|
|
||||||
|
|
||||||
# misc
|
|
||||||
.DS_Store
|
|
||||||
.env.local
|
|
||||||
.env.development.local
|
|
||||||
.env.test.local
|
|
||||||
.env.production.local
|
|
||||||
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
# Getting Started with Create React App
|
|
||||||
|
|
||||||
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
||||||
|
|
||||||
## Available Scripts
|
|
||||||
|
|
||||||
In the project directory, you can run:
|
|
||||||
|
|
||||||
### `npm start`
|
|
||||||
|
|
||||||
Runs the app in the development mode.\
|
|
||||||
Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
|
|
||||||
|
|
||||||
The page will reload when you make changes.\
|
|
||||||
You may also see any lint errors in the console.
|
|
||||||
|
|
||||||
### `npm test`
|
|
||||||
|
|
||||||
Launches the test runner in the interactive watch mode.\
|
|
||||||
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
|
||||||
|
|
||||||
### `npm run build`
|
|
||||||
|
|
||||||
Builds the app for production to the `build` folder.\
|
|
||||||
It correctly bundles React in production mode and optimizes the build for the best performance.
|
|
||||||
|
|
||||||
The build is minified and the filenames include the hashes.\
|
|
||||||
Your app is ready to be deployed!
|
|
||||||
|
|
||||||
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
|
||||||
|
|
||||||
### `npm run eject`
|
|
||||||
|
|
||||||
**Note: this is a one-way operation. Once you `eject`, you can't go back!**
|
|
||||||
|
|
||||||
If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
|
||||||
|
|
||||||
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
|
|
||||||
|
|
||||||
You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
|
|
||||||
|
|
||||||
## Learn More
|
|
||||||
|
|
||||||
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
|
||||||
|
|
||||||
To learn React, check out the [React documentation](https://reactjs.org/).
|
|
||||||
|
|
||||||
### Code Splitting
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
|
|
||||||
|
|
||||||
### Analyzing the Bundle Size
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
|
|
||||||
|
|
||||||
### Making a Progressive Web App
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
|
|
||||||
|
|
||||||
### Advanced Configuration
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
|
|
||||||
|
|
||||||
### Deployment
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
|
|
||||||
|
|
||||||
### `npm run build` fails to minify
|
|
||||||
|
|
||||||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
|
|
||||||
17612
containers/old_react/package-lock.json
generated
17612
containers/old_react/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,47 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "my-app",
|
|
||||||
"version": "0.1.0",
|
|
||||||
"private": true,
|
|
||||||
"compilerOptions": {
|
|
||||||
"topLevelAwait": true
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@testing-library/jest-dom": "^5.16.5",
|
|
||||||
"@testing-library/react": "^13.4.0",
|
|
||||||
"@testing-library/user-event": "^13.5.0",
|
|
||||||
"axios": "^1.3.5",
|
|
||||||
"query-string": "^8.1.0",
|
|
||||||
"react": "^18.2.0",
|
|
||||||
"react-dom": "^18.2.0",
|
|
||||||
"react-router-dom": "^6.10.0",
|
|
||||||
"react-scripts": "5.0.1",
|
|
||||||
"socket.io-client": "^4.6.1",
|
|
||||||
"typescript": "^4.9.5",
|
|
||||||
"web-vitals": "^2.1.4"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"start": "HOST=0.0.0.0 PORT=8080 react-scripts start",
|
|
||||||
"start:dev": "npm run start --watch",
|
|
||||||
"build": "react-scripts build",
|
|
||||||
"test": "react-scripts test",
|
|
||||||
"eject": "react-scripts eject"
|
|
||||||
},
|
|
||||||
"eslintConfig": {
|
|
||||||
"extends": [
|
|
||||||
"react-app",
|
|
||||||
"react-app/jest"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"browserslist": {
|
|
||||||
"production": [
|
|
||||||
">0.2%",
|
|
||||||
"not dead",
|
|
||||||
"not op_mini all"
|
|
||||||
],
|
|
||||||
"development": [
|
|
||||||
"last 1 chrome version",
|
|
||||||
"last 1 firefox version",
|
|
||||||
"last 1 safari version"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB |
@ -1,43 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<!-- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" /> -->
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
||||||
<meta name="theme-color" content="#000000" />
|
|
||||||
<meta
|
|
||||||
name="description"
|
|
||||||
content="Web site created using create-react-app"
|
|
||||||
/>
|
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
|
||||||
<!--
|
|
||||||
manifest.json provides metadata used when your web app is installed on a
|
|
||||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
|
||||||
-->
|
|
||||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
|
||||||
<!--
|
|
||||||
Notice the use of %PUBLIC_URL% in the tags above.
|
|
||||||
It will be replaced with the URL of the `public` folder during the build.
|
|
||||||
Only files inside the `public` folder can be referenced from the HTML.
|
|
||||||
|
|
||||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
||||||
work correctly both with client-side routing and a non-root public URL.
|
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
|
||||||
-->
|
|
||||||
<title>React App</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
||||||
<div id="root"></div>
|
|
||||||
<!--
|
|
||||||
This HTML file is a template.
|
|
||||||
If you open it directly in the browser, you will see an empty page.
|
|
||||||
|
|
||||||
You can add webfonts, meta tags, or analytics to this file.
|
|
||||||
The build step will place the bundled scripts into the <body> tag.
|
|
||||||
|
|
||||||
To begin the development, run `npm start` or `yarn start`.
|
|
||||||
To create a production bundle, use `npm run build` or `yarn build`.
|
|
||||||
-->
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 9.4 KiB |
@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"short_name": "React App",
|
|
||||||
"name": "Create React App Sample",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "favicon.ico",
|
|
||||||
"sizes": "64x64 32x32 24x24 16x16",
|
|
||||||
"type": "image/x-icon"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "logo192.png",
|
|
||||||
"type": "image/png",
|
|
||||||
"sizes": "192x192"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "logo512.png",
|
|
||||||
"type": "image/png",
|
|
||||||
"sizes": "512x512"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"start_url": ".",
|
|
||||||
"display": "standalone",
|
|
||||||
"theme_color": "#000000",
|
|
||||||
"background_color": "#ffffff"
|
|
||||||
}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
# https://www.robotstxt.org/robotstxt.html
|
|
||||||
User-agent: *
|
|
||||||
Disallow:
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
import { useEffect, useState } from "react";
|
|
||||||
import { Navigate, Route, Routes, useNavigate } from "react-router-dom";
|
|
||||||
import "../styles/App.css";
|
|
||||||
|
|
||||||
import Field from './Field';
|
|
||||||
import PlayButton from './PlayButton';
|
|
||||||
import SuccessToken from '../script/tokenSuccess'
|
|
||||||
import Home from './Home';
|
|
||||||
|
|
||||||
import api from '../script/axiosApi';
|
|
||||||
|
|
||||||
// import Login42 from './Login42';
|
|
||||||
|
|
||||||
// const navigate = useNavigate();
|
|
||||||
|
|
||||||
// const [isLoggedIn, setisLoggedIn] = useState(false);
|
|
||||||
// useEffect(() => {
|
|
||||||
// if (!localStorage.getItem('token'))
|
|
||||||
// {
|
|
||||||
// navigate("/");
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// setisLoggedIn(true);
|
|
||||||
// }
|
|
||||||
// },);
|
|
||||||
|
|
||||||
function App() {
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const handleUnload = async (event) => {
|
|
||||||
await api.post('/quit');
|
|
||||||
// Custom logic when the user is quitting the app
|
|
||||||
// You can perform any necessary cleanup or trigger actions here
|
|
||||||
// This function will be called when the user leaves the app
|
|
||||||
};
|
|
||||||
|
|
||||||
// Add the event listener when the component mounts
|
|
||||||
window.addEventListener('beforeunload', handleUnload);
|
|
||||||
|
|
||||||
// Remove the event listener when the component unmounts
|
|
||||||
return () => {
|
|
||||||
window.removeEventListener('beforeunload', handleUnload);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Routes>
|
|
||||||
<Route exact path="/" element={<Home/>}/>
|
|
||||||
<Route exact path="/pong" element={<PlayButton />}/>
|
|
||||||
<Route exact path="/pong/play" element={<Field />}/>
|
|
||||||
<Route exact path="/token" element={<SuccessToken />}/>
|
|
||||||
|
|
||||||
<Route path='*' element={<Navigate to='/' />} />
|
|
||||||
|
|
||||||
</Routes>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App;
|
|
||||||
|
|
||||||
// {/* <Route path="*"><Navigate to="/" /></Route>
|
|
||||||
// */}
|
|
||||||
|
|
||||||
// {/* Gestion des pages inexistantes */}
|
|
||||||
|
|
||||||
// {/* ------- ROUTE FOR CHAT APP HERE --------- */}
|
|
||||||
// {/* <Route exact path="/chat" element={<NOM DU COMPONENT == index dans le tuto/>}/> */}
|
|
||||||
|
|
||||||
|
|
||||||
// {/* <Routes>
|
|
||||||
// {/* {redirectToUrl} */}
|
|
||||||
// <Route exact path="/" element={<Home/>}/>
|
|
||||||
// <Route exact path="/pong" element={<PlayButton />}/>
|
|
||||||
// <Route exact path="/pong/play" element={<Field />}/>
|
|
||||||
// <Route exact path="/token" element={<SuccessToken />}/>
|
|
||||||
|
|
||||||
// <Route path='*' element={<Navigate to='/' />} />
|
|
||||||
|
|
||||||
// {/* <Route path="*"><Navigate to="/" /></Route>
|
|
||||||
// */}
|
|
||||||
|
|
||||||
// {/* Gestion des pages inexistantes */}
|
|
||||||
|
|
||||||
// {/* ------- ROUTE FOR CHAT APP HERE --------- */}
|
|
||||||
// {/* <Route exact path="/chat" element={<NOM DU COMPONENT == index dans le tuto/>}/> */}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// </Routes> */}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
import { BrowserRouter, Routes, Route } from 'react-router-dom';
|
|
||||||
import Home from './components/Home';
|
|
||||||
import ChatPage from './components/ChatPage';
|
|
||||||
import socketIO from 'socket.io-client';
|
|
||||||
|
|
||||||
const socket = socketIO.connect('http://localhost:4000');
|
|
||||||
function App() {
|
|
||||||
return (
|
|
||||||
<BrowserRouter>
|
|
||||||
<div>
|
|
||||||
<Routes>
|
|
||||||
<Route path="/" element={<Home socket={socket} />}></Route>
|
|
||||||
<Route path="/chat" element={<ChatPage socket={socket} />}></Route>
|
|
||||||
</Routes>
|
|
||||||
</div>
|
|
||||||
</BrowserRouter>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default App;
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
import { useEffect } from 'react';
|
|
||||||
import { useState, useRef } from 'react';
|
|
||||||
import { drawCanvas } from './canvas.js';
|
|
||||||
import '../styles/field.css';
|
|
||||||
|
|
||||||
function Field()
|
|
||||||
{
|
|
||||||
useEffect(() => {
|
|
||||||
console.log("launch canva hehe")
|
|
||||||
drawCanvas();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
// const [buttonClicked, setButtonClicked] = useState(false);
|
|
||||||
|
|
||||||
// const handleButtonClick = () => {
|
|
||||||
// drawCanvas();
|
|
||||||
// setButtonClicked(true);
|
|
||||||
// };
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="field" id="canvas_container">
|
|
||||||
<canvas id="myCanvas"></canvas>
|
|
||||||
{/* <button onClick={handleButtonClick}>Draw on Canvas</button> */}
|
|
||||||
{/* {buttonClicked && <canvas id="myCanvas"></canvas>}
|
|
||||||
{!buttonClicked && <button onClick={handleButtonClick}>Draw on Canvas</button>} */}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Field;
|
|
||||||
|
|
||||||
|
|
||||||
// function Field() {
|
|
||||||
// const [buttonClicked, setButtonClicked] = useState(false);
|
|
||||||
|
|
||||||
// const handleButtonClick = () => {
|
|
||||||
// const canvas = document.createElement('canvas');
|
|
||||||
// canvas.id = 'myCanvas';
|
|
||||||
// console.log("button clicked")
|
|
||||||
// document.getElementById('canvas_container').appendChild(canvas);
|
|
||||||
// setButtonClicked(true);
|
|
||||||
// drawCanvas(canvas);
|
|
||||||
// };
|
|
||||||
// setButtonClicked(true);
|
|
||||||
// return (
|
|
||||||
// // <div className="field" id="canvas_container">
|
|
||||||
// <div className={`notClicked ${buttonClicked ? 'clicked' : ''}`} id="canvas_container">
|
|
||||||
// {!buttonClicked && <button className="playButton" onClick={handleButtonClick}>Play</button>}
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default Field;
|
|
||||||
|
|
||||||
// function draw() {
|
|
||||||
// // Effacer le canvas
|
|
||||||
// ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
||||||
|
|
||||||
// // Dessiner la raquette
|
|
||||||
// ctx.fillRect(canvas.width - paddleWidth, paddleY, paddleWidth, paddleHeight);
|
|
||||||
|
|
||||||
// // Appeler la fonction draw à chaque frame
|
|
||||||
// requestAnimationFrame(draw);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// draw(); // Appeler la fonction draw pour la première fois
|
|
||||||
|
|
||||||
// const canvas = document.getElementById('myCanvas');
|
|
||||||
// canvas.width = 500;
|
|
||||||
// canvas.height = 500;
|
|
||||||
// const ctx = canvas.getContext('2d');
|
|
||||||
// ctx.fillRect(50, 50, 1000, 1000);
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
import '../styles/old.css';
|
|
||||||
|
|
||||||
function Footer()
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
<footer>
|
|
||||||
<p>@apommier | apommier@student.42.fr</p>
|
|
||||||
</footer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Footer;
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
function Head()
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
<div>
|
|
||||||
<meta charSet="utf-8"></meta>
|
|
||||||
<link href="./css/header.css" rel="stylesheet"></link>
|
|
||||||
<title>BEST PONG EVER</title>
|
|
||||||
{/* <script src="./script/login.js"></script> */}
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com"></link>
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="true"></link>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Rubik+Iso&display=swap" rel="stylesheet"></link>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Head;
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
import '../styles/App.css';
|
|
||||||
import '../styles/old.css';
|
|
||||||
import logo from '../logo.svg';
|
|
||||||
|
|
||||||
|
|
||||||
import React, { useEffect, useState } from 'react';
|
|
||||||
import axios from 'axios';
|
|
||||||
// import setupLogin from '../script/login42';
|
|
||||||
// import React, { useEffect } from 'react';
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function Header()
|
|
||||||
{
|
|
||||||
return (
|
|
||||||
<div className="header">
|
|
||||||
<a href="http://localhost" className="box menu"> <p className="userTxt">Menu</p> </a>
|
|
||||||
<div className="box headerName">
|
|
||||||
{/* <a href="https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Flogin42&response_type=code" */}
|
|
||||||
<a className="center pong">PONG</a>
|
|
||||||
</div>
|
|
||||||
<a href="http://localhost/pong" className="box username">
|
|
||||||
<p className="userTxt">Play</p>
|
|
||||||
{/* <img className="pp center" src="../../public/logo192.png" alt="profile picture"> */}
|
|
||||||
<img src={logo} className="pp center" alt="logo" />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Header;
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
import '../styles/old.css';
|
|
||||||
import '../styles/field.css';
|
|
||||||
|
|
||||||
import { useLocation } from 'react-router-dom';
|
|
||||||
import api from '../script/axiosApi';
|
|
||||||
|
|
||||||
function Home()
|
|
||||||
{
|
|
||||||
const login2 = () => {
|
|
||||||
console.log('Hello from myFunction');
|
|
||||||
api.get('/profile').then((response) => {
|
|
||||||
const data = response;
|
|
||||||
const myJSON = JSON.stringify(response.data);
|
|
||||||
console.log(`data response= ${myJSON}`)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const location = useLocation();
|
|
||||||
|
|
||||||
const handleButtonClick = () => {
|
|
||||||
const token = localStorage.getItem('token')
|
|
||||||
console.log(`token type= ${typeof token}`);
|
|
||||||
if (token !== null && typeof token === 'string')
|
|
||||||
{
|
|
||||||
console.log(`already token= ${localStorage.getItem('token')}`)
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
// else
|
|
||||||
let path = "https://api.intra.42.fr/oauth/authorize?client_id=u-s4t2ud-6d29dfa49ba7146577ffd8bf595ae8d9e5aaa3e0a9615df18777171ebf836a41&redirect_uri=http%3A%2F%2Flocalhost%3A80%2Fapi%2Fauth%2Flogin&response_type=code";
|
|
||||||
window.location.replace(path);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="notClicked">
|
|
||||||
<button onClick={handleButtonClick} className="playButton" >LOGIN</button>
|
|
||||||
<div className ="loginForm">
|
|
||||||
<button className="submit" onClick={login2}>test button</button>
|
|
||||||
</div>
|
|
||||||
<div className ="loginForm">
|
|
||||||
<button className="submit" onClick={() => api.post('/win')}>add win</button>
|
|
||||||
</div>
|
|
||||||
<div className ="loginForm">
|
|
||||||
<button className="submit" onClick={() => api.post('/loss')}>add loss</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Home;
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
import '../styles/field.css';
|
|
||||||
// import { useHistory } from 'react-router-dom';
|
|
||||||
import { useNavigate } from "react-router-dom";
|
|
||||||
|
|
||||||
function PlayButton() {
|
|
||||||
|
|
||||||
const history = useNavigate();
|
|
||||||
|
|
||||||
const handleButtonClick = () => {
|
|
||||||
let path = `play`;
|
|
||||||
history(path);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="notClicked" id="canvas_container">
|
|
||||||
<button onClick={handleButtonClick} className="playButton">Play</button>
|
|
||||||
{/* !buttonClicked && <button onClick={handleButtonClick}>Draw on Canvas</button> */}
|
|
||||||
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default PlayButton;
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
import React, { useEffect } from 'react';
|
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
function MyComponent() {
|
|
||||||
useEffect(() => {
|
|
||||||
const api = axios.create({
|
|
||||||
baseURL: 'https://api.example.com',
|
|
||||||
withCredentials: true, // this is required to send cookies
|
|
||||||
headers: {
|
|
||||||
'X-Custom-Header': 'foobar', // you can also set other default headers
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const response = api.get('/some-endpoint').then((response) => {
|
|
||||||
console.log(response.data);
|
|
||||||
response.data.username
|
|
||||||
});
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return <div>My Component</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default MyComponent;
|
|
||||||
@ -1,514 +0,0 @@
|
|||||||
// import io from 'socket.io-client';
|
|
||||||
|
|
||||||
import api from '../script/axiosApi';
|
|
||||||
|
|
||||||
// import { useEffect } from 'react';
|
|
||||||
import io from 'socket.io-client';
|
|
||||||
// const socket = io('http://192.168.1.14:4000');
|
|
||||||
// const socket = io('http://86.209.110.20:4000');
|
|
||||||
// const socket = io('http://172.29.113.91:4000');
|
|
||||||
|
|
||||||
export function drawCanvas() {
|
|
||||||
const socket = io('http://localhost:4000');
|
|
||||||
// const socket = io()
|
|
||||||
console.log("start function");
|
|
||||||
const canvas = document.getElementById('myCanvas');
|
|
||||||
const ctx = canvas.getContext('2d');
|
|
||||||
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
// Var Declaration
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
|
|
||||||
//socket
|
|
||||||
let myId = 0;
|
|
||||||
let gameId = 0;
|
|
||||||
let opName;
|
|
||||||
let opRank;
|
|
||||||
|
|
||||||
//general canvas
|
|
||||||
const scale = window.devicePixelRatio;
|
|
||||||
canvas.width = canvas.offsetWidth;
|
|
||||||
canvas.height = canvas.offsetHeight;
|
|
||||||
|
|
||||||
//paddle var
|
|
||||||
let paddleWidth = canvas.width * 0.01;
|
|
||||||
let paddleHeight = canvas.height * 0.25;
|
|
||||||
let paddleY = canvas.height / 2 - (paddleHeight / 2);
|
|
||||||
let paddleX = canvas.width / 40;
|
|
||||||
let paddleSpeed = canvas.height / 40;
|
|
||||||
|
|
||||||
//opponent var
|
|
||||||
let oPaddleY = paddleY;
|
|
||||||
|
|
||||||
//mouse and touch
|
|
||||||
let lastMouseY = 0;
|
|
||||||
let lastTouchY = 0;
|
|
||||||
|
|
||||||
//ball var
|
|
||||||
let ballX = canvas.width / 2;
|
|
||||||
let ballY = canvas.height / 2;
|
|
||||||
|
|
||||||
//ball display
|
|
||||||
let ballRadius = canvas.width * 0.01;
|
|
||||||
let circleRadius = ballRadius * 3;
|
|
||||||
ctx.lineWidth = (canvas.width / 300);
|
|
||||||
|
|
||||||
//ball vector
|
|
||||||
let vX = 0;
|
|
||||||
let vY = 0;
|
|
||||||
|
|
||||||
//score
|
|
||||||
let myScore = 0;
|
|
||||||
let hisScore = 0;
|
|
||||||
const maxScore = 5;
|
|
||||||
|
|
||||||
let lastUpdateTime = performance.now();
|
|
||||||
|
|
||||||
const maxAngle = 50;
|
|
||||||
let maxBounceAngle = (maxAngle * Math.PI) / 180;
|
|
||||||
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
// Socket handler
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
|
|
||||||
function matchmaking()
|
|
||||||
{
|
|
||||||
console.log(`id ion matcj= ${myId}`)
|
|
||||||
const info = {
|
|
||||||
id: myId,
|
|
||||||
};
|
|
||||||
socket.emit('pong:matchmaking', info);
|
|
||||||
}
|
|
||||||
|
|
||||||
// socket.on('pong:gameId', (data) => {
|
|
||||||
// console.log("gameId received")
|
|
||||||
// gameId = data;
|
|
||||||
// // api.get('/profile');
|
|
||||||
|
|
||||||
// let myName;
|
|
||||||
|
|
||||||
// api.get('/profile').then((data) => {
|
|
||||||
// // Faire quelque chose avec les données
|
|
||||||
// console.log(data);
|
|
||||||
// myName = data.data.username;
|
|
||||||
// console.log(`myname= ${myName}`);
|
|
||||||
// }).catch((error) => {
|
|
||||||
// console.log(error);
|
|
||||||
// // exit() ;
|
|
||||||
// return;
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const info = {
|
|
||||||
// id: myId,
|
|
||||||
// name: myName,
|
|
||||||
// gameId: gameId,
|
|
||||||
// };
|
|
||||||
// console.log("emit to name")
|
|
||||||
// socket.emit('pong:name', info);
|
|
||||||
// });
|
|
||||||
|
|
||||||
socket.on('pong:gameId', async (data) => {
|
|
||||||
console.log("gameId received");
|
|
||||||
gameId = data;
|
|
||||||
|
|
||||||
try {
|
|
||||||
let response = await api.get('/profile');
|
|
||||||
const myName = response.data.username;
|
|
||||||
response = await api.get('/rank');
|
|
||||||
opRank = response.data
|
|
||||||
console.log(`rank= ${opRank}`);
|
|
||||||
console.log(`myname= ${myName}`);
|
|
||||||
|
|
||||||
const info = {
|
|
||||||
id: myId,
|
|
||||||
name: myName,
|
|
||||||
gameId: gameId,
|
|
||||||
rank: opRank,
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log("emit to name");
|
|
||||||
socket.emit('pong:name', info);
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
// Handle error here
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('pong:name', (data) => {
|
|
||||||
opName = data;
|
|
||||||
console.log(`opponent Name= ${opName}`)
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('connect', () => {
|
|
||||||
console.log('Connected to NestJS server');
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('pong:clientId', (data) => {
|
|
||||||
console.log("receive id")
|
|
||||||
myId = data;
|
|
||||||
console.log(`id is= ${myId}`)
|
|
||||||
});
|
|
||||||
|
|
||||||
socket.on('pong:info', (data) => {
|
|
||||||
oPaddleY = (data.paddleY / data.height) * canvas.height//canvas.height - data.ballY;
|
|
||||||
ballX = canvas.width - (data.ballX * (canvas.width / data.width));//- data.ballX;
|
|
||||||
ballY = ((data.ballY / data.height) * canvas.height)//canvas.height - data.ballY;
|
|
||||||
|
|
||||||
vX = -data.vX;
|
|
||||||
vY = data.vY;
|
|
||||||
});
|
|
||||||
|
|
||||||
function send_info()
|
|
||||||
{
|
|
||||||
if (gameId === 0)
|
|
||||||
return ;
|
|
||||||
const info = {
|
|
||||||
id: myId,
|
|
||||||
width: canvas.width,
|
|
||||||
height: canvas.height,
|
|
||||||
paddleY: paddleY,
|
|
||||||
vX: vX,
|
|
||||||
vY: vY,
|
|
||||||
ballX: ballX,
|
|
||||||
ballY: ballY,
|
|
||||||
gameId: gameId,
|
|
||||||
};
|
|
||||||
socket.emit('pong:message', info);
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.on('pong:paddle', (data) => {
|
|
||||||
console.log("paddle info receive")
|
|
||||||
oPaddleY = (data.paddleY / data.height) * canvas.height
|
|
||||||
});
|
|
||||||
|
|
||||||
function send_point()
|
|
||||||
{
|
|
||||||
if (gameId === 0)
|
|
||||||
return ;
|
|
||||||
console.log("send point");
|
|
||||||
const info = {
|
|
||||||
id: myId,
|
|
||||||
gameId: gameId,
|
|
||||||
point: hisScore,
|
|
||||||
}
|
|
||||||
socket.emit('pong:point', info);
|
|
||||||
}
|
|
||||||
|
|
||||||
socket.on('pong:point', (data) => {
|
|
||||||
// hisScore += 1;
|
|
||||||
console.log("gain point");
|
|
||||||
// if (vX != 0)
|
|
||||||
// {
|
|
||||||
// console.log("up point");
|
|
||||||
myScore = data.point;
|
|
||||||
// }
|
|
||||||
vX = 0;
|
|
||||||
vY = 0;
|
|
||||||
ballX = canvas.width / 2;
|
|
||||||
ballY = canvas.height / 2;
|
|
||||||
});
|
|
||||||
|
|
||||||
function send_paddle_info()
|
|
||||||
{
|
|
||||||
if (gameId === 0)
|
|
||||||
return ;
|
|
||||||
const info = {
|
|
||||||
id: myId,
|
|
||||||
paddleY: paddleY,
|
|
||||||
// width: canvas.width,
|
|
||||||
height: canvas.height,
|
|
||||||
gameId: gameId,
|
|
||||||
};
|
|
||||||
socket.emit('pong:paddle', info);
|
|
||||||
}
|
|
||||||
|
|
||||||
function send_forced_info()
|
|
||||||
{
|
|
||||||
if (gameId === 0)
|
|
||||||
return ;
|
|
||||||
const info = {
|
|
||||||
gameId: gameId,
|
|
||||||
width: canvas.width,
|
|
||||||
height: canvas.height,
|
|
||||||
id: myId,
|
|
||||||
paddleY: paddleY,
|
|
||||||
vX: vX,
|
|
||||||
vY: vY,
|
|
||||||
ballX: ballX,
|
|
||||||
ballY: ballY,
|
|
||||||
};
|
|
||||||
socket.emit('pong:forced', info);
|
|
||||||
}
|
|
||||||
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
// Drawer
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
|
|
||||||
function drawcenter()
|
|
||||||
{
|
|
||||||
// ctx.restore();
|
|
||||||
ctx.fillStyle = 'white';
|
|
||||||
ctx.fillRect(canvas.width / 2 - ctx.lineWidth / 2, 0, canvas.width / 300, canvas.height);
|
|
||||||
|
|
||||||
ctx.beginPath();
|
|
||||||
// ctx.lineWidth = 5;
|
|
||||||
ctx.arc(canvas.width / 2, canvas.height / 2, circleRadius, 0, 2 * Math.PI);
|
|
||||||
ctx.strokeStyle = 'white'; // couleur de dessin
|
|
||||||
ctx.stroke(); // dessin du contour
|
|
||||||
|
|
||||||
ctx.font = canvas.width * 0.1 + "px Arial";
|
|
||||||
ctx.textAlign = "center";
|
|
||||||
ctx.textBaseline = "middle";
|
|
||||||
ctx.fillText(myScore, canvas.width/4, canvas.height/8);
|
|
||||||
ctx.fillText(hisScore, canvas.width/1.25, canvas.height/8);
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawPaddle() {
|
|
||||||
ctx.fillStyle = 'white';
|
|
||||||
ctx.fillRect(paddleX, paddleY, paddleWidth, paddleHeight);
|
|
||||||
ctx.fillRect(canvas.width - paddleX - paddleWidth, oPaddleY, paddleWidth, paddleHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
function drawball()
|
|
||||||
{
|
|
||||||
ctx.beginPath();
|
|
||||||
ctx.arc(ballX, ballY, ballRadius, 0, 2 * Math.PI);
|
|
||||||
// ctx.lineWidth = 2;
|
|
||||||
ctx.fillStyle = 'red ';
|
|
||||||
ctx.fill();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
// Loop
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
|
|
||||||
matchmaking();
|
|
||||||
// while (!gameId)
|
|
||||||
// ;
|
|
||||||
|
|
||||||
|
|
||||||
function draw(timestamp)
|
|
||||||
{
|
|
||||||
if (gameId === 0 )
|
|
||||||
{
|
|
||||||
requestAnimationFrame(draw);
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
if (myScore === maxScore || hisScore === maxScore)
|
|
||||||
{
|
|
||||||
const data = {
|
|
||||||
myScore: myScore,
|
|
||||||
opScore: hisScore,
|
|
||||||
opName: opName,
|
|
||||||
opRank: opRank,
|
|
||||||
};
|
|
||||||
if (myScore === maxScore)
|
|
||||||
{
|
|
||||||
api.post('/win', data);
|
|
||||||
console.log("send win");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
api.post('/loss', data);
|
|
||||||
console.log("send loose");
|
|
||||||
}
|
|
||||||
window.location.replace("http://localhost/pong");
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
const deltaTime = timestamp - lastUpdateTime;
|
|
||||||
lastUpdateTime = timestamp;
|
|
||||||
ballX += vX * deltaTime * canvas.width;
|
|
||||||
ballY += vY * deltaTime * canvas.width;
|
|
||||||
|
|
||||||
ctx.clearRect(0, 0, canvas.width, canvas.height);
|
|
||||||
drawPaddle();
|
|
||||||
drawcenter();
|
|
||||||
drawball();
|
|
||||||
is_collision();
|
|
||||||
is_out();
|
|
||||||
requestAnimationFrame(draw);
|
|
||||||
}
|
|
||||||
requestAnimationFrame(draw);
|
|
||||||
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
// Logical Part
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
|
|
||||||
function updateVector()
|
|
||||||
{
|
|
||||||
const relativeBallY = ballY - (paddleY + paddleHeight / 2);
|
|
||||||
const normalizedRelativeBallY = relativeBallY / (paddleHeight / 2);
|
|
||||||
const bounceAngle = normalizedRelativeBallY * maxBounceAngle;
|
|
||||||
|
|
||||||
vY = vX * Math.sin(-bounceAngle);
|
|
||||||
if (vX < 0)
|
|
||||||
vX = -vX;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function updatePaddlePosition(newY)
|
|
||||||
{
|
|
||||||
if (newY >= 0 && newY <= canvas.height - paddleHeight)
|
|
||||||
paddleY = newY;
|
|
||||||
}
|
|
||||||
|
|
||||||
function is_collision()
|
|
||||||
{
|
|
||||||
if (ballX <= paddleX + paddleWidth + ballRadius)
|
|
||||||
{
|
|
||||||
if (ballY <= paddleY + paddleHeight + ballRadius && ballY >= paddleY - ballRadius)//touch paddle
|
|
||||||
{
|
|
||||||
if (ballX + ballRadius > paddleX && ballX - ballRadius < paddleX + paddleWidth)
|
|
||||||
{
|
|
||||||
console.log("hehe here")
|
|
||||||
ballX = paddleX + paddleWidth + ballRadius;
|
|
||||||
}
|
|
||||||
updateVector();
|
|
||||||
}
|
|
||||||
send_info();
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
if (ballY - ballRadius - 2 <= 0 || ballY + ballRadius + 2 >= canvas.height) //touch up or down wall
|
|
||||||
{
|
|
||||||
vY = -vY;
|
|
||||||
// send_info();
|
|
||||||
}
|
|
||||||
else if (ballX + ballRadius + 2 >= canvas.width) //touch right wall
|
|
||||||
{
|
|
||||||
vX = -vX;
|
|
||||||
// send_info();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function is_out()
|
|
||||||
{
|
|
||||||
if (ballX < 0)
|
|
||||||
{
|
|
||||||
if (ballY <= paddleY + paddleHeight + ballRadius && ballY >= paddleY - ballRadius)
|
|
||||||
{
|
|
||||||
console.log('true hehe');
|
|
||||||
ballX = paddleX + paddleWidth + ballRadius;
|
|
||||||
updateVector();
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
ballX = canvas.width / 2;
|
|
||||||
ballY = canvas.height / 2;
|
|
||||||
vX = 0;
|
|
||||||
vY = 0;
|
|
||||||
hisScore += 1;
|
|
||||||
send_point();
|
|
||||||
// send_forced_info();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
// Listener
|
|
||||||
//========================================================================================================
|
|
||||||
//========================================================================================================
|
|
||||||
|
|
||||||
|
|
||||||
document.addEventListener('mousemove', event => {
|
|
||||||
const mouseY = event.clientY;
|
|
||||||
|
|
||||||
if (!lastMouseY)
|
|
||||||
{
|
|
||||||
lastMouseY = mouseY;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const newY = mouseY > lastMouseY ? paddleY - (lastMouseY - mouseY) : paddleY + (mouseY - lastMouseY);
|
|
||||||
updatePaddlePosition(newY);
|
|
||||||
lastMouseY = mouseY;
|
|
||||||
send_paddle_info();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener("touchmove", event => {
|
|
||||||
const touchY = event.touches[0].pageY;
|
|
||||||
|
|
||||||
// if (!lastTouchY)
|
|
||||||
// {
|
|
||||||
// vX = -0.01;
|
|
||||||
// lastTouchY = touchY;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
const newY = touchY > lastTouchY ? paddleY - (lastTouchY - touchY) : paddleY + (touchY - lastTouchY);
|
|
||||||
updatePaddlePosition(newY);
|
|
||||||
lastTouchY = touchY;
|
|
||||||
send_paddle_info();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener("keydown", event => {
|
|
||||||
// console.log(event.code);
|
|
||||||
if (event.code === "ArrowUp")
|
|
||||||
{
|
|
||||||
if ((paddleY - paddleSpeed) > 0)
|
|
||||||
paddleY -= paddleSpeed; // déplacer la raquette vers le haut
|
|
||||||
send_paddle_info();
|
|
||||||
}
|
|
||||||
else if (event.code === "ArrowDown")
|
|
||||||
{
|
|
||||||
if (paddleY + paddleSpeed < canvas.height - paddleHeight)
|
|
||||||
paddleY += paddleSpeed; // déplacer la raquette vers le bas
|
|
||||||
send_paddle_info();
|
|
||||||
}
|
|
||||||
else if (event.code === "Space")//space
|
|
||||||
{
|
|
||||||
console.log('vx change to -1');
|
|
||||||
vX = -0.0001;
|
|
||||||
|
|
||||||
// ballSpeed = 0.0001;
|
|
||||||
vY = 0;
|
|
||||||
send_forced_info();
|
|
||||||
// vX = 0.0001;
|
|
||||||
}
|
|
||||||
else if (event.code === "KeyE")
|
|
||||||
{
|
|
||||||
// console.log('vx change to -1');
|
|
||||||
vX = 0;
|
|
||||||
vY = 0;
|
|
||||||
ballX = canvas.width / 2;
|
|
||||||
ballY = canvas.height / 2;
|
|
||||||
send_forced_info();
|
|
||||||
}
|
|
||||||
else if (event.code === "KeyQ" )
|
|
||||||
{
|
|
||||||
if (vX < 0.003 * canvas.width && vX > -0.003 * canvas.width)
|
|
||||||
{
|
|
||||||
if (vX > 0)
|
|
||||||
vX += 0.0001;
|
|
||||||
else
|
|
||||||
vX -= 0.0001;
|
|
||||||
}
|
|
||||||
send_forced_info();
|
|
||||||
// console.log(`vx = ${vX}`);
|
|
||||||
}
|
|
||||||
else if (event.code === "KeyR")
|
|
||||||
{
|
|
||||||
paddleY = 0;
|
|
||||||
paddleHeight = canvas.height;
|
|
||||||
setTimeout(() => {
|
|
||||||
// code à exécuter après 5 secondes
|
|
||||||
paddleHeight = canvas.height * 0.25;
|
|
||||||
paddleY = canvas.height / 2 - paddleHeight / 2;
|
|
||||||
console.log('Cinq secondes se sont écoulées.');
|
|
||||||
}, 5000);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
import React from 'react';
|
|
||||||
import ReactDOM from 'react-dom/client';
|
|
||||||
|
|
||||||
import './styles/index.css';
|
|
||||||
import App from './components/App';
|
|
||||||
import Header from './components/Header';
|
|
||||||
// import Home from './components/Home';
|
|
||||||
// import Login42 from './components/Login42';
|
|
||||||
import Head from './components/Head';
|
|
||||||
// import Field from './components/Field';
|
|
||||||
// import PlayButton from './components/PlayButton';
|
|
||||||
import reportWebVitals from './reportWebVitals';
|
|
||||||
// import SuccessToken from './script/tokenSuccess'
|
|
||||||
import { BrowserRouter, Route, Routes, Navigate} from 'react-router-dom'
|
|
||||||
|
|
||||||
// let redirectToUrl;
|
|
||||||
// if (localStorage.getItem('token') !== null) //check condition
|
|
||||||
// {
|
|
||||||
// redirectToUrl = <Navigate to='/'/>;
|
|
||||||
// }
|
|
||||||
|
|
||||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
|
||||||
root.render(
|
|
||||||
<>
|
|
||||||
<Head />
|
|
||||||
<Header />
|
|
||||||
<BrowserRouter>
|
|
||||||
<App></App>
|
|
||||||
</BrowserRouter>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
|
|
||||||
// If you want to start measuring performance in your app, pass a function
|
|
||||||
// to log results (for example: reportWebVitals(console.log))
|
|
||||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
||||||
reportWebVitals();
|
|
||||||
|
|
||||||
{/* <Route exact path="/login42" element={<Login42 />}/> */}
|
|
||||||
// <Routes>
|
|
||||||
// {/* {redirectToUrl} */}
|
|
||||||
// <Route exact path="/" element={<Home/>}/>
|
|
||||||
// <Route exact path="/pong" element={<PlayButton />}/>
|
|
||||||
// <Route exact path="/pong/play" element={<Field />}/>
|
|
||||||
// <Route exact path="/token" element={<SuccessToken />}/>
|
|
||||||
|
|
||||||
// <Route path='*' element={<Navigate to='/' />} />
|
|
||||||
|
|
||||||
// {/* <Route path="*"><Navigate to="/" /></Route>
|
|
||||||
// */}
|
|
||||||
|
|
||||||
// {/* Gestion des pages inexistantes */}
|
|
||||||
|
|
||||||
// {/* ------- ROUTE FOR CHAT APP HERE --------- */}
|
|
||||||
// {/* <Route exact path="/chat" element={<NOM DU COMPONENT == index dans le tuto/>}/> */}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// </Routes>
|
|
||||||
@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.6 KiB |
@ -1,13 +0,0 @@
|
|||||||
const reportWebVitals = onPerfEntry => {
|
|
||||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
||||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
||||||
getCLS(onPerfEntry);
|
|
||||||
getFID(onPerfEntry);
|
|
||||||
getFCP(onPerfEntry);
|
|
||||||
getLCP(onPerfEntry);
|
|
||||||
getTTFB(onPerfEntry);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default reportWebVitals;
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
// console.log(`toktoken= ${token}`)
|
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
// const token = localStorage.getItem('token');
|
|
||||||
|
|
||||||
|
|
||||||
function getToken() {
|
|
||||||
// your code to retrieve the token from localStorage or any other source
|
|
||||||
const token = localStorage.getItem('token');
|
|
||||||
if (typeof token === 'string') {
|
|
||||||
console.log("is a string !!!")
|
|
||||||
}
|
|
||||||
return token;
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`getToken = ${getToken()}`)
|
|
||||||
console.log(`Bearer ${localStorage.getItem("token")}`)
|
|
||||||
|
|
||||||
let api = axios.create({
|
|
||||||
baseURL: 'http://localhost/api',
|
|
||||||
headers: {
|
|
||||||
// Authorization: `Bearer ${getToken()}`,
|
|
||||||
Authorization : `Bearer ${localStorage.getItem("token")}`
|
|
||||||
},
|
|
||||||
withCredentials: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
export default api;
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
import { useLocation } from 'react-router-dom';
|
|
||||||
import queryString from 'query-string';
|
|
||||||
|
|
||||||
function SuccessToken() {
|
|
||||||
const location = useLocation();
|
|
||||||
const { data } = queryString.parse(location.search);
|
|
||||||
// localStorage data.token;
|
|
||||||
const cleanData = data.slice(1, -1);
|
|
||||||
// console.log(`prout token= ${cleanData}`)
|
|
||||||
localStorage.setItem('token', `${cleanData}`);
|
|
||||||
console.log(`prout token2= ${localStorage.getItem('token')}`)
|
|
||||||
window.location.replace("http://localhost/pong");
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <div>
|
|
||||||
// <h2>Success!</h2>
|
|
||||||
// <p>Data: {data}</p>
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
}
|
|
||||||
|
|
||||||
export default SuccessToken;
|
|
||||||
|
|
||||||
|
|
||||||
// // Store a value in localStorage
|
|
||||||
// localStorage.setItem('key', 'value');
|
|
||||||
|
|
||||||
// // Retrieve a value from localStorage
|
|
||||||
// const value = localStorage.getItem('key');
|
|
||||||
|
|
||||||
// // Remove a value from localStorage
|
|
||||||
// localStorage.removeItem('key');
|
|
||||||
|
|
||||||
// // Clear all values from localStorage
|
|
||||||
// localStorage.clear();
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
.App {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.App-logo {
|
|
||||||
height: 40vmin;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-reduced-motion: no-preference) {
|
|
||||||
.App-logo {
|
|
||||||
animation: App-logo-spin infinite 20s linear;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.App-header {
|
|
||||||
background-color: #1f1919;
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: calc(10px + 2vmin);
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.App-link {
|
|
||||||
color: #61dafb;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes App-logo-spin {
|
|
||||||
from {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,155 +0,0 @@
|
|||||||
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100;200;300;400;500;600;700;800;900&display=swap');
|
|
||||||
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
font-family: 'Poppins', sans-serif;
|
|
||||||
}
|
|
||||||
.home__container {
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.home__container > * {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.home__header {
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
.username__input {
|
|
||||||
padding: 10px;
|
|
||||||
width: 50%;
|
|
||||||
}
|
|
||||||
.home__cta {
|
|
||||||
width: 200px;
|
|
||||||
padding: 10px;
|
|
||||||
font-size: 16px;
|
|
||||||
cursor: pointer;
|
|
||||||
background-color: #607eaa;
|
|
||||||
color: #f9f5eb;
|
|
||||||
outline: none;
|
|
||||||
border: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
.chat {
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.chat__sidebar {
|
|
||||||
height: 100%;
|
|
||||||
background-color: #f9f5eb;
|
|
||||||
flex: 0.2;
|
|
||||||
padding: 20px;
|
|
||||||
border-right: 1px solid #fdfdfd;
|
|
||||||
}
|
|
||||||
.chat__main {
|
|
||||||
height: 100%;
|
|
||||||
flex: 0.8;
|
|
||||||
}
|
|
||||||
.chat__header {
|
|
||||||
margin: 30px 0 20px 0;
|
|
||||||
}
|
|
||||||
.chat__users > * {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
color: #607eaa;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
.online__users > * {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
color: rgb(238, 102, 102);
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
.chat__mainHeader {
|
|
||||||
width: 100%;
|
|
||||||
height: 10vh;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 20px;
|
|
||||||
background-color: #f9f5eb;
|
|
||||||
}
|
|
||||||
.leaveChat__btn {
|
|
||||||
padding: 10px;
|
|
||||||
width: 150px;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
background-color: #d1512d;
|
|
||||||
cursor: pointer;
|
|
||||||
color: #eae3d2;
|
|
||||||
}
|
|
||||||
.message__container {
|
|
||||||
width: 100%;
|
|
||||||
height: 80vh;
|
|
||||||
background-color: #fff;
|
|
||||||
padding: 20px;
|
|
||||||
overflow-y: scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message__container > * {
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.chat__footer {
|
|
||||||
padding: 10px;
|
|
||||||
background-color: #f9f5eb;
|
|
||||||
height: 10vh;
|
|
||||||
}
|
|
||||||
.form {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
.message {
|
|
||||||
width: 80%;
|
|
||||||
height: 100%;
|
|
||||||
border-radius: 10px;
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
outline: none;
|
|
||||||
padding: 15px;
|
|
||||||
}
|
|
||||||
.sendBtn {
|
|
||||||
width: 150px;
|
|
||||||
background-color: green;
|
|
||||||
padding: 10px;
|
|
||||||
border: none;
|
|
||||||
outline: none;
|
|
||||||
color: #eae3d2;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.sendBtn:hover {
|
|
||||||
background-color: rgb(129, 201, 129);
|
|
||||||
}
|
|
||||||
.message__recipient {
|
|
||||||
background-color: #f5ccc2;
|
|
||||||
width: 300px;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
.message__sender {
|
|
||||||
background-color: rgb(194, 243, 194);
|
|
||||||
max-width: 300px;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 10px;
|
|
||||||
margin-left: auto;
|
|
||||||
font-size: 15px;
|
|
||||||
}
|
|
||||||
.message__chats > p {
|
|
||||||
font-size: 13px;
|
|
||||||
}
|
|
||||||
.sender__name {
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.message__status {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 50px;
|
|
||||||
font-size: 13px;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
.playButton {
|
|
||||||
background-color: rgb(0, 0, 0);
|
|
||||||
border-radius: 5vh;
|
|
||||||
color: white;
|
|
||||||
display: block;
|
|
||||||
margin: auto;
|
|
||||||
margin-top: 30vh;
|
|
||||||
padding: 2vh 5vw;
|
|
||||||
height: 10vh;
|
|
||||||
width: 20vw;
|
|
||||||
font-size: 300%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.clicked{
|
|
||||||
/* justify-content: center; */
|
|
||||||
/* display: flex;
|
|
||||||
justify-content: center; */
|
|
||||||
background-color: rgb(0, 0, 0);
|
|
||||||
width: 70vw;
|
|
||||||
/* height: 70vh; */
|
|
||||||
margin:auto;
|
|
||||||
margin-right: 15vw;
|
|
||||||
margin-left: 15vw;
|
|
||||||
margin-top: 10vh;
|
|
||||||
position: relative;
|
|
||||||
padding-top: 35%;
|
|
||||||
/* padding-top: 25; */
|
|
||||||
/* padding-top: 177.77% */
|
|
||||||
}
|
|
||||||
|
|
||||||
#myCanvas {
|
|
||||||
background-color: rgb(75, 33, 33);
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
cursor: none;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
|
||||||
#canvas_container {
|
|
||||||
transform: rotate(90deg);
|
|
||||||
transform-origin: top right;
|
|
||||||
position: relative;
|
|
||||||
/* margin-right: 100vw; */
|
|
||||||
/* height: 100vw; */
|
|
||||||
width: 100vh;
|
|
||||||
}
|
|
||||||
/* #myCanvas {
|
|
||||||
height: 100%;
|
|
||||||
width: 100%;
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
||||||
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
||||||
sans-serif;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
code {
|
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
|
||||||
monospace;
|
|
||||||
}
|
|
||||||
@ -1,165 +0,0 @@
|
|||||||
body {
|
|
||||||
/* display: flex; */
|
|
||||||
margin: 0%;
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
background-color: rgb(71, 71, 71);
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
footer {
|
|
||||||
text-align: center;
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
background-color: rgb(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
.pp {
|
|
||||||
height: 7vw;
|
|
||||||
width: 7vw;
|
|
||||||
max-height: 7vh;
|
|
||||||
max-width: 7vh;
|
|
||||||
/* max-width: ; */
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 5px solid rgb(255, 255, 255);
|
|
||||||
}
|
|
||||||
|
|
||||||
.loginHere{
|
|
||||||
font-size: 5vh;
|
|
||||||
font-family: 'Rubik Iso';
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 10vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
::placeholder {
|
|
||||||
font-size: 3vh;
|
|
||||||
text-align: center;
|
|
||||||
align-items: center;
|
|
||||||
margin:auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submit{
|
|
||||||
height: 5vh;
|
|
||||||
border-radius: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.submit:hover {
|
|
||||||
background-color: blueviolet;
|
|
||||||
}
|
|
||||||
|
|
||||||
input{
|
|
||||||
height: 5vh;
|
|
||||||
border-radius: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pp:hover {
|
|
||||||
border: 5px solid rgb(100, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
.userTxt:hover {
|
|
||||||
color:blueviolet;;
|
|
||||||
}
|
|
||||||
|
|
||||||
.userTxt {
|
|
||||||
margin-right: 5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.username {
|
|
||||||
/* justify-content: center; */
|
|
||||||
margin-right: 1vw;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 2vw;
|
|
||||||
max-width: 33%;
|
|
||||||
color: aqua;
|
|
||||||
justify-content: right;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* .loginButton {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
text-decoration: none;
|
|
||||||
background-color: black;
|
|
||||||
color: white;
|
|
||||||
border-radius: ;
|
|
||||||
padding: 10px 20px;
|
|
||||||
margin-left: 40vw;
|
|
||||||
margin-top: 40vh;
|
|
||||||
width: 20vw;
|
|
||||||
height: 10vh;
|
|
||||||
font-size: 5vh;
|
|
||||||
} */
|
|
||||||
|
|
||||||
.loginButton {
|
|
||||||
background-color: rgb(0, 0, 0);
|
|
||||||
border-radius: 5vh;
|
|
||||||
color: white;
|
|
||||||
display: block;
|
|
||||||
margin: auto;
|
|
||||||
margin-top: 30vh;
|
|
||||||
padding: 2vh 5vw;
|
|
||||||
height: 10vh;
|
|
||||||
width: 20vw;
|
|
||||||
font-size: 300%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* .loginButton {
|
|
||||||
border-radius: 100vh;
|
|
||||||
max-height: 10vh;
|
|
||||||
background-color: black;
|
|
||||||
font-family: 'Rubik Iso';
|
|
||||||
font-size: 5vh;
|
|
||||||
align-items: center;
|
|
||||||
height: 50vh;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-around;
|
|
||||||
} */
|
|
||||||
|
|
||||||
|
|
||||||
.menu {
|
|
||||||
margin-left: 2vw;
|
|
||||||
color: aqua;
|
|
||||||
/* font-size: 4vh; */
|
|
||||||
font-size: 2vw;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pong{
|
|
||||||
font-family:'Rubik Iso';
|
|
||||||
}
|
|
||||||
|
|
||||||
.box {
|
|
||||||
width: 33%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.center {
|
|
||||||
align-self: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headerName {
|
|
||||||
display:flex;
|
|
||||||
max-width: 33%;
|
|
||||||
height: 100%;
|
|
||||||
/* font-size: 50px; */
|
|
||||||
color:blueviolet;
|
|
||||||
/* font-size: 10vw; */
|
|
||||||
font-size: min(10vw, 10vh);
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header {
|
|
||||||
display: flex;
|
|
||||||
margin: 0;
|
|
||||||
height: 10vw;
|
|
||||||
max-height: 10vh;
|
|
||||||
align-items: center;
|
|
||||||
background-color: rgb(0, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color:blueviolet
|
|
||||||
}
|
|
||||||
@ -28,7 +28,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||||
<div id="root"></div>
|
<div id="root" style=" height: 100%;"></div>
|
||||||
<!--
|
<!--
|
||||||
This HTML file is a template.
|
This HTML file is a template.
|
||||||
If you open it directly in the browser, you will see an empty page.
|
If you open it directly in the browser, you will see an empty page.
|
||||||
|
|||||||
@ -36,8 +36,8 @@ function Chat(){
|
|||||||
</TouchDiv>
|
</TouchDiv>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Conversation/>
|
{/* <Conversation/> */}
|
||||||
<Input/>
|
{/* <Input/> */}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,15 @@
|
|||||||
import React from "react";
|
import React, { useState, useEffect, useRef } from "react";
|
||||||
import '../../styles/Messages.css'
|
import '../../styles/Messages.css'
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
import DefaultPic from '../../assets/profile.jpg'
|
import DefaultPic from '../../assets/profile.jpg'
|
||||||
|
import api from '../../script/axiosApi';
|
||||||
|
|
||||||
|
import io from 'socket.io-client';
|
||||||
|
import { TbSend } from 'react-icons/tb';
|
||||||
|
import MessageYou from "./MessageYou"
|
||||||
|
import Message from "./Message"
|
||||||
|
import Input from "./Input";
|
||||||
|
|
||||||
|
|
||||||
const UserChat = styled.div `
|
const UserChat = styled.div `
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
@ -16,10 +24,10 @@ const UserChat = styled.div `
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
const SideSpan = styled.span`
|
// const SideSpan = styled.span`
|
||||||
font-size: 18px;
|
// font-size: 18px;
|
||||||
font-weight: 500;
|
// font-weight: 500;
|
||||||
`
|
// `
|
||||||
|
|
||||||
const SideP = styled.p`
|
const SideP = styled.p`
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
@ -27,37 +35,191 @@ const SideP = styled.p`
|
|||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
// Socket handler
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
// Logical part
|
||||||
|
//========================================================================================================
|
||||||
|
//========================================================================================================
|
||||||
|
|
||||||
|
|
||||||
function Chats(){
|
function Chats(){
|
||||||
|
|
||||||
|
const [conversations, setConversation] = useState([]);
|
||||||
|
const [user, setUser] = useState(null);
|
||||||
|
const [currentChat, setCurrentChat] = useState(null);
|
||||||
|
const [messages, setMessage] = useState([]);
|
||||||
|
const [newMessages, setNewMessage] = useState("");
|
||||||
|
const [incomingMessage, setIncomingMessage] = useState("");
|
||||||
|
const socket = useRef();
|
||||||
|
|
||||||
|
// Socket handler
|
||||||
|
|
||||||
|
// socket.on('message', (data) => { //data should be a message ?
|
||||||
|
// console.log(`message received data= ${data}`)
|
||||||
|
// setMessage([...messages, data]);
|
||||||
|
// });
|
||||||
|
|
||||||
|
//End of socket handler
|
||||||
|
|
||||||
|
useEffect(()=> {
|
||||||
|
|
||||||
|
const getConv = async ()=>{
|
||||||
|
try{
|
||||||
|
const convs = await api.get("/conv")
|
||||||
|
const tmpUser = await api.get("/profile")
|
||||||
|
console.log(convs);
|
||||||
|
setUser(tmpUser);
|
||||||
|
setConversation(convs.data);
|
||||||
|
// return tmpUser;
|
||||||
|
|
||||||
|
|
||||||
|
console.log(`tmpUser= ${tmpUser.data}`);
|
||||||
|
socket.current = io("http://localhost:4001");
|
||||||
|
console.log(`connection....`);
|
||||||
|
socket.current.emit('connection', {username: tmpUser.data.username})
|
||||||
|
// const socket = io("http://localhost:4001", {
|
||||||
|
// query: {
|
||||||
|
// username: user.data.username,
|
||||||
|
// },});
|
||||||
|
socket.current.on('message', (data) => { //data should be a message ?
|
||||||
|
console.log(`message received data= ${data.sender}`)
|
||||||
|
console.log(`message received data= ${data.convId}`)
|
||||||
|
console.log(`message received data= ${data.sender}`)
|
||||||
|
console.log(`curretn chat = ${currentChat}`)
|
||||||
|
setIncomingMessage(data);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
catch(err){
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
getConv();
|
||||||
|
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(()=> {
|
||||||
|
if (currentChat)
|
||||||
|
console.log(currentChat.id)
|
||||||
|
// console.log(`result1 = ${currentChat.id !== incomingMessage.convId}`)
|
||||||
|
if (currentChat !== null && currentChat.id === incomingMessage.convId)
|
||||||
|
setMessage((prev) => [...prev, incomingMessage]);
|
||||||
|
}, [incomingMessage, currentChat])
|
||||||
|
|
||||||
|
// useEffect(()=> {
|
||||||
|
|
||||||
|
// const getConv = async ()=>{
|
||||||
|
// try{
|
||||||
|
// const convs = await api.get("/conv")
|
||||||
|
// const tmpUser = await api.get("/profile")
|
||||||
|
// console.log(convs);
|
||||||
|
// setUser(tmpUser);
|
||||||
|
// setConversation(convs.data);
|
||||||
|
// }
|
||||||
|
// catch(err){
|
||||||
|
// console.log(err);
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// getConv();
|
||||||
|
// }, [])
|
||||||
|
|
||||||
|
useEffect(()=> {
|
||||||
|
const getMessage = async ()=>
|
||||||
|
{
|
||||||
|
const data = {
|
||||||
|
convId: currentChat.id
|
||||||
|
};
|
||||||
|
try{
|
||||||
|
const res = await api.post('/getMessage', data);
|
||||||
|
setMessage(res.data);
|
||||||
|
} catch(err){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getMessage()
|
||||||
|
}, [currentChat])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const handleSubmit = async (e)=>{
|
||||||
|
e.preventDefault();
|
||||||
|
const message = {
|
||||||
|
sender: user.data.username,
|
||||||
|
text: newMessages,
|
||||||
|
convId: currentChat.id,
|
||||||
|
members: null
|
||||||
|
};
|
||||||
|
try{
|
||||||
|
console.log(`id= ${currentChat.id}`)
|
||||||
|
const res = await api.post('/message', message);
|
||||||
|
const convMember = await api.post('/member', message);
|
||||||
|
message.members = convMember.data.members;
|
||||||
|
console.log(convMember);
|
||||||
|
// console.log(`currentChat= ${currentChat.id}`)
|
||||||
|
|
||||||
|
setMessage([...messages, res.data]);
|
||||||
|
setNewMessage("");
|
||||||
|
socket.current.emit('sendMessage', message);
|
||||||
|
}
|
||||||
|
catch(err){
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="chat">
|
<div className="chat">
|
||||||
|
{conversations.map(c=> (
|
||||||
|
<div onClick={() => setCurrentChat(c)}>
|
||||||
<UserChat>
|
<UserChat>
|
||||||
<img className="pic-user" src={DefaultPic} alt="User" />
|
<img className="pic-user" src={DefaultPic} alt="User" />
|
||||||
<div className="infoSideBar">
|
<div className="infoSideBar">
|
||||||
<SideSpan>Dummy</SideSpan>
|
<span>{c.name}</span>
|
||||||
<SideP>yo</SideP>
|
<SideP>Desc?</SideP>
|
||||||
</div>
|
</div>
|
||||||
</UserChat>
|
</UserChat>
|
||||||
<UserChat>
|
|
||||||
<img className="pic-user" src={DefaultPic} alt="User" />
|
|
||||||
<div className="infoSideBar">
|
|
||||||
<SideSpan>Dummy</SideSpan>
|
|
||||||
<SideP>yo</SideP>
|
|
||||||
</div>
|
</div>
|
||||||
</UserChat><UserChat>
|
))}
|
||||||
<img className="pic-user" src={DefaultPic} alt="User" />
|
|
||||||
<div className="infoSideBar">
|
{
|
||||||
<SideSpan>Dummy</SideSpan>
|
currentChat ? (
|
||||||
<SideP>yo</SideP>
|
<>
|
||||||
|
<div className="messages">
|
||||||
|
{messages.map(m=>(
|
||||||
|
<Message message = {m} own={m.sender === user.data.username}/>
|
||||||
|
))}
|
||||||
|
{/* <Input/> */}
|
||||||
|
<div className="input">
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
placeholder="What do you want to say"
|
||||||
|
onChange={(e) => setNewMessage(e.target.value)}
|
||||||
|
value={newMessages}
|
||||||
|
/>
|
||||||
|
<div className="send">
|
||||||
|
<TbSend onClick={handleSubmit}></TbSend>
|
||||||
</div>
|
</div>
|
||||||
</UserChat><UserChat>
|
|
||||||
<img className="pic-user" src={DefaultPic} alt="User" />
|
|
||||||
<div className="infoSideBar">
|
|
||||||
<SideSpan>Dummy</SideSpan>
|
|
||||||
<SideP>yo</SideP>
|
|
||||||
</div>
|
</div>
|
||||||
</UserChat>
|
</div></>) : (<span className="noConv">Open a conversation</span>)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Chats
|
export default Chats
|
||||||
@ -1,17 +1,22 @@
|
|||||||
import MessageYou from "./MessageYou"
|
import MessageYou from "./MessageYou"
|
||||||
import MessageMe from "./MessageMe"
|
import MessageMe from "./MessageMe"
|
||||||
// import { useRef } from "react";
|
// import { useRef } from "react";
|
||||||
// import { useEffect } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import '../../styles/Messages.css'
|
import '../../styles/Messages.css'
|
||||||
|
import Input from "./Input";
|
||||||
|
|
||||||
function Conversation(){
|
function Conversation(){
|
||||||
// const scrollRef = useRef();
|
|
||||||
|
|
||||||
// useEffect(() => {
|
const [currentChat, setCurrentChat] = useState(null);
|
||||||
// scrollRef.current?.scrollIntoView({ behavior: "smooth"})
|
const [message, setMessage] = useState([]);
|
||||||
// }, [])
|
|
||||||
|
// setCurrentChat(true)
|
||||||
return (
|
return (
|
||||||
<div className="messages">
|
<div className="messages">
|
||||||
|
{
|
||||||
|
currentChat ? (
|
||||||
|
<>
|
||||||
|
<div>
|
||||||
<MessageYou/>
|
<MessageYou/>
|
||||||
<MessageMe/>
|
<MessageMe/>
|
||||||
<MessageYou/>
|
<MessageYou/>
|
||||||
@ -33,7 +38,10 @@ function Conversation(){
|
|||||||
<MessageMe/>
|
<MessageMe/>
|
||||||
<MessageYou/>
|
<MessageYou/>
|
||||||
<MessageMe/>
|
<MessageMe/>
|
||||||
|
<Input/>
|
||||||
|
</div></>) : (<span className="noConv">Open a conversation</span>)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
47
containers/react/src/components/Messages/Message.jsx
Normal file
47
containers/react/src/components/Messages/Message.jsx
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* Message.jsx :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: apommier <apommier@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2023/06/01 18:24:46 by apommier #+# #+# */
|
||||||
|
/* Updated: 2023/06/01 18:33:43 by apommier ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
import React from "react"
|
||||||
|
import styled from "styled-components"
|
||||||
|
import DefaultPic from '../../assets/profile.jpg'
|
||||||
|
import { useRef } from "react";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import '../../styles/Messages.css'
|
||||||
|
|
||||||
|
const MeStyleP = styled.p`
|
||||||
|
background-color: lightgray;
|
||||||
|
padding 10px 20px;
|
||||||
|
border-radius 10px 0px 10px 10px;
|
||||||
|
color: black;
|
||||||
|
margin-right: 20px;
|
||||||
|
`
|
||||||
|
|
||||||
|
function MessageMe({message, own}){
|
||||||
|
const scrollRef = useRef();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
scrollRef.current?.scrollIntoView({ behavior: "smooth"})
|
||||||
|
}, [])
|
||||||
|
return (
|
||||||
|
<div className={own ? "meMessage" : "youMessage"} ref={scrollRef}>
|
||||||
|
<div>
|
||||||
|
<img className="messageInfo" src={DefaultPic} alt="profile" />
|
||||||
|
</div>
|
||||||
|
<div className="usernameMesage">{message.sender}</div>
|
||||||
|
<div className="messageContent">
|
||||||
|
<MeStyleP>{message.text}</MeStyleP>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MessageMe
|
||||||
@ -12,7 +12,7 @@ import './styles/App.css'
|
|||||||
|
|
||||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||||
root.render(
|
root.render(
|
||||||
<div className='App'>
|
<div className="App">
|
||||||
<Head />
|
<Head />
|
||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Header />
|
<Header />
|
||||||
|
|||||||
@ -30,6 +30,7 @@ export function drawCanvas() {
|
|||||||
//general canvas
|
//general canvas
|
||||||
const scale = window.devicePixelRatio;
|
const scale = window.devicePixelRatio;
|
||||||
canvas.width = canvas.offsetWidth;
|
canvas.width = canvas.offsetWidth;
|
||||||
|
// canvas.height = canvas.width * 0.7
|
||||||
canvas.height = canvas.offsetHeight;
|
canvas.height = canvas.offsetHeight;
|
||||||
|
|
||||||
//paddle var
|
//paddle var
|
||||||
@ -423,6 +424,12 @@ requestAnimationFrame(draw);
|
|||||||
//========================================================================================================
|
//========================================================================================================
|
||||||
//========================================================================================================
|
//========================================================================================================
|
||||||
|
|
||||||
|
document.addEventListener('resize', event => {
|
||||||
|
// event.height
|
||||||
|
// event.width
|
||||||
|
const { clientWidth, clientHeight } = canvas.parentElement;
|
||||||
|
console.log(`resize detected widht= ${clientWidth} height= ${clientHeight}`)
|
||||||
|
});
|
||||||
|
|
||||||
document.addEventListener('mousemove', event => {
|
document.addEventListener('mousemove', event => {
|
||||||
const mouseY = event.clientY;
|
const mouseY = event.clientY;
|
||||||
|
|||||||
@ -1,11 +1,7 @@
|
|||||||
// console.log(`toktoken= ${token}`)
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
// const token = localStorage.getItem('token');
|
|
||||||
|
|
||||||
|
|
||||||
function getToken() {
|
function getToken() {
|
||||||
// your code to retrieve the token from localStorage or any other source
|
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('token');
|
||||||
if (typeof token === 'string') {
|
if (typeof token === 'string') {
|
||||||
console.log("is a string !!!")
|
console.log("is a string !!!")
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.App-logo {
|
.App-logo {
|
||||||
|
|||||||
@ -11,6 +11,19 @@
|
|||||||
font-size: 300%;
|
font-size: 300%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
background-color: rgb(249, 249, 249);
|
||||||
|
/* border-radius: 5vh; */
|
||||||
|
/* color: rgb(100, 42, 42); */
|
||||||
|
display: block;
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 5vh;
|
||||||
|
/* padding: 2vh 5vw; */
|
||||||
|
height: 80%;
|
||||||
|
width: 80%;
|
||||||
|
/* font-size: 300%; */
|
||||||
|
}
|
||||||
|
|
||||||
.clicked{
|
.clicked{
|
||||||
/* justify-content: center; */
|
/* justify-content: center; */
|
||||||
/* display: flex;
|
/* display: flex;
|
||||||
@ -29,60 +42,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#myCanvas {
|
#myCanvas {
|
||||||
background-color: rgb(75, 33, 33);
|
background-color: rgb(124, 47, 47);
|
||||||
position: absolute;
|
/* position: absolute; */
|
||||||
top: 0;
|
/* top: 0; */
|
||||||
left: 0;
|
/* left: 0; */
|
||||||
cursor: none;
|
/* cursor: none; */
|
||||||
/* width: 100%; */
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 768px) {
|
/* @media screen and (max-width: 768px) { */
|
||||||
#canvas_container {
|
/* #canvas_container { */
|
||||||
transform: rotate(90deg);
|
/* width: 50%; */
|
||||||
|
/* transform: rotate(90deg);
|
||||||
transform-origin: top right;
|
transform-origin: top right;
|
||||||
position: relative;
|
position: relative;
|
||||||
/* margin-right: 100vw; */
|
/* margin-right: 100vw; */
|
||||||
/* height: 100vw; */
|
/* height: 100vw; */
|
||||||
width: 100vh;
|
/* width: 100vh; */
|
||||||
}
|
/* } */
|
||||||
/* #myCanvas {
|
/* #myCanvas {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
} */
|
} */
|
||||||
}
|
/* } */
|
||||||
|
|
||||||
.checkbox{
|
|
||||||
font-size: 25px;
|
|
||||||
left: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
input[type=checkbox] {
|
|
||||||
-webkit-appearance: none;
|
|
||||||
-moz-appearance: none;
|
|
||||||
-ms-appearance: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type=checkbox] {
|
|
||||||
border-radius: 4px;
|
|
||||||
height: 25px;
|
|
||||||
width: 25px;
|
|
||||||
background: grey;
|
|
||||||
/* border: 1px solid #ccc; */
|
|
||||||
}
|
|
||||||
|
|
||||||
input[type="checkbox"]:checked {
|
|
||||||
background: #5843e4;
|
|
||||||
margin:0px;
|
|
||||||
/* position: relative; */
|
|
||||||
&:before {
|
|
||||||
font-family: FontAwesome;
|
|
||||||
/* content: '\f00c'; */
|
|
||||||
display: block;
|
|
||||||
color: grey;
|
|
||||||
font-size: 40px;
|
|
||||||
/* position: absolute; */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ body {
|
|||||||
sans-serif;
|
sans-serif;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
/* height: 100%; */
|
||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
|
|||||||
@ -75,18 +75,18 @@ services:
|
|||||||
- ./containers/pong:/app
|
- ./containers/pong:/app
|
||||||
entrypoint: ["sh", "-c" , "npm install && npm run start:dev"]
|
entrypoint: ["sh", "-c" , "npm install && npm run start:dev"]
|
||||||
|
|
||||||
# chat:
|
chat:
|
||||||
# image: node:latest
|
image: node:latest
|
||||||
# container_name: chat
|
container_name: chat
|
||||||
# working_dir: /app
|
working_dir: /app
|
||||||
# ports:
|
ports:
|
||||||
# - 4001:4001
|
- 4001:4001
|
||||||
# env_file: .env
|
env_file: .env
|
||||||
# networks:
|
networks:
|
||||||
# - pongNetwork
|
- pongNetwork
|
||||||
# volumes:
|
volumes:
|
||||||
# - ./chat:/app
|
- ./containers/chat:/app
|
||||||
# entrypoint: ["sh", "-c" , "npm install && npm run start:dev"]
|
entrypoint: ["sh", "-c" , "npm install && npm run start:dev"]
|
||||||
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user