Skip to content

Commit

Permalink
remove https options!
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruo committed Mar 6, 2017
1 parent 535dc20 commit 814d312
Show file tree
Hide file tree
Showing 9 changed files with 126 additions and 157 deletions.
56 changes: 23 additions & 33 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function getUrlVars(url) {

function searchBilibili(info) {
chrome.tabs.create({
url: getOption("https") + "://www.bilibili.com/search?keyword=" + info.selectionText
url: "http://www.bilibili.com/search?keyword=" + info.selectionText
});
}

Expand Down Expand Up @@ -196,7 +196,7 @@ function disableAll() {

function checkDynamic() {
if (getOption("dynamic") == "on") {
getFileData(getOption("https") + "://api.bilibili.com/x/feed/unread/count?type=0", function (data) {
getFileData("http://api.bilibili.com/x/feed/unread/count?type=0", function (data) {
var dynamic = JSON.parse(data);
if (typeof dynamic === "object" && dynamic.code == 0 && typeof dynamic.data === "object" &&
typeof dynamic.data.all === "number") {
Expand All @@ -205,7 +205,7 @@ function checkDynamic() {
chrome.browserAction.setBadgeText({
text: getOption("updates")
});
getFileData(getOption("https") + "://api.bilibili.com/x/feed/pull?ps=1&type=0", function (data) {
getFileData("http://api.bilibili.com/x/feed/pull?ps=1&type=0", function (data) {
var feed = JSON.parse(data);
if (typeof feed === "object" && feed.code == 0 && typeof feed.data === "object" &&
typeof feed.data.feeds === "object" && feed.data.feeds.length > 0) {
Expand Down Expand Up @@ -296,10 +296,10 @@ function getVideoInfo(avid, page, isbangumi, callback) {
bangumi = isbangumi;
resetVideoHostList();
if (isbangumi) {
getFileData(getOption("https") + "://bangumi.bilibili.com/web_api/episode/get_source?episode_id=" + avid, function (result) {
getFileData("http://bangumi.bilibili.com/web_api/episode/get_source?episode_id=" + avid, function (result) {
result = JSON.parse(result)['result'];
avid = result.aid;
getFileData(getOption("https") + "://api.bilibili.com/view?type=json&appkey=8e9fc618fbd41e28&id=" + avid + "&page=" + page + "&batch=true", function (avInfo) {
getFileData("http://api.bilibili.com/view?type=json&appkey=8e9fc618fbd41e28&id=" + avid + "&page=" + page + "&batch=true", function (avInfo) {
avInfo = JSON.parse(avInfo);
if (typeof avInfo.code != "undefined" && avInfo.code == -503) {
setTimeout(function () {
Expand Down Expand Up @@ -334,7 +334,7 @@ function getVideoInfo(avid, page, isbangumi, callback) {
bangumi: false
};
if (typeof avInfo.bangumi == "object") {
getFileData(getOption("https") + "://api.bilibili.cn/sp?spid=" + avInfo.spid, function (spInfo) {
getFileData("http://api.bilibili.cn/sp?spid=" + avInfo.spid, function (spInfo) {
spInfo = JSON.parse(spInfo);
if (spInfo.isbangumi == 1) {
viCache[avid + '-' + page].bangumi = {
Expand All @@ -352,7 +352,7 @@ function getVideoInfo(avid, page, isbangumi, callback) {
});
});
} else
getFileData(getOption("https") + "://api.bilibili.com/view?type=json&appkey=8e9fc618fbd41e28&id=" + avid + "&page=" + page + "&batch=true", function (avInfo) {
getFileData("http://api.bilibili.com/view?type=json&appkey=8e9fc618fbd41e28&id=" + avid + "&page=" + page + "&batch=true", function (avInfo) {
avInfo = JSON.parse(avInfo);
if (typeof avInfo.code != "undefined" && avInfo.code == -503) {
setTimeout(function () {
Expand Down Expand Up @@ -387,7 +387,7 @@ function getVideoInfo(avid, page, isbangumi, callback) {
bangumi: false
};
if (typeof avInfo.bangumi == "object") {
getFileData(getOption("https") + "://api.bilibili.cn/sp?spid=" + avInfo.spid, function (spInfo) {
getFileData("http://api.bilibili.cn/sp?spid=" + avInfo.spid, function (spInfo) {
spInfo = JSON.parse(spInfo);
if (spInfo.isbangumi == 1) {
viCache[avid + '-' + page].bangumi = {
Expand Down Expand Up @@ -599,13 +599,8 @@ chrome.extension.onMessage.addListener(function (request, sender, sendResponse)
// playback: "http://interface.bilibili.com/playurl?platform=android&otype=json&appkey=86385cdc024c0f6c&cid=" + request.cid + "&quality=2&type=mp4"
// };
var url = {
<<<<<<< HEAD
download: "http://interface.bilibili.com/playurl?platform=bilihelper&otype=json&appkey=95acd7f6cc3392f3&cid=" + request.cid + "&quality="+getOption("dlquality"),
playback: "http://interface.bilibili.com/playurl?platform=bilihelper&otype=json&appkey=95acd7f6cc3392f3&cid=" + request.cid + "&quality=2&type=mp4"
=======
download: getOption("https") + "://interface.bilibili.com/playurl?platform=android&otype=json&appkey=86385cdc024c0f6c&cid=" + request.cid + "&quality=3&type=" + getOption("dlquality"),
playback: getOption("https") + "://interface.bilibili.com/playurl?platform=android&otype=json&appkey=86385cdc024c0f6c&cid=" + request.cid + "&quality=2&type=mp4"
>>>>>>> origin/master
};
if (request.cidHack && request.cidHack != locale) {
cidHackType[request.cid] = request.cidHack;
Expand Down Expand Up @@ -638,7 +633,7 @@ chrome.extension.onMessage.addListener(function (request, sender, sendResponse)
});
return true;
case "getMyInfo":
getFileData(getOption("https") + "://api.bilibili.com/myinfo", function (myinfo) {
getFileData("http://api.bilibili.com/myinfo", function (myinfo) {
myinfo = JSON.parse(myinfo);
if (typeof myinfo.code == undefined) myinfo.code = 200;
sendResponse({
Expand All @@ -649,7 +644,7 @@ chrome.extension.onMessage.addListener(function (request, sender, sendResponse)
return true;
case "searchVideo":
var keyword = request.keyword;
getFileData(getOption("https") + "://api.bilibili.com/search?type=json&appkey=8e9fc618fbd41e28&keyword=" + encodeURIComponent(keyword) + "&page=1&order=ranklevel", function (searchResult) {
getFileData("http://api.bilibili.com/search?type=json&appkey=8e9fc618fbd41e28&keyword=" + encodeURIComponent(keyword) + "&page=1&order=ranklevel", function (searchResult) {
searchResult = JSON.parse(searchResult);
if (searchResult.code == 0) {
sendResponse({
Expand All @@ -666,7 +661,7 @@ chrome.extension.onMessage.addListener(function (request, sender, sendResponse)
});
return true;
case "checkComment":
getFileData(getOption("https") + "://www.bilibili.com/feedback/arc-" + request.avid + "-1.html", function (commentData) {
getFileData("http://www.bilibili.com/feedback/arc-" + request.avid + "-1.html", function (commentData) {
var test = commentData.indexOf('<div class="no_more">');
if (test >= 0) {
sendResponse({
Expand All @@ -689,7 +684,7 @@ chrome.extension.onMessage.addListener(function (request, sender, sendResponse)
"投稿不存在", "UP主禁止", "权限有误", "视频未审核/未发布", "禁止游客弹幕"
];
request.comment.cid = request.cid;
postFileData(getOption("https") + "://interface.bilibili.com/dmpost?cid=" + request.cid +
postFileData("http://interface.bilibili.com/dmpost?cid=" + request.cid +
"&aid=" + request.avid + "&pid=" + request.page, request.comment,
function (result) {
result = parseInt(result);
Expand Down Expand Up @@ -920,7 +915,7 @@ chrome.notifications.onButtonClicked.addListener(function (notificationId, index
});
} else if (index === 1) {
chrome.tabs.create({
url: getOption("https") + '://live.bilibili.com/i/following'
url: 'http://live.bilibili.com/i/following'
});
}
} else if (notificationId == 'bh-update') {
Expand All @@ -929,15 +924,15 @@ chrome.notifications.onButtonClicked.addListener(function (notificationId, index
});
} else if (notificationId == 'getTV') {
chrome.tabs.create({
url: getOption("https") + '://live.bilibili.com/i/awards'
url: 'http://live.bilibili.com/i/awards'
});
} else if (index == 0 && notificationAvid[notificationId]) {
chrome.tabs.create({
url: getOption("https") + "://www.bilibili.com/video/av" + notificationAvid[notificationId]
url: "http://www.bilibili.com/video/av" + notificationAvid[notificationId]
});
} else if (index == 1) {
chrome.tabs.create({
url: getOption("https") + "://www.bilibili.com/account/dynamic"
url: "http://www.bilibili.com/account/dynamic"
});
}
});
Expand All @@ -947,7 +942,7 @@ chrome.webRequest.onBeforeRequest.addListener(function (details) {
command: "error"
});
}, {
urls: [getOption("https") + "://comment.bilibili.com/1272.xml"]
urls: ["http://comment.bilibili.com/1272.xml"]
});

chrome.webRequest.onBeforeRequest.addListener(function (details) {
Expand Down Expand Up @@ -986,12 +981,7 @@ chrome.webRequest.onBeforeSendHeaders.addListener(function (details) {
requestHeaders: details.requestHeaders
};
}, {
<<<<<<< HEAD
urls: ["http://interface.bilibili.com/playurl?cid*", "http://interface.bilibili.com/playurl?accel=1&cid=*", "http://interface.bilibili.com/playurl?platform=bilihelper*", "http://www.bilibili.com/video/av*", "http://www.bilibili.com/bangumi/*", "http://app.bilibili.com/bangumi/*", "http://www.bilibili.com/search*", "http://*.acgvideo.com/*", "http://www.bilibili.com/api_proxy*", "http://bangumi.bilibili.com/*", "http://interface.bilibili.com/playurl?platform=android*"]
=======
urls: [/*"http://interface.bilibili.com/playurl?cid*", "http://interface.bilibili.com/playurl?accel=1&cid=*", "http://interface.bilibili.com/playurl?platform=bilihelper*", "http://www.bilibili.com/video/av*", "http://www.bilibili.com/bangumi/*", "http://app.bilibili.com/bangumi/*", "http://www.bilibili.com/search*", "http://*.acgvideo.com/*", "http://www.bilibili.com/api_proxy*", "http://bangumi.bilibili.com/*", "http://interface.bilibili.com/playurl?platform=android*"*/]

>>>>>>> origin/master
}, ['requestHeaders', 'blocking']);

function receivedHeaderModifier(details) {
Expand All @@ -1004,12 +994,12 @@ function receivedHeaderModifier(details) {
if (!hasCORS && !bangumi) {
details.responseHeaders.push({
name: "Access-Control-Allow-Origin",
value: getOption("https") + "://www.bilibili.com"
value: "http://www.bilibili.com"
});
} else if (!hasCORS) {
details.responseHeaders.push({
name: "Access-Control-Allow-Origin",
value: getOption("https") + "://bangumi.bilibili.com"
value: "http://bangumi.bilibili.com"
});
}
return {
Expand Down Expand Up @@ -1042,7 +1032,7 @@ chrome.webRequest.onHeadersReceived.addListener(function (details) {
responseHeaders: headers
};
}, {
urls: [getOption("https") + "://www.bilibili.com/video/av*", getOption("https") + "://bangumi.bilibili.com/anime/v/*"]
urls: ["http://www.bilibili.com/video/av*", "http://bangumi.bilibili.com/anime/v/*"]
}, ["responseHeaders", "blocking"]);

function getCookie(name) {
Expand Down Expand Up @@ -1083,7 +1073,7 @@ Live.notise = {
roomIdList: {},
cacheList: {},
getList: function (d) {
var url = getOption("https") + "://live.bilibili.com/feed/getList/" + Live.notise.page;
var url = "http://live.bilibili.com/feed/getList/" + Live.notise.page;
var callback = function (t) {
t = t.substr(1, t.length - 3);
t = JSON.parse(t);
Expand Down Expand Up @@ -1140,7 +1130,7 @@ Live.notise = {
getFileData(url, callback, type);
},
heartBeat: function () {
getFileData(getOption("https") + "://live.bilibili.com/feed/heartBeat/heartBeat", function (data) {
getFileData("http://live.bilibili.com/feed/heartBeat/heartBeat", function (data) {
data = JSON.parse(data);
Live.notise.do(data);
}, 'POST');
Expand Down Expand Up @@ -1188,4 +1178,4 @@ chrome.runtime.onConnect.addListener(function (port) {
port.onMessage.addListener(function (request, sender, sendResponse) {
if (!request.cmd) return false;
});
});
});
25 changes: 10 additions & 15 deletions src/bilibili_injected.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
biliHelper.mainBlock.downloaderSection.find('p .b-btn.w').click();
});
}
//biliHelper.mainBlock.downloaderSection.find('p').append($('<a class="b-btn" target="_blank" href="' + getOption("https") + '://bilibili.audio/' + biliHelper.avid + '/' + biliHelper.page + '"></a>').text('抽出并下载音频'));
//biliHelper.mainBlock.downloaderSection.find('p').append($('<a class="b-btn" target="_blank" href="http://bilibili.audio/' + biliHelper.avid + '/' + biliHelper.page + '"></a>').text('抽出并下载音频'));
}
if (biliHelper.playbackUrls && biliHelper.playbackUrls.length == 1) {
biliHelper.mainBlock.switcherSection.find('a[type="html5"]').removeClass('hidden');
Expand Down Expand Up @@ -339,7 +339,7 @@
src: {
playlist: [{
video: document.getElementById("bilibili_helper_html5_player_video"),
comments: getOption("https") + "://comment.bilibili.com/" + biliHelper.cid + ".xml"
comments: "http://comment.bilibili.com/" + biliHelper.cid + ".xml"
}]
},
width: "100%",
Expand Down Expand Up @@ -539,8 +539,8 @@
biliHelper.cid = videoInfo.cid;
if (!biliHelper.genPage) {
biliHelper.mainBlock.infoSection.find('p').append($('<span>cid: ' + biliHelper.cid + '</span>'));
var commentDiv = $('<div class="section comment"><h3>弹幕下载</h3><p><a class="b-btn w" href="' + getOption("https") + '://comment.bilibili.com/' + biliHelper.cid + '.xml">下载 XML 格式弹幕</a></p></div>'),
downloadFileName = getDownloadOptions(getOption("https") + '://comment.bilibili.com/' + biliHelper.cid + '.xml',
var commentDiv = $('<div class="section comment"><h3>弹幕下载</h3><p><a class="b-btn w" href="http://comment.bilibili.com/' + biliHelper.cid + '.xml">下载 XML 格式弹幕</a></p></div>'),
downloadFileName = getDownloadOptions('http://comment.bilibili.com/' + biliHelper.cid + '.xml',
getNiceSectionFilename(biliHelper.avid,
biliHelper.page, biliHelper.totalPage, 1, 1)).filename;
commentDiv.find('a').attr('download', downloadFileName).click(function(e) {
Expand All @@ -554,12 +554,7 @@
biliHelper.mainBlock.commentSection = commentDiv;
biliHelper.mainBlock.append(biliHelper.mainBlock.commentSection);
var id = biliHelper.site ==1?biliHelper.avid:biliHelper.cid;
<<<<<<< HEAD
$.get('http://comment.bilibili.com/' + id + '.xml', function(response) {
=======
$.get(getOption("https") + '://comment.bilibili.com/' + id + '.xml', function(response) {
console.log(response)
>>>>>>> origin/master
var assData = '\ufeff' + generateASS(setPosition(parseXML('', response)), {
'title': getNiceSectionFilename(biliHelper.avid, biliHelper.page, biliHelper.totalPage, 1, 1),
'ori': location.href
Expand Down Expand Up @@ -611,7 +606,7 @@
return;
}
var displayUserInfo = function(uid, data) {
control.find('.result').html('发送者: <a href="' + getOption("https") + '://space.bilibili.com/' + uid + '" target="_blank" card="' + parseSafe(data.name) + '">' + parseSafe(data.name) + '</a><div target="_blank" class="user-info-level l' + parseSafe(data.level_info.current_level) + '"></div>');
control.find('.result').html('发送者: <a href="http://space.bilibili.com/' + uid + '" target="_blank" card="' + parseSafe(data.name) + '">' + parseSafe(data.name) + '</a><div target="_blank" class="user-info-level l' + parseSafe(data.level_info.current_level) + '"></div>');
var s = document.createElement('script');
s.appendChild(document.createTextNode('UserCard.bind($("#bilibili_helper .query .result"));'));
document.body.appendChild(s);
Expand All @@ -622,13 +617,13 @@
control.find('.result').text('查询失败, 发送用户可能已被管理员删除.');
} else {
var uid = parseSafe(data.data[0].id);
control.find('.result').html('发送者 UID: <a href="' + getOption("https") + '://space.bilibili.com/' + uid + '" target="_blank">' + uid + '</a>');
control.find('.result').html('发送者 UID: <a href="http://space.bilibili.com/' + uid + '" target="_blank">' + uid + '</a>');
var data = sessionStorage.getItem('user/' + uid);
if (data) {
displayUserInfo(uid, JSON.parse(data));
return false;
}
$.getJSON(getOption("https") + '://api.bilibili.cn/userinfo?mid=' + uid + '&type=json', function(data) {
$.getJSON('http://api.bilibili.cn/userinfo?mid=' + uid + '&type=json', function(data) {
if (data.code == 0) {
sessionStorage.setItem('user/' + uid, JSON.stringify({
name: data.name,
Expand Down Expand Up @@ -716,7 +711,7 @@
$('.viewbox .info .v-title h1').html(addTitleLink($('.viewbox .info .v-title h1').attr('title'), response.rel_search));
$(".titleNumber").click(function() {
var msgbox = new MessageBox;
msgbox.show(this, '\u70b9\u51fb\u641c\u7d22\u76f8\u5173\u89c6\u9891\uff1a<br /><a target="_blank" href="' + getOption("https") + '://www.bilibili.com/search?orderby=default&keyword=' + encodeURIComponent($(this).attr("previous")) + '">' + $(this).attr("previous") + '</a><br /><a target="_blank" href="' + getOption("https") + '://www.bilibili.com/search?orderby=ranklevel&keyword=' + encodeURIComponent($(this).attr("next")) + '">' + $(this).attr("next") + '</a>', 1e3);
msgbox.show(this, '\u70b9\u51fb\u641c\u7d22\u76f8\u5173\u89c6\u9891\uff1a<br /><a target="_blank" href="http://www.bilibili.com/search?orderby=default&keyword=' + encodeURIComponent($(this).attr("previous")) + '">' + $(this).attr("previous") + '</a><br /><a target="_blank" href="http://www.bilibili.com/search?orderby=ranklevel&keyword=' + encodeURIComponent($(this).attr("next")) + '">' + $(this).attr("next") + '</a>', 1e3);
});
});
}
Expand Down Expand Up @@ -792,7 +787,7 @@
}
})();
(function(){
if(location.href==getOption("https") + "://www.bilibili.com/video/bgm_calendar.html"){
if(location.href=="http://www.bilibili.com/video/bgm_calendar.html"){
var l = $('#bangumi');
var d= new Date().getDay()-1;
for(var i = 0;i<7;++i){
Expand All @@ -803,4 +798,4 @@
}else break;
}
}
})();
})();
Loading

2 comments on commit 814d312

@myfreeer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jjj201200
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我的天,真是醉了

Please sign in to comment.