Add Discord Bot project type with process control, config editor, and log viewer

- DiscordBotProject: new project type (discord-bot), auto-detects from main.py + cogs/
- botcontrol API: start/stop/restart/status via sudo systemctl
- botconfig API: atomic read/write of config.json; CRUD for streamers, RSS feeds,
  Mastodon accounts, and LinkedIn pages; tokens masked in GET responses
- botlogs API: tail log file (path via project_settings.bot_log_file)
- Tab partials: _tab_bot (process control), _tab_botconfig (structured editor),
  _tab_logs (log viewer with auto-refresh)
- view.php: register bot/botconfig/logs tabs with labels, icons, and groups
- app.js: bot control panel, config editor with account/page dropdowns in RSS modal,
  Mastodon accounts CRUD, LinkedIn pages CRUD; audit labels/icons for all new actions
- CLAUDE.md: document Discord Bot integration, sudoers requirement, API actions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-05-26 14:39:17 +03:00
parent a2a1f356ba
commit bf3ae2351d
10 changed files with 1025 additions and 0 deletions

View file

@ -0,0 +1,19 @@
<?php
require_once __DIR__ . '/ProjectTypeBase.php';
class DiscordBotProject extends ProjectTypeBase {
public static function typeSlug(): string { return 'discord-bot'; }
public static function typeName(): string { return 'Discord Bot'; }
public static function typeIcon(): string { return 'bi-robot'; }
public static function description(): string { return 'Discord bot managed via systemd'; }
public static function tabs(): array {
return ['dashboard', 'bot', 'botconfig', 'logs', 'files', 'notes', 'settings'];
}
public static function detectFromPath(string $path): bool {
return file_exists($path . '/main.py')
&& is_dir($path . '/cogs')
&& file_exists($path . '/config.json');
}
}