Commit Graph

57 Commits

Author SHA1 Message Date
master3395
211571a4db Fix plugin count discrepancy and remove duplicate view toggle
- Fixed installed plugin count to correctly show all 10 installed plugins
- Added filesystem verification to ensure accurate plugin counting
- Fixed duplicate view-toggle navigation row (removed second row)
- Added installed/active count display in page header
- Improved plugin installed status detection logic
- Enhanced debug logging for plugin count discrepancies
2026-01-26 17:45:36 +01:00
master3395
e13c0d0756 fix(plugins): Add total_installed and total_active to context 2026-01-26 03:48:13 +01:00
master3395
2c9500fe35 feat(plugins): Add installed and active plugin statistics to Installed Plugins page
- Calculate total installed plugins count
- Calculate total active/enabled plugins count
- Display statistics in page header with icons
- Shows 'Installed: X' and 'Active: Y' counts
- Statistics only shown when plugins are installed
- Improves visibility of plugin status at a glance
2026-01-26 03:47:41 +01:00
master3395
1f369b36b8 fix(plugins): Add missing outer except block in fetch_plugin_store 2026-01-26 03:45:29 +01:00
master3395
3026d50f35 fix(plugins): Fix indentation in fetch_plugin_store - final fix 2026-01-26 03:44:59 +01:00
master3395
28b69eb2f0 fix(plugins): Fix indentation error in fetch_plugin_store exception handler
- Fix except block indentation to match try block
- Add error handling for enrichment in stale cache fallback
- Ensures proper exception handling structure
2026-01-26 03:44:34 +01:00
master3395
35167b46cf fix(plugins): Add error handling to fetch_plugin_store to prevent 500 errors
- Wrap mailUtilities.checkHome in try-except
- Add try-except around _enrich_store_plugins calls
- If enrichment fails, return plugins without enrichment instead of 500 error
- Add error handling for _is_plugin_enabled calls
- Prevents HTTP 500 errors when plugin store loading fails
- Fixes issue where installing discordWebhooks caused plugin store to fail
2026-01-26 03:43:49 +01:00
master3395
6b65cf12d8 fix(plugins): Fix 'local variable pluginInstaller referenced before assignment' error
- Remove redundant local import of pluginInstaller inside install_from_store function
- pluginInstaller is already imported at module level (line 20)
- The local import was creating a variable shadowing issue
- When the cleanup code path wasn't executed, pluginInstaller was referenced before assignment
- Fixes installation from store failing with variable reference error
2026-01-26 03:41:14 +01:00
master3395
666b1d4097 fix(plugins): Fix plugin store showing uninstalled plugins as installed
- Only check /usr/local/CyberCP/ for installed status, not /home/cyberpanel/plugins/
- Require both plugin directory AND meta.xml to exist for installed status
- Plugins in source directory are not considered installed
- Fixes issue where Discord Webhooks, Fail2ban, Premium Plugin Example, and Test Plugin showed as installed when they weren't

Previously, the check used: os.path.exists(installed_path) or os.path.exists(source_path)
This incorrectly marked plugins as installed if they existed in the source directory.

Now uses: os.path.exists(installed_path) and os.path.exists(installed_meta)
This correctly only marks plugins as installed if they're actually in /usr/local/CyberCP/ with meta.xml
2026-01-26 03:37:48 +01:00
master3395
5cce9a036d fix(plugins): Allow store view to work when grid/table views don't exist
- Make toggleView more flexible - only require the specific view element needed
- Store view can now work even when gridView/tableView don't exist (no plugins installed)
- Fix initialization to directly show store view without calling toggleView recursively
- Find store button by text content instead of array index for reliability
- Prevents 'View elements not found' errors when loading Plugin Store with no installed plugins
2026-01-26 03:35:39 +01:00
master3395
42f66f30ea fix(plugins): Hide Grid/Table view buttons when no plugins installed
- Hide Grid and Table view buttons when plugins list is empty
- Only show Plugin Store button when no plugins are installed
- Improves UX by preventing clicks on non-functional buttons
- Combined with null checks, ensures no JavaScript errors occur
2026-01-26 03:33:32 +01:00
master3395
43f10f7796 fix(plugins): Add null checks to toggleView function to prevent errors when no plugins installed
- Add null checks for gridView, tableView, and storeView elements
- Prevent 'Cannot read properties of null' errors when elements don't exist
- Add null checks for viewBtns array access
- Add function existence checks before calling setupStoreSearch, loadPluginStore, displayStorePlugins
- Improve initialization code with better error handling
- Fixes Plugin Store loading errors when no plugins are installed
2026-01-26 03:32:49 +01:00
master3395
ead1044781 fix(plugins): Only show actually installed plugins in Installed Plugins page
- Filter pluginList to only include plugins where installed == True
- Uninstalled plugins will only appear in Plugin Store, not Installed Plugins
- This fixes the issue where uninstalled plugins were still showing locally
- Plugins in /home/cyberpanel/plugins/ but not in /usr/local/CyberCP/ are now hidden from Installed Plugins
2026-01-26 03:30:35 +01:00
master3395
0c140ed69d fix(plugins): Check ProcessUtilities return values and add shell=True fallback
- Check return values from ProcessUtilities.normalExecutioner() (returns 0/1)
- Add subprocess with shell=True as additional fallback
- Better error handling and logging

