diff --git a/js/background.js b/js/background.js index 53c81ba..a096588 100644 --- a/js/background.js +++ b/js/background.js @@ -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']); diff --git a/manifest.json b/manifest.json index 0193778..2e3588e 100644 --- a/manifest.json +++ b/manifest.json @@ -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"] }] -} +} \ No newline at end of file