Trigger82 commited on
Commit
cbe1311
·
verified ·
1 Parent(s): 8b34763

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +24 -1
server.js CHANGED
@@ -38,7 +38,7 @@ async function connectDB() {
38
  if (!adminExists) {
39
  await db.collection('users').insertOne({
40
  username: 'admin',
41
- password: crypto.createHash('sha256').update('admin123').digest('hex'),
42
  isAdmin: true,
43
  createdAt: new Date()
44
  });
@@ -186,6 +186,29 @@ io.on('connection', (socket) => {
186
  });
187
  });
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  // Start server
190
  const PORT = process.env.PORT || 7860;
191
  connectDB().then(() => {
 
38
  if (!adminExists) {
39
  await db.collection('users').insertOne({
40
  username: 'admin',
41
+ password: crypto.createHash('sha256').update('admin2008').digest('hex'),
42
  isAdmin: true,
43
  createdAt: new Date()
44
  });
 
186
  });
187
  });
188
 
189
+ // Add this to your Socket.IO setup
190
+ io.on('connection', (socket) => {
191
+ console.log(`New connection: ${socket.id}`);
192
+
193
+ // Force terminal to be visible
194
+ socket.emit('terminal-init', {
195
+ ready: true,
196
+ timestamp: Date.now()
197
+ });
198
+
199
+ // New event to force terminal visibility
200
+ socket.on('force-terminal-visible', () => {
201
+ socket.emit('terminal-output', 'Terminal session activated\n');
202
+ socket.emit('terminal-output', 'Ready for commands\n');
203
+ });
204
+
205
+
206
+ // Add this error handling middleware
207
+ app.use((err, req, res, next) => {
208
+ console.error('Global error:', err);
209
+ io.emit('terminal-output', `ERROR: ${err.message}\n`);
210
+ next();
211
+ });
212
  // Start server
213
  const PORT = process.env.PORT || 7860;
214
  connectDB().then(() => {