Fixes: pm2Manager and paypalPremiumPlugin uninstall failures
2026-01-26 03:25:09 +01:00
master3395
130ec9f4a8 fix(plugins): Improve uninstall retry logic with permission fix and root fallback
- Fix permissions with ProcessUtilities before removal retry
- Add subprocess fallback if running as root
- Add filesystem sync delay after removal
- Better error messages showing all attempted methods

Fixes: pm2Manager and paypalPremiumPlugin uninstall failures
2026-01-26 03:24:23 +01:00
master3395
e92f3a7f17 fix(plugins): Add verification and retry logic to uninstall process
- Verify plugin directory is actually removed after removeFiles()
- If directory still exists, retry with ProcessUtilities.normalExecutioner()
- Return error if directory still exists after all attempts
- Prevents silent failures where uninstall appears successful but plugin remains

Fixes: Plugins showing as installed after 'successful' uninstall
2026-01-26 03:20:56 +01:00
master3395
f9573d9155 fix: Remove remaining emailMarketing references from pluginHolder/views.py
Remove emailMarketing manage_url assignments that were left after
skipping the plugin. These were causing issues.
2026-01-26 03:12:50 +01:00
master3395
806571e0f1 fix: Remove emailMarketing references after removal from INSTALLED_APPS
- Comment out emailMarketing menu item in baseTemplate/index.html
- Skip emailMarketing in pluginHolder/views.py when listing plugins
- Prevents HTTP 500 error when template tries to reverse 'emailMarketing' URL

Fixes: HTTP 500 on /plugins/installed after emailMarketing removal
2026-01-26 03:09:58 +01:00
master3395
618ceb61e5 fix(plugins): Improve auto-cleanup of incomplete plugin directories
- Use pluginInstaller.removeFiles() which handles permissions properly
- Add fallback to rm -rf if pluginInstaller method fails
- Better error handling and logging
- Applied to both install_plugin and install_from_store functions

Fixes: Incomplete plugin directory cleanup failures due to permission issues
2026-01-26 03:09:01 +01:00
master3395
41b548e8f5 fix(plugins): Improve 'already installed' check to handle incomplete directories
- Only consider plugin installed if meta.xml exists
- Auto-cleanup incomplete plugin directories during install
- Prevents 'Plugin already installed' error when directory exists but is incomplete

Fixes: Plugin already installed: discordAuth (when directory exists but incomplete)
2026-01-26 03:03:52 +01:00
master3395
c0af88706b feat(plugins): Add plugin registrations and improve installation process
- Add fail2ban, discordAuth, discordWebhooks, googleTagManager to INSTALLED_APPS
- Add URL routes for all new plugins
- Add automatic lscpd restart after plugin installation in pluginHolder/views.py
- Fix file ownership/permissions for baseTemplate/index.html (cyberpanel:cyberpanel 664)

