Skip to content

Commit a489fae

Browse files
committed
setting-page-filter: update setting
1 parent 5b02d94 commit a489fae

2 files changed

Lines changed: 26 additions & 8 deletions

File tree

Resources/BrowserGuard.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
},
1919
"SettingPageFilter": {
2020
"Enabled": false,
21-
"BlockedPrefixes": ["edge://settings/"]
21+
"NotifyOnBlocked": true,
22+
"BlockedPrefixes": [
23+
"edge://settings",
24+
"edge://extensions",
25+
"edge://flags",
26+
"edge://policy"
27+
]
2228
}
2329
}

webextensions/edge/setting-page-filter.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import { loadConfig } from './config-loader.js';
44

55
export const SettingPageFilter = {
66
enabled: true,
7-
blockedPrefixes: ['edge://settings/'],
7+
notifyOnBlocked: true,
8+
blockedPrefixes: [
9+
'edge://settings',
10+
'edge://extensions',
11+
'edge://flags',
12+
'edge://policy',
13+
],
814

915
async init() {
1016
const config = await loadConfig();
@@ -17,9 +23,13 @@ export const SettingPageFilter = {
1723
if (typeof settingPageFilter.Enabled === 'boolean') {
1824
this.enabled = settingPageFilter.Enabled;
1925
}
26+
if (typeof settingPageFilter.NotifyOnBlocked === 'boolean') {
27+
this.notifyOnBlocked = settingPageFilter.NotifyOnBlocked;
28+
}
2029
if (Array.isArray(settingPageFilter.BlockedPrefixes)) {
2130
this.blockedPrefixes = settingPageFilter.BlockedPrefixes;
2231
}
32+
2333
},
2434

2535
isBlockedUrl(url) {
@@ -33,12 +43,14 @@ export const SettingPageFilter = {
3343
chrome.tabs.goBack(details.tabId).catch(() =>
3444
chrome.tabs.update(details.tabId, { url: 'about:blank' })
3545
);
36-
chrome.notifications.create('settings-blocked', {
37-
type: 'basic',
38-
iconUrl: 'misc/128x128.png',
39-
title: '設定画面へのアクセスはブロックされています',
40-
message: '拡張機能のポリシーにより edge://settings/ は表示できません。',
41-
});
46+
if (this.notifyOnBlocked) {
47+
chrome.notifications.create('settings-blocked', {
48+
type: 'basic',
49+
iconUrl: 'misc/128x128.png',
50+
title: '設定画面へのアクセスはブロックされています',
51+
message: `拡張機能のポリシーにより ${details.url} は表示できません。`,
52+
});
53+
}
4254
},
4355
}
4456

0 commit comments

Comments
 (0)