mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-09-27 20:02:01 +02:00
CLI consolidation: - Delete 13 legacy CLI scripts from includes/cli/ (ondemand, proxy, queue, record, scanner, signals, startup, thumbnail, tools, update, watchdog, plex_item, watch_item) - Convert status and tools entry points to thin proxies that delegate to console.php - Update all shell_exec() calls across admin controllers, views, and API layer to use console.php command syntax instead of direct CLI file paths - Update src/service to launch daemons via console.php (signals, watchdog, queue, cache_handler, startup) - Update Python src/update script to call console.php update instead of includes/cli/update.php - Update test_installer to use console.php startup Streaming deduplication: - Extract StreamAuthMiddleware — common response headers and token decryption shared by live/vod/timeshift - Extract ShutdownHandler — unified shutdown logic replacing 3 duplicate function shutdown() blocks - Refactor live.php, vod.php, timeshift.php to use new middleware classes - Add streaming micro-router to www/stream/index.php as fallback entry point Routing fixes: - Fix admin index.php redirect to use relative path (supports access code prefixes) - Add access code root redirect in public/index.php to prevent broken CSS/JS asset resolution - Fix init.php for CLI compatibility: guard $_SERVER access, define PHP_ERRORS safely Migrations: - 001_update_crontab_filenames.sql — strip .php suffix from crontab filenames - Fix cache.php view query to match new filename format (cache_engine instead of cache_engine.php)
34 lines
1.0 KiB
Markdown
34 lines
1.0 KiB
Markdown
---
|
|
description: "Use when writing or editing shell scripts in tools/, src/bin/, or src/infrastructure/. Covers bash conventions for XC_VM."
|
|
applyTo: "**/*.sh"
|
|
---
|
|
# Bash Script Conventions — XC_VM
|
|
|
|
## Required Header
|
|
```bash
|
|
#!/bin/bash
|
|
set -euo pipefail
|
|
```
|
|
|
|
## Style
|
|
- Indent with 4 spaces (not tabs — unlike PHP)
|
|
- Quote all variables: `"$var"` not `$var`
|
|
- Use `[[ ]]` for conditionals, not `[ ]`
|
|
- Use `$()` for command substitution, not backticks
|
|
|
|
## Error Handling
|
|
- `set -e` — exit on first error
|
|
- `set -u` — treat unset variables as error
|
|
- `set -o pipefail` — catch errors in pipes
|
|
- Use `trap` for cleanup on exit when creating temp files
|
|
|
|
## Security
|
|
- Never pass secrets via command-line arguments (visible in `ps`)
|
|
- Use environment variables or files with restricted permissions (0600)
|
|
- Validate external input before using in commands
|
|
- Avoid `eval` unless absolutely necessary
|
|
|
|
## Paths
|
|
- Use absolute paths for system binaries: `/usr/bin/php8.1`, `/usr/sbin/nginx`
|
|
- Reference project root via variable, not hardcoded paths
|