Plugins added:
- fail2ban: Security management plugin
- discordAuth: Discord authentication plugin
- discordWebhooks: Discord webhook notifications plugin
- googleTagManager: Google Tag Manager integration plugin
2026-01-26 02:53:24 +01:00
master3395
ddc4e8c656 Add NEW/Stale badges to Plugin Store and fix intermittent display issues
- Added NEW badge for plugins updated within last 3 months (90 days)
- Added Stale badge for plugins not updated in last 2 years (730 days)
- Removed Author, Status, and Active columns from Plugin Store view
- Fixed intermittent old table display with cache-busting v7
- Added column count validation to ensure correct 8-column structure
- Added tooltips for NEW and Stale badges with descriptive messages
- Cleared plugin store cache to prevent stale data display
- Updated cache-busting version to v7 to force browser refresh
2026-01-25 22:25:21 +01:00
master3395
56cb95fadd Update pluginHolder with Free/Paid badges and Plugin Information support
- Added Free/Paid badges to Grid View, Table View, and Plugin Store
- Fixed intermittent badge display issues with robust boolean handling
- Updated plugin store to show plugin icons and proper pricing badges
- Removed Deactivate/Uninstall from Plugin Store (only Install/Installed)
- Fixed template syntax errors and duplicate navigation buttons
- Enhanced cache handling for plugin metadata (is_paid, patreon_url, etc.)
- Improved JavaScript cache-busting and isPaid normalization
2026-01-25 20:55:56 +01:00
master3395
67df1a5c3f Add JavaScript to remove duplicate view-toggle divs on page load
- Added code to detect and remove any duplicate view-toggle divs
- Keeps only the one with id='plugins-view-toggle'
- This handles cases where browser cache or template cache shows duplicates
2026-01-22 19:58:54 +01:00
master3395
d38cf84db4 Update View Toggle comment to match user expectation
- Changed comment from 'always shown at top' to simple 'View Toggle'
- This matches what user sees in browser (the correct one with checkmark)
2026-01-22 19:58:31 +01:00
master3395
58f218093f Add unique ID to view-toggle and fix duplicate button selection
- Added id='plugins-view-toggle' to view-toggle div to prevent duplicates
- Updated toggleView() to only select buttons from the main view-toggle
- This should prevent any duplicate button issues
2026-01-22 19:54:29 +01:00
master3395
4d08d1ceab Move view toggle buttons to top, remove duplicate at bottom
- Moved view toggle (Grid View, Table View, Plugin Store, Plugin Development Guide) to top of plugins section
- Removed duplicate view toggle that appeared at bottom
- Now only one set of view toggle buttons appears at the top
2026-01-22 19:50:36 +01:00
master3395
351aefd1a9 Remove duplicate view toggle buttons
- Removed duplicate view toggle section that appeared when plugins exist
- Kept single view toggle that's always visible (after plugins section)
- Fixes issue where Grid View, Table View, Plugin Store buttons appeared twice
2026-01-22 19:49:49 +01:00
master3395
7b1181b231 Add Author field to Plugin Store views (Grid, Table, and Store)
- Added author display to Grid View plugin cards
- Added Author column to Table View
- Added Author column to Plugin Store table view
- Author information is extracted from plugin meta.xml files
- Displays 'Unknown' if author is not specified in meta.xml
2026-01-22 19:48:19 +01:00
master3395
b034d54055 Standardize plugin version format to 1.0.0 and add semantic versioning explanation
- Update examplePlugin and emailMarketing meta.xml to use 1.0.0 format
- Add comprehensive semantic versioning section to plugin help page
- Explain major/minor/patch version numbers with examples
- Standardize all plugins to use three-number version format (X.Y.Z)
- Improve version tracking and update clarity for plugin developers
2026-01-20 01:47:18 +01:00
master3395
571a34822f Fix plugin Settings button to use main route instead of /settings/
- Change default manage_url from /plugins/{plugin}/settings/ to /plugins/{plugin}/
- Many plugins don't have a /settings/ route but have a main route
- Ensures Settings button works for plugins like examplePlugin that only have a main route
- Still respects settings_url and url from meta.xml if provided
2026-01-20 01:39:35 +01:00
master3395
f05f850727 Ensure emailMarketing manage_url is always set correctly
- Add fallback handling for emailMarketing in else branch
- Ensures Settings button always has correct URL (/emailMarketing/)
- Prevents any edge case where manage_url might be wrong
2026-01-20 01:37:49 +01:00
master3395
4eb12a5f81 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
2026-01-20 01:31:18 +01:00
master3395
080749eaa4 Add markdown link and image support to plugin help pages
- Convert linked images (badges): [![alt](img_url)](link_url) to clickable <a><img></a>
- Convert regular images: ![alt](img_url) to <img> tags
- Convert regular links: [text](url) to <a> tags
- All external links open in new tab with security attributes
- Preserve existing HTML tags when wrapping paragraphs
- Fixes badge links not working in README.md content
2026-01-20 01:23:44 +01:00
master3395
5dff70c9e6 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
2026-01-20 01:22:03 +01:00
master3395
5bf3499d6f Fix plugin-specific help pages and examplePlugin version
- Update examplePlugin version from 0 to 1.0 in meta.xml
- Implement proper plugin_help view to show plugin-specific information
- Reads plugin meta.xml for name, version, author, description
- Looks for README.md, HELP.md, CHANGELOG.md files in plugin directory
- Displays plugin information and version history
- Now shows plugin-specific help instead of redirecting to development guide
- Individual plugin Help buttons now show plugin-specific information
2026-01-20 01:19:14 +01:00
master3395
1c1886f4c2 Add proper CSS styling for Plugin Development Guide link button
- Add specific CSS rules for a.view-btn to ensure proper styling
- Help button now displays correctly next to Plugin Store button
- Matches styling of other view toggle buttons (hover effects, colors)
- Button is clearly visible and accessible for users
2026-01-20 01:11:09 +01:00
master3395
efb1a03c53 Add Plugin Development Guide button next to Plugin Store
- Add help button next to CyberPanel Plugin Store button
- Links to /plugins/help/ (Plugin Development Guide)
- Helps users understand how to work with plugins
- Button appears in both view toggle sections (with and without plugins)
- Styled consistently with other view toggle buttons
2026-01-20 01:09:43 +01:00
master3395
8cfe946397 Fix remaining code block in help.html - wrap with verbatim
- Wrap second Django template code example (line 500) with {% verbatim %} tags
- Ensures all Django template syntax in code examples is properly escaped
- Fixes remaining 'Invalid block tag' error on line 660
2026-01-20 01:05:47 +01:00
master3395
1fd893357c Fix help.html template - use verbatim tags for code examples
- Wrap Django template code examples with {% verbatim %} tags
- Prevents Django from parsing template syntax in documentation code blocks
- Fixes 'Invalid block tag' error when displaying code examples
- All code examples now display correctly without syntax errors
2026-01-20 01:05:19 +01:00
master3395
d388e993d5 Fix help.html template - escape Django template tags in code examples
- Replace {% with {%% in code examples to prevent template parsing errors
- Fixes 'block tag with name title appears more than once' error
- Code examples now display correctly without being parsed as actual template blocks
2026-01-20 01:01:40 +01:00
master3395
32561dd9e5 Fix processed_plugins tracking - move add() after successful processing
- Move processed_plugins.add() to after plugin is successfully added to pluginList
- Prevents plugins from being marked as processed if they fail validation
- Ensures pm2Manager and other store-installed plugins show up correctly
2026-01-20 00:55:43 +01:00
master3395
bcc73e4352 Fix installed plugins view to show plugins installed from store - final fix
- Add logic to check installed plugins that don't have source directories
- Fixes issue where PM2 Manager (installed from store) wasn't showing
- Moved processed_plugins.add() to correct location in code flow
- Now shows all 4 installed plugins: testPlugin, discordWebhooks, fail2ban, pm2Manager
2026-01-20 00:55:24 +01:00
master3395
ed84555ddf Fix installed plugins view to show plugins installed from store
- Add logic to check installed plugins that don't have source directories
- Fixes issue where PM2 Manager (installed from store) wasn't showing in installed list
- Now shows all installed plugins regardless of whether they have source in /home/cyberpanel/plugins/
- Prevents duplicate plugin entries by tracking processed plugins
2026-01-20 00:53:18 +01:00
master3395
f2acb8bbfc Fix pluginInstaller encoding issues and installation timing
- Add UTF-8 encoding to all file operations in pluginInstaller
- Fix ASCII codec error in removeFromSettings and removeFromURLs
- Add 2 second delay after installation to allow filesystem sync
- Fix fileinput.input encoding issue in removeFromURLs
- Update uninstall confirmation message to warn about data deletion
- Fixes plugin installation and uninstallation from store
2026-01-20 00:47:49 +01:00
master3395
fa6ce67f24 Fix 500 error and pluginInstaller fileinput encoding issue
- Revert GitHub API fetching in installed() view to use local file modification time (prevents timeouts)
- Fix fileinput.input() encoding issue in pluginInstaller.removeFromURLs()
- Replace fileinput with manual file read/write using utf-8 encoding
- Add missing import re to pluginInstaller
- Fixes 500 Internal Server Error on CyberPanel pages
- Fixes plugin installation from store
2026-01-20 00:38:21 +01:00
master3395
046d5458bd Disable GitHub API calls for modify_date in installed() view
- Use local file modification time by default to prevent timeouts
- GitHub API calls commented out (can be enabled if needed)
- Improves page load performance
- Prevents 500 errors from API timeouts
2026-01-20 00:08:46 +01:00
master3395
271507eff2 Add better error handling for pluginInstaller exceptions
- Catch and re-raise exceptions from pluginInstaller.installPlugin()
- Add logging for installation steps
- Improve error messages for debugging
2026-01-19 23:44:52 +01:00
master3395
d5e8edc9bd Fix plugin ZIP structure for installation
- Add plugin name as directory prefix in ZIP file
- pluginInstaller expects ZIP to contain plugin_name/ directory
- Fixes installation failure where plugin directory was not created
2026-01-19 23:39:48 +01:00
master3395
48e11f19ed Update uninstall confirmation message
- Change message to warn that all data will be deleted
- Apply to both local and store uninstall functions
2026-01-19 23:36:50 +01:00