fix(steam_workshop): address code review feedback
- WorkshopInstaller: rename cachePath/installPath params to sourcePath/targetPath in checkNeedsSync; replace account_placeholder with TODO comment explaining feature is pending - WorkshopRepository: remove duplicate docblock on insertOrUpdateMod - module.php: improve install_queries version comments - user_workshop_mods.php: rename $scriptPath to $requestPath - profile_form.php: add symlink limitation note to copy method dropdown - lang/en_US.php: update steamcmd login mode hint to reflect account mode status" Agent-Logs-Url: https://github.com/GameServerPanel/GSP/sessions/e7f0d80d-f775-4794-adbd-cf48b55bc9c1 Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
69f415ad86
commit
df4f1d1bdc
6 changed files with 20 additions and 16 deletions
|
|
@ -226,7 +226,7 @@ return [
|
|||
'profile_hint_steamcmd_path' => 'Full path to steamcmd.sh on the remote agent. Leave blank to use the agent default (/home/gameserver/steamcmd/steamcmd.sh).',
|
||||
'profile_label_steam_login_required'=> 'Steam login required (game is not free / requires ownership)',
|
||||
'profile_label_steamcmd_login_mode' => 'SteamCMD login mode',
|
||||
'profile_hint_steamcmd_login_mode' => 'Use anonymous for free Workshop mods. Use configured account for games requiring ownership.',
|
||||
'profile_hint_steamcmd_login_mode' => 'Use anonymous for free Workshop mods. Configured account mode stores the intent; full credential injection requires panel-level Steam account configuration (see admin docs).',
|
||||
'profile_label_os' => 'Supported OS',
|
||||
'profile_label_cache_path' => 'Workshop download/cache path',
|
||||
'profile_hint_cache_path' => 'Where SteamCMD stores downloaded mod content on the agent. E.g. /home/gameserver/steamcmd/steamapps/workshop/content/%workshop_app_id%/%workshop_id%',
|
||||
|
|
|
|||
|
|
@ -382,7 +382,12 @@ class WorkshopInstaller
|
|||
}
|
||||
|
||||
$loginMode = (string)($profile['steamcmd_login_mode'] ?? 'anonymous');
|
||||
$loginArg = $loginMode === 'account' ? 'account_placeholder' : 'anonymous';
|
||||
// TODO: When login_mode is 'account', replace 'anonymous' with the
|
||||
// configured SteamCMD credentials (username + password) loaded from
|
||||
// a secure panel-side credential store. Until that feature is
|
||||
// implemented, 'account' mode logs in anonymously (which works for
|
||||
// free/publicly-accessible Workshop items).
|
||||
$loginArg = 'anonymous';
|
||||
|
||||
$cmd = implode(' ', [
|
||||
escapeshellarg($steamcmdPath),
|
||||
|
|
@ -422,19 +427,19 @@ class WorkshopInstaller
|
|||
*/
|
||||
private function checkNeedsSync(
|
||||
object $remote,
|
||||
string $cachePath,
|
||||
string $installPath,
|
||||
string $sourcePath,
|
||||
string $targetPath,
|
||||
array $profile,
|
||||
array &$log
|
||||
): bool {
|
||||
$copyMethod = (string)($profile['copy_method'] ?? 'rsync');
|
||||
$log[] = "Pre-start compare: cache={$cachePath} dest={$installPath} method={$copyMethod}";
|
||||
$log[] = "Pre-start compare: source={$sourcePath} target={$targetPath} method={$copyMethod}";
|
||||
|
||||
if ($copyMethod === 'rsync') {
|
||||
$cmd = sprintf(
|
||||
'rsync -rcn --delete %s %s 2>/dev/null; echo "RSYNC_EXIT:$?"',
|
||||
escapeshellarg(rtrim($cachePath, '/') . '/'),
|
||||
escapeshellarg(rtrim($installPath, '/') . '/')
|
||||
escapeshellarg(rtrim($sourcePath, '/') . '/'),
|
||||
escapeshellarg(rtrim($targetPath, '/') . '/')
|
||||
);
|
||||
$out = (string)$remote->exec($cmd);
|
||||
$body = preg_replace('/RSYNC_EXIT:\d+\s*$/', '', $out) ?? '';
|
||||
|
|
|
|||
|
|
@ -314,10 +314,6 @@ class WorkshopRepository
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new mod row or update the existing one (upsert by home_id + workshop_id).
|
||||
* Returns the row id.
|
||||
*/
|
||||
/**
|
||||
* Insert (id = 0) or update (id > 0) a Workshop mod entry for a game home.
|
||||
* Returns the row id.
|
||||
|
|
|
|||
|
|
@ -29,8 +29,11 @@ $module_required = TRUE;
|
|||
$module_menus = array();
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
// $install_queries[0] – run during FRESH install (all keys executed).
|
||||
// $install_queries[2] – run when upgrading an existing v1 install to v2.
|
||||
// $install_queries[0] – executed for FRESH installs (all keys run).
|
||||
// Contains the full v2 schema with every column.
|
||||
// $install_queries[2] – executed when upgrading an existing v1 install
|
||||
// to v2 (ALTER TABLE + new settings table).
|
||||
// $db_version = 2 (v1 = original release; v2 = this rewrite).
|
||||
// -----------------------------------------------------------------------
|
||||
$install_queries = array();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ $folderFormats = ['@%mod_name%' => '@%mod_name% (mod title)', '@%workshop_id%'
|
|||
$curFolderFormat = (string)($profile['folder_naming_format'] ?? '@%workshop_id%');
|
||||
$separatorList = ['semicolon' => 'Semicolon ( ; )', 'comma' => 'Comma ( , )', 'space' => 'Space ( )'];
|
||||
$curSeparator = (string)($profile['mod_separator'] ?? 'semicolon');
|
||||
$copyMethods = ['rsync' => 'rsync (Linux/Unix)', 'copy' => 'cp / basic copy', 'symlink' => 'Symlink'];
|
||||
$copyMethods = ['rsync' => 'rsync (Linux/Unix)', 'copy' => 'cp / basic copy', 'symlink' => 'Symlink (requires persistent cache path)'];
|
||||
$curCopyMethod = (string)($profile['copy_method'] ?? 'rsync');
|
||||
$loginModes = ['anonymous' => 'Anonymous (recommended for free mods)', 'account' => 'Configured account (paid games)'];
|
||||
$curLoginMode = (string)($profile['steamcmd_login_mode'] ?? 'anonymous');
|
||||
|
|
|
|||
|
|
@ -287,8 +287,8 @@ $statusClass = match($lastStatus) {
|
|||
|
||||
<!-- ── Steam Workshop search widget ── -->
|
||||
<?php
|
||||
$scriptPath = (string)($_SERVER['PHP_SELF'] ?? '/index.php');
|
||||
$searchEndpoint = sprintf('%s?m=steam_workshop&p=main&action=search&home_id=%d', $scriptPath, $homeId);
|
||||
$requestPath = (string)($_SERVER['PHP_SELF'] ?? '/index.php');
|
||||
$searchEndpoint = sprintf('%s?m=steam_workshop&p=main&action=search&home_id=%d', $requestPath, $homeId);
|
||||
$langAttrs = [
|
||||
'add' => $lang['mod_picker_action_add'] ?? 'Add',
|
||||
'remove' => $lang['mod_picker_action_remove'] ?? 'Remove',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue