Commit Graph

8 Commits

Author SHA1 Message Date
master3395
0bc8c745e4 Fix issue #1643: Fix downloadFile function to properly parse query parameters
- Changed from incorrect URI splitting to proper request.GET.get() method
- Added proper URL decoding with unquote()
- Fixed both downloadFile and RootDownloadFile functions
- Added path normalization for additional security
- Added file existence validation
- Improved error messages to match reported error format

This fixes the 'Unauthorized access: Not a valid file' error when downloading files from the file manager.
2026-01-07 23:47:23 +01:00
Master3395
7c692ab250 Implement .htaccess feature banner and extraction support in file manager
- Added a new fixed position banner in the index.html to announce .htaccess support, including styling and functionality for showing and dismissing the notification.
- Enhanced file manager to support extraction of 7z and rar file formats, with appropriate command handling in filemanager.py.
- Updated JavaScript files to determine extraction types based on file extensions, ensuring compatibility with new formats.
- Modified HTML templates to include options for 7z and rar compression types in the user interface.
https://github.com/usmannasir/cyberpanel/issues/1617#issue-3727006951

These changes improve user experience by providing clear notifications and expanding file management capabilities within CyberPanel.
2025-12-17 19:19:00 +01:00
usmannasir
4bedb9cd73 Implement real-time disk usage updates with async background processing
This commit implements an improved version of PRs #1575 and #1576 from @bdgreenweb
with critical performance optimizations.

## Background
The original PRs (#1575, #1576) proposed real-time disk usage tracking for file
manager operations. While the feature was valuable for improving user awareness of
disk quotas, there were several concerns:

1. **Performance Impact**: Original implementation used synchronous `executioner()`
   calls that would block file operations until disk calculation completed
2. **Target Branch Issues**: PRs were submitted to the stable branch instead of
   development branch, which could introduce instability
3. **Blocking Operations**: Each file operation would wait for disk usage
   recalculation, potentially causing noticeable delays

## Implementation Changes

### filemanager/filemanager.py
- Added disk usage updates to 9 file operation methods:
  - createNewFile() - After file creation
  - createNewFolder() - After folder creation
  - deleteFolderOrFile() - After deletion (both permanent and trash)
  - restore() - After restoring from trash
  - copy() - After copying files/folders
  - move() - After moving files/folders
  - upload() - After file uploads
  - extract() - After extracting archives
  - compress() - After creating archives

### plogical/IncScheduler.py
- Added CalculateAndUpdateDiskUsageDomain() function for domain-specific updates
- Added command-line argument handler for UpdateDiskUsageForceDomain
- Calculates disk usage for websites, email accounts, and bandwidth

## Key Improvements Over Original PRs

1. **Asynchronous Execution**: Uses `popenExecutioner()` instead of `executioner()`
   - File operations return immediately without waiting
   - Disk usage updates happen in background threads
   - Zero performance impact on user operations

2. **Selective Updates**: Only updates the specific domain affected by the operation
   rather than all domains system-wide

3. **Proper Branch Targeting**: Applied to development branch (v2.5.5-dev) for
   proper testing before stable release

## Benefits
- Real-time disk usage tracking as requested
- No performance degradation
- Users immediately aware of quota usage
- Prevents accidental quota violations
- Better than competitors (cPanel/DirectAdmin) in responsiveness

## Acknowledgments
Thank you @bdgreenweb for the original implementation idea and PRs #1575/#1576.
While we couldn't merge them directly due to the performance and stability concerns
mentioned above, your contribution highlighted an important feature gap. This
implementation preserves your core functionality while addressing the performance
concerns through asynchronous execution.

This will definitely help organizations track disk usage more effectively without
sacrificing file manager performance.
2025-10-08 13:40:16 +05:00
Master3395
af434bcb89 Enhance file deletion process in FileManager: Implement detailed logging for file and directory deletion, including security checks and error handling. Improve handling of immutable flags and ensure proper permissions for suspension pages in website management. Add fallback mechanisms for system file deletions and enhance user feedback on operations. 2025-09-20 20:39:35 +02:00
Master3395
f4b627f2ff Refactor FileManager: Update file paths for hello.txt and enhance directory mutability settings. Allow specific directories to remain mutable by adjusting chattr settings for logs, trash, backup, incbackup, lscache, and .cagefs. 2025-09-20 19:14:05 +02:00
Master3395
97fd4e055a Enhance security by adding rel="noopener" to external links
- Updated multiple HTML templates to include rel="noopener" on links that open in a new tab, improving security by preventing potential reverse tabnabbing attacks.
- This change affects various templates across the backup, base, file manager, mail server, and website functions sections.
2025-09-13 17:44:37 +02:00
Master3395
c06533b986 Fix ALL documentation links.
Fix ALL documentation links.
2025-09-08 11:50:35 +02:00
usmannasir
6dd7114f6d Initial commit for v2.4.3 2025-08-01 14:56:30 +05:00