@minecraft-docker/mcctl 2.1.3 → 2.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft-docker/mcctl",
3
- "version": "2.1.3",
3
+ "version": "2.3.0",
4
4
  "description": "CLI tool for managing Docker Minecraft servers with mc-router",
5
5
  "type": "module",
6
6
  "bin": {
@@ -55,8 +55,8 @@
55
55
  ],
56
56
  "dependencies": {
57
57
  "@clack/prompts": "^0.8.0",
58
- "@minecraft-docker/mod-source-modrinth": "^2.1.3",
59
- "@minecraft-docker/shared": "^2.1.3",
58
+ "@minecraft-docker/mod-source-modrinth": "^2.3.0",
59
+ "@minecraft-docker/shared": "^2.3.0",
60
60
  "better-sqlite3": "^12.6.2",
61
61
  "commander": "^12.0.0",
62
62
  "js-yaml": "^4.1.0",
@@ -21,8 +21,12 @@
21
21
  # --modpack SLUG Modpack slug (required for MODRINTH/AUTO_CURSEFORGE)
22
22
  # --modpack-version VER Modpack version (optional)
23
23
  # --mod-loader LOADER Mod loader: fabric, forge, neoforge, quilt (optional)
24
+ # --no-whitelist Disable whitelist (whitelist is enabled by default)
25
+ # --whitelist PLAYERS Initial whitelist players (comma-separated)
24
26
  # --no-start Don't start the server after creation
25
27
  # --start Start the server after creation (default)
28
+ # --playit-domain DOMAIN Register playit.gg external domain (e.g., aa.example.com)
29
+ # --no-playit-domain Skip playit domain registration (explicit)
26
30
  #
27
31
  # World options are mutually exclusive (only one can be specified).
28
32
  #
@@ -33,6 +37,7 @@
33
37
  # ./scripts/create-server.sh myserver --seed 12345 --no-start
34
38
  # ./scripts/create-server.sh myserver --world-url https://example.com/world.zip
35
39
  # ./scripts/create-server.sh myserver --world existing-world --version 1.21.1
40
+ # ./scripts/create-server.sh myserver --playit-domain aa.example.com
36
41
  # =============================================================================
37
42
 
38
43
  set -e
@@ -154,6 +159,11 @@ build_hostnames() {
154
159
  done
155
160
  fi
156
161
 
162
+ # Add playit domain if set
163
+ if [ -n "${PLAYIT_DOMAIN:-}" ]; then
164
+ hostnames="$hostnames,$PLAYIT_DOMAIN"
165
+ fi
166
+
157
167
  echo "$hostnames"
158
168
  }
159
169
 
@@ -229,7 +239,11 @@ WORLD_NAME=""
229
239
  MODPACK_SLUG=""
230
240
  MODPACK_VERSION=""
231
241
  MOD_LOADER=""
242
+ ENABLE_WHITELIST="true"
243
+ WHITELIST_PLAYERS=""
232
244
  START_SERVER="true"
245
+ PLAYIT_DOMAIN=""
246
+ NO_PLAYIT_DOMAIN="false"
233
247
 
234
248
  # Show usage
235
249
  show_usage() {
@@ -247,8 +261,12 @@ show_usage() {
247
261
  echo " --modpack SLUG Modpack slug (required for MODRINTH/AUTO_CURSEFORGE)"
248
262
  echo " --modpack-version VER Modpack version (optional)"
249
263
  echo " --mod-loader LOADER Mod loader: fabric, forge, neoforge, quilt (optional)"
264
+ echo " --no-whitelist Disable whitelist (whitelist is enabled by default)"
265
+ echo " --whitelist PLAYERS Initial whitelist players (comma-separated)"
250
266
  echo " --no-start Don't start the server after creation"
251
267
  echo " --start Start the server after creation (default)"
268
+ echo " --playit-domain DOMAIN Register playit.gg external domain (e.g., aa.example.com)"
269
+ echo " --no-playit-domain Skip playit domain registration (explicit)"
252
270
  echo ""
253
271
  echo "World options (--seed, --world-url, --world) are mutually exclusive."
254
272
  echo ""
@@ -260,6 +278,7 @@ show_usage() {
260
278
  echo " $0 myserver --world-url https://example.com/world.zip"
261
279
  echo " $0 myserver --world existing-world -v 1.21.1 --no-start"
262
280
  echo " $0 myserver -t MODRINTH --modpack fabric-example --modpack-version 1.0.0"
281
+ echo " $0 myserver --playit-domain aa.example.com"
263
282
  }
264
283
 
265
284
  # Check if first argument exists
@@ -309,6 +328,14 @@ while [[ $# -gt 0 ]]; do
309
328
  MOD_LOADER="$2"
310
329
  shift 2
311
330
  ;;
331
+ --no-whitelist)
332
+ ENABLE_WHITELIST="false"
333
+ shift
334
+ ;;
335
+ --whitelist)
336
+ WHITELIST_PLAYERS="$2"
337
+ shift 2
338
+ ;;
312
339
  --no-start)
313
340
  START_SERVER="false"
314
341
  shift
@@ -317,6 +344,14 @@ while [[ $# -gt 0 ]]; do
317
344
  START_SERVER="true"
318
345
  shift
319
346
  ;;
347
+ --playit-domain)
348
+ PLAYIT_DOMAIN="$2"
349
+ shift 2
350
+ ;;
351
+ --no-playit-domain)
352
+ NO_PLAYIT_DOMAIN="true"
353
+ shift
354
+ ;;
320
355
  -h|--help)
321
356
  show_usage
322
357
  exit 0
@@ -501,6 +536,27 @@ if [ -f "$CONFIG_FILE" ]; then
501
536
  fi
502
537
  fi
503
538
  fi
539
+
540
+ # Apply whitelist settings (enabled by default for security)
541
+ if [ "$ENABLE_WHITELIST" = "true" ]; then
542
+ echo "" >> "$CONFIG_FILE"
543
+ echo "# Whitelist (Secure by Default)" >> "$CONFIG_FILE"
544
+ echo "ENABLE_WHITELIST=TRUE" >> "$CONFIG_FILE"
545
+ if [ -n "$WHITELIST_PLAYERS" ]; then
546
+ echo "WHITELIST=$WHITELIST_PLAYERS" >> "$CONFIG_FILE"
547
+ echo " Whitelist: enabled (players: $WHITELIST_PLAYERS)"
548
+ else
549
+ echo " Whitelist: enabled (no initial players)"
550
+ fi
551
+ fi
552
+
553
+ # Apply playit.gg domain if provided
554
+ if [ -n "$PLAYIT_DOMAIN" ]; then
555
+ echo "" >> "$CONFIG_FILE"
556
+ echo "# playit.gg External Domain" >> "$CONFIG_FILE"
557
+ echo "PLAYIT_DOMAIN=$PLAYIT_DOMAIN" >> "$CONFIG_FILE"
558
+ echo " playit.gg domain: $PLAYIT_DOMAIN"
559
+ fi
504
560
  fi
505
561
 
506
562
  # Create data and logs directories
@@ -598,6 +654,17 @@ if [ -n "$WORLD_SEED" ]; then
598
654
  fi
599
655
  echo ""
600
656
 
657
+ echo -e "${GREEN}Security:${NC}"
658
+ if [ "$ENABLE_WHITELIST" = "true" ]; then
659
+ echo " - Whitelist: enabled"
660
+ if [ -n "$WHITELIST_PLAYERS" ]; then
661
+ echo " - Players: $WHITELIST_PLAYERS"
662
+ fi
663
+ else
664
+ echo " - Whitelist: disabled"
665
+ fi
666
+ echo ""
667
+
601
668
  echo -e "${GREEN}Server details:${NC}"
602
669
  echo " - Directory: servers/$SERVER_NAME/"
603
670
  echo " - Service: mc-$SERVER_NAME"
@@ -88,10 +88,15 @@ MOTD=Welcome! Your adventure begins here.
88
88
  # - none: Don't download dependencies (manual management)
89
89
  MODRINTH_DOWNLOAD_DEPENDENCIES=required
90
90
 
91
+ # -----------------------------------------------------------------------------
92
+ # Whitelist (Secure by Default)
93
+ # -----------------------------------------------------------------------------
94
+ ENABLE_WHITELIST=TRUE
95
+ # WHITELIST=player1,player2
96
+ # OPS=admin1,admin2
97
+
91
98
  # -----------------------------------------------------------------------------
92
99
  # Optional: Advanced
93
100
  # -----------------------------------------------------------------------------
94
101
  # USE_AIKAR_FLAGS=true
95
102
  # ICON=https://example.com/icon.png
96
- # WHITELIST=player1,player2
97
- # OPS=admin1,admin2