Files
api/plugin/source
Pujit Mehrotra 5ba4479663 chore: rm obsolete style block from myservers1.php (#1435)
Complement to https://github.com/unraid/webgui/pull/2270

Compared our dynamix.my.servers with the webgui's and made the
corresponding changes. activation code logic was omitted because it has
already been written into the api.

python script used for comparison:
https://gist.github.com/pujitm/43a4d2fc35c74f51c70cc66fe1909e6c
```py
#!/usr/bin/env python3
"""
Directory comparison script that recursively compares two directories
and shows files that exist in one but not the other, plus diffs for common files.
"""

import os
import sys
import subprocess
from pathlib import Path
from typing import Set, Tuple


def get_all_files(directory: str) -> Set[str]:
    """Get all files in a directory recursively, returning relative paths."""
    files = set()
    dir_path = Path(directory)
    
    if not dir_path.exists():
        print(f"Error: Directory '{directory}' does not exist")
        return files
    
    for root, dirs, filenames in os.walk(directory):
        for filename in filenames:
            full_path = Path(root) / filename
            # Get relative path from the base directory
            relative_path = full_path.relative_to(dir_path)
            files.add(str(relative_path))
    
    return files


def compare_directories(dir1: str, dir2: str) -> Tuple[Set[str], Set[str], Set[str]]:
    """
    Compare two directories and return files in each directory.
    
    Returns:
        - files only in dir1
        - files only in dir2  
        - files in both directories
    """
    files1 = get_all_files(dir1)
    files2 = get_all_files(dir2)
    
    only_in_dir1 = files1 - files2
    only_in_dir2 = files2 - files1
    in_both = files1 & files2
    
    return only_in_dir1, only_in_dir2, in_both


def run_diff(file1_path: str, file2_path: str, relative_path: str) -> bool:
    """
    Run diff on two files and print the output.
    Returns True if files are different, False if identical.
    """
    try:
        # Use diff -u for unified diff format
        result = subprocess.run(
            ['diff', '-u', file1_path, file2_path],
            capture_output=True,
            text=True
        )
        
        if result.returncode == 0:
            # Files are identical
            return False
        elif result.returncode == 1:
            # Files are different
            print(f"\n--- Diff for: {relative_path} ---")
            print(result.stdout)
            return True
        else:
            # Error occurred
            print(f"\nError running diff on {relative_path}: {result.stderr}")
            return False
            
    except FileNotFoundError:
        print(f"\nError: 'diff' command not found. Please install diffutils.")
        return False
    except Exception as e:
        print(f"\nError comparing {relative_path}: {e}")
        return False


def compare_file_contents(dir1: str, dir2: str, common_files: Set[str]) -> Tuple[int, int]:
    """
    Compare contents of files that exist in both directories.
    Returns (identical_count, different_count).
    """
    identical_count = 0
    different_count = 0
    
    print(f"\nComparing contents of {len(common_files)} common files...")
    print("=" * 60)
    
    for relative_path in sorted(common_files):
        file1_path = os.path.join(dir1, relative_path)
        file2_path = os.path.join(dir2, relative_path)
        
        if run_diff(file1_path, file2_path, relative_path):
            different_count += 1
        else:
            identical_count += 1
    
    return identical_count, different_count


def main():
    if len(sys.argv) < 3:
        print("Usage: python compare_directories.py <directory1> <directory2> [--no-diff]")
        print("Example: python compare_directories.py /path/to/dir1 /path/to/dir2")
        print("Use --no-diff to skip content comparison")
        sys.exit(1)
    
    dir1 = sys.argv[1]
    dir2 = sys.argv[2]
    skip_diff = '--no-diff' in sys.argv
    
    print(f"Comparing directories:")
    print(f"  Directory 1: {dir1}")
    print(f"  Directory 2: {dir2}")
    print("=" * 60)
    
    only_in_dir1, only_in_dir2, in_both = compare_directories(dir1, dir2)
    
    print(f"\nFiles only in '{dir1}' ({len(only_in_dir1)} files):")
    if only_in_dir1:
        for file in sorted(only_in_dir1):
            print(f"  - {file}")
    else:
        print("  (none)")
    
    print(f"\nFiles only in '{dir2}' ({len(only_in_dir2)} files):")
    if only_in_dir2:
        for file in sorted(only_in_dir2):
            print(f"  - {file}")
    else:
        print("  (none)")
    
    print(f"\nFiles in both directories ({len(in_both)} files):")
    if in_both:
        for file in sorted(in_both):
            print(f"  - {file}")
    else:
        print("  (none)")
    
    # Compare file contents if requested and there are common files
    identical_count = 0
    different_count = 0
    if not skip_diff and in_both:
        identical_count, different_count = compare_file_contents(dir1, dir2, in_both)
    
    print("\n" + "=" * 60)
    print(f"Summary:")
    print(f"  Total files in '{dir1}': {len(only_in_dir1) + len(in_both)}")
    print(f"  Total files in '{dir2}': {len(only_in_dir2) + len(in_both)}")
    print(f"  Files only in '{dir1}': {len(only_in_dir1)}")
    print(f"  Files only in '{dir2}': {len(only_in_dir2)}")
    print(f"  Files in both: {len(in_both)}")
    
    if not skip_diff and in_both:
        print(f"  Identical files: {identical_count}")
        print(f"  Different files: {different_count}")


if __name__ == "__main__":
    main() 
```

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Added support for extracting and displaying activation code data,
including partner information and logos, when relevant.
- **Style**
- Removed embedded CSS styling from the server management interface
header.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-25 12:57:48 -04:00
..