@minecraft-docker/mcctl-api 1.7.6
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 +142 -0
- package/dist/app.d.ts +7 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +83 -0
- package/dist/app.js.map +1 -0
- package/dist/config/index.d.ts +32 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +124 -0
- package/dist/config/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/rcon.d.ts +35 -0
- package/dist/lib/rcon.d.ts.map +1 -0
- package/dist/lib/rcon.js +90 -0
- package/dist/lib/rcon.js.map +1 -0
- package/dist/plugins/auth.d.ts +32 -0
- package/dist/plugins/auth.d.ts.map +1 -0
- package/dist/plugins/auth.js +194 -0
- package/dist/plugins/auth.js.map +1 -0
- package/dist/plugins/swagger.d.ts +170 -0
- package/dist/plugins/swagger.d.ts.map +1 -0
- package/dist/plugins/swagger.js +211 -0
- package/dist/plugins/swagger.js.map +1 -0
- package/dist/routes/auth.d.ts +12 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +144 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/backup.d.ts +9 -0
- package/dist/routes/backup.d.ts.map +1 -0
- package/dist/routes/backup.js +271 -0
- package/dist/routes/backup.js.map +1 -0
- package/dist/routes/console.d.ts +6 -0
- package/dist/routes/console.d.ts.map +1 -0
- package/dist/routes/console.js +90 -0
- package/dist/routes/console.js.map +1 -0
- package/dist/routes/players.d.ts +9 -0
- package/dist/routes/players.d.ts.map +1 -0
- package/dist/routes/players.js +353 -0
- package/dist/routes/players.js.map +1 -0
- package/dist/routes/router.d.ts +10 -0
- package/dist/routes/router.d.ts.map +1 -0
- package/dist/routes/router.js +55 -0
- package/dist/routes/router.js.map +1 -0
- package/dist/routes/servers/actions.d.ts +6 -0
- package/dist/routes/servers/actions.d.ts.map +1 -0
- package/dist/routes/servers/actions.js +65 -0
- package/dist/routes/servers/actions.js.map +1 -0
- package/dist/routes/servers.d.ts +10 -0
- package/dist/routes/servers.d.ts.map +1 -0
- package/dist/routes/servers.js +403 -0
- package/dist/routes/servers.js.map +1 -0
- package/dist/routes/worlds.d.ts +10 -0
- package/dist/routes/worlds.d.ts.map +1 -0
- package/dist/routes/worlds.js +341 -0
- package/dist/routes/worlds.js.map +1 -0
- package/dist/schemas/backup.d.ts +47 -0
- package/dist/schemas/backup.d.ts.map +1 -0
- package/dist/schemas/backup.js +43 -0
- package/dist/schemas/backup.js.map +1 -0
- package/dist/schemas/player.d.ts +46 -0
- package/dist/schemas/player.d.ts.map +1 -0
- package/dist/schemas/player.js +46 -0
- package/dist/schemas/player.js.map +1 -0
- package/dist/schemas/router.d.ts +42 -0
- package/dist/schemas/router.d.ts.map +1 -0
- package/dist/schemas/router.js +26 -0
- package/dist/schemas/router.js.map +1 -0
- package/dist/schemas/server.d.ts +139 -0
- package/dist/schemas/server.d.ts.map +1 -0
- package/dist/schemas/server.js +124 -0
- package/dist/schemas/server.js.map +1 -0
- package/dist/schemas/world.d.ts +142 -0
- package/dist/schemas/world.d.ts.map +1 -0
- package/dist/schemas/world.js +124 -0
- package/dist/schemas/world.js.map +1 -0
- package/dist/utils/docker-compose.d.ts +23 -0
- package/dist/utils/docker-compose.d.ts.map +1 -0
- package/dist/utils/docker-compose.js +100 -0
- package/dist/utils/docker-compose.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import fp from 'fastify-plugin';
|
|
2
|
+
import { containerExists, getContainerStatus } from '@minecraft-docker/shared';
|
|
3
|
+
import { PlayerInfoSchema, OnlinePlayersResponseSchema, PlayerListResponseSchema, AddPlayerRequestSchema, KickPlayerRequestSchema, PlayerActionResponseSchema, PlayerParamsSchema, UsernameParamsSchema, ErrorResponseSchema, } from '../schemas/player.js';
|
|
4
|
+
import { ServerNameParamsSchema } from '../schemas/server.js';
|
|
5
|
+
import { execRconCommand, parsePlayerList } from '../lib/rcon.js';
|
|
6
|
+
/**
|
|
7
|
+
* Player management routes plugin
|
|
8
|
+
*/
|
|
9
|
+
const playersPlugin = async (fastify) => {
|
|
10
|
+
// Helper to check server running
|
|
11
|
+
const checkServerRunning = (name, reply) => {
|
|
12
|
+
const containerName = `mc-${name}`;
|
|
13
|
+
if (!containerExists(containerName)) {
|
|
14
|
+
reply.code(404).send({ error: 'NotFound', message: `Server '${name}' not found` });
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const status = getContainerStatus(containerName);
|
|
18
|
+
if (status !== 'running') {
|
|
19
|
+
reply.code(400).send({ error: 'BadRequest', message: `Server '${name}' is not running` });
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* GET /api/servers/:name/players
|
|
26
|
+
* List online players
|
|
27
|
+
*/
|
|
28
|
+
fastify.get('/api/servers/:name/players', {
|
|
29
|
+
schema: {
|
|
30
|
+
description: 'List online players on a server',
|
|
31
|
+
tags: ['players'],
|
|
32
|
+
params: ServerNameParamsSchema,
|
|
33
|
+
response: {
|
|
34
|
+
200: OnlinePlayersResponseSchema,
|
|
35
|
+
400: ErrorResponseSchema,
|
|
36
|
+
404: ErrorResponseSchema,
|
|
37
|
+
500: ErrorResponseSchema,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}, async (request, reply) => {
|
|
41
|
+
const { name } = request.params;
|
|
42
|
+
if (!checkServerRunning(name, reply))
|
|
43
|
+
return;
|
|
44
|
+
try {
|
|
45
|
+
const result = await execRconCommand(name, 'list');
|
|
46
|
+
const parsed = parsePlayerList(result);
|
|
47
|
+
return reply.send(parsed);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
fastify.log.error(error, 'Failed to get online players');
|
|
51
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to get online players' });
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* GET /api/players/:username
|
|
56
|
+
* Get player info from Mojang API
|
|
57
|
+
*/
|
|
58
|
+
fastify.get('/api/players/:username', {
|
|
59
|
+
schema: {
|
|
60
|
+
description: 'Get player info (UUID, skin) from Mojang API',
|
|
61
|
+
tags: ['players'],
|
|
62
|
+
params: UsernameParamsSchema,
|
|
63
|
+
response: {
|
|
64
|
+
200: PlayerInfoSchema,
|
|
65
|
+
404: ErrorResponseSchema,
|
|
66
|
+
500: ErrorResponseSchema,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}, async (request, reply) => {
|
|
70
|
+
const { username } = request.params;
|
|
71
|
+
try {
|
|
72
|
+
// Fetch from Mojang API
|
|
73
|
+
const response = await fetch(`https://api.mojang.com/users/profiles/minecraft/${username}`);
|
|
74
|
+
if (response.status === 404) {
|
|
75
|
+
return reply.code(404).send({ error: 'NotFound', message: `Player '${username}' not found` });
|
|
76
|
+
}
|
|
77
|
+
if (!response.ok) {
|
|
78
|
+
throw new Error(`Mojang API returned ${response.status}`);
|
|
79
|
+
}
|
|
80
|
+
const data = await response.json();
|
|
81
|
+
// Format UUID with dashes
|
|
82
|
+
const uuid = data.id.replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, '$1-$2-$3-$4-$5');
|
|
83
|
+
return reply.send({
|
|
84
|
+
username: data.name,
|
|
85
|
+
uuid,
|
|
86
|
+
skinUrl: `https://crafatar.com/avatars/${data.id}?overlay`,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
fastify.log.error(error, 'Failed to get player info');
|
|
91
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to get player info' });
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
// ==================== WHITELIST ====================
|
|
95
|
+
/**
|
|
96
|
+
* GET /api/servers/:name/whitelist
|
|
97
|
+
*/
|
|
98
|
+
fastify.get('/api/servers/:name/whitelist', {
|
|
99
|
+
schema: {
|
|
100
|
+
description: 'Get server whitelist',
|
|
101
|
+
tags: ['players'],
|
|
102
|
+
params: ServerNameParamsSchema,
|
|
103
|
+
response: { 200: PlayerListResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
104
|
+
},
|
|
105
|
+
}, async (request, reply) => {
|
|
106
|
+
const { name } = request.params;
|
|
107
|
+
if (!checkServerRunning(name, reply))
|
|
108
|
+
return;
|
|
109
|
+
try {
|
|
110
|
+
const result = await execRconCommand(name, 'whitelist list');
|
|
111
|
+
// Parse: "There are N whitelisted players: player1, player2"
|
|
112
|
+
const match = result.match(/:\s*(.*)$/);
|
|
113
|
+
const players = match && match[1] ? match[1].split(',').map(p => p.trim()).filter(Boolean) : [];
|
|
114
|
+
return reply.send({ players, total: players.length });
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
fastify.log.error(error, 'Failed to get whitelist');
|
|
118
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to get whitelist' });
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
/**
|
|
122
|
+
* POST /api/servers/:name/whitelist
|
|
123
|
+
*/
|
|
124
|
+
fastify.post('/api/servers/:name/whitelist', {
|
|
125
|
+
schema: {
|
|
126
|
+
description: 'Add player to whitelist',
|
|
127
|
+
tags: ['players'],
|
|
128
|
+
params: ServerNameParamsSchema,
|
|
129
|
+
body: AddPlayerRequestSchema,
|
|
130
|
+
response: { 200: PlayerActionResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
131
|
+
},
|
|
132
|
+
}, async (request, reply) => {
|
|
133
|
+
const { name } = request.params;
|
|
134
|
+
const { player } = request.body;
|
|
135
|
+
if (!checkServerRunning(name, reply))
|
|
136
|
+
return;
|
|
137
|
+
try {
|
|
138
|
+
const result = await execRconCommand(name, `whitelist add ${player}`);
|
|
139
|
+
return reply.send({ success: true, message: result || `Added ${player} to whitelist` });
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
fastify.log.error(error, 'Failed to add to whitelist');
|
|
143
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to add to whitelist' });
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
/**
|
|
147
|
+
* DELETE /api/servers/:name/whitelist/:player
|
|
148
|
+
*/
|
|
149
|
+
fastify.delete('/api/servers/:name/whitelist/:player', {
|
|
150
|
+
schema: {
|
|
151
|
+
description: 'Remove player from whitelist',
|
|
152
|
+
tags: ['players'],
|
|
153
|
+
params: PlayerParamsSchema,
|
|
154
|
+
response: { 200: PlayerActionResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
155
|
+
},
|
|
156
|
+
}, async (request, reply) => {
|
|
157
|
+
const { name, player } = request.params;
|
|
158
|
+
if (!checkServerRunning(name, reply))
|
|
159
|
+
return;
|
|
160
|
+
try {
|
|
161
|
+
const result = await execRconCommand(name, `whitelist remove ${player}`);
|
|
162
|
+
return reply.send({ success: true, message: result || `Removed ${player} from whitelist` });
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
fastify.log.error(error, 'Failed to remove from whitelist');
|
|
166
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to remove from whitelist' });
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
// ==================== BANS ====================
|
|
170
|
+
/**
|
|
171
|
+
* GET /api/servers/:name/bans
|
|
172
|
+
*/
|
|
173
|
+
fastify.get('/api/servers/:name/bans', {
|
|
174
|
+
schema: {
|
|
175
|
+
description: 'Get banned players list',
|
|
176
|
+
tags: ['players'],
|
|
177
|
+
params: ServerNameParamsSchema,
|
|
178
|
+
response: { 200: PlayerListResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
179
|
+
},
|
|
180
|
+
}, async (request, reply) => {
|
|
181
|
+
const { name } = request.params;
|
|
182
|
+
if (!checkServerRunning(name, reply))
|
|
183
|
+
return;
|
|
184
|
+
try {
|
|
185
|
+
const result = await execRconCommand(name, 'banlist players');
|
|
186
|
+
// Parse: "There are N bans: player1, player2" or "There are no bans"
|
|
187
|
+
const match = result.match(/:\s*(.*)$/);
|
|
188
|
+
const players = match && match[1] ? match[1].split(',').map(p => p.trim()).filter(Boolean) : [];
|
|
189
|
+
return reply.send({ players, total: players.length });
|
|
190
|
+
}
|
|
191
|
+
catch (error) {
|
|
192
|
+
fastify.log.error(error, 'Failed to get ban list');
|
|
193
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to get ban list' });
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
/**
|
|
197
|
+
* POST /api/servers/:name/bans
|
|
198
|
+
*/
|
|
199
|
+
fastify.post('/api/servers/:name/bans', {
|
|
200
|
+
schema: {
|
|
201
|
+
description: 'Ban a player',
|
|
202
|
+
tags: ['players'],
|
|
203
|
+
params: ServerNameParamsSchema,
|
|
204
|
+
body: AddPlayerRequestSchema,
|
|
205
|
+
response: { 200: PlayerActionResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
206
|
+
},
|
|
207
|
+
}, async (request, reply) => {
|
|
208
|
+
const { name } = request.params;
|
|
209
|
+
const { player, reason } = request.body;
|
|
210
|
+
if (!checkServerRunning(name, reply))
|
|
211
|
+
return;
|
|
212
|
+
try {
|
|
213
|
+
const cmd = reason ? `ban ${player} ${reason}` : `ban ${player}`;
|
|
214
|
+
const result = await execRconCommand(name, cmd);
|
|
215
|
+
return reply.send({ success: true, message: result || `Banned ${player}` });
|
|
216
|
+
}
|
|
217
|
+
catch (error) {
|
|
218
|
+
fastify.log.error(error, 'Failed to ban player');
|
|
219
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to ban player' });
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
/**
|
|
223
|
+
* DELETE /api/servers/:name/bans/:player
|
|
224
|
+
*/
|
|
225
|
+
fastify.delete('/api/servers/:name/bans/:player', {
|
|
226
|
+
schema: {
|
|
227
|
+
description: 'Unban a player',
|
|
228
|
+
tags: ['players'],
|
|
229
|
+
params: PlayerParamsSchema,
|
|
230
|
+
response: { 200: PlayerActionResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
231
|
+
},
|
|
232
|
+
}, async (request, reply) => {
|
|
233
|
+
const { name, player } = request.params;
|
|
234
|
+
if (!checkServerRunning(name, reply))
|
|
235
|
+
return;
|
|
236
|
+
try {
|
|
237
|
+
const result = await execRconCommand(name, `pardon ${player}`);
|
|
238
|
+
return reply.send({ success: true, message: result || `Unbanned ${player}` });
|
|
239
|
+
}
|
|
240
|
+
catch (error) {
|
|
241
|
+
fastify.log.error(error, 'Failed to unban player');
|
|
242
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to unban player' });
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
// ==================== KICK ====================
|
|
246
|
+
/**
|
|
247
|
+
* POST /api/servers/:name/kick
|
|
248
|
+
*/
|
|
249
|
+
fastify.post('/api/servers/:name/kick', {
|
|
250
|
+
schema: {
|
|
251
|
+
description: 'Kick a player from the server',
|
|
252
|
+
tags: ['players'],
|
|
253
|
+
params: ServerNameParamsSchema,
|
|
254
|
+
body: KickPlayerRequestSchema,
|
|
255
|
+
response: { 200: PlayerActionResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
256
|
+
},
|
|
257
|
+
}, async (request, reply) => {
|
|
258
|
+
const { name } = request.params;
|
|
259
|
+
const { player, reason } = request.body;
|
|
260
|
+
if (!checkServerRunning(name, reply))
|
|
261
|
+
return;
|
|
262
|
+
try {
|
|
263
|
+
const cmd = reason ? `kick ${player} ${reason}` : `kick ${player}`;
|
|
264
|
+
const result = await execRconCommand(name, cmd);
|
|
265
|
+
return reply.send({ success: true, message: result || `Kicked ${player}` });
|
|
266
|
+
}
|
|
267
|
+
catch (error) {
|
|
268
|
+
fastify.log.error(error, 'Failed to kick player');
|
|
269
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to kick player' });
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
// ==================== OPERATORS ====================
|
|
273
|
+
/**
|
|
274
|
+
* GET /api/servers/:name/ops
|
|
275
|
+
*/
|
|
276
|
+
fastify.get('/api/servers/:name/ops', {
|
|
277
|
+
schema: {
|
|
278
|
+
description: 'Get server operators list',
|
|
279
|
+
tags: ['players'],
|
|
280
|
+
params: ServerNameParamsSchema,
|
|
281
|
+
response: { 200: PlayerListResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
282
|
+
},
|
|
283
|
+
}, async (request, reply) => {
|
|
284
|
+
const { name } = request.params;
|
|
285
|
+
if (!checkServerRunning(name, reply))
|
|
286
|
+
return;
|
|
287
|
+
try {
|
|
288
|
+
const result = await execRconCommand(name, 'op list');
|
|
289
|
+
// Parse: "There are N ops: player1, player2"
|
|
290
|
+
const match = result.match(/:\s*(.*)$/);
|
|
291
|
+
const players = match && match[1] ? match[1].split(',').map(p => p.trim()).filter(Boolean) : [];
|
|
292
|
+
return reply.send({ players, total: players.length });
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
fastify.log.error(error, 'Failed to get ops list');
|
|
296
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to get ops list' });
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
/**
|
|
300
|
+
* POST /api/servers/:name/ops
|
|
301
|
+
*/
|
|
302
|
+
fastify.post('/api/servers/:name/ops', {
|
|
303
|
+
schema: {
|
|
304
|
+
description: 'Add player as operator',
|
|
305
|
+
tags: ['players'],
|
|
306
|
+
params: ServerNameParamsSchema,
|
|
307
|
+
body: AddPlayerRequestSchema,
|
|
308
|
+
response: { 200: PlayerActionResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
309
|
+
},
|
|
310
|
+
}, async (request, reply) => {
|
|
311
|
+
const { name } = request.params;
|
|
312
|
+
const { player } = request.body;
|
|
313
|
+
if (!checkServerRunning(name, reply))
|
|
314
|
+
return;
|
|
315
|
+
try {
|
|
316
|
+
const result = await execRconCommand(name, `op ${player}`);
|
|
317
|
+
return reply.send({ success: true, message: result || `Made ${player} an operator` });
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
fastify.log.error(error, 'Failed to add operator');
|
|
321
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to add operator' });
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
/**
|
|
325
|
+
* DELETE /api/servers/:name/ops/:player
|
|
326
|
+
*/
|
|
327
|
+
fastify.delete('/api/servers/:name/ops/:player', {
|
|
328
|
+
schema: {
|
|
329
|
+
description: 'Remove player operator status',
|
|
330
|
+
tags: ['players'],
|
|
331
|
+
params: PlayerParamsSchema,
|
|
332
|
+
response: { 200: PlayerActionResponseSchema, 400: ErrorResponseSchema, 404: ErrorResponseSchema, 500: ErrorResponseSchema },
|
|
333
|
+
},
|
|
334
|
+
}, async (request, reply) => {
|
|
335
|
+
const { name, player } = request.params;
|
|
336
|
+
if (!checkServerRunning(name, reply))
|
|
337
|
+
return;
|
|
338
|
+
try {
|
|
339
|
+
const result = await execRconCommand(name, `deop ${player}`);
|
|
340
|
+
return reply.send({ success: true, message: result || `Removed operator status from ${player}` });
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
fastify.log.error(error, 'Failed to remove operator');
|
|
344
|
+
return reply.code(500).send({ error: 'InternalServerError', message: 'Failed to remove operator' });
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
};
|
|
348
|
+
export default fp(playersPlugin, {
|
|
349
|
+
name: 'players-routes',
|
|
350
|
+
fastify: '5.x',
|
|
351
|
+
});
|
|
352
|
+
export { playersPlugin };
|
|
353
|
+
//# sourceMappingURL=players.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"players.js","sourceRoot":"","sources":["../../src/routes/players.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,gBAAgB,EAChB,2BAA2B,EAC3B,wBAAwB,EACxB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,GAKpB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAyB,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAyBlE;;GAEG;AACH,MAAM,aAAa,GAAuB,KAAK,EAAE,OAAwB,EAAE,EAAE;IAE3E,iCAAiC;IACjC,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAE,KAAmB,EAAW,EAAE;QACxE,MAAM,aAAa,GAAG,MAAM,IAAI,EAAE,CAAC;QACnC,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,CAAC,CAAC;YACnF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,MAAM,MAAM,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;QACjD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,IAAI,kBAA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,EAAE,KAAmB,EAAE,EAAE;QACrE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;QACxC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC;YAAE,OAAO;QAE7C,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,IAAI,EAAE,QAAQ,MAAM,EAAE,CAAC,CAAC;YAC7D,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,IAAI,gCAAgC,MAAM,EAAE,EAAE,CAAC,CAAC;QACpG,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC;YACtD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,2BAA2B,EAAE,CAAC,CAAC;QACtG,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC,aAAa,EAAE;IAC/B,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,KAAK;CACf,CAAC,CAAC;AAEH,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FastifyPluginAsync } from 'fastify';
|
|
2
|
+
/**
|
|
3
|
+
* Router routes plugin
|
|
4
|
+
* Provides REST API for mc-router status
|
|
5
|
+
*/
|
|
6
|
+
declare const routerPlugin: FastifyPluginAsync;
|
|
7
|
+
declare const _default: FastifyPluginAsync;
|
|
8
|
+
export default _default;
|
|
9
|
+
export { routerPlugin };
|
|
10
|
+
//# sourceMappingURL=router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/routes/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAS9D;;;GAGG;AACH,QAAA,MAAM,YAAY,EAAE,kBA0CnB,CAAC;;AAEF,wBAGG;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import fp from 'fastify-plugin';
|
|
2
|
+
import { getRouterDetailInfo } from '@minecraft-docker/shared';
|
|
3
|
+
import { RouterStatusResponseSchema, ErrorResponseSchema, } from '../schemas/router.js';
|
|
4
|
+
/**
|
|
5
|
+
* Router routes plugin
|
|
6
|
+
* Provides REST API for mc-router status
|
|
7
|
+
*/
|
|
8
|
+
const routerPlugin = async (fastify) => {
|
|
9
|
+
/**
|
|
10
|
+
* GET /api/router/status
|
|
11
|
+
* Get mc-router status and routes
|
|
12
|
+
*/
|
|
13
|
+
fastify.get('/api/router/status', {
|
|
14
|
+
schema: {
|
|
15
|
+
description: 'Get mc-router status including all routes',
|
|
16
|
+
tags: ['router'],
|
|
17
|
+
response: {
|
|
18
|
+
200: RouterStatusResponseSchema,
|
|
19
|
+
500: ErrorResponseSchema,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
}, async (_request, reply) => {
|
|
23
|
+
try {
|
|
24
|
+
const info = getRouterDetailInfo();
|
|
25
|
+
const router = {
|
|
26
|
+
name: info.name,
|
|
27
|
+
status: info.status,
|
|
28
|
+
health: info.health,
|
|
29
|
+
port: info.port,
|
|
30
|
+
uptime: info.uptime,
|
|
31
|
+
uptimeSeconds: info.uptimeSeconds,
|
|
32
|
+
mode: info.mode,
|
|
33
|
+
routes: info.routes.map((route) => ({
|
|
34
|
+
hostname: route.hostname,
|
|
35
|
+
target: route.target,
|
|
36
|
+
serverStatus: route.serverStatus,
|
|
37
|
+
})),
|
|
38
|
+
};
|
|
39
|
+
return reply.send({ router });
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
fastify.log.error(error, 'Failed to get router status');
|
|
43
|
+
return reply.code(500).send({
|
|
44
|
+
error: 'InternalServerError',
|
|
45
|
+
message: 'Failed to get router status',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
export default fp(routerPlugin, {
|
|
51
|
+
name: 'router-routes',
|
|
52
|
+
fastify: '5.x',
|
|
53
|
+
});
|
|
54
|
+
export { routerPlugin };
|
|
55
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/routes/router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,GAEpB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,MAAM,YAAY,GAAuB,KAAK,EAAE,OAAwB,EAAE,EAAE;IAC1E;;;OAGG;IACH,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE;QAChC,MAAM,EAAE;YACN,WAAW,EAAE,2CAA2C;YACxD,IAAI,EAAE,CAAC,QAAQ,CAAC;YAChB,QAAQ,EAAE;gBACR,GAAG,EAAE,0BAA0B;gBAC/B,GAAG,EAAE,mBAAmB;aACzB;SACF;KACF,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE;QAC3B,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,mBAAmB,EAAE,CAAC;YAEnC,MAAM,MAAM,GAAiB;gBAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;oBAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ;oBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;oBACpB,YAAY,EAAE,KAAK,CAAC,YAAY;iBACjC,CAAC,CAAC;aACJ,CAAC;YAEF,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;QAChC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,6BAA6B,CAAC,CAAC;YACxD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBAC1B,KAAK,EAAE,qBAAqB;gBAC5B,OAAO,EAAE,6BAA6B;aACvC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,eAAe,EAAE,CAAC,YAAY,EAAE;IAC9B,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,KAAK;CACf,CAAC,CAAC;AAEH,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../src/routes/servers/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,kBAAkB,EAAgC,MAAM,SAAS,CAAC;AA6E5F,QAAA,MAAM,mBAAmB,EAAE,kBAwB1B,CAAC;;AAMF,wBAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import fp from 'fastify-plugin';
|
|
2
|
+
import { isValidServerName, sanitizeServerName, executeServerAction, } from '../../utils/docker-compose.js';
|
|
3
|
+
// ============================================================
|
|
4
|
+
// Route Handlers
|
|
5
|
+
// ============================================================
|
|
6
|
+
async function handleServerAction(request, reply, action) {
|
|
7
|
+
const serverName = sanitizeServerName(request.params.name);
|
|
8
|
+
// Validate server name
|
|
9
|
+
if (!isValidServerName(serverName)) {
|
|
10
|
+
reply.code(400);
|
|
11
|
+
return {
|
|
12
|
+
success: false,
|
|
13
|
+
server: serverName,
|
|
14
|
+
action,
|
|
15
|
+
timestamp: new Date().toISOString(),
|
|
16
|
+
error: 'Invalid server name. Server name must start with a letter or number and contain only alphanumeric characters, hyphens, or underscores.',
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
// Execute the action
|
|
20
|
+
const result = await executeServerAction(serverName, action);
|
|
21
|
+
if (!result.success) {
|
|
22
|
+
reply.code(500);
|
|
23
|
+
return {
|
|
24
|
+
success: false,
|
|
25
|
+
server: serverName,
|
|
26
|
+
action,
|
|
27
|
+
timestamp: new Date().toISOString(),
|
|
28
|
+
error: result.error ?? 'Failed to execute action',
|
|
29
|
+
message: result.stderr,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
success: true,
|
|
34
|
+
server: serverName,
|
|
35
|
+
action,
|
|
36
|
+
timestamp: new Date().toISOString(),
|
|
37
|
+
message: result.stdout,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// ============================================================
|
|
41
|
+
// Plugin Definition
|
|
42
|
+
// ============================================================
|
|
43
|
+
const serverActionsPlugin = async (fastify) => {
|
|
44
|
+
// POST /api/servers/:name/start
|
|
45
|
+
fastify.post('/api/servers/:name/start', async (request, reply) => {
|
|
46
|
+
return handleServerAction(request, reply, 'start');
|
|
47
|
+
});
|
|
48
|
+
// POST /api/servers/:name/stop
|
|
49
|
+
fastify.post('/api/servers/:name/stop', async (request, reply) => {
|
|
50
|
+
return handleServerAction(request, reply, 'stop');
|
|
51
|
+
});
|
|
52
|
+
// POST /api/servers/:name/restart
|
|
53
|
+
fastify.post('/api/servers/:name/restart', async (request, reply) => {
|
|
54
|
+
return handleServerAction(request, reply, 'restart');
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
// ============================================================
|
|
58
|
+
// Export
|
|
59
|
+
// ============================================================
|
|
60
|
+
export default fp(serverActionsPlugin, {
|
|
61
|
+
name: 'server-actions-routes',
|
|
62
|
+
fastify: '5.x',
|
|
63
|
+
});
|
|
64
|
+
export { serverActionsPlugin };
|
|
65
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../src/routes/servers/actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAChC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,+BAA+B,CAAC;AAmBvC,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAE/D,KAAK,UAAU,kBAAkB,CAC/B,OAAqD,EACrD,KAAmB,EACnB,MAAoB;IAEpB,MAAM,UAAU,GAAG,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE3D,uBAAuB;IACvB,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,UAAU;YAClB,MAAM;YACN,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,KAAK,EAAE,wIAAwI;SAChJ,CAAC;IACJ,CAAC;IAED,qBAAqB;IACrB,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;IAE7D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,UAAU;YAClB,MAAM;YACN,SAAS,EAAE,IAA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10 @@
|
|
|
1
|
+
import { FastifyPluginAsync } from 'fastify';
|
|
2
|
+
/**
|
|
3
|
+
* Server routes plugin
|
|
4
|
+
* Provides REST API for Minecraft server management
|
|
5
|
+
*/
|
|
6
|
+
declare const serversPlugin: FastifyPluginAsync;
|
|
7
|
+
declare const _default: FastifyPluginAsync;
|
|
8
|
+
export default _default;
|
|
9
|
+
export { serversPlugin };
|
|
10
|
+
//# sourceMappingURL=servers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"servers.d.ts","sourceRoot":"","sources":["../../src/routes/servers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,kBAAkB,EAAgC,MAAM,SAAS,CAAC;AAiE5F;;;GAGG;AACH,QAAA,MAAM,aAAa,EAAE,kBAiapB,CAAC;;AAEF,wBAGG;AAEH,OAAO,EAAE,aAAa,EAAE,CAAC"}
|