Skip to content

chore: ignore artifacts from unraid-api package#2270

Merged
limetech merged 5 commits into
unraid:masterfrom
pujitm:chore/resolve-git
Jun 25, 2025
Merged

chore: ignore artifacts from unraid-api package#2270
limetech merged 5 commits into
unraid:masterfrom
pujitm:chore/resolve-git

Conversation

@pujitm

@pujitm pujitm commented Jun 24, 2025

Copy link
Copy Markdown
Member

For developer convenience, gitignore artifacts produced by installing an unraid-api slackware pkg.

Also stop tracking duplicated files concerned with api/web component/connect integration.

Based on the following git status:

root@Develop:/usr/local/emhttp/plugins# gits
On branch unraid-api
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        modified:   dynamix/include/DefaultPageLayout.php
        deleted:    dynamix/include/DefaultPageLayout/GUIModeSessionFix.php

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   dynamix.my.servers/include/myservers1.php
        modified:   dynamix.my.servers/include/state.php
        modified:   dynamix.my.servers/include/translations.php
        modified:   ../../etc/rc.d/rc.S

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        ../../.node-version
        ../../bin/
        dynamix.my.servers/Connect.page
        dynamix.my.servers/include/UpdateFlashBackup.php
        dynamix.my.servers/include/sso-login.php
        dynamix.my.servers/include/unraid-api.php
        dynamix.my.servers/include/welcome-modal.php
        dynamix.my.servers/scripts/
        dynamix.my.servers/unraid-components/
        dynamix.unraid.net/
        ../../etc/rc.d/rc.flash_backup
        ../../etc/rc.d/rc.unraid-api
        ../../etc/rc.d/rc0.d
        ../../etc/rc.d/rc6.d/
        ../../lib/
        ../../sbin/unraid-api
        ../../share/dynamix.unraid.net/
        ../../unraid-api/

Summary by CodeRabbit

  • Chores

    • Updated ignore patterns to exclude additional Unraid API-related files and directories from version control.
  • Refactor

    • Removed several legacy files related to server state management, registration, translations, activation code extraction, reboot details, and web component extraction.
    • Deleted the Registration page and related server-side scripts for user profile and registration UI components.

No user-facing features or bug fixes are included in this release.

@coderabbitai

coderabbitai Bot commented Jun 24, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This change removes several PHP files and components related to Unraid's "my servers" plugin, including classes for web component extraction, server state, translations, activation code extraction, and reboot details. It also updates the .gitignore to comprehensively exclude Unraid API artifacts and removes a related menu page and data endpoint.

Changes

File(s) Change Summary
.gitignore Removed an ignored web component file; added comprehensive ignore rules for Unraid API artifacts.
emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php
myservers1.php
Deleted web components extractor class and its usage script.
emhttp/plugins/dynamix.my.servers/include/state.php
data/server-state.php
Deleted server state class and the endpoint serving server state as JSON.
emhttp/plugins/dynamix.my.servers/include/translations.php
myservers2.php
Deleted web component translations class and its initialization script.
emhttp/plugins/dynamix.my.servers/include/activation-code-extractor.php Deleted activation code extractor class.
emhttp/plugins/dynamix.my.servers/include/reboot-details.php Deleted reboot details class.
emhttp/plugins/dynamix.my.servers/Registration.page Deleted the Registration page definition and its PHP logic.

Possibly related PRs

Poem

In the warren of code, some files hop away,
Old scripts and classes now call it a day.
Web bits and translations, all swept aside—
The garden is tidier, with nothing to hide.
As the server burrows on, lean and light,
The rabbit waves goodbye, whiskers twitching in delight!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a6aae4 and 0897e68.

📒 Files selected for processing (7)
  • .gitignore (1 hunks)
  • emhttp/plugins/dynamix.my.servers/Registration.page (0 hunks)
  • emhttp/plugins/dynamix.my.servers/data/server-state.php (0 hunks)
  • emhttp/plugins/dynamix.my.servers/include/activation-code-extractor.php (0 hunks)
  • emhttp/plugins/dynamix.my.servers/include/myservers2.php (0 hunks)
  • emhttp/plugins/dynamix.my.servers/include/reboot-details.php (0 hunks)
  • emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php (0 hunks)
