Skip to content

Commit

Permalink
Fix condition for inject file
Browse files Browse the repository at this point in the history
  • Loading branch information
Baghdasaryan committed Sep 6, 2023
1 parent 6d1d7a1 commit 6ddf303
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/serviceWorker/serviceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class ServiceWorker extends BaseService {
const isUrlExluded: boolean = EXCLUDED_URLS.some(url => tab.url?.startsWith(url));
const filters = [{key: 'pageType', value: PageType.MODIFY_REQUEST_BODY}, {key: 'enabled', value: true}];
const rules: IRuleMetaData[] = await StorageService.getFilteredRules(filters);
if (!BSService.isSupportScripting() && isUrlExluded && rules.length) return;
if (!BSService.isSupportScripting() || isUrlExluded || !rules.length) return;
InjectCodeService.injectContentScript(tabId, rules);
};

Expand Down
2 changes: 1 addition & 1 deletion src/services/InjectCodeService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class InjectCodeService extends BaseService {
target : {tabId},
// this code runs in the browser tab
func: (rules: IRuleMetaData[], NAMESPACE: string, runtimeId: string) => {
window[NAMESPACE].rules = rules.filter(rule => rule.enabled);
window[NAMESPACE].rules = rules;
window[NAMESPACE].runtimeId = runtimeId;
window[NAMESPACE].start();
},
Expand Down

0 comments on commit 6ddf303

Please sign in to comment.