mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-07 13:27:09 +02:00
Fix plugin author display and add Settings button
- Add author field extraction from meta.xml in both plugin processing loops - Update discordWebhooks meta.xml to include author: Master3395 - Update examplePlugin meta.xml to include author: usmannasir - Add Plugin Settings button next to Deactivate/Uninstall buttons in both grid and table views - Special handling for emailMarketing core plugin URL (/emailMarketing/ instead of /plugins/emailMarketing/) - Add btn-settings styling for Settings button with hover effects
This commit is contained in:
@@ -4,4 +4,5 @@
|
||||
<type>plugin</type>
|
||||
<description>This is an example plugin</description>
|
||||
<version>1.0</version>
|
||||
<author>usmannasir</author>
|
||||
</cyberpanelPluginConfig>
|
||||
@@ -708,6 +708,17 @@
|
||||
box-shadow: 0 4px 8px rgba(255,193,7,0.3);
|
||||
}
|
||||
|
||||
.btn-settings {
|
||||
background: #5856d6;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-settings:hover {
|
||||
background: #4a48c4;
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 8px rgba(88,86,214,0.3);
|
||||
}
|
||||
|
||||
.btn-action:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: not-allowed;
|
||||
@@ -883,6 +894,11 @@
|
||||
<div class="plugin-footer">
|
||||
<div class="plugin-actions">
|
||||
{% if plugin.installed %}
|
||||
{% if plugin.manage_url %}
|
||||
<a href="{{ plugin.manage_url }}" class="btn-action btn-settings btn-small" title="{% trans 'Plugin Settings' %}">
|
||||
<i class="fas fa-cog"></i> {% trans "Settings" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if plugin.enabled %}
|
||||
<button class="btn-action btn-deactivate btn-small" onclick="deactivatePlugin('{{ plugin.plugin_dir }}')">
|
||||
<i class="fas fa-toggle-on"></i> {% trans "Deactivate" %}
|
||||
@@ -954,6 +970,11 @@
|
||||
<td>
|
||||
<div class="plugin-actions">
|
||||
{% if plugin.installed %}
|
||||
{% if plugin.manage_url %}
|
||||
<a href="{{ plugin.manage_url }}" class="btn-action btn-settings" title="{% trans 'Plugin Settings' %}">
|
||||
<i class="fas fa-cog"></i> {% trans "Settings" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if plugin.enabled %}
|
||||
<button class="btn-action btn-deactivate" onclick="deactivatePlugin('{{ plugin.plugin_dir }}')">
|
||||
<i class="fas fa-toggle-on"></i> {% trans "Deactivate" %}
|
||||
|
||||
@@ -152,7 +152,11 @@ def installed(request):
|
||||
url_elem = root.find('url')
|
||||
|
||||
# Priority: settings_url > url > default pattern
|
||||
if settings_url_elem is not None and settings_url_elem.text:
|
||||
# Special handling for core plugins that don't use /plugins/ prefix
|
||||
if plugin == 'emailMarketing':
|
||||
# emailMarketing is a core CyberPanel plugin, uses /emailMarketing/ not /plugins/emailMarketing/
|
||||
data['manage_url'] = '/emailMarketing/'
|
||||
elif settings_url_elem is not None and settings_url_elem.text:
|
||||
data['manage_url'] = settings_url_elem.text
|
||||
elif url_elem is not None and url_elem.text:
|
||||
data['manage_url'] = url_elem.text
|
||||
@@ -163,6 +167,13 @@ def installed(request):
|
||||
data['manage_url'] = f'/plugins/{plugin}/settings/'
|
||||
else:
|
||||
data['manage_url'] = None
|
||||
|
||||
# Extract author information
|
||||
author_elem = root.find('author')
|
||||
if author_elem is not None and author_elem.text:
|
||||
data['author'] = author_elem.text
|
||||
else:
|
||||
data['author'] = 'Unknown'
|
||||
|
||||
pluginList.append(data)
|
||||
processed_plugins.add(plugin) # Mark as processed
|
||||
@@ -233,13 +244,25 @@ def installed(request):
|
||||
settings_url_elem = root.find('settings_url')
|
||||
url_elem = root.find('url')
|
||||
|
||||
if settings_url_elem is not None and settings_url_elem.text:
|
||||
# Priority: settings_url > url > default pattern
|
||||
# Special handling for core plugins that don't use /plugins/ prefix
|
||||
if plugin == 'emailMarketing':
|
||||
# emailMarketing is a core CyberPanel plugin, uses /emailMarketing/ not /plugins/emailMarketing/
|
||||
data['manage_url'] = '/emailMarketing/'
|
||||
elif settings_url_elem is not None and settings_url_elem.text:
|
||||
data['manage_url'] = settings_url_elem.text
|
||||
elif url_elem is not None and url_elem.text:
|
||||
data['manage_url'] = url_elem.text
|
||||
else:
|
||||
data['manage_url'] = f'/plugins/{plugin}/'
|
||||
|
||||
# Extract author information
|
||||
author_elem = root.find('author')
|
||||
if author_elem is not None and author_elem.text:
|
||||
data['author'] = author_elem.text
|
||||
else:
|
||||
data['author'] = 'Unknown'
|
||||
|
||||
pluginList.append(data)
|
||||
|
||||
except ElementTree.ParseError as e:
|
||||
|
||||
Reference in New Issue
Block a user