updated
This commit is contained in:
parent
74fbe0773a
commit
4baa43bcbf
2 changed files with 16 additions and 50 deletions
|
|
@ -3,3 +3,6 @@
|
|||
## 2026-01-17
|
||||
- Added per-game Steam Workshop adapter management with CRUD UI and automatic mapping helpers.
|
||||
- Added workshop capability helpers and monitor button gating so only supported SteamCMD homes expose the Steam Workshop shortcut.
|
||||
|
||||
## 2026-01-18
|
||||
- Reworked Steam Workshop support detection to read installer AppIDs directly from the canonical game XMLs, ensuring admin mappings and Game Monitor buttons only appear for true Workshop-enabled titles.
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ class SteamWorkshopService
|
|||
private string $adapterDir;
|
||||
private string $adapterMapFile;
|
||||
private string $gameAdapterDir;
|
||||
private string $workshopConfigDir;
|
||||
private ?array $workshopAppIds = null;
|
||||
private string $serverConfigDir;
|
||||
|
||||
public function __construct(OGPDatabase $db)
|
||||
{
|
||||
|
|
@ -21,7 +20,9 @@ class SteamWorkshopService
|
|||
$this->adapterDir = __DIR__ . '/GameAdapters';
|
||||
$this->adapterMapFile = __DIR__ . '/../data/game_adapter_map.json';
|
||||
$this->gameAdapterDir = __DIR__ . '/../data/game_adapters';
|
||||
$this->workshopConfigDir = __DIR__ . '/../game_configs';
|
||||
$this->serverConfigDir = defined('SERVER_CONFIG_LOCATION')
|
||||
? SERVER_CONFIG_LOCATION
|
||||
: __DIR__ . '/../../config_games/server_configs';
|
||||
|
||||
if (!is_dir($this->configDir)) {
|
||||
mkdir($this->configDir, 0775, true);
|
||||
|
|
@ -502,20 +503,23 @@ class SteamWorkshopService
|
|||
|
||||
public function listWorkshopGameGroups(): array
|
||||
{
|
||||
$configDir = defined('SERVER_CONFIG_LOCATION') ? SERVER_CONFIG_LOCATION : __DIR__ . '/../../config_games/server_configs';
|
||||
$groups = [];
|
||||
$supportedAppIds = $this->getWorkshopConfigAppIds();
|
||||
if (empty($supportedAppIds)) {
|
||||
$configDir = $this->serverConfigDir;
|
||||
if (!is_dir($configDir)) {
|
||||
return [];
|
||||
}
|
||||
$supportedLookup = array_flip($supportedAppIds);
|
||||
|
||||
$groups = [];
|
||||
foreach (glob($configDir . '/*.xml') as $file) {
|
||||
$xml = @simplexml_load_file($file);
|
||||
if ($xml === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$installer = isset($xml->installer) ? trim((string)$xml->installer) : '';
|
||||
if ($installer !== 'steamcmd') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$gameKey = isset($xml->game_key) ? trim((string)$xml->game_key) : '';
|
||||
if ($gameKey === '') {
|
||||
continue;
|
||||
|
|
@ -526,10 +530,6 @@ class SteamWorkshopService
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!isset($supportedLookup[$appId])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$groupKey = $this->buildWorkshopGroupKey($appId);
|
||||
if (!isset($groups[$groupKey])) {
|
||||
$gameName = isset($xml->game_name) ? trim((string)$xml->game_name) : '';
|
||||
|
|
@ -747,11 +747,7 @@ class SteamWorkshopService
|
|||
}
|
||||
|
||||
$appId = $this->parseSteamAppIdFromConfig($serverXml);
|
||||
if ($appId === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return in_array($appId, $this->getWorkshopConfigAppIds(), true);
|
||||
return $appId !== null;
|
||||
}
|
||||
|
||||
private function parseSteamAppIdFromConfig($xml): ?string
|
||||
|
|
@ -782,39 +778,6 @@ class SteamWorkshopService
|
|||
return $candidate;
|
||||
}
|
||||
|
||||
private function getWorkshopConfigAppIds(): array
|
||||
{
|
||||
if ($this->workshopAppIds !== null) {
|
||||
return $this->workshopAppIds;
|
||||
}
|
||||
|
||||
$dir = $this->workshopConfigDir;
|
||||
if (!is_dir($dir)) {
|
||||
$this->workshopAppIds = [];
|
||||
return $this->workshopAppIds;
|
||||
}
|
||||
|
||||
$appIds = [];
|
||||
foreach (glob($dir . '/*.xml') as $file) {
|
||||
$xml = @simplexml_load_file($file);
|
||||
if ($xml === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$appId = preg_replace('/[^0-9]/', '', (string)($xml->workshop_id ?? ''));
|
||||
if ($appId === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$appIds[$appId] = true;
|
||||
}
|
||||
|
||||
$this->workshopAppIds = array_keys($appIds);
|
||||
sort($this->workshopAppIds);
|
||||
|
||||
return $this->workshopAppIds;
|
||||
}
|
||||
|
||||
private function buildWorkshopGroupKey(string $appId): string
|
||||
{
|
||||
return 'steamapp_' . $appId;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue