diff --git a/frontend/src/pages/chat/chat.ts b/frontend/src/pages/chat/chat.ts index 2998eef..7d79aab 100644 --- a/frontend/src/pages/chat/chat.ts +++ b/frontend/src/pages/chat/chat.ts @@ -31,6 +31,23 @@ export type blockedUnBlocked = by: string, }; +<<<<<<< HEAD +======= +export type obj = +{ + command: string, + destination: string, + type: string, + user: string, + frontendUserName: string, + frontendUser: string, + token: string, + text: string, + timestamp: number, + SenderWindowID: string, + Sendertext: string, +}; +>>>>>>> refs/remotes/origin/nigel/functionBlockMessage // get the name of the machine used to connect const machineHostName = window.location.hostname; diff --git a/src/auth/src/run.ts b/src/auth/src/run.ts index 3c59d5d..f9dd40a 100644 --- a/src/auth/src/run.ts +++ b/src/auth/src/run.ts @@ -4,7 +4,25 @@ import fastify, { FastifyInstance } from 'fastify'; import app from './app'; const start = async () => { +<<<<<<< HEAD const f: FastifyInstance = fastify({ logger: { level: 'info' } }); +======= + const envToLogger = { + development: { + transport: { + target: 'pino-pretty', + options: { + translateTime: 'HH:MM:ss Z', + ignore: 'pid,hostname', + }, + }, + }, + production: true, + test: false, + }; + + const f: FastifyInstance = fastify({ logger: envToLogger.development }); +>>>>>>> refs/remotes/origin/nigel/functionBlockMessage process.on('SIGTERM', () => { f.log.warn('Requested to shutdown'); process.exit(134); diff --git a/src/chat/src/app.ts b/src/chat/src/app.ts index 7e8e10f..4ba3d34 100644 --- a/src/chat/src/app.ts +++ b/src/chat/src/app.ts @@ -41,6 +41,41 @@ interface ClientInfo { lastSeen: number; } +<<<<<<< HEAD +======= + +export type blockedUnBlocked = +{ + userState: string, + userTarget: string, + by: string, +}; + + +export type obj = +{ + command: string, + destination: string, + type: string, + user: string, + frontendUserName: string, + frontendUser: string, + token: string, + text: string, + timestamp: number, + SenderWindowID: string, + Sendertext: string, +}; + + + +// function setAboutPlayer(about: string): string { +// if (!about) { +// about = 'Player is good Shape - This is a default description'; +// } +// return about; +// }; +>>>>>>> refs/remotes/origin/nigel/functionBlockMessage export type blockedUnBlocked = { @@ -174,6 +209,7 @@ async function onReady(fastify: FastifyInstance) { +<<<<<<< HEAD // fastify.io.fetchSockets().then((sockets) => { // for (const socket of sockets) { // const clientInfo = clientChat.get(socket.id); @@ -189,6 +225,23 @@ async function onReady(fastify: FastifyInstance) { // } // }); +======= + fastify.io.fetchSockets().then((sockets) => { + for (const socket of sockets) { + const clientInfo = clientChat.get(socket.id); + if (!clientInfo?.user) { + console.log(color.yellow, `Skipping socket ${socket.id} (no user found)`); + continue; + } + console.log('DEBUG: UserIDWindow :', getUserByName(users, clientInfo.user)?.id); + const IDUser = getUserByName(users, clientInfo.user)?.id; + + console.log(filter_Blocked_user(fastify, obj, IDUser?? "")); + + + } + }); +>>>>>>> refs/remotes/origin/nigel/functionBlockMessage diff --git a/src/chat/src/broadcast.ts b/src/chat/src/broadcast.ts index 50fd98b..02db5c2 100644 --- a/src/chat/src/broadcast.ts +++ b/src/chat/src/broadcast.ts @@ -1,6 +1,7 @@ import type { ClientMessage } from './chat_types'; import { clientChat, color } from './app'; import { FastifyInstance } from 'fastify'; +<<<<<<< HEAD import type { BlockedData } from '@shared/database/mixin/blocked'; import { getUserByName } from './getUserByName'; import type { User } from '@shared/database/mixin/user'; @@ -30,6 +31,9 @@ function whoBlockedMe( +======= +import { getUserById } from './getUserById'; +>>>>>>> refs/remotes/origin/nigel/functionBlockMessage export function broadcast(fastify: FastifyInstance, data: ClientMessage, sender?: string) { diff --git a/src/chat/src/chat_types.ts b/src/chat/src/chat_types.ts index ae26cbc..d7306cd 100644 --- a/src/chat/src/chat_types.ts +++ b/src/chat/src/chat_types.ts @@ -32,6 +32,7 @@ export type ClientProfil = { innerHtml?: string, }; +<<<<<<< HEAD export type obj = @@ -48,3 +49,5 @@ export type obj = SenderWindowID: string, Sendertext: string, }; +======= +>>>>>>> refs/remotes/origin/nigel/functionBlockMessage diff --git a/src/chat/src/run.ts b/src/chat/src/run.ts index 3c59d5d..c96aed0 100644 --- a/src/chat/src/run.ts +++ b/src/chat/src/run.ts @@ -4,11 +4,29 @@ import fastify, { FastifyInstance } from 'fastify'; import app from './app'; const start = async () => { +<<<<<<< HEAD const f: FastifyInstance = fastify({ logger: { level: 'info' } }); process.on('SIGTERM', () => { f.log.warn('Requested to shutdown'); process.exit(134); }); +======= + const envToLogger = { + development: { + transport: { + target: 'pino-pretty', + options: { + translateTime: 'HH:MM:ss Z', + ignore: 'pid,hostname', + }, + }, + }, + production: true, + test: false, + }; + + const f: FastifyInstance = fastify({ logger: envToLogger.development }); +>>>>>>> refs/remotes/origin/nigel/functionBlockMessage try { await f.register(app, {}); await f.listen({ port: 80, host: '0.0.0.0' }); diff --git a/src/user/src/run.ts b/src/user/src/run.ts index 3c59d5d..f9dd40a 100644 --- a/src/user/src/run.ts +++ b/src/user/src/run.ts @@ -4,7 +4,25 @@ import fastify, { FastifyInstance } from 'fastify'; import app from './app'; const start = async () => { +<<<<<<< HEAD const f: FastifyInstance = fastify({ logger: { level: 'info' } }); +======= + const envToLogger = { + development: { + transport: { + target: 'pino-pretty', + options: { + translateTime: 'HH:MM:ss Z', + ignore: 'pid,hostname', + }, + }, + }, + production: true, + test: false, + }; + + const f: FastifyInstance = fastify({ logger: envToLogger.development }); +>>>>>>> refs/remotes/origin/nigel/functionBlockMessage process.on('SIGTERM', () => { f.log.warn('Requested to shutdown'); process.exit(134);