fix: GitHub LOC injection and API compatibility - #82
Closed
dongguacute wants to merge 5 commits into
Closed
dongguacute wants to merge 5 commits into
dongguacute wants to merge 5 commits into
Conversation
- Updated the `locateRoot` function to use a MutationObserver for dynamic DOM changes, enhancing the reliability of root element detection. - Modified the `loadLoc` function to improve type safety and URL construction for fetching LOC data, including support for custom branch names with slashes. - Updated the link in the `Stat` component to point to the new domain for the application.
- Updated the URL construction in the `fetchLoc` function to handle optional branch paths more cleanly. - Modified the `Stat` component's link to conditionally include the branch parameter based on its presence. - Improved branch detection logic in the `getTarget` function to utilize more reliable DOM selectors.
- Updated the `fetchLoc` function to accept an `isPublic` parameter, allowing for conditional API URL selection based on repository visibility. - Introduced a new `isPublicRepository` function to determine repository visibility more reliably. - Refactored the `locateRoot` function to utilize the new visibility detection logic, improving the overall robustness of the LOC fetching process.
dongguacute
marked this pull request as draft
August 18, 2026 17:38
…nd file filtering - Introduced new interfaces for GitHub API responses to improve type safety. - Refactored the `fetchLocalLoc` and `fetchPublicLoc` functions to streamline LOC data retrieval and incorporate ignored file filtering. - Added utility functions for decoding base64 content and counting text lines, enhancing the overall robustness of the LOC fetching process. - Improved error handling for GitHub API requests to provide clearer feedback on failures.
dongguacute
marked this pull request as ready for review
August 18, 2026 17:43
- Removed the redundant `isInjected` function to simplify the injection process. - Updated the `injectStat` function to check for an existing element before creating a new one, improving efficiency. - Ensured proper placement of the injected element based on the presence of specific text in the last child of the root element.
Owner
|
Thanks for the contribution — the About-section injection and default-branch detection fixes are useful. I'm closing this PR because we don't want to switch LOC fetching to the public ghloc.dev API or add in-browser/local counting. This extension relies on a custom ghloc backend that already supports private repos via the user's GitHub token, and dropping that path would break private-repo support. I've extracted just the injection + default-branch fixes into a separate PR: #84 |
Owner
|
The close comment above was generated by Grok Bot. |
DervexDev
added a commit
that referenced
this pull request
Sep 15, 2026
- Improve About section detection using normalize-space XPath for better DOM compatibility - Add MutationObserver to handle cases where About section loads after initial page paint - Reuse existing #github-loc element to prevent widget duplication on re-injection - Improve branch detection by checking tree/blob path and branch selector with fallbacks - Stop defaulting to 'main' branch - use empty string to let backend resolve default - Handle empty branch in API URL and Stat link to support default branch resolution - Encode branch parameter in Stat link for proper URL formatting Changes extracted from PR #82 by dongguacute, keeping only DOM/branch fixes while maintaining the existing custom ghloc backend with token support. Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
main.