Merge remote-tracking branch 'refs/remotes/origin/nigel/functionBlockMessage' into nigel/functionBlockMessage
This commit is contained in:
commit
0d5b30388f
6 changed files with 114 additions and 0 deletions
|
|
@ -4,7 +4,25 @@ import fastify, { FastifyInstance } from 'fastify';
|
||||||
import app from './app';
|
import app from './app';
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
|
<<<<<<< HEAD
|
||||||
const f: FastifyInstance = fastify({ logger: { level: 'info' } });
|
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', () => {
|
process.on('SIGTERM', () => {
|
||||||
f.log.warn('Requested to shutdown');
|
f.log.warn('Requested to shutdown');
|
||||||
process.exit(134);
|
process.exit(134);
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,41 @@ interface ClientInfo {
|
||||||
lastSeen: number;
|
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 =
|
export type blockedUnBlocked =
|
||||||
{
|
{
|
||||||
|
|
@ -174,6 +209,7 @@ async function onReady(fastify: FastifyInstance) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
// fastify.io.fetchSockets().then((sockets) => {
|
// fastify.io.fetchSockets().then((sockets) => {
|
||||||
// for (const socket of sockets) {
|
// for (const socket of sockets) {
|
||||||
// const clientInfo = clientChat.get(socket.id);
|
// 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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import type { ClientMessage } from './chat_types';
|
import type { ClientMessage } from './chat_types';
|
||||||
import { clientChat, color } from './app';
|
import { clientChat, color } from './app';
|
||||||
import { FastifyInstance } from 'fastify';
|
import { FastifyInstance } from 'fastify';
|
||||||
|
<<<<<<< HEAD
|
||||||
import type { BlockedData } from '@shared/database/mixin/blocked';
|
import type { BlockedData } from '@shared/database/mixin/blocked';
|
||||||
import { getUserByName } from './getUserByName';
|
import { getUserByName } from './getUserByName';
|
||||||
import type { User } from '@shared/database/mixin/user';
|
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) {
|
export function broadcast(fastify: FastifyInstance, data: ClientMessage, sender?: string) {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ export type ClientProfil = {
|
||||||
innerHtml?: string,
|
innerHtml?: string,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
<<<<<<< HEAD
|
||||||
|
|
||||||
|
|
||||||
export type obj =
|
export type obj =
|
||||||
|
|
@ -48,3 +49,5 @@ export type obj =
|
||||||
SenderWindowID: string,
|
SenderWindowID: string,
|
||||||
Sendertext: string,
|
Sendertext: string,
|
||||||
};
|
};
|
||||||
|
=======
|
||||||
|
>>>>>>> refs/remotes/origin/nigel/functionBlockMessage
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,29 @@ import fastify, { FastifyInstance } from 'fastify';
|
||||||
import app from './app';
|
import app from './app';
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
|
<<<<<<< HEAD
|
||||||
const f: FastifyInstance = fastify({ logger: { level: 'info' } });
|
const f: FastifyInstance = fastify({ logger: { level: 'info' } });
|
||||||
process.on('SIGTERM', () => {
|
process.on('SIGTERM', () => {
|
||||||
f.log.warn('Requested to shutdown');
|
f.log.warn('Requested to shutdown');
|
||||||
process.exit(134);
|
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 {
|
try {
|
||||||
await f.register(app, {});
|
await f.register(app, {});
|
||||||
await f.listen({ port: 80, host: '0.0.0.0' });
|
await f.listen({ port: 80, host: '0.0.0.0' });
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,25 @@ import fastify, { FastifyInstance } from 'fastify';
|
||||||
import app from './app';
|
import app from './app';
|
||||||
|
|
||||||
const start = async () => {
|
const start = async () => {
|
||||||
|
<<<<<<< HEAD
|
||||||
const f: FastifyInstance = fastify({ logger: { level: 'info' } });
|
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', () => {
|
process.on('SIGTERM', () => {
|
||||||
f.log.warn('Requested to shutdown');
|
f.log.warn('Requested to shutdown');
|
||||||
process.exit(134);
|
process.exit(134);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue