Refacor electron app and add migrations
This commit is contained in:
Binary file not shown.
@@ -19,7 +19,7 @@ const PORT = process.env.PORT || 3001;
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// In-memory runtime state (WebSocket connections only – not persisted)
|
||||
// In-memory runtime state (WebSocket connections only - not persisted)
|
||||
interface ConnectedUser {
|
||||
oderId: string;
|
||||
ws: WebSocket;
|
||||
@@ -49,8 +49,10 @@ import {
|
||||
JoinRequest
|
||||
} from './db';
|
||||
|
||||
function hashPassword(pw: string) { return crypto.createHash('sha256').update(pw)
|
||||
.digest('hex'); }
|
||||
function hashPassword(pw: string) {
|
||||
return crypto.createHash('sha256')
|
||||
.update(pw)
|
||||
.digest('hex'); }
|
||||
|
||||
// REST API Routes
|
||||
|
||||
@@ -476,6 +478,7 @@ function handleWebSocketMessage(connectionId: string, message: any): void {
|
||||
serverId: viewSid,
|
||||
users: viewUsers
|
||||
}));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -514,6 +517,7 @@ function handleWebSocketMessage(connectionId: string, message: any): void {
|
||||
...message,
|
||||
fromUserId: user.oderId
|
||||
}));
|
||||
|
||||
console.log(`Successfully forwarded ${message.type} to ${message.targetUserId}`);
|
||||
} else {
|
||||
console.log(`Target user ${message.targetUserId} not found. Connected users:`,
|
||||
|
||||
Reference in New Issue
Block a user