Request permissions for all 4chan.org and 4cdn.org subdomains in the Chrome extension.

This should reduce the frequency of asking for new permissions.
This commit is contained in:
ccd0 2017-01-05 03:11:12 -08:00
parent 14b7bb2f1f
commit a110d2f703
4 changed files with 13 additions and 6 deletions

View File

@ -21,12 +21,18 @@
"youtubeAPIKey": "AIzaSyB5_zaen_-46Uhz1xGR-lz1YoUMHqCD6CE", "youtubeAPIKey": "AIzaSyB5_zaen_-46Uhz1xGR-lz1YoUMHqCD6CE",
"distBranch": "gh-pages", "distBranch": "gh-pages",
"uploadPath": "www.4chan-x.net:/var/www/html/", "uploadPath": "www.4chan-x.net:/var/www/html/",
"matches": [ "includes_only": [
"*://boards.4chan.org/*", "*://boards.4chan.org/*",
"*://sys.4chan.org/*", "*://sys.4chan.org/*",
"*://www.4chan.org/*", "*://www.4chan.org/*",
"*://i.4cdn.org/*", "*://i.4cdn.org/*",
"*://is.4chan.org/*", "*://is.4chan.org/*"
],
"matches_only": [
"*://*.4chan.org/*",
"*://*.4cdn.org/*"
],
"matches": [
"https://www.google.com/recaptcha/api2/anchor?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*", "https://www.google.com/recaptcha/api2/anchor?k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*",
"https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*", "https://www.google.com/recaptcha/api2/frame?*&k=6Ldp2bsSAAAAAAJ5uyx_lx34lJeEpTLVkP5k04qc*",
"https://www.google.com/recaptcha/api2/frame?*&k=887877714&*", "https://www.google.com/recaptcha/api2/frame?*&k=887877714&*",

View File

@ -147,6 +147,8 @@ Main =
ImageCommon.addControls video ImageCommon.addControls video
return return
return unless hostname is 'boards.4chan.org'
if pathname[2] in ['thread', 'res'] if pathname[2] in ['thread', 'res']
g.VIEW = 'thread' g.VIEW = 'thread'
g.THREADID = +pathname[3] g.THREADID = +pathname[3]

View File

@ -10,7 +10,7 @@
}, },
"content_scripts": [{ "content_scripts": [{
"js": ["script.js"], "js": ["script.js"],
"matches": <%= JSON.stringify(meta.matches) %>, "matches": <%= JSON.stringify(meta.matches_only.concat(meta.matches)) %>,
"exclude_matches": <%= JSON.stringify(meta.exclude_matches) %>, "exclude_matches": <%= JSON.stringify(meta.exclude_matches) %>,
"all_frames": true, "all_frames": true,
"run_at": "document_start" "run_at": "document_start"
@ -24,8 +24,7 @@
"key": "<%= meta.appid %>", "key": "<%= meta.appid %>",
<% } %> "minimum_chrome_version": "<%= meta.min.chrome %>", <% } %> "minimum_chrome_version": "<%= meta.min.chrome %>",
"permissions": [ "permissions": [
"storage", "storage"
"*://a.4cdn.org/"
], ],
"optional_permissions": [ "optional_permissions": [
"*://*/" "*://*/"

View File

@ -25,7 +25,7 @@
return expand(matches, /^\*/, ['http', 'https']); return expand(matches, /^\*/, ['http', 'https']);
} }
return [].concat( return [].concat(
expandMatches(meta.matches).map(function(match) { expandMatches(meta.includes_only.concat(meta.matches)).map(function(match) {
return '// @include ' + match; return '// @include ' + match;
}), }),
expandMatches(meta.exclude_matches).map(function(match) { expandMatches(meta.exclude_matches).map(function(match) {