Dapshen commited on
Commit
a83a357
·
verified ·
1 Parent(s): 4e88001

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +1142 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Null V 0 1
3
- emoji: 📚
4
- colorFrom: gray
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: null-v-0-1
3
+ emoji: 🐳
4
+ colorFrom: yellow
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,1142 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Null Messenger</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
9
+ <style>
10
+ .message-animation {
11
+ animation: fadeIn 0.3s ease-in-out;
12
+ }
13
+ @keyframes fadeIn {
14
+ from { opacity: 0; transform: translateY(10px); }
15
+ to { opacity: 1; transform: translateY(0); }
16
+ }
17
+ .blink {
18
+ animation: blink 1s infinite;
19
+ }
20
+ @keyframes blink {
21
+ 0% { opacity: 1; }
22
+ 50% { opacity: 0.5; }
23
+ 100% { opacity: 1; }
24
+ }
25
+ .scrollbar-hide::-webkit-scrollbar {
26
+ display: none;
27
+ }
28
+ .scrollbar-hide {
29
+ -ms-overflow-style: none;
30
+ scrollbar-width: none;
31
+ }
32
+ </style>
33
+ </head>
34
+ <body class="bg-gray-900 text-gray-100 min-h-screen">
35
+ <div id="app" class="container mx-auto px-4 py-8 max-w-6xl">
36
+ <!-- Auth Screen -->
37
+ <div id="auth-screen" class="flex flex-col items-center justify-center min-h-[80vh]">
38
+ <div class="bg-gray-800 rounded-xl p-8 w-full max-w-md shadow-2xl border border-gray-700">
39
+ <div class="text-center mb-8">
40
+ <h1 class="text-4xl font-bold text-purple-500 mb-2">NULL</h1>
41
+ <p class="text-gray-400">Secure anonymous messaging</p>
42
+ </div>
43
+
44
+ <div id="auth-tabs" class="flex mb-6 border-b border-gray-700">
45
+ <button id="login-tab" class="flex-1 py-2 font-medium text-purple-500 border-b-2 border-purple-500">Login</button>
46
+ <button id="register-tab" class="flex-1 py-2 font-medium text-gray-400 hover:text-gray-300">Register</button>
47
+ </div>
48
+
49
+ <!-- Login Form -->
50
+ <div id="login-form" class="space-y-4">
51
+ <div>
52
+ <label for="login-id" class="block text-sm font-medium mb-1">ID</label>
53
+ <input type="number" id="login-id" class="w-full px-4 py-2 bg-gray-700 rounded-lg focus:ring-2 focus:ring-purple-500 focus:outline-none">
54
+ </div>
55
+ <div>
56
+ <label for="login-password" class="block text-sm font-medium mb-1">Password</label>
57
+ <input type="password" id="login-password" class="w-full px-4 py-2 bg-gray-700 rounded-lg focus:ring-2 focus:ring-purple-500 focus:outline-none">
58
+ </div>
59
+ <button id="login-btn" class="w-full bg-purple-600 hover:bg-purple-700 text-white py-2 px-4 rounded-lg font-medium transition duration-200 mt-4">
60
+ Login
61
+ </button>
62
+ </div>
63
+
64
+ <!-- Register Form -->
65
+ <div id="register-form" class="space-y-4 hidden">
66
+ <div>
67
+ <label for="register-name" class="block text-sm font-medium mb-1">Name (max 20 chars)</label>
68
+ <input type="text" id="register-name" maxlength="20" class="w-full px-4 py-2 bg-gray-700 rounded-lg focus:ring-2 focus:ring-purple-500 focus:outline-none">
69
+ </div>
70
+ <div>
71
+ <label for="register-password" class="block text-sm font-medium mb-1">Password (max 20 chars)</label>
72
+ <input type="password" id="register-password" maxlength="20" class="w-full px-4 py-2 bg-gray-700 rounded-lg focus:ring-2 focus:ring-purple-500 focus:outline-none">
73
+ </div>
74
+ <button id="register-btn" class="w-full bg-purple-600 hover:bg-purple-700 text-white py-2 px-4 rounded-lg font-medium transition duration-200 mt-4">
75
+ Register
76
+ </button>
77
+ </div>
78
+
79
+ <div id="auth-message" class="mt-4 text-sm text-center text-red-500 hidden"></div>
80
+ </div>
81
+ </div>
82
+
83
+ <!-- Chat Screen -->
84
+ <div id="chat-screen" class="hidden">
85
+ <div class="flex flex-col h-[80vh] border border-gray-700 rounded-xl overflow-hidden">
86
+ <!-- Header -->
87
+ <div class="bg-gray-800 p-4 flex justify-between items-center border-b border-gray-700">
88
+ <div class="flex items-center">
89
+ <h2 class="text-xl font-bold text-purple-500">NULL CHAT</h2>
90
+ <span id="user-badge" class="ml-2 px-2 py-1 text-xs rounded-full bg-gray-700"></span>
91
+ </div>
92
+ <div class="flex space-x-2">
93
+ <button id="settings-btn" class="p-2 text-gray-400 hover:text-purple-500 rounded-full hover:bg-gray-700 transition">
94
+ <i class="fas fa-cog"></i>
95
+ </button>
96
+ <button id="logout-btn" class="p-2 text-gray-400 hover:text-purple-500 rounded-full hover:bg-gray-700 transition">
97
+ <i class="fas fa-sign-out-alt"></i>
98
+ </button>
99
+ <button id="admin-btn" class="p-2 text-gray-400 hover:text-purple-500 rounded-full hover:bg-gray-700 transition hidden">
100
+ <i class="fas fa-shield-alt"></i>
101
+ </button>
102
+ </div>
103
+ </div>
104
+
105
+ <!-- Messages -->
106
+ <div id="messages-container" class="flex-1 overflow-y-auto p-4 bg-gray-800 scrollbar-hide">
107
+ <div id="messages" class="space-y-3"></div>
108
+ </div>
109
+
110
+ <!-- Message Input -->
111
+ <div class="bg-gray-800 p-4 border-t border-gray-700">
112
+ <div class="flex space-x-2">
113
+ <input id="message-input" type="text" maxlength="1000" placeholder="Type your message..." class="flex-1 px-4 py-2 bg-gray-700 rounded-lg focus:ring-2 focus:ring-purple-500 focus:outline-none">
114
+ <button id="send-btn" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg font-medium transition duration-200">
115
+ Send
116
+ </button>
117
+ </div>
118
+ <div id="message-counter" class="text-xs text-gray-500 mt-1 text-right"></div>
119
+ <div id="message-error" class="text-xs text-red-500 mt-1 hidden"></div>
120
+ </div>
121
+ </div>
122
+ </div>
123
+
124
+ <!-- Settings Modal -->
125
+ <div id="settings-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
126
+ <div class="bg-gray-800 rounded-xl p-6 w-full max-w-md border border-gray-700">
127
+ <div class="flex justify-between items-center mb-4">
128
+ <h3 class="text-xl font-bold">Settings</h3>
129
+ <button id="close-settings" class="text-gray-400 hover:text-white">
130
+ <i class="fas fa-times"></i>
131
+ </button>
132
+ </div>
133
+
134
+ <div class="space-y-4">
135
+ <div>
136
+ <label class="block text-sm font-medium mb-1">Change Name (max 20 chars)</label>
137
+ <div class="flex space-x-2">
138
+ <input type="text" id="new-name" maxlength="20" class="flex-1 px-4 py-2 bg-gray-700 rounded-lg focus:ring-2 focus:ring-purple-500 focus:outline-none">
139
+ <button id="change-name-btn" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg font-medium transition duration-200">
140
+ Update
141
+ </button>
142
+ </div>
143
+ </div>
144
+
145
+ <div>
146
+ <label class="block text-sm font-medium mb-1">Change Password (max 20 chars)</label>
147
+ <div class="flex space-x-2">
148
+ <input type="password" id="new-password" maxlength="20" class="flex-1 px-4 py-2 bg-gray-700 rounded-lg focus:ring-2 focus:ring-purple-500 focus:outline-none">
149
+ <button id="change-password-btn" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg font-medium transition duration-200">
150
+ Update
151
+ </button>
152
+ </div>
153
+ </div>
154
+ </div>
155
+
156
+ <div id="settings-message" class="mt-4 text-sm text-center hidden"></div>
157
+ </div>
158
+ </div>
159
+
160
+ <!-- Admin Panel Modal -->
161
+ <div id="admin-modal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 hidden">
162
+ <div class="bg-gray-800 rounded-xl p-6 w-full max-w-4xl border border-gray-700 max-h-[90vh] flex flex-col">
163
+ <div class="flex justify-between items-center mb-4">
164
+ <h3 class="text-xl font-bold text-purple-500">Admin Panel</h3>
165
+ <button id="close-admin" class="text-gray-400 hover:text-white">
166
+ <i class="fas fa-times"></i>
167
+ </button>
168
+ </div>
169
+
170
+ <div class="flex-1 overflow-hidden flex flex-col">
171
+ <div class="bg-gray-900 p-4 rounded-lg mb-4 overflow-y-auto scrollbar-hide flex-1">
172
+ <div id="admin-console" class="font-mono text-sm space-y-2">
173
+ <div class="text-green-400">Welcome to Admin Panel</div>
174
+ <div class="text-gray-500">Type /help to see available commands</div>
175
+ </div>
176
+ </div>
177
+
178
+ <div class="flex space-x-2">
179
+ <input id="admin-command" type="text" placeholder="Enter command..." class="flex-1 px-4 py-2 bg-gray-700 rounded-lg focus:ring-2 focus:ring-purple-500 focus:outline-none">
180
+ <button id="execute-command" class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded-lg font-medium transition duration-200">
181
+ Execute
182
+ </button>
183
+ </div>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ </div>
188
+
189
+ <script>
190
+ // Data storage
191
+ let users = [
192
+ { id: 0, name: "Null", password: "QWERTYnull123!", isAdmin: true }
193
+ ];
194
+
195
+ let messages = [];
196
+ let mutedAccounts = [];
197
+ let mutedIPs = [];
198
+ let messageLimit = 10;
199
+ let messageCounts = {};
200
+ let accountCreationLimits = {};
201
+
202
+ // Current user state
203
+ let currentUser = null;
204
+ let currentIP = generateRandomIP(); // Simulated IP for demo
205
+
206
+ // DOM elements
207
+ const authScreen = document.getElementById('auth-screen');
208
+ const chatScreen = document.getElementById('chat-screen');
209
+ const loginForm = document.getElementById('login-form');
210
+ const registerForm = document.getElementById('register-form');
211
+ const loginTab = document.getElementById('login-tab');
212
+ const registerTab = document.getElementById('register-tab');
213
+ const loginBtn = document.getElementById('login-btn');
214
+ const registerBtn = document.getElementById('register-btn');
215
+ const loginIdInput = document.getElementById('login-id');
216
+ const loginPasswordInput = document.getElementById('login-password');
217
+ const registerNameInput = document.getElementById('register-name');
218
+ const registerPasswordInput = document.getElementById('register-password');
219
+ const authMessage = document.getElementById('auth-message');
220
+ const messagesContainer = document.getElementById('messages');
221
+ const messageInput = document.getElementById('message-input');
222
+ const sendBtn = document.getElementById('send-btn');
223
+ const messageCounter = document.getElementById('message-counter');
224
+ const messageError = document.getElementById('message-error');
225
+ const userBadge = document.getElementById('user-badge');
226
+ const settingsBtn = document.getElementById('settings-btn');
227
+ const logoutBtn = document.getElementById('logout-btn');
228
+ const adminBtn = document.getElementById('admin-btn');
229
+ const settingsModal = document.getElementById('settings-modal');
230
+ const closeSettings = document.getElementById('close-settings');
231
+ const newNameInput = document.getElementById('new-name');
232
+ const newPasswordInput = document.getElementById('new-password');
233
+ const changeNameBtn = document.getElementById('change-name-btn');
234
+ const changePasswordBtn = document.getElementById('change-password-btn');
235
+ const settingsMessage = document.getElementById('settings-message');
236
+ const adminModal = document.getElementById('admin-modal');
237
+ const closeAdmin = document.getElementById('close-admin');
238
+ const adminCommand = document.getElementById('admin-command');
239
+ const executeCommand = document.getElementById('execute-command');
240
+ const adminConsole = document.getElementById('admin-console');
241
+
242
+ // Initialize
243
+ loadFromLocalStorage();
244
+ renderMessageCounter();
245
+
246
+ // Event listeners
247
+ loginTab.addEventListener('click', () => {
248
+ loginTab.classList.add('text-purple-500', 'border-purple-500');
249
+ loginTab.classList.remove('text-gray-400');
250
+ registerTab.classList.add('text-gray-400');
251
+ registerTab.classList.remove('text-purple-500', 'border-purple-500');
252
+ loginForm.classList.remove('hidden');
253
+ registerForm.classList.add('hidden');
254
+ authMessage.classList.add('hidden');
255
+ });
256
+
257
+ registerTab.addEventListener('click', () => {
258
+ registerTab.classList.add('text-purple-500', 'border-purple-500');
259
+ registerTab.classList.remove('text-gray-400');
260
+ loginTab.classList.add('text-gray-400');
261
+ loginTab.classList.remove('text-purple-500', 'border-purple-500');
262
+ registerForm.classList.remove('hidden');
263
+ loginForm.classList.add('hidden');
264
+ authMessage.classList.add('hidden');
265
+ });
266
+
267
+ loginBtn.addEventListener('click', handleLogin);
268
+ registerBtn.addEventListener('click', handleRegister);
269
+ sendBtn.addEventListener('click', sendMessage);
270
+ messageInput.addEventListener('keypress', (e) => {
271
+ if (e.key === 'Enter') sendMessage();
272
+ });
273
+ settingsBtn.addEventListener('click', () => {
274
+ newNameInput.value = currentUser.name;
275
+ newPasswordInput.value = '';
276
+ settingsMessage.classList.add('hidden');
277
+ settingsModal.classList.remove('hidden');
278
+ });
279
+ logoutBtn.addEventListener('click', handleLogout);
280
+ adminBtn.addEventListener('click', () => {
281
+ adminModal.classList.remove('hidden');
282
+ });
283
+ closeSettings.addEventListener('click', () => {
284
+ settingsModal.classList.add('hidden');
285
+ });
286
+ closeAdmin.addEventListener('click', () => {
287
+ adminModal.classList.add('hidden');
288
+ });
289
+ changeNameBtn.addEventListener('click', changeName);
290
+ changePasswordBtn.addEventListener('click', changePassword);
291
+ executeCommand.addEventListener('click', executeAdminCommand);
292
+ adminCommand.addEventListener('keypress', (e) => {
293
+ if (e.key === 'Enter') executeAdminCommand();
294
+ });
295
+
296
+ // Functions
297
+ function handleLogin() {
298
+ const id = parseInt(loginIdInput.value);
299
+ const password = loginPasswordInput.value;
300
+
301
+ if (isNaN(id)) {
302
+ showAuthMessage('ID must be a number');
303
+ return;
304
+ }
305
+
306
+ const user = users.find(u => u.id === id);
307
+
308
+ if (!user) {
309
+ showAuthMessage('User not found');
310
+ return;
311
+ }
312
+
313
+ // Check if account is muted
314
+ const muteRecord = mutedAccounts.find(m => m.id === id && m.expires > Date.now());
315
+ if (muteRecord) {
316
+ const hoursLeft = Math.ceil((muteRecord.expires - Date.now()) / (1000 * 60 * 60));
317
+ showAuthMessage(`Account is muted for ${hoursLeft} more hours`);
318
+ return;
319
+ }
320
+
321
+ // Check if IP is muted
322
+ const ipMuteRecord = mutedIPs.find(m => m.ip === currentIP && m.expires > Date.now());
323
+ if (ipMuteRecord) {
324
+ const hoursLeft = Math.ceil((ipMuteRecord.expires - Date.now()) / (1000 * 60 * 60));
325
+ showAuthMessage(`Your IP is muted for ${hoursLeft} more hours`);
326
+ return;
327
+ }
328
+
329
+ if (user.password !== password) {
330
+ showAuthMessage('Incorrect password');
331
+ return;
332
+ }
333
+
334
+ currentUser = user;
335
+ authScreen.classList.add('hidden');
336
+ chatScreen.classList.remove('hidden');
337
+
338
+ if (currentUser.isAdmin) {
339
+ adminBtn.classList.remove('hidden');
340
+ }
341
+
342
+ userBadge.textContent = `${currentUser.name} (ID: ${currentUser.id})`;
343
+ renderMessages();
344
+ renderMessageCounter();
345
+
346
+ // Clear inputs
347
+ loginIdInput.value = '';
348
+ loginPasswordInput.value = '';
349
+ authMessage.classList.add('hidden');
350
+ }
351
+
352
+ function handleRegister() {
353
+ const name = registerNameInput.value.trim();
354
+ const password = registerPasswordInput.value;
355
+
356
+ if (!name || !password) {
357
+ showAuthMessage('Name and password are required');
358
+ return;
359
+ }
360
+
361
+ if (name.length > 20) {
362
+ showAuthMessage('Name must be 20 characters or less');
363
+ return;
364
+ }
365
+
366
+ if (password.length > 20) {
367
+ showAuthMessage('Password must be 20 characters or less');
368
+ return;
369
+ }
370
+
371
+ // Check if IP has created too many accounts
372
+ const now = Date.now();
373
+ const lastMonth = now - 30 * 24 * 60 * 60 * 1000;
374
+
375
+ if (!accountCreationLimits[currentIP]) {
376
+ accountCreationLimits[currentIP] = [];
377
+ }
378
+
379
+ // Remove old records
380
+ accountCreationLimits[currentIP] = accountCreationLimits[currentIP].filter(t => t > lastMonth);
381
+
382
+ if (accountCreationLimits[currentIP].length >= 2) {
383
+ showAuthMessage('You can only create 2 accounts per month from this device');
384
+ return;
385
+ }
386
+
387
+ // Create new user
388
+ const newId = users.length > 0 ? Math.max(...users.map(u => u.id)) + 1 : 1;
389
+ const newUser = {
390
+ id: newId,
391
+ name,
392
+ password,
393
+ isAdmin: false
394
+ };
395
+
396
+ users.push(newUser);
397
+ accountCreationLimits[currentIP].push(now);
398
+
399
+ // Show success message with ID
400
+ showAuthMessage(`Account created! Your ID is ${newId}`, 'green');
401
+
402
+ // Clear inputs
403
+ registerNameInput.value = '';
404
+ registerPasswordInput.value = '';
405
+
406
+ saveToLocalStorage();
407
+ }
408
+
409
+ function handleLogout() {
410
+ currentUser = null;
411
+ chatScreen.classList.add('hidden');
412
+ authScreen.classList.remove('hidden');
413
+ adminModal.classList.add('hidden');
414
+ settingsModal.classList.add('hidden');
415
+ }
416
+
417
+ function sendMessage() {
418
+ const text = messageInput.value.trim();
419
+
420
+ if (!text) return;
421
+
422
+ // Check if user is muted
423
+ const muteRecord = mutedAccounts.find(m => m.id === currentUser.id && m.expires > Date.now());
424
+ if (muteRecord) {
425
+ const hoursLeft = Math.ceil((muteRecord.expires - Date.now()) / (1000 * 60 * 60));
426
+ showMessageError(`You are muted for ${hoursLeft} more hours`);
427
+ return;
428
+ }
429
+
430
+ // Check if IP is muted
431
+ const ipMuteRecord = mutedIPs.find(m => m.ip === currentIP && m.expires > Date.now());
432
+ if (ipMuteRecord) {
433
+ const hoursLeft = Math.ceil((ipMuteRecord.expires - Date.now()) / (1000 * 60 * 60));
434
+ showMessageError(`Your IP is muted for ${hoursLeft} more hours`);
435
+ return;
436
+ }
437
+
438
+ // Check message limit
439
+ const now = Date.now();
440
+ const lastHour = now - 60 * 60 * 1000;
441
+
442
+ if (!messageCounts[currentUser.id]) {
443
+ messageCounts[currentUser.id] = [];
444
+ }
445
+
446
+ // Remove old records
447
+ messageCounts[currentUser.id] = messageCounts[currentUser.id].filter(t => t > lastHour);
448
+
449
+ if (messageCounts[currentUser.id].length >= messageLimit) {
450
+ showMessageError(`You can only send ${messageLimit} messages per hour`);
451
+ return;
452
+ }
453
+
454
+ // Create message
455
+ const messageId = messages.length > 0 ? Math.max(...messages.map(m => m.id)) + 1 : 1;
456
+ const newMessage = {
457
+ id: messageId,
458
+ userId: currentUser.id,
459
+ userName: currentUser.name,
460
+ text,
461
+ timestamp: now,
462
+ ip: currentIP
463
+ };
464
+
465
+ messages.push(newMessage);
466
+ messageCounts[currentUser.id].push(now);
467
+
468
+ // Clear input and render
469
+ messageInput.value = '';
470
+ renderMessages();
471
+ renderMessageCounter();
472
+ messageError.classList.add('hidden');
473
+
474
+ // Auto-scroll to bottom
475
+ setTimeout(() => {
476
+ messagesContainer.scrollTop = messagesContainer.scrollHeight;
477
+ }, 100);
478
+
479
+ saveToLocalStorage();
480
+ }
481
+
482
+ function renderMessages() {
483
+ messagesContainer.innerHTML = '';
484
+
485
+ messages.forEach(msg => {
486
+ const messageElement = document.createElement('div');
487
+ messageElement.className = 'bg-gray-700 p-3 rounded-lg message-animation';
488
+
489
+ const header = document.createElement('div');
490
+ header.className = 'flex justify-between text-xs text-gray-400 mb-1';
491
+ header.innerHTML = `
492
+ <span>${msg.userName} / ID: ${msg.userId} / mID: ${msg.id}</span>
493
+ <span>${formatTime(msg.timestamp)}</span>
494
+ `;
495
+
496
+ const content = document.createElement('div');
497
+ content.className = 'text-gray-100';
498
+ content.textContent = msg.text;
499
+
500
+ messageElement.appendChild(header);
501
+ messageElement.appendChild(content);
502
+ messagesContainer.appendChild(messageElement);
503
+ });
504
+ }
505
+
506
+ function renderMessageCounter() {
507
+ if (!currentUser) return;
508
+
509
+ const now = Date.now();
510
+ const lastHour = now - 60 * 60 * 1000;
511
+
512
+ if (!messageCounts[currentUser.id]) {
513
+ messageCounts[currentUser.id] = [];
514
+ }
515
+
516
+ // Remove old records
517
+ messageCounts[currentUser.id] = messageCounts[currentUser.id].filter(t => t > lastHour);
518
+
519
+ const count = messageCounts[currentUser.id].length;
520
+ const remaining = Math.max(0, messageLimit - count);
521
+
522
+ messageCounter.textContent = `Messages this hour: ${count}/${messageLimit} (${remaining} remaining)`;
523
+
524
+ if (count >= messageLimit) {
525
+ messageCounter.classList.add('text-red-400');
526
+ messageCounter.classList.remove('text-gray-500');
527
+ } else {
528
+ messageCounter.classList.add('text-gray-500');
529
+ messageCounter.classList.remove('text-red-400');
530
+ }
531
+ }
532
+
533
+ function changeName() {
534
+ const newName = newNameInput.value.trim();
535
+
536
+ if (!newName) {
537
+ showSettingsMessage('Name cannot be empty', 'red');
538
+ return;
539
+ }
540
+
541
+ if (newName.length > 20) {
542
+ showSettingsMessage('Name must be 20 characters or less', 'red');
543
+ return;
544
+ }
545
+
546
+ currentUser.name = newName;
547
+ userBadge.textContent = `${currentUser.name} (ID: ${currentUser.id})`;
548
+
549
+ // Update name in all messages
550
+ messages.forEach(msg => {
551
+ if (msg.userId === currentUser.id) {
552
+ msg.userName = newName;
553
+ }
554
+ });
555
+
556
+ showSettingsMessage('Name updated successfully', 'green');
557
+ renderMessages();
558
+ saveToLocalStorage();
559
+ }
560
+
561
+ function changePassword() {
562
+ const newPassword = newPasswordInput.value;
563
+
564
+ if (!newPassword) {
565
+ showSettingsMessage('Password cannot be empty', 'red');
566
+ return;
567
+ }
568
+
569
+ if (newPassword.length > 20) {
570
+ showSettingsMessage('Password must be 20 characters or less', 'red');
571
+ return;
572
+ }
573
+
574
+ currentUser.password = newPassword;
575
+ showSettingsMessage('Password updated successfully', 'green');
576
+ newPasswordInput.value = '';
577
+ saveToLocalStorage();
578
+ }
579
+
580
+ function executeAdminCommand() {
581
+ if (!currentUser || !currentUser.isAdmin) return;
582
+
583
+ const command = adminCommand.value.trim();
584
+ adminCommand.value = '';
585
+
586
+ if (!command) return;
587
+
588
+ // Add command to console
589
+ addToConsole(`> ${command}`, 'text-purple-400');
590
+
591
+ // Parse command
592
+ const parts = command.split(' ');
593
+ const cmd = parts[0].toLowerCase();
594
+ const args = parts.slice(1);
595
+
596
+ // Process commands
597
+ switch (cmd) {
598
+ case '/mute':
599
+ if (args.length !== 2) {
600
+ addToConsole('Usage: /mute id hours', 'text-red-400');
601
+ break;
602
+ }
603
+ const muteId = parseInt(args[0]);
604
+ const muteHours = parseInt(args[1]);
605
+ if (isNaN(muteId) || isNaN(muteHours)) {
606
+ addToConsole('Invalid id or hours', 'text-red-400');
607
+ break;
608
+ }
609
+ muteAccount(muteId, muteHours);
610
+ break;
611
+
612
+ case '/unmute':
613
+ if (args.length !== 1) {
614
+ addToConsole('Usage: /unmute id', 'text-red-400');
615
+ break;
616
+ }
617
+ const unmuteId = parseInt(args[0]);
618
+ if (isNaN(unmuteId)) {
619
+ addToConsole('Invalid id', 'text-red-400');
620
+ break;
621
+ }
622
+ unmuteAccount(unmuteId);
623
+ break;
624
+
625
+ case '/del_m':
626
+ if (args.length !== 1) {
627
+ addToConsole('Usage: /del_m mid', 'text-red-400');
628
+ break;
629
+ }
630
+ const delMid = parseInt(args[0]);
631
+ if (isNaN(delMid)) {
632
+ addToConsole('Invalid message id', 'text-red-400');
633
+ break;
634
+ }
635
+ deleteMessage(delMid);
636
+ break;
637
+
638
+ case '/del_um':
639
+ if (args.length !== 1) {
640
+ addToConsole('Usage: /del_um id', 'text-red-400');
641
+ break;
642
+ }
643
+ const delUserId = parseInt(args[0]);
644
+ if (isNaN(delUserId)) {
645
+ addToConsole('Invalid user id', 'text-red-400');
646
+ break;
647
+ }
648
+ deleteUserMessages(delUserId);
649
+ break;
650
+
651
+ case '/limit_m':
652
+ if (args.length !== 1) {
653
+ addToConsole('Usage: /limit_m x', 'text-red-400');
654
+ break;
655
+ }
656
+ const newLimit = parseInt(args[0]);
657
+ if (isNaN(newLimit) || newLimit < 1) {
658
+ addToConsole('Invalid limit (must be positive number)', 'text-red-400');
659
+ break;
660
+ }
661
+ setMessageLimit(newLimit);
662
+ break;
663
+
664
+ case '/limit_reset':
665
+ resetMessageCounts();
666
+ break;
667
+
668
+ case '/vipe_chat':
669
+ clearChat();
670
+ break;
671
+
672
+ case '/vipe_all':
673
+ clearAll();
674
+ break;
675
+
676
+ case '/change_n':
677
+ if (args.length < 2) {
678
+ addToConsole('Usage: /change_n id name', 'text-red-400');
679
+ break;
680
+ }
681
+ const changeNameId = parseInt(args[0]);
682
+ if (isNaN(changeNameId)) {
683
+ addToConsole('Invalid id', 'text-red-400');
684
+ break;
685
+ }
686
+ const newUserName = args.slice(1).join(' ');
687
+ changeUserName(changeNameId, newUserName);
688
+ break;
689
+
690
+ case '/change_p':
691
+ if (args.length !== 2) {
692
+ addToConsole('Usage: /change_p id password', 'text-red-400');
693
+ break;
694
+ }
695
+ const changePassId = parseInt(args[0]);
696
+ if (isNaN(changePassId)) {
697
+ addToConsole('Invalid id', 'text-red-400');
698
+ break;
699
+ }
700
+ const newUserPass = args[1];
701
+ changeUserPassword(changeNameId, newUserPass);
702
+ break;
703
+
704
+ case '/check_ip':
705
+ if (args.length !== 1) {
706
+ addToConsole('Usage: /check_ip mid', 'text-red-400');
707
+ break;
708
+ }
709
+ const checkIpMid = parseInt(args[0]);
710
+ if (isNaN(checkIpMid)) {
711
+ addToConsole('Invalid message id', 'text-red-400');
712
+ break;
713
+ }
714
+ checkMessageIP(checkIpMid);
715
+ break;
716
+
717
+ case '/mute_ip':
718
+ if (args.length !== 2) {
719
+ addToConsole('Usage: /mute_ip ip hours', 'text-red-400');
720
+ break;
721
+ }
722
+ const muteIp = args[0];
723
+ const muteIpHours = parseInt(args[1]);
724
+ if (isNaN(muteIpHours)) {
725
+ addToConsole('Invalid hours', 'text-red-400');
726
+ break;
727
+ }
728
+ muteIP(muteIp, muteIpHours);
729
+ break;
730
+
731
+ case '/unmute_ip':
732
+ if (args.length !== 1) {
733
+ addToConsole('Usage: /unmute_ip ip', 'text-red-400');
734
+ break;
735
+ }
736
+ const unmuteIp = args[0];
737
+ unmuteIP(unmuteIp);
738
+ break;
739
+
740
+ case '/mutes':
741
+ showMutes();
742
+ break;
743
+
744
+ case '/create':
745
+ if (args.length < 2) {
746
+ addToConsole('Usage: /create name password', 'text-red-400');
747
+ break;
748
+ }
749
+ const createName = args[0];
750
+ const createPass = args.slice(1).join(' ');
751
+ createUser(createName, createPass);
752
+ break;
753
+
754
+ case '/info_n':
755
+ if (args.length !== 1) {
756
+ addToConsole('Usage: /info_n id', 'text-red-400');
757
+ break;
758
+ }
759
+ const infoId = parseInt(args[0]);
760
+ if (isNaN(infoId)) {
761
+ addToConsole('Invalid id', 'text-red-400');
762
+ break;
763
+ }
764
+ getUserName(infoId);
765
+ break;
766
+
767
+ case '/list':
768
+ listUsers();
769
+ break;
770
+
771
+ case '/help':
772
+ showHelp();
773
+ break;
774
+
775
+ default:
776
+ addToConsole('Unknown command. Type /help for list of commands', 'text-red-400');
777
+ }
778
+
779
+ // Auto-scroll console to bottom
780
+ setTimeout(() => {
781
+ adminConsole.scrollTop = adminConsole.scrollHeight;
782
+ }, 10);
783
+ }
784
+
785
+ // Admin command functions
786
+ function muteAccount(id, hours) {
787
+ const user = users.find(u => u.id === id);
788
+ if (!user) {
789
+ addToConsole(`User with ID ${id} not found`, 'text-red-400');
790
+ return;
791
+ }
792
+
793
+ if (id === 0) {
794
+ addToConsole('Cannot mute admin account', 'text-red-400');
795
+ return;
796
+ }
797
+
798
+ const expires = Date.now() + hours * 60 * 60 * 1000;
799
+
800
+ // Remove existing mute if any
801
+ mutedAccounts = mutedAccounts.filter(m => m.id !== id);
802
+
803
+ mutedAccounts.push({ id, expires });
804
+ addToConsole(`User ${user.name} (ID: ${id}) muted for ${hours} hours`, 'text-green-400');
805
+ saveToLocalStorage();
806
+ }
807
+
808
+ function unmuteAccount(id) {
809
+ const user = users.find(u => u.id === id);
810
+ if (!user) {
811
+ addToConsole(`User with ID ${id} not found`, 'text-red-400');
812
+ return;
813
+ }
814
+
815
+ const wasMuted = mutedAccounts.some(m => m.id === id);
816
+ mutedAccounts = mutedAccounts.filter(m => m.id !== id);
817
+
818
+ if (wasMuted) {
819
+ addToConsole(`User ${user.name} (ID: ${id}) unmuted`, 'text-green-400');
820
+ } else {
821
+ addToConsole(`User ${user.name} (ID: ${id}) was not muted`, 'text-yellow-400');
822
+ }
823
+ saveToLocalStorage();
824
+ }
825
+
826
+ function deleteMessage(mid) {
827
+ const messageIndex = messages.findIndex(m => m.id === mid);
828
+ if (messageIndex === -1) {
829
+ addToConsole(`Message with ID ${mid} not found`, 'text-red-400');
830
+ return;
831
+ }
832
+
833
+ messages.splice(messageIndex, 1);
834
+ addToConsole(`Message ${mid} deleted`, 'text-green-400');
835
+ renderMessages();
836
+ saveToLocalStorage();
837
+ }
838
+
839
+ function deleteUserMessages(id) {
840
+ const user = users.find(u => u.id === id);
841
+ if (!user) {
842
+ addToConsole(`User with ID ${id} not found`, 'text-red-400');
843
+ return;
844
+ }
845
+
846
+ const count = messages.filter(m => m.userId === id).length;
847
+ messages = messages.filter(m => m.userId !== id);
848
+ addToConsole(`Deleted ${count} messages from user ${user.name} (ID: ${id})`, 'text-green-400');
849
+ renderMessages();
850
+ saveToLocalStorage();
851
+ }
852
+
853
+ function setMessageLimit(limit) {
854
+ messageLimit = limit;
855
+ addToConsole(`Message limit set to ${limit} per hour`, 'text-green-400');
856
+ renderMessageCounter();
857
+ saveToLocalStorage();
858
+ }
859
+
860
+ function resetMessageCounts() {
861
+ messageCounts = {};
862
+ addToConsole('All message counts reset to 0', 'text-green-400');
863
+ renderMessageCounter();
864
+ saveToLocalStorage();
865
+ }
866
+
867
+ function clearChat() {
868
+ messages = [];
869
+ addToConsole('Chat cleared', 'text-green-400');
870
+ renderMessages();
871
+ saveToLocalStorage();
872
+ }
873
+
874
+ function clearAll() {
875
+ // Keep only admin account
876
+ users = users.filter(u => u.id === 0);
877
+ messages = [];
878
+ mutedAccounts = [];
879
+ mutedIPs = [];
880
+ messageCounts = {};
881
+ accountCreationLimits = {};
882
+
883
+ addToConsole('All data cleared except admin account', 'text-green-400');
884
+
885
+ if (currentUser && currentUser.id !== 0) {
886
+ handleLogout();
887
+ } else {
888
+ renderMessages();
889
+ }
890
+
891
+ saveToLocalStorage();
892
+ }
893
+
894
+ function changeUserName(id, newName) {
895
+ const user = users.find(u => u.id === id);
896
+ if (!user) {
897
+ addToConsole(`User with ID ${id} not found`, 'text-red-400');
898
+ return;
899
+ }
900
+
901
+ if (newName.length > 20) {
902
+ addToConsole('Name must be 20 characters or less', 'text-red-400');
903
+ return;
904
+ }
905
+
906
+ const oldName = user.name;
907
+ user.name = newName;
908
+
909
+ // Update name in messages
910
+ messages.forEach(msg => {
911
+ if (msg.userId === id) {
912
+ msg.userName = newName;
913
+ }
914
+ });
915
+
916
+ addToConsole(`Changed name for user ${id} from "${oldName}" to "${newName}"`, 'text-green-400');
917
+
918
+ if (currentUser && currentUser.id === id) {
919
+ userBadge.textContent = `${newName} (ID: ${id})`;
920
+ }
921
+
922
+ renderMessages();
923
+ saveToLocalStorage();
924
+ }
925
+
926
+ function changeUserPassword(id, newPassword) {
927
+ const user = users.find(u => u.id === id);
928
+ if (!user) {
929
+ addToConsole(`User with ID ${id} not found`, 'text-red-400');
930
+ return;
931
+ }
932
+
933
+ if (newPassword.length > 20) {
934
+ addToConsole('Password must be 20 characters or less', 'text-red-400');
935
+ return;
936
+ }
937
+
938
+ user.password = newPassword;
939
+ addToConsole(`Password changed for user ${user.name} (ID: ${id})`, 'text-green-400');
940
+ saveToLocalStorage();
941
+ }
942
+
943
+ function checkMessageIP(mid) {
944
+ const message = messages.find(m => m.id === mid);
945
+ if (!message) {
946
+ addToConsole(`Message with ID ${mid} not found`, 'text-red-400');
947
+ return;
948
+ }
949
+
950
+ addToConsole(`Message ${mid} was sent from IP: ${message.ip}`, 'text-green-400');
951
+ }
952
+
953
+ function muteIP(ip, hours) {
954
+ const expires = Date.now() + hours * 60 * 60 * 1000;
955
+
956
+ // Remove existing mute if any
957
+ mutedIPs = mutedIPs.filter(m => m.ip !== ip);
958
+
959
+ mutedIPs.push({ ip, expires });
960
+ addToConsole(`IP ${ip} muted for ${hours} hours`, 'text-green-400');
961
+ saveToLocalStorage();
962
+ }
963
+
964
+ function unmuteIP(ip) {
965
+ const wasMuted = mutedIPs.some(m => m.ip === ip);
966
+ mutedIPs = mutedIPs.filter(m => m.ip !== ip);
967
+
968
+ if (wasMuted) {
969
+ addToConsole(`IP ${ip} unmuted`, 'text-green-400');
970
+ } else {
971
+ addToConsole(`IP ${ip} was not muted`, 'text-yellow-400');
972
+ }
973
+ saveToLocalStorage();
974
+ }
975
+
976
+ function showMutes() {
977
+ if (mutedAccounts.length === 0 && mutedIPs.length === 0) {
978
+ addToConsole('No active mutes', 'text-yellow-400');
979
+ return;
980
+ }
981
+
982
+ addToConsole('Active account mutes:', 'text-blue-400');
983
+ mutedAccounts.forEach(m => {
984
+ const user = users.find(u => u.id === m.id);
985
+ const name = user ? user.name : 'Unknown';
986
+ const hoursLeft = Math.ceil((m.expires - Date.now()) / (1000 * 60 * 60));
987
+ addToConsole(`- ${name} (ID: ${m.id}): ${hoursLeft} hours remaining`);
988
+ });
989
+
990
+ addToConsole('Active IP mutes:', 'text-blue-400');
991
+ mutedIPs.forEach(m => {
992
+ const hoursLeft = Math.ceil((m.expires - Date.now()) / (1000 * 60 * 60));
993
+ addToConsole(`- ${m.ip}: ${hoursLeft} hours remaining`);
994
+ });
995
+ }
996
+
997
+ function createUser(name, password) {
998
+ if (name.length > 20) {
999
+ addToConsole('Name must be 20 characters or less', 'text-red-400');
1000
+ return;
1001
+ }
1002
+
1003
+ if (password.length > 20) {
1004
+ addToConsole('Password must be 20 characters or less', 'text-red-400');
1005
+ return;
1006
+ }
1007
+
1008
+ const newId = users.length > 0 ? Math.max(...users.map(u => u.id)) + 1 : 1;
1009
+ const newUser = {
1010
+ id: newId,
1011
+ name,
1012
+ password,
1013
+ isAdmin: false
1014
+ };
1015
+
1016
+ users.push(newUser);
1017
+ addToConsole(`Created new user: ${name} (ID: ${newId})`, 'text-green-400');
1018
+ saveToLocalStorage();
1019
+ }
1020
+
1021
+ function getUserName(id) {
1022
+ const user = users.find(u => u.id === id);
1023
+ if (!user) {
1024
+ addToConsole(`User with ID ${id} not found`, 'text-red-400');
1025
+ return;
1026
+ }
1027
+
1028
+ addToConsole(`User ${id} name: ${user.name}`, 'text-green-400');
1029
+ }
1030
+
1031
+ function listUsers() {
1032
+ if (users.length === 0) {
1033
+ addToConsole('No users found', 'text-yellow-400');
1034
+ return;
1035
+ }
1036
+
1037
+ addToConsole('User list (ID - Name):', 'text-blue-400');
1038
+ users.forEach(user => {
1039
+ addToConsole(`- ${user.id}: ${user.name}${user.isAdmin ? ' (Admin)' : ''}`);
1040
+ });
1041
+ }
1042
+
1043
+ function showHelp() {
1044
+ addToConsole('Available commands:', 'text-blue-400');
1045
+ addToConsole('/mute id x - Mute account by ID for x hours');
1046
+ addToConsole('/unmute id - Unmute account by ID');
1047
+ addToConsole('/del_m mid - Delete message by message ID');
1048
+ addToConsole('/del_um id - Delete all messages by user ID');
1049
+ addToConsole('/limit_m x - Set message limit per hour to x');
1050
+ addToConsole('/limit_reset - Reset all message counts to 0');
1051
+ addToConsole('/vipe_chat - Delete all messages');
1052
+ addToConsole('/vipe_all - Delete all messages and accounts (except admin)');
1053
+ addToConsole('/change_n id x - Change username of ID to x');
1054
+ addToConsole('/change_p id x - Change password of ID to x');
1055
+ addToConsole('/check_ip mid - Check IP of message by message ID');
1056
+ addToConsole('/mute_ip ip x - Mute IP for x hours');
1057
+ addToConsole('/unmute_ip ip - Unmute IP');
1058
+ addToConsole('/mutes - Show all active mutes');
1059
+ addToConsole('/create x y - Create account with name x and password y');
1060
+ addToConsole('/info_n id - Get username by ID');
1061
+ addToConsole('/list - List all accounts');
1062
+ addToConsole('/help - Show this help');
1063
+ }
1064
+
1065
+ // Helper functions
1066
+ function showAuthMessage(message, color = 'red') {
1067
+ authMessage.textContent = message;
1068
+ authMessage.classList.remove('hidden');
1069
+ authMessage.classList.remove('text-red-500', 'text-green-500');
1070
+ authMessage.classList.add(color === 'green' ? 'text-green-500' : 'text-red-500');
1071
+ }
1072
+
1073
+ function showMessageError(message) {
1074
+ messageError.textContent = message;
1075
+ messageError.classList.remove('hidden');
1076
+ }
1077
+
1078
+ function showSettingsMessage(message, color = 'green') {
1079
+ settingsMessage.textContent = message;
1080
+ settingsMessage.classList.remove('hidden');
1081
+ settingsMessage.classList.remove('text-red-500', 'text-green-500');
1082
+ settingsMessage.classList.add(color === 'green' ? 'text-green-500' : 'text-red-500');
1083
+ }
1084
+
1085
+ function addToConsole(text, colorClass = 'text-gray-300') {
1086
+ const div = document.createElement('div');
1087
+ div.className = colorClass;
1088
+ div.textContent = text;
1089
+ adminConsole.appendChild(div);
1090
+ }
1091
+
1092
+ function formatTime(timestamp) {
1093
+ const date = new Date(timestamp);
1094
+ return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
1095
+ }
1096
+
1097
+ function generateRandomIP() {
1098
+ // For demo purposes only - generates a random IP
1099
+ return `${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}.${Math.floor(Math.random() * 255)}`;
1100
+ }
1101
+
1102
+ // Local storage
1103
+ function saveToLocalStorage() {
1104
+ const data = {
1105
+ users,
1106
+ messages,
1107
+ mutedAccounts,
1108
+ mutedIPs,
1109
+ messageLimit,
1110
+ messageCounts,
1111
+ accountCreationLimits
1112
+ };
1113
+
1114
+ localStorage.setItem('nullMessenger', JSON.stringify(data));
1115
+ }
1116
+
1117
+ function loadFromLocalStorage() {
1118
+ const data = localStorage.getItem('nullMessenger');
1119
+ if (!data) return;
1120
+
1121
+ try {
1122
+ const parsed = JSON.parse(data);
1123
+
1124
+ if (parsed.users) users = parsed.users;
1125
+ if (parsed.messages) messages = parsed.messages;
1126
+ if (parsed.mutedAccounts) mutedAccounts = parsed.mutedAccounts;
1127
+ if (parsed.mutedIPs) mutedIPs = parsed.mutedIPs;
1128
+ if (parsed.messageLimit) messageLimit = parsed.messageLimit;
1129
+ if (parsed.messageCounts) messageCounts = parsed.messageCounts;
1130
+ if (parsed.accountCreationLimits) accountCreationLimits = parsed.accountCreationLimits;
1131
+
1132
+ // Ensure admin account exists
1133
+ if (!users.some(u => u.id === 0)) {
1134
+ users.unshift({ id: 0, name: "Null", password: "QWERTYnull123!", isAdmin: true });
1135
+ }
1136
+ } catch (e) {
1137
+ console.error('Failed to load from localStorage', e);
1138
+ }
1139
+ }
1140
+ </script>
1141
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Dapshen/null-v-0-1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1142
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ Привет, сделай код и расскажи как его развернуть в открытый интернет. Мессенджер с названием "Null" с этими параметрами: Изначально должен существовать только аккаунт администратора: ID: 0; Имя: Null; Пароль: QWERTYnull123! Функция регистрации: Человек должен ввести имя и пароль и регистрация завершена! Очень важно - надо сделать так что бы с одного устройства нельзя было создавать более 2 аккаунтов в месяц! После ввода имени и пароля человеку должно показать его ID(у каждого нового аккаунта ID больше на единицу чем у предыдущего) Имя и пароль - максимум по 20 символов Функция входа: Человек вводит ID и пароль и попадает в аккаунт Функция изменения настроек: Человек войдя в аккаунт может менять своё имя или пароль(Имя и пароль - максимум по 20 символов) и функция выхода из аккаунта Сообщения: Не существует ЛС, веток и тд, есть только один глобальный чат в котором могут писать все! Очень важно - сделай так чтобы человек не мог писать в чате более 10 сообщений в час! Длинна сообщения - до 1000 символов! Так же у каждого сообщения должно быть сверху написано: Имя отправителя/ ID отправителя/ mID сообщения Админ панель(доступна только для аккаунта ID 0): Там должна быть командная строка в которой будут эти команды: /mute id x (Мут аккаунта по id аккаунта на x часов ) /unmute id (Размут аккаунта по id) /del_m mid (Удаление сообщения из чата по mid сообщения) /del_um id (Удаления из чата всех сообщений юзера по id) /limit_m x (До скольки сообщений каждый человек может отправлять в час) /limit_reset (Сбрасывает количество истраченных людьми сообщений в час до 0, тоесть тот кто дошёл до лимита по сообщениям в час снова сможет писать будто написал 0 сообщений за час) /vipe_chat (удаление всех сообщений из чата) /vipe_all (удаление всех сообщений и аккаунтов, кроме аккаунта ID 0) /change_n id x (изменить имя пользователя id на x) /change_p id x (изменить пароль пользователя id на x) /check_ip mid (проверить с какого ip было отправлено сообщение mid) /mute_ip ip x (Мут по ip на x часов) /unmute_ip ip (Размут по ip) /mutes (Список всех замученых ip/аккаунтов) /create x y (Создать аккаунт с именем x и паролем y, после создания в админ панели должно показать ID аккаунта) /info_n id (Посмотреть имя аккаунта) /list (Список всех существующих аккаунтов по порядку, с их id и именами) /help (вывод всего этого списка команд)