💤 Files with no reviewable changes (6)
  • emhttp/plugins/dynamix.my.servers/data/server-state.php
  • emhttp/plugins/dynamix.my.servers/Registration.page
  • emhttp/plugins/dynamix.my.servers/include/myservers2.php
  • emhttp/plugins/dynamix.my.servers/include/activation-code-extractor.php
  • emhttp/plugins/dynamix.my.servers/include/web-components-extractor.php
  • emhttp/plugins/dynamix.my.servers/include/reboot-details.php
🚧 Files skipped from review as they are similar to previous changes (1)
  • .gitignore
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@pujitm pujitm requested a review from limetech June 24, 2025 20:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (4)
.gitignore (3)

75-83: pnpm-lock.yaml is ignored but workspace files are still tracked

If you’re adopting pnpm, consider also ignoring the cache/work-space artefacts (pnpm-workspace.yaml, .pnpm-store*, etc.) to keep the repository free of large, deterministic build artefacts.

 emhttp/plugins/pnpm-lock.yaml
+emhttp/plugins/pnpm-workspace.yaml
+.pnpm-store/

84-90: bin/ and lib/node_modules patterns are too broad

Patterns without a leading slash match any nested path named bin/ or lib/node_modules/.
That will silently exclude unrelated project assets under sub-directories (e.g. a docs/bin/ folder).

Tighten the scope by anchoring the patterns to the repo root:

-bin/
-lib/node_modules
+ /bin/
+ /lib/node_modules/

Please double-check whether any legitimate sub-directory is now unintentionally ignored.


91-99: Inconsistent use of trailing slashes

Some directory entries (etc/rc.d/rc0.d, etc/rc.d/rc6.d) are missing the trailing slash while others have it. Keeping the syntax consistent avoids future confusion and accidental mismatches.

-etc/rc.d/rc0.d
-etc/rc.d/rc6.d
+etc/rc.d/rc0.d/
+etc/rc.d/rc6.d/
emhttp/plugins/dynamix.my.servers/.gitignore (1)

1-13: Duplication with root-level .gitignore

Most of these patterns are already covered by the root .gitignore. Keeping two sources of truth invites divergence over time.

Option A – delete this file and rely on the root ignore rules.

Option B – keep it, but add a comment explaining why a plugin-scoped .gitignore is required (e.g. to support subtree check-outs).

Either way, document the intent to prevent future clean-up churn.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5e2a204 and 04f792c.

📒 Files selected for processing (5)
  • .gitignore (1 hunks)
  • emhttp/plugins/dynamix.my.servers/.gitignore (1 hunks)
  • emhttp/plugins/dynamix.my.servers/include/myservers1.php (0 hunks)
  • emhttp/plugins/dynamix.my.servers/include/state.php (0 hunks)
  • emhttp/plugins/dynamix.my.servers/include/translations.php (0 hunks)
💤 Files with no reviewable changes (3)
  • emhttp/plugins/dynamix.my.servers/include/state.php
  • emhttp/plugins/dynamix.my.servers/include/myservers1.php
  • emhttp/plugins/dynamix.my.servers/include/translations.php

@pujitm

pujitm commented Jun 24, 2025

Copy link
Copy Markdown
Member Author

a sister pr for the api repo is up at unraid/api#1435

ran a diff between the 2 dynamix.my.servers to make sure recent changes from here are reflected in the api's dynamix.my.servers.

pujitm added a commit to unraid/api that referenced this pull request Jun 25, 2025
Complement to unraid/webgui#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 -->
@limetech limetech merged commit 918ba6d into unraid:master Jun 25, 2025
1 check passed
@ljm42 ljm42 added the 7.2 label Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants