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 -->
Unraid Plugin Builder
Tool for building and testing Unraid plugins locally as well as packaging them for deployment.
Development Workflow
1. Watch for Changes
The watch command will automatically sync changes from the API, UI components, and web app into the plugin source:
# Start watching all components
pnpm run watch:all
# Or run individual watchers:
pnpm run api:watch # Watch API changes
pnpm run ui:watch # Watch Unraid UI component changes
pnpm run wc:watch # Watch web component changes
This will copy:
- API files to
./source/dynamix.unraid.net/usr/local/unraid-api - UI components to
./source/dynamix.unraid.net/usr/local/emhttp/plugins/dynamix.my.servers/unraid-components - Web components to the same UI directory
2. Build the Plugin
Once your changes are ready, build the plugin package:
# Build using Docker - on non-Linux systems
pnpm run docker:build-and-run
# Or build with the build script
pnpm run build:validate
This will create the plugin files in ./deploy/release/
3. Serve and Install
Start a local HTTP server to serve the plugin files:
# Serve the plugin files
pnpm run http-server
Then install the plugin on your Unraid development machine by visiting:
http://SERVER_NAME.local/Plugins
Then paste the following URL into the Unraid Plugins page:
http://YOUR_LOCAL_DEV_MACHINE_IP:5858/plugins/local/dynamix.unraid.net.plg
Replace SERVER_NAME with your development machine's hostname.
Development Tips
- Run watchers in a separate terminal while developing
- The http-server includes CORS headers for local development
- Check the Unraid system log for plugin installation issues
Environment Setup
-
Initialize environment:
pnpm run env:init -
Validate environment:
pnpm run env:validate
Available Commands
Build Commands
build- Build the plugin packagebuild:validate- Build with environment validationdocker:build- Build the Docker containerdocker:run- Run the builder in Dockerdocker:build-and-run- Build and run in Docker
Watch Commands
watch:all- Watch all component changesapi:watch- Watch API changesui:watch- Watch UI component changeswc:watch- Watch web component changes
Server Commands
http-server- Serve the plugin files locally
Environment Commands
env:init- Create initial .env fileenv:validate- Validate environment setupenv:clean- Remove .env file
Troubleshooting
-
Watch not updating files
- Check that source directories exist
- Verify file permissions
-
Build failures
- Ensure .env file exists
- Check Docker setup if using containerized build
- Verify source files are present
-
Installation issues
- Confirm http-server is running
- Check your local IP is correct
- Verify plugin file permissions