Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add automatic & manual hostname configuration #158

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

BelKed
Copy link
Contributor

@BelKed BelKed commented Feb 11, 2025



Important

Adds automatic and manual hostname configuration, updating client, UI, and storage components to support hostname management.

  • Behavior:
    • Adds automatic hostname detection in client.ts with detectHostname() and autodetectHostname() in main.ts.
    • Updates ensureBucket() and sendHeartbeat() in client.ts to use detected hostname.
    • Modifies getBucketId() in client.ts to include hostname in bucket ID.
  • UI:
    • Adds hostname display in popup/index.html and popup/main.ts.
    • Adds hostname input field in settings/index.html and settings/main.ts for manual configuration.
  • Storage:
    • Adds getHostname() and setHostname() in storage.ts to manage hostname persistence.

This description was created by Ellipsis for 48ed9bd. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 9d8d670 in 3 minutes and 11 seconds

More details
  • Looked at 388 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. src/background/main.ts:27
  • Draft comment:
    Consider passing 'client' as an argument to autodetectHostname for clarity instead of capturing the outer variable.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50%
    While passing dependencies explicitly is generally good practice, this is a background script where client is effectively a global singleton. The client is used consistently this way throughout the file. Making this change would be inconsistent with the rest of the codebase's style. The benefit seems minimal given the context.
    The comment does point out a legitimate code quality improvement from a pure functional programming perspective. Explicit dependencies make code more testable and maintainable.
    However, this appears to be a background script where client is intentionally used as a global singleton throughout. Changing just this one function would be inconsistent.
    Delete the comment as it suggests a change that would be inconsistent with the codebase's established patterns and provides minimal practical benefit in this context.
2. src/background/client.ts:50
  • Draft comment:
    getHostname() may return undefined but ensureBucket expects a string. Consider defaulting the hostname (e.g. to 'unknown') or validating it before use.
  • Reason this comment was not posted:
    Marked as duplicate.
3. src/background/main.ts:28
  • Draft comment:
    In autodetectHostname, if detection fails (i.e. detectedHostname remains undefined), consider logging a warning to aid debugging.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
4. src/popup/main.ts:87
  • Draft comment:
    When setting the hostname in the UI, getHostname might return undefined. Consider displaying a fallback value (e.g., 'unknown') instead of showing 'undefined'.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None

Workflow ID: wflow_claeha65UrmZs1gw


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

src/background/client.ts Show resolved Hide resolved
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 48ed9bd in 2 minutes and 0 seconds

More details
  • Looked at 388 lines of code in 8 files
  • Skipped 0 files when reviewing.
  • Skipped posting 9 drafted comments based on config settings.
1. src/background/client.ts:13
  • Draft comment:
    Good update: passing hostname to ensureBucket. Consider adding a comment on fallback 'unknown' to clarify the design.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
2. src/background/client.ts:31
  • Draft comment:
    The detectHostname function catches errors and returns undefined. This behavior is acceptable if silent failure is intended.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
3. src/background/main.ts:27
  • Draft comment:
    autodetectHostname function calls setHostname but is not awaited. Ensure non-blocking behavior is intended.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
4. src/popup/main.ts:86
  • Draft comment:
    Hostname status is rendered similarly to browser name. Consider handling undefined values explicitly.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
5. src/settings/main.ts:87
  • Draft comment:
    Restoring hostname value: consider handling case where getHostname returns undefined to avoid setting an undefined value in the input.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50%
    None
6. src/background/client.ts:38
  • Draft comment:
    Consider logging the error details in the catch block of detectHostname to aid debugging.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None
7. src/background/client.ts:27
  • Draft comment:
    Infinite retries in ensureBucket (using { forever: true, minTimeout: 500 }) could mask persistent errors. Consider capping retries or adding more error handling.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None
8. src/background/main.ts:60
  • Draft comment:
    autodetectHostname is an async function and is called without await. Consider awaiting it or adding error handling to capture potential issues.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None
9. src/popup/main.ts:87
  • Draft comment:
    If getHostname returns undefined, the UI may display 'undefined'. Consider providing a fallback (e.g. 'unknown').
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50%
    None

Workflow ID: wflow_zGlTKoISQdUbjaH6


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants