diff --git a/README.md b/README.md index 8cfff11..9bfc853 100755 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ [![Discord](https://img.shields.io/badge/Discord-Join%20Server-5865F2?style=flat&logo=discord&logoColor=white)](https://discord.gg/pP6HyZedAj) [![Laravel](https://img.shields.io/badge/Laravel-13.x-FF2D20?style=flat&logo=laravel&logoColor=white)](https://laravel.com) [![PHP](https://img.shields.io/badge/PHP-8.1+-777BB4?style=flat&logo=php&logoColor=white)](https://php.net) -[![Code Quality](https://img.shields.io/badge/Code%20Quality-A+-green?style=flat)](https://github.com/atom-retros/atomcms) @@ -18,6 +17,18 @@ ## Features +### Commandocentrum (Admin Panel) +- **Nitro V3 Update** — One-click update system for Emulator, Nitro-V3, and Nitro_Render_V3 +- **Configurable paths** — All directories (emulator, nitro client, renderer, gamedata, SQL, backups) configurable via the Housekeeping UI, stored in the database +- **Emulator control** — Start, stop, restart, and check emulator status +- **Hotel alert** — Send messages to all online users +- **Live monitoring** — Online users, emulator status, database status, server load, system diagnostics +- **Emulator logs viewer** — Live log viewer +- **Clothing sync** — Sync catalog clothing from FigureMap +- **Notification settings** — Email & Discord alerts with rank-based filtering +- **Social login** — Google, Discord, GitHub OAuth configuration +- **Staff activity log** — Track recent housekeeping actions + ### Radio Station - DJ applications & rank system - Live DJ sessions with schedule @@ -45,8 +56,6 @@ ### Hotel Client - Nitro (HTML5) client support -- Flash client support -- FindRetros integration - VPN/proxy checker ### User System @@ -77,16 +86,60 @@ - Website navigation & settings - Camera/photo management -### API Endpoints -- `GET /api/user/{username}` — Fetch user data -- `GET /api/online-users` — Online users list -- `GET /api/online-count` — Online user count -- `GET /api/radio/current-dj` — Current DJ info -- `GET /api/radio/now-playing` — Current song -- `GET /api/radio/listeners` — Listener count -- `GET /api/radio/shouts` — Recent shouts -- `GET /api/radio/points` — Points data -- `GET /api/radio/points/leaderboard` — Points leaderboard +--- + +## Nitro V3 Update System + +The **Commandocentrum** page in the Filament admin panel provides a one-click update system for your entire retro hotel stack. + +### How It Works + +1. **Configure paths** — Click "Configureer Paths" to set directories for your emulator, Nitro-V3 client, Nitro_Render_V3, Gamedata, SQL updates, and backups. Paths are stored in the database and editable at any time. +2. **Run Update** — Click "Run Update" to execute `update-Nitrov3.sh`, which performs: + - `git pull` on the emulator source + - Automatic database backup via `mariadb-dump` + - Import new SQL update files + - Maven build (`mvn package`) + - Update the emulator launch script to point to the newly built JAR + - `git pull` on Nitro_Render_V3 (with automatic `yarn install` if `package.json` changed) + - `git pull` on Nitro-V3 (with automatic `yarn install` if `package.json` changed) + - `yarn build` for Nitro-V3 + - Sync Gamedata configuration files (renderer-config, ui-config, UITexts) + - Cleanup old emulator logs (14+ days) and database backups (keep last 5) + - Clear Yarn cache + - Fix filesystem permissions + - Restart the emulator service + +### Sudo Configuration + +The update script requires `sudo` access for `www-data` to restart the emulator service and fix permissions. Add this sudoers file: + +```bash +sudo tee /etc/sudoers.d/www-data << 'EOF' +www-data ALL=(ALL) NOPASSWD: /usr/bin/systemctl restart emulator +www-data ALL=(ALL) NOPASSWD: /usr/bin/systemctl status emulator +www-data ALL=(ALL) NOPASSWD: /usr/bin/chown +EOF +sudo chmod 440 /etc/sudoers.d/www-data +``` + +The script gracefully skips sudo operations if they're not available. + +### Configurable Paths + +| Setting | Default | Description | +| ------- | ------- | ----------- | +| Emulator hoofdmap | `/var/www/emulator` | Root emulator directory | +| Emulator service naam | `emulator` | systemd service name | +| Database naam | `habbo` | MySQL/MariaDB database | +| SQL updates map | `{emulator}/Database Updates` | Directory with `.sql` update files | +| Backup map | `{emulator}/Database Updates/backups` | Database backup storage | +| Gamedata config map | `/var/www/Gamedata/config` | Gamedata configuration | +| Nitro client config map | `{nitro}/public/configuration` | Client configuration output | +| Nitro-V3 bronmap | `/var/www/Nitro-V3` | Nitro client source | +| Nitro Render V3 bronmap | `/var/www/Nitro_Render_V3` | Nitro renderer source | + +Database credentials are read automatically from the Laravel `.env` file. --- @@ -126,16 +179,12 @@ sudo corepack enable corepack install -g yarn@latest # 4. Clone the project -git clone https://gitlab.epicnabbo.nl/RemcoEpic/atomcms-edit.git /var/www/atomcms +git clone ssh://git@5.252.100.130:8422/remco/Atomcms-edit.git /var/www/atomcms cd /var/www/atomcms # 5. Configure environment cp .env.example .env php artisan key:generate -# Edit .env with your database credentials: -# DB_DATABASE=habbo -# DB_USERNAME=root -# DB_PASSWORD=yourpassword # 6. Install PHP dependencies composer install --no-dev --optimize-autoloader @@ -146,10 +195,8 @@ yarn install # 8. Create database mysql -u root -p -e "CREATE DATABASE IF NOT EXISTS habbo CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" -# 9. Run migrations & seeders (or use the auto-repair tool) +# 9. Run migrations & seeders php artisan migrate --seed -# Or use the interactive repair tool: -# php artisan atom:check --fix # 10. Build frontend assets yarn build:all @@ -158,11 +205,10 @@ yarn build:all sudo chown -R www-data:www-data storage bootstrap/cache public/build sudo chmod -R 775 storage bootstrap/cache -# 12. Configure web server - -# --- Nginx --- -sudo nano /etc/nginx/sites-available/atomcms +# 12. Configure web server (Nginx example) ``` + +```nginx server { listen 80; server_name your-domain.com; @@ -172,18 +218,12 @@ server { add_header X-Content-Type-Options "nosniff"; index index.php; - charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } - location = /favicon.ico { access_log off; log_not_found off; } - location = /robots.txt { access_log off; log_not_found off; } - - error_page 404 /index.php; - location ~ \.php$ { fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; @@ -195,150 +235,16 @@ server { } } ``` + ```bash sudo ln -sf /etc/nginx/sites-available/atomcms /etc/nginx/sites-enabled/ sudo nginx -t && sudo systemctl reload nginx - -# --- Apache --- -sudo a2enmod rewrite -sudo nano /etc/apache2/sites-available/atomcms.conf -``` - - ServerName your-domain.com - DocumentRoot /var/www/atomcms/public - - - Options Indexes FollowSymLinks - AllowOverride All - Require all granted - - - ErrorLog ${APACHE_LOG_DIR}/atomcms-error.log - CustomLog ${APACHE_LOG_DIR}/atomcms-access.log combined - -``` -```bash -sudo a2ensite atomcms -sudo systemctl reload apache2 -``` - -# 13. Restart PHP-FPM to clear opcache sudo systemctl restart php8.3-fpm - -# 14. Visit http://your-domain.com in your browser ``` --- -### Windows (XAMPP / WampServer) - -#### Prerequisites -- [XAMPP](https://www.apachefriends.org/) (PHP 8.1+, Apache, MariaDB) or [WampServer](https://www.wampserver.com/) -- [Node.js](https://nodejs.org/) (20 LTS or higher) -- [Yarn](https://yarnpkg.com/getting-started/install) (`npm install -g yarn` after Node.js) -- [Composer](https://getcomposer.org/download/) (Windows installer) -- [Git for Windows](https://git-scm.com/download/win) - -#### Steps - -```powershell -# 1. Open PowerShell or CMD as Administrator - -# 2. Clone the project -git clone https://gitlab.epicnabbo.nl/RemcoEpic/atomcms-edit.git C:\xampp\htdocs\atomcms -cd C:\xampp\htdocs\atomcms - -# 3. Configure environment -copy .env.example .env -php artisan key:generate - -# Edit .env with your XAMPP database credentials: -# DB_CONNECTION=mariadb -# DB_HOST=localhost -# DB_PORT=3306 -# DB_DATABASE=habbo -# DB_USERNAME=root -# DB_PASSWORD= - -# 4. Start XAMPP services -# Open XAMPP Control Panel → Start Apache & MySQL - -# 5. Create database -# Open phpMyAdmin (http://localhost/phpmyadmin) -# → New → Database name: habbo → Charset: utf8mb4_unicode_ci → Create - -# 6. Install PHP dependencies -composer install --no-dev --optimize-autoloader - -# 7. Install frontend dependencies -yarn install - -# 8. Run migrations & seeders -php artisan migrate --seed -# Or use the interactive repair tool: -# php artisan atom:check --fix - -# 9. Build frontend assets -yarn build:all - -# 10. Set permissions (required for storage & cache) -# Right-click storage\ and bootstrap\cache\ folders -# → Properties → Security → Edit → Add "Everyone" → Full Control -# Or run in PowerShell as Admin: -icacls storage /grant Everyone:F /T -icacls bootstrap/cache /grant Everyone:F /T -icacls public/build /grant Everyone:F /T - -# 11. Enable Apache mod_rewrite -# Open XAMPP Control Panel → Apache → Config → httpd.conf -# Uncomment: LoadModule rewrite_module modules/mod_rewrite.so - -# 12. Visit http://localhost/atomcms/public in your browser -``` - -> **Note:** If you use IIS on Windows, the repair tool supports auto-detection: -> `php artisan atom:check --fix` - ---- - -## Quick Start (Repair Tool) - -```bash -# Interactive mode (asks for confirmation before each step) -php artisan atom:check --fix - -# Auto mode (fixes everything automatically without asking) -php artisan atom:check --auto - -# Force platform detection -php artisan atom:check --platform=nginx - -# Dutch language output -php artisan atom:check --fix --lang=nl -``` - ---- - -## Commands - -```bash -# Check only (no changes) -php artisan atom:check - -# Interactive fix (asks before each step) -php artisan atom:check --fix - -# Automatic fix (no questions) -php artisan atom:check --auto - -# Fix gamedata symlinks for bundled assets -php artisan atom:fix-gamedata-symlinks - -# Preview symlinks (dry-run) -php artisan atom:fix-gamedata-symlinks --dry-run -``` - -### Yarn Scripts +## Yarn Scripts ```bash # Build all themes @@ -355,136 +261,13 @@ yarn dev:atom # Dev server for Atom theme # Linting & Formatting yarn lint # Check JS/Vue yarn lint:fix # Fix JS/Vue -yarn lint:css # Check CSS -yarn lint:css:fix # Fix CSS yarn format # Format everything -yarn format:check # Check formatting - -# Full check -yarn check # Lint + format check -yarn check:php # PHP syntax check -yarn check:security # Composer & npm audit -yarn check:deps # Check outdated packages # Cache yarn clean # Clear Vite cache yarn rebuild # Clean + install + build ``` -### PHP Commands - -```bash -# Auto-fix code style -php artisan atom:fix-code - -# Static analysis (PHPStan Level 3) -./vendor/bin/phpstan analyse - -# Build frontend assets -yarn build:atom -yarn build:dusk - -# Development mode -yarn dev:atom -``` - ---- - -## Repair Tool Details - -The `atom:check` command performs over **100 deep system checks** and offers to fix them automatically. - -### Diagnostic Checks - -| Section | What it Checks | -| ------------- | ------------------------------------------------------------- | -| **Environment** | .env, APP_KEY, Debug mode, Composer security | -| **Database** | Tables, columns, migrations, seeders, settings, radio, admin | -| **PHP Stack** | Extensions, php.ini, config cache, session | -| **Web Server**| Apache/Nginx/IIS config, SSL | -| **System** | Permissions, firewall ports | -| **Assets** | Frontend, Redis, Cron, Queue, Supervisor, Vite | -| **HTTP Errors** | 400, 401, 403, 404, 419, 429, 500, 502, 503, 504 | - -### Auto-Fix Steps - -| Step | Action | -| ---- | ---------------------------------- | -| 1 | Environment (.env, APP_KEY) | -| 2 | Clear all caches | -| 3 | Fix permissions | -| 4 | Run migrations | -| 5 | Run seeders | -| 6 | Fix storage (symlink, directories) | -| 6b | Fix Radio tables | -| 7 | Fix Gamedata symlinks | -| 8 | Create admin user | -| 9 | Web server config (.htaccess) | -| 10 | PHP config & extensions | -| 11 | Build assets (npm) | -| 12 | Fix HTTP errors | - -Auto-detects: **Linux, Windows IIS, XAMPP, WAMP, Apache, Nginx** - ---- - -## Troubleshooting - -### 500 Error After `php artisan optimize` - -If you get a 500 error after running `php artisan optimize`, PHP OPcache is likely caching stale files. Fix: - -```bash -# Disable OPcache in your FPM configuration: -# Edit /etc/php/8.x/fpm/conf.d/99-opcache.ini -opcache.enable=0 - -# Then restart PHP-FPM: -sudo systemctl restart php8.x-fpm -``` - -Alternatively, keep OPcache enabled but restart PHP-FPM after every `php artisan optimize`: - -```bash -php artisan optimize -sudo systemctl restart php8.x-fpm -``` - -### Filament Translations Not Working - -If Filament navigation labels or resource names aren't translating (e.g., Dashboard shows in English instead of Dutch): - -1. Add the missing key to `lang/vendor/filament/{locale}/resources.php` (navigations section) or `lang/{locale}.json` -2. Clear the cache: `php artisan optimize:clear` (then restart PHP-FPM if OPcache is on) - ---- - -## Performance Optimizations - -| Optimization | Description | -| ------------------- | -------------------------------- | -| **Vite 8** | Fastest build tool | -| **esbuild** | Faster minification | -| **Better chunking** | Optimal code splitting | -| **Gzip + Brotli** | Compression (~70% smaller) | -| **Resource hints** | DNS prefetch, preconnect, preload| -| **HTTP/2** | Faster network requests | -| **Console removed** | Smaller JS bundles | -| **Caching** | Vite cache + optimizedeps | - -### Gamedata Symlinks - -The `atom:fix-gamedata-symlinks` command creates symlinks in the Gamedata directory to point to optimized bundled assets, significantly improving game client load times. - -| Symlink | Target | Purpose | -| ---------------- | ------------------- | ---------------- | -| `effect` | `bundled/effect` | Avatar effects | -| `furniture` | `bundled/furniture` | Furniture assets | -| `generic` | `bundled/generic` | Generic assets | -| `pet` | `bundled/pet` | Pet assets | -| `figure` | `bundled/figure` | Avatar figures | -| `generic_custom` | `bundled/generic` | Custom generic | - --- ## Tech Stack @@ -495,7 +278,6 @@ The `atom:fix-gamedata-symlinks` command creates symlinks in the Gamedata direct - **CSS:** TailwindCSS 4 - **Admin Panel:** Filament 5 - **Database:** MariaDB / MySQL -- **Linting:** ESLint + Stylelint + Prettier ---