Steam Workshop – Admin'; sw_admin_print_styles(); $action = $_GET['action'] ?? ''; if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_profile'])) { sw_admin_save_profile($db); return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['sync_profiles'])) { $n = sw_sync_profiles($db); sw_success("Sync complete. $n new profile(s) created."); } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['detect_defaults'])) { $profile = sw_get_profile_by_id($db, (int)($_POST['id'] ?? 0)); if (!$profile) { sw_error('Profile not found.'); sw_admin_list($db); return; } $detected = sw_detect_profile_defaults_from_xml($profile['config_name']); if (empty($detected)) { sw_error('No Steam defaults were detected in this game XML. You can still enter values manually.'); } else { sw_success('Detected XML defaults. Review and apply when ready.'); } sw_admin_edit_form($profile, $detected, true); return; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['apply_detected_defaults'])) { $profile = sw_get_profile_by_id($db, (int)($_POST['id'] ?? 0)); if (!$profile) { sw_error('Profile not found.'); sw_admin_list($db); return; } $detected = sw_detect_profile_defaults_from_xml($profile['config_name']); if (empty($detected)) { sw_error('No Steam defaults were detected in this game XML.'); sw_admin_edit_form($profile); return; } $overwrite = isset($_POST['overwrite_existing']) && $_POST['overwrite_existing'] === '1'; $updated = sw_apply_detected_profile_defaults($db, $profile, $detected, $overwrite); if ($updated > 0) { $overwriteMessage = $overwrite ? ' Existing values were allowed to be overwritten.' : ' Existing non-empty values were kept.'; sw_success("Applied $updated detected default value(s)." . $overwriteMessage); } else { sw_success('No profile values needed updating based on current overwrite setting.'); } $profile = sw_get_profile_by_id($db, (int)$profile['id']); sw_admin_edit_form($profile, $detected, true); return; } if ($action === 'edit' && isset($_GET['id'])) { $profile = sw_get_profile_by_id($db, (int)$_GET['id']); if ($profile) { sw_admin_edit_form($profile); } else { sw_error('Profile not found.'); sw_admin_list($db); } return; } sw_admin_list($db); } function sw_admin_save_profile($db) { $id = isset($_POST['id']) ? (int)$_POST['id'] : 0; if (!$id) { sw_error('Invalid profile ID.'); sw_admin_list($db); return; } $profile = sw_get_profile_by_id($db, $id); if (!$profile) { sw_error('Profile not found.'); sw_admin_list($db); return; } $fields = array( 'enabled' => isset($_POST['enabled']) ? 1 : 0, 'steam_app_id' => trim($_POST['steam_app_id'] ?? ''), 'workshop_app_id' => trim($_POST['workshop_app_id'] ?? ''), 'steam_login_required' => isset($_POST['steam_login_required']) ? 1 : 0, 'steamcmd_login_mode' => (($_POST['steamcmd_login_mode'] ?? 'anonymous') === 'account') ? 'account' : 'anonymous', 'steamcmd_path' => trim($_POST['steamcmd_path'] ?? ''), 'workshop_download_dir_template' => trim($_POST['workshop_download_dir_template'] ?? ''), 'server_root_template' => trim($_POST['server_root_template'] ?? ''), 'install_path_template' => trim($_POST['install_path_template'] ?? ''), 'folder_naming_format' => trim($_POST['folder_naming_format'] ?? ''), 'mod_launch_param_template' => trim($_POST['mod_launch_param_template'] ?? '-mod='), 'servermod_launch_param_template' => trim($_POST['servermod_launch_param_template'] ?? '-serverMod='), 'install_script_template' => trim($_POST['install_script_template'] ?? ''), 'update_script_template' => trim($_POST['update_script_template'] ?? ''), 'copy_bikeys_enabled' => isset($_POST['copy_bikeys_enabled']) ? 1 : 0, 'notes' => trim($_POST['notes'] ?? ''), ); // Per-profile default behavior fields $valid_update_modes = array('manual', 'on_restart', 'before_start'); $valid_restart_behaviors = array('none', 'if_stopped'); $posted_um = $_POST['default_update_mode'] ?? 'manual'; $posted_rb = $_POST['default_restart_behavior'] ?? 'none'; $fields['default_update_mode'] = in_array($posted_um, $valid_update_modes, true) ? $posted_um : 'manual'; $fields['default_restart_behavior'] = in_array($posted_rb, $valid_restart_behaviors, true) ? $posted_rb : 'none'; $setParts = array(); foreach ($fields as $col => $val) { $setParts[] = "`$col` = '" . $db->realEscapeSingle($val) . "'"; } $setParts[] = "`updated_at` = NOW()"; $ok = $db->query( "UPDATE " . sw_table('steam_workshop_game_profiles') . " SET " . implode(', ', $setParts) . " WHERE `id` = $id LIMIT 1" ); if ($ok) { sw_success('Profile saved.'); } else { sw_error('Failed to save profile.'); } $profile = sw_get_profile_by_id($db, $id); if ($profile) { sw_admin_edit_form($profile); } else { sw_admin_list($db); } } function sw_admin_list($db) { $profiles = sw_get_profiles($db); ?>

Profiles map game XML configs to Steam Workshop defaults. Sync to create missing profiles, then edit each profile for game-specific paths and launch templates.

No profiles yet. Click Sync Profiles to create them from installed game configs.

Config Name Game Name Steam App ID Workshop App ID Enabled Actions
Yes' : 'No' ?> Edit

« Back to profile list

Edit Profile:

Placeholder tokens: {SERVER_ROOT} {HOME_ID} {STEAM_APP_ID} {WORKSHOP_APP_ID} {MOD_FOLDER}

XML-Assisted Defaults

Use values detected from this game XML. Existing values are not overwritten unless you explicitly allow it.

Detected values:
  • Steam App ID:
  • Workshop App ID:
  • SteamCMD path:
  • Workshop download dir:
  • Server root:
  • Mod install path:

Global Profile Defaults

Path Templates

Use placeholders so paths stay portable between server homes.

Per-Game Runtime Values

Optional Script Templates

Notes

Default Workshop Behavior for New Servers

These defaults are applied when a user enables Workshop on a server that has no saved behavior settings yet. Users can always override them on their own server pages. All defaults are intentionally set to the safest option (manual / no automatic restart).

Cancel

.sw-admin-panel{background:#171717;border:1px solid #2d2d2d;border-radius:6px;padding:14px;margin:10px 0;color:#e7e7e7} .sw-admin-table{border-collapse:collapse;background:#121212} .sw-admin-table th,.sw-admin-table td{border:1px solid #2c2c2c;padding:8px} .sw-admin-table thead th{background:#232323;color:#fff} .sw-state-on{color:#78d978;font-weight:700} .sw-state-off{color:#9a9a9a} .sw-section{margin-top:14px;padding:12px;border:1px solid #2f2f2f;border-radius:4px;background:#111} .sw-section h4{margin:0 0 8px 0;color:#f6f6f6} .sw-note{margin-bottom:10px;background:#202020;border-left:3px solid #3f80d0;padding:10px} .sw-muted{color:#b3b3b3} .sw-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:10px} .sw-grid label, .sw-section > label{display:block} .sw-grid span, .sw-section span{display:block;font-size:12px;color:#bdbdbd;margin-bottom:4px} .sw-grid input[type=text], .sw-grid select, .sw-section textarea{width:100%;box-sizing:border-box;background:#0d0d0d;border:1px solid #3a3a3a;color:#eee;padding:7px;border-radius:4px} .sw-grid input[type=checkbox]{transform:scale(1.1);margin-top:4px} .sw-detected-box{margin-top:10px;padding:10px;background:#1d2a1d;border:1px solid #335933;border-radius:4px} .sw-detected-box ul{margin:8px 0 10px 18px} .sw-detected-box code,.sw-note code{background:#0b0b0b;padding:1px 4px;border-radius:3px;color:#9fd4ff} '; }