@gameap/debug 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +222 -0
- package/empty-plugin/plugin.js +7 -0
- package/index.html +111 -0
- package/package.json +38 -0
- package/postcss.config.cjs +12 -0
- package/src/main.ts +328 -0
- package/src/mocks/README.md +68 -0
- package/src/mocks/browser.ts +22 -0
- package/src/mocks/files.ts +347 -0
- package/src/mocks/handlers.ts +940 -0
- package/src/mocks/servers.ts +397 -0
- package/src/mocks/translations-en.json +704 -0
- package/src/mocks/translations-ru.json +692 -0
- package/src/mocks/users.ts +34 -0
- package/src/shims-vue.d.ts +5 -0
- package/tailwind.config.js +25 -0
- package/tsconfig.json +31 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +93 -0
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
export interface MockFile {
|
|
2
|
+
path: string
|
|
3
|
+
timestamp: number
|
|
4
|
+
type: 'file' | 'dir'
|
|
5
|
+
visibility: 'public' | 'private'
|
|
6
|
+
size: number
|
|
7
|
+
dirname: string
|
|
8
|
+
basename: string
|
|
9
|
+
extension?: string
|
|
10
|
+
filename: string
|
|
11
|
+
// Internal: file content for download/read
|
|
12
|
+
_content?: string | ArrayBuffer
|
|
13
|
+
_contentType?: 'text' | 'binary'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface MockDirectory {
|
|
17
|
+
path: string
|
|
18
|
+
timestamp: number
|
|
19
|
+
type: 'dir'
|
|
20
|
+
visibility: 'public' | 'private'
|
|
21
|
+
dirname: string
|
|
22
|
+
basename: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Create binary content (256 bytes: 0x00 to 0xFF)
|
|
26
|
+
function createBinaryContent(): ArrayBuffer {
|
|
27
|
+
const buffer = new ArrayBuffer(256)
|
|
28
|
+
const view = new Uint8Array(buffer)
|
|
29
|
+
for (let i = 0; i < 256; i++) {
|
|
30
|
+
view[i] = i
|
|
31
|
+
}
|
|
32
|
+
return buffer
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Create a more complex binary file (1KB with patterns)
|
|
36
|
+
function createComplexBinaryContent(): ArrayBuffer {
|
|
37
|
+
const buffer = new ArrayBuffer(1024)
|
|
38
|
+
const view = new Uint8Array(buffer)
|
|
39
|
+
|
|
40
|
+
// Header pattern
|
|
41
|
+
view[0] = 0x89
|
|
42
|
+
view[1] = 0x50
|
|
43
|
+
view[2] = 0x4E
|
|
44
|
+
view[3] = 0x47 // PNG-like header
|
|
45
|
+
|
|
46
|
+
// Fill rest with repeating pattern
|
|
47
|
+
for (let i = 4; i < 1024; i++) {
|
|
48
|
+
view[i] = (i * 7 + 13) % 256
|
|
49
|
+
}
|
|
50
|
+
return buffer
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const now = Math.floor(Date.now() / 1000)
|
|
54
|
+
|
|
55
|
+
// Mock files in root directory
|
|
56
|
+
export const mockFiles: MockFile[] = [
|
|
57
|
+
{
|
|
58
|
+
path: 'server.properties',
|
|
59
|
+
timestamp: now - 86400, // 1 day ago
|
|
60
|
+
type: 'file',
|
|
61
|
+
visibility: 'private',
|
|
62
|
+
size: 512,
|
|
63
|
+
dirname: '',
|
|
64
|
+
basename: 'server.properties',
|
|
65
|
+
extension: 'properties',
|
|
66
|
+
filename: 'server',
|
|
67
|
+
_contentType: 'text',
|
|
68
|
+
_content: `# Minecraft server properties
|
|
69
|
+
# Generated by GameAP Debug Harness
|
|
70
|
+
|
|
71
|
+
server-port=25565
|
|
72
|
+
gamemode=survival
|
|
73
|
+
difficulty=normal
|
|
74
|
+
max-players=20
|
|
75
|
+
motd=A Minecraft Server
|
|
76
|
+
enable-command-block=false
|
|
77
|
+
spawn-protection=16
|
|
78
|
+
view-distance=10
|
|
79
|
+
online-mode=true
|
|
80
|
+
pvp=true
|
|
81
|
+
level-name=world
|
|
82
|
+
level-seed=
|
|
83
|
+
`,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
path: 'start.sh',
|
|
87
|
+
timestamp: now - 172800, // 2 days ago
|
|
88
|
+
type: 'file',
|
|
89
|
+
visibility: 'public',
|
|
90
|
+
size: 256,
|
|
91
|
+
dirname: '',
|
|
92
|
+
basename: 'start.sh',
|
|
93
|
+
extension: 'sh',
|
|
94
|
+
filename: 'start',
|
|
95
|
+
_contentType: 'text',
|
|
96
|
+
_content: `#!/bin/bash
|
|
97
|
+
# Server start script
|
|
98
|
+
|
|
99
|
+
java -Xmx2G -Xms1G -jar server.jar nogui
|
|
100
|
+
`,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
path: 'readme.txt',
|
|
104
|
+
timestamp: now - 3600, // 1 hour ago
|
|
105
|
+
type: 'file',
|
|
106
|
+
visibility: 'private',
|
|
107
|
+
size: 454,
|
|
108
|
+
dirname: '',
|
|
109
|
+
basename: 'readme.txt',
|
|
110
|
+
extension: 'txt',
|
|
111
|
+
filename: 'readme',
|
|
112
|
+
_contentType: 'text',
|
|
113
|
+
_content: `GameAP Debug Harness
|
|
114
|
+
====================
|
|
115
|
+
|
|
116
|
+
This is a sample text file for testing text editors.
|
|
117
|
+
You can edit this content and test the save functionality.
|
|
118
|
+
|
|
119
|
+
Line with special chars: <>&"'
|
|
120
|
+
Unicode: Hello, Мир!
|
|
121
|
+
`,
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
path: 'server.jar',
|
|
125
|
+
timestamp: now - 604800, // 1 week ago
|
|
126
|
+
type: 'file',
|
|
127
|
+
visibility: 'private',
|
|
128
|
+
size: 11197597,
|
|
129
|
+
dirname: '',
|
|
130
|
+
basename: 'server.jar',
|
|
131
|
+
extension: 'jar',
|
|
132
|
+
filename: 'server',
|
|
133
|
+
_contentType: 'binary',
|
|
134
|
+
_content: createComplexBinaryContent(),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
path: 'backup.zip',
|
|
138
|
+
timestamp: now - 7200, // 2 hours ago
|
|
139
|
+
type: 'file',
|
|
140
|
+
visibility: 'private',
|
|
141
|
+
size: 27160,
|
|
142
|
+
dirname: '',
|
|
143
|
+
basename: 'backup.zip',
|
|
144
|
+
extension: 'zip',
|
|
145
|
+
filename: 'backup',
|
|
146
|
+
_contentType: 'binary',
|
|
147
|
+
_content: createBinaryContent(),
|
|
148
|
+
},
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
// Mock directories
|
|
152
|
+
export const mockDirectories: MockDirectory[] = [
|
|
153
|
+
{
|
|
154
|
+
path: 'config',
|
|
155
|
+
timestamp: now - 86400,
|
|
156
|
+
type: 'dir',
|
|
157
|
+
visibility: 'public',
|
|
158
|
+
dirname: '',
|
|
159
|
+
basename: 'config',
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
path: 'logs',
|
|
163
|
+
timestamp: now - 3600,
|
|
164
|
+
type: 'dir',
|
|
165
|
+
visibility: 'public',
|
|
166
|
+
dirname: '',
|
|
167
|
+
basename: 'logs',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
path: 'plugins',
|
|
171
|
+
timestamp: now - 172800,
|
|
172
|
+
type: 'dir',
|
|
173
|
+
visibility: 'public',
|
|
174
|
+
dirname: '',
|
|
175
|
+
basename: 'plugins',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
path: 'world',
|
|
179
|
+
timestamp: now - 43200,
|
|
180
|
+
type: 'dir',
|
|
181
|
+
visibility: 'public',
|
|
182
|
+
dirname: '',
|
|
183
|
+
basename: 'world',
|
|
184
|
+
},
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
// Files in subdirectories
|
|
188
|
+
export const mockSubdirectoryFiles: Record<string, MockFile[]> = {
|
|
189
|
+
'config': [
|
|
190
|
+
{
|
|
191
|
+
path: 'config/config.json',
|
|
192
|
+
timestamp: now - 86400,
|
|
193
|
+
type: 'file',
|
|
194
|
+
visibility: 'private',
|
|
195
|
+
size: 256,
|
|
196
|
+
dirname: 'config',
|
|
197
|
+
basename: 'config.json',
|
|
198
|
+
extension: 'json',
|
|
199
|
+
filename: 'config',
|
|
200
|
+
_contentType: 'text',
|
|
201
|
+
_content: JSON.stringify({
|
|
202
|
+
version: '1.0.0',
|
|
203
|
+
settings: {
|
|
204
|
+
debug: true,
|
|
205
|
+
logLevel: 'info',
|
|
206
|
+
maxConnections: 100,
|
|
207
|
+
},
|
|
208
|
+
features: {
|
|
209
|
+
autoSave: true,
|
|
210
|
+
compression: false,
|
|
211
|
+
},
|
|
212
|
+
}, null, 2),
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
path: 'config/settings.yml',
|
|
216
|
+
timestamp: now - 172800,
|
|
217
|
+
type: 'file',
|
|
218
|
+
visibility: 'private',
|
|
219
|
+
size: 128,
|
|
220
|
+
dirname: 'config',
|
|
221
|
+
basename: 'settings.yml',
|
|
222
|
+
extension: 'yml',
|
|
223
|
+
filename: 'settings',
|
|
224
|
+
_contentType: 'text',
|
|
225
|
+
_content: `# Settings
|
|
226
|
+
server:
|
|
227
|
+
name: "My Server"
|
|
228
|
+
port: 25565
|
|
229
|
+
max-players: 20
|
|
230
|
+
`,
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
'logs': [
|
|
234
|
+
{
|
|
235
|
+
path: 'logs/latest.log',
|
|
236
|
+
timestamp: now - 60,
|
|
237
|
+
type: 'file',
|
|
238
|
+
visibility: 'private',
|
|
239
|
+
size: 4096,
|
|
240
|
+
dirname: 'logs',
|
|
241
|
+
basename: 'latest.log',
|
|
242
|
+
extension: 'log',
|
|
243
|
+
filename: 'latest',
|
|
244
|
+
_contentType: 'text',
|
|
245
|
+
_content: `[12:00:00] [Server thread/INFO]: Starting server...
|
|
246
|
+
[12:00:01] [Server thread/INFO]: Loading properties
|
|
247
|
+
[12:00:02] [Server thread/INFO]: Starting Minecraft server on *:25565
|
|
248
|
+
[12:00:05] [Server thread/INFO]: Done (3.245s)! For help, type "help"
|
|
249
|
+
[12:01:00] [Server thread/INFO]: Player1 joined the game
|
|
250
|
+
[12:05:30] [Server thread/INFO]: Player1 left the game
|
|
251
|
+
`,
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
'plugins': [
|
|
255
|
+
{
|
|
256
|
+
path: 'plugins/example-plugin.jar',
|
|
257
|
+
timestamp: now - 259200,
|
|
258
|
+
type: 'file',
|
|
259
|
+
visibility: 'private',
|
|
260
|
+
size: 524288,
|
|
261
|
+
dirname: 'plugins',
|
|
262
|
+
basename: 'example-plugin.jar',
|
|
263
|
+
extension: 'jar',
|
|
264
|
+
filename: 'example-plugin',
|
|
265
|
+
_contentType: 'binary',
|
|
266
|
+
_content: createBinaryContent(),
|
|
267
|
+
},
|
|
268
|
+
],
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Subdirectories in directories
|
|
272
|
+
export const mockSubdirectories: Record<string, MockDirectory[]> = {
|
|
273
|
+
'config': [],
|
|
274
|
+
'logs': [
|
|
275
|
+
{
|
|
276
|
+
path: 'logs/archive',
|
|
277
|
+
timestamp: now - 604800,
|
|
278
|
+
type: 'dir',
|
|
279
|
+
visibility: 'public',
|
|
280
|
+
dirname: 'logs',
|
|
281
|
+
basename: 'archive',
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
'plugins': [],
|
|
285
|
+
'world': [
|
|
286
|
+
{
|
|
287
|
+
path: 'world/region',
|
|
288
|
+
timestamp: now - 43200,
|
|
289
|
+
type: 'dir',
|
|
290
|
+
visibility: 'public',
|
|
291
|
+
dirname: 'world',
|
|
292
|
+
basename: 'region',
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
path: 'world/data',
|
|
296
|
+
timestamp: now - 43200,
|
|
297
|
+
type: 'dir',
|
|
298
|
+
visibility: 'public',
|
|
299
|
+
dirname: 'world',
|
|
300
|
+
basename: 'data',
|
|
301
|
+
},
|
|
302
|
+
],
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function getFileByPath(path: string): MockFile | undefined {
|
|
306
|
+
// Check root files
|
|
307
|
+
const rootFile = mockFiles.find(f => f.path === path)
|
|
308
|
+
if (rootFile) return rootFile
|
|
309
|
+
|
|
310
|
+
// Check subdirectory files
|
|
311
|
+
for (const files of Object.values(mockSubdirectoryFiles)) {
|
|
312
|
+
const file = files.find(f => f.path === path)
|
|
313
|
+
if (file) return file
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return undefined
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export function getFileContent(file: MockFile): string | ArrayBuffer {
|
|
320
|
+
return file._content || ''
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export function getFileIcon(file: MockFile): string {
|
|
324
|
+
if (file._contentType === 'binary') {
|
|
325
|
+
return 'fa-solid fa-file-code'
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
switch (file.extension) {
|
|
329
|
+
case 'json':
|
|
330
|
+
return 'fa-solid fa-file-code'
|
|
331
|
+
case 'cfg':
|
|
332
|
+
case 'properties':
|
|
333
|
+
case 'yml':
|
|
334
|
+
case 'yaml':
|
|
335
|
+
return 'fa-solid fa-file-lines'
|
|
336
|
+
case 'txt':
|
|
337
|
+
case 'log':
|
|
338
|
+
return 'fa-solid fa-file'
|
|
339
|
+
case 'jar':
|
|
340
|
+
case 'zip':
|
|
341
|
+
return 'fa-solid fa-file-zipper'
|
|
342
|
+
case 'sh':
|
|
343
|
+
return 'fa-solid fa-terminal'
|
|
344
|
+
default:
|
|
345
|
+
return 'fa-solid fa-file'
|
|
346
|
+
}
|
|
347
|
+
}
|