fix kugou cross-domain visit block bug

This commit is contained in:
Listen 1 2018-06-10 08:54:27 +08:00
parent d074cd78a9
commit 4424e158ec
2 changed files with 7 additions and 3 deletions

View File

@ -1,3 +1,4 @@
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.create({'url': chrome.extension.getURL('listen1.html')}, function(tab) {
// Tab opened.
@ -21,6 +22,9 @@ function hack_referer_header(details) {
(details.url.indexOf("imgcache.qq.com/") != -1)) {
referer_value = "http://y.qq.com/";
}
if (details.url.indexOf(".kugou.com/") != -1) {
referer_value = "http://www.kugou.com/";
}
var isRefererSet = false;
var isOriginSet = false;
@ -57,7 +61,7 @@ function hack_referer_header(details) {
};
chrome.webRequest.onBeforeSendHeaders.addListener(hack_referer_header, {
urls: ["*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*"]
urls: ["*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://*.kugou.com/*"]
}, ['requestHeaders', 'blocking']);

View File

@ -14,11 +14,11 @@
},
"manifest_version": 2,
"name": "Listen 1",
"permissions": [ "notifications", "unlimitedStorage", "downloads", "storage", "contextMenus", "tabs", "*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://api.github.com/*", "*://github.com/*", "webRequest", "webRequestBlocking"],
"permissions": [ "notifications", "unlimitedStorage", "downloads", "storage", "contextMenus", "tabs", "*://music.163.com/*", "*://*.xiami.com/*", "*://*.qq.com/*", "*://*.kugou.com/", "*://api.github.com/*", "*://github.com/*", "webRequest", "webRequestBlocking"],
"version": "1.6.2",
"web_accessible_resources": [ "images/*" ],
"content_scripts": [{
"matches": ["https://listen1.github.io/listen1/*"],
"js": ["js/oauth_callback.js"]
}]
}
}