Address code review feedback
- Fix option text handling to check for None instead of falsy - Improve HTML cleaning with html.unescape and better tag removal - Fix multi-line string in die() function - Add html module import for proper HTML entity handling Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
parent
7fe56d207f
commit
293066cbfd
3 changed files with 113 additions and 16 deletions
|
|
@ -223,18 +223,110 @@ setadminpassword [password]
|
|||
|
||||
<h2 id="parameters">⚙️ Startup Parameters</h2>
|
||||
|
||||
<h3>Basic Startup</h3>
|
||||
<pre><code>./srcds_run -console -game tf -ip 0.0.0.0 -port 27015 +map cp_dustbowl +maxplayers 24 +exec server.cfg
|
||||
</code></pre>
|
||||
<h3>Command Line Template</h3>
|
||||
<p>The server uses the following command line template:</p>
|
||||
<pre><code>-console %GAME_TYPE% %PID_FILE% %MAP% %IP% %PORT% %PLAYERS% -condebug</code></pre>
|
||||
|
||||
<h3>Common Parameters</h3>
|
||||
<ul>
|
||||
<li><code>-port [number]</code> - Set the server port</li>
|
||||
<li><code>-maxplayers [number]</code> - Maximum player slots</li>
|
||||
<li><code>-map [name]</code> - Starting map/level</li>
|
||||
<li><code>-console</code> - Enable console output</li>
|
||||
<li><code>-nographics</code> - Run without graphics (headless mode)</li>
|
||||
</ul>
|
||||
<h3>Available Startup Parameters</h3>
|
||||
<p>The following parameters can be configured when starting the server:</p>
|
||||
|
||||
<div style="background: #1e3a5f; padding: 20px; border-left: 4px solid #3b82f6; margin: 20px 0; border-radius: 4px;">
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">+sv_setsteamaccount</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Steam Account Login Token</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">Manage your steam tokens here</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">-sv_pure</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Pure Server</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">A pure server is one that forces all clients on the server to use content that matches what is on the server.</p>
|
||||
<p style="color: #e5e7eb;"><strong>Options:</strong></p>
|
||||
<ul style="color: #e5e7eb; margin-left: 20px;">
|
||||
<li><code style="background: #0f172a; padding: 2px 6px; border-radius: 3px; color: #a5b4fc;">-1</code> - Do not apply any rules or restrict which files the client may load. (Default)</li>
|
||||
<li><code style="background: #0f172a; padding: 2px 6px; border-radius: 3px; color: #a5b4fc;">0</code> - Apply rules in cfg/pure_server_minimal.txt only</li>
|
||||
<li><code style="background: #0f172a; padding: 2px 6px; border-radius: 3px; color: #a5b4fc;">1</code> - Apply rules in cfg/pure_server_full.txt and then cfg/pure_server_whitelist.txt</li>
|
||||
<li><code style="background: #0f172a; padding: 2px 6px; border-radius: 3px; color: #a5b4fc;">2</code> - Apply rules in cfg/pure_server_full.txt</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">-dev</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Developer Messages.</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">Show developer messages.</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">-debuglog custom_error.log</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Error Logging</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">File Errors are Logged to.</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">-debug</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Debugging</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">Turns on Debugging.</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">+motdfile custom_motd.txt</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Custom MOTD</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">Custom MOTD file.</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">+mapcyclefile custom_mapcycle.txt</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Custom Mapcycle</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">Custom Mapcycle file.</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">-nomaster</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Disable master server communication</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">No description available</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">-insecure</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - Disable Valve Anti-Cheat</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">Will start the server without Valve Anti-Cheat technology.</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">-nohltv</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - No SourceTV</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">Disables SourceTV and closes its port.</p>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
<h4 style="color: #ffffff; margin-top: 0;">
|
||||
<code style="background: #0f172a; padding: 4px 8px; border-radius: 3px; color: #a5b4fc;">-norestart</code>
|
||||
<span style="color: #e5e7eb; font-weight: normal; font-size: 0.9em;"> - No Restart</span>
|
||||
</h4>
|
||||
<p style="color: #e5e7eb; margin: 10px 0;">Won't attempt to restart failed servers.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3>Creating a Start Script</h3>
|
||||
|
||||
|
|
|
|||
|
|
@ -72,8 +72,7 @@ if [[ -s "$TOKEN_FILE" ]]; then
|
|||
elif [[ -n "${GITHUB_TOKEN:-}" ]]; then
|
||||
TOKEN="$GITHUB_TOKEN"
|
||||
else
|
||||
die "GitHub token not found. Set GITHUB_TOKEN env var or create $TOKEN_FILE with your token.
|
||||
Get a token at: https://github.com/settings/tokens (requires 'repo' scope)"
|
||||
die "GitHub token not found. Set GITHUB_TOKEN env var or create $TOKEN_FILE with your token. Get a token at: https://github.com/settings/tokens (requires 'repo' scope)"
|
||||
fi
|
||||
|
||||
[[ ${#TOKEN} -ge 10 ]] || die "Token looks invalid (too short)"
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ import json
|
|||
import yaml
|
||||
import re
|
||||
import argparse
|
||||
import html
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
import xml.etree.ElementTree as ET
|
||||
|
|
@ -193,7 +194,7 @@ class GameDocGenerator:
|
|||
if param_type == 'select':
|
||||
for option in param.findall('option'):
|
||||
opt_value = option.get('value', '')
|
||||
opt_text = option.text if option.text else opt_value
|
||||
opt_text = option.text if option.text is not None else opt_value
|
||||
options.append({'value': opt_value, 'text': opt_text})
|
||||
|
||||
startup_params.append({
|
||||
|
|
@ -622,8 +623,13 @@ setadminpassword [password]
|
|||
default = param.get('default')
|
||||
options = param.get('options', [])
|
||||
|
||||
# Clean HTML from description
|
||||
description_clean = re.sub(r'<[^>]+>', '', description) if description else "No description available"
|
||||
# Clean HTML from description - unescape HTML entities and remove tags
|
||||
if description:
|
||||
description_clean = html.unescape(description)
|
||||
# Remove HTML tags (simple but effective for our use case)
|
||||
description_clean = re.sub(r'<[^<>]+>', '', description_clean)
|
||||
else:
|
||||
description_clean = "No description available"
|
||||
|
||||
php_doc += f'''
|
||||
<div style="margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #374151;">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue