Fix About-section injection and default-branch detection - #84
Merged
Merged
Conversation
- 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.
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.
This PR cherry-picks two specific fixes from PR #82 by @dongguacute while preserving the existing custom ghloc backend architecture.
Changes Included
1. Fix GitHub About Section Injection
normalize-space(.)="About"XPath instead oftext()="About"to handle varying whitespace in GitHub's DOM#github-locelement on re-injection instead of creating duplicates2. Fix Default Branch Detection
Changes NOT Included
The following changes from PR #82 were intentionally left out to preserve the existing architecture:
fetchLocalLoc/fetchPublicLocsplitisPublicparameter driving API choiceGhloc-AuthorizationheaderWhy This Approach?
The custom ghloc backend (
ghloc-api.vercel.app/ghloc.vercel.app) already supports private repositories via the user's GitHub token with the salt-based authentication flow. Switching to the public API would break this functionality.These cherry-picked fixes address real issues:
Credits: DOM and branch detection improvements extracted from PR #82 by @dongguacute
Generated by Grok Bot.