feat show badge count based on headers applied to current page When U…#109
Open
Kirrrusha wants to merge 1 commit into
Open
feat show badge count based on headers applied to current page When U…#109Kirrrusha wants to merge 1 commit into
Kirrrusha wants to merge 1 commit into
Conversation
🤖 Pull request artifacts
|
…RL filters are configured the extension icon badge now shows 0 empty if the current page doesn't match any filter and the actual header count only when headers are actively being injected - Add countActiveHeadersForUrl utility with doesUrlMatchFilter - Update setBrowserHeaders to pass current tab URL to badge logic - Add tabsonUpdated listener to refresh badge on navigation - Add 'tabs' permission to all manifests
af42196 to
cee7b51
Compare
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.
feat: бейдж показывает число заголовков, применимых к текущей вкладке
Описание
Иконка расширения отражает не общее число активных заголовков в профиле, а сколько из них реально применяется к URL активной вкладки, если заданы URL-фильтры.
activeRulesCount === 0)chrome://,about:blank, гонки)Изменения
countActiveHeadersForUrl,doesUrlMatchFilter— подсчёт с учётом фильтров; семантика как у DNR: паттерны с*://черезconvertToRegexFilter, остальное — какurlFilter(подстрока /*, без учёта регистра).setBrowserHeaders(result, currentTabUrl?)— второй аргумент для расчётаactiveRulesCountпередsetIconBadge.background.ts:getCurrentTabUrl(), передача URL во все вызовыsetBrowserHeaders;tabs.onActivated— URL изtabs.get;tabs.onUpdated(status === complete, только активная вкладка).tabs.src/shared/utils/__tests__/countActiveHeadersForUrl.spec.ts(Vitest).tests/e2e/badge-url-filters.spec.ts— два заголовка и фильтрhttps://example.com/*: наexample.comбейдж2, после перехода наexample.org— пустой (черезchrome.action.getBadgeTextв service worker).Чеклист
pnpm test:unit(в т.ч.countActiveHeadersForUrl).pnpm build:chromium && pnpm exec playwright test tests/e2e/badge-url-filters.spec.ts --project=chrome-extension(нужен сеть иplaywright install).Заметки для ревью
tabs— дляtabs.query/tabs.get/onUpdated; стоит упомянуть в release notes для магазинов.