Skip to content

fix: GitHub LOC injection and API compatibility - #82

Open
dongguacute wants to merge 5 commits into
DervexDev:mainfrom
dongguacute:main
Open

fix: GitHub LOC injection and API compatibility#82
dongguacute wants to merge 5 commits into
DervexDev:mainfrom
dongguacute:main

Conversation

@dongguacute

@dongguacute dongguacute commented Aug 18, 2026

Copy link
Copy Markdown
  • Fix GitHub About section injection for the latest GitHub DOM.
  • Switch LOC requests to the public ghloc.dev API.
  • Make Ghloc-Authorization optional for self-hosted deployments.
  • Fix 404 errors by detecting the repository’s actual default branch instead of assuming main.

- 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
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
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant