mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-28 10:19:04 +01:00
Add GitHub README.md and CHANGELOG.md fetching for plugin help pages
- Fetch CHANGELOG.md from GitHub if not found locally (non-blocking, 3s timeout) - Fetch README.md from GitHub if no local help files found - Provides version history and documentation for plugins from GitHub - All GitHub fetches are optional and fail silently to avoid slow page loads - Enhances plugin-specific help pages with complete information
This commit is contained in:
@@ -909,6 +909,38 @@ def plugin_help(request, plugin_name):
|
||||
except Exception as e:
|
||||
logging.writeToFile(f"Error reading changelog for {plugin_name}: {str(e)}")
|
||||
|
||||
# If no local changelog, try fetching from GitHub (non-blocking)
|
||||
if not changelog_content:
|
||||
try:
|
||||
github_changelog_url = f'{GITHUB_RAW_BASE}/{plugin_name}/CHANGELOG.md'
|
||||
try:
|
||||
with urllib.request.urlopen(github_changelog_url, timeout=3) as response:
|
||||
if response.getcode() == 200:
|
||||
changelog_content = response.read().decode('utf-8')
|
||||
logging.writeToFile(f"Fetched CHANGELOG.md from GitHub for {plugin_name}")
|
||||
except (urllib.error.HTTPError, urllib.error.URLError, Exception):
|
||||
# Silently fail - GitHub fetch is optional
|
||||
pass
|
||||
except Exception:
|
||||
# Silently fail - GitHub fetch is optional
|
||||
pass
|
||||
|
||||
# If no help content and no local README, try fetching README.md from GitHub
|
||||
if not help_content:
|
||||
try:
|
||||
github_readme_url = f'{GITHUB_RAW_BASE}/{plugin_name}/README.md'
|
||||
try:
|
||||
with urllib.request.urlopen(github_readme_url, timeout=3) as response:
|
||||
if response.getcode() == 200:
|
||||
help_content = response.read().decode('utf-8')
|
||||
logging.writeToFile(f"Fetched README.md from GitHub for {plugin_name}")
|
||||
except (urllib.error.HTTPError, urllib.error.URLError, Exception):
|
||||
# Silently fail - GitHub fetch is optional
|
||||
pass
|
||||
except Exception:
|
||||
# Silently fail - GitHub fetch is optional
|
||||
pass
|
||||
|
||||
# If no help content found, create default content from meta.xml
|
||||
if not help_content:
|
||||
help_content = f"""
|
||||
|
||||
Reference in New Issue
Block a user