Skip to content

Commit

Permalink
修复下载显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
jjj201200 committed Dec 4, 2019
1 parent 6ead6a6 commit 34d56fd
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 109 deletions.
194 changes: 97 additions & 97 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,98 +1,98 @@
{
"name": "bilibili-helper-master",
"version": "1.2.8",
"description": "bilibili-helper",
"main": "index.js",
"dependencies": {
"color": "^3.0.0",
"fetch-progress": "^1.2.0",
"ffmpeg.js": "^3.1.9001",
"history": "^4.7.2",
"jquery": "^3.4.0",
"lodash": "^4.17.10",
"md5": "^2.2.1",
"mobx": "^5.0.3",
"mobx-react": "^5.2.3",
"mobx-react-router": "^4.0.4",
"moment": "^2.22.2",
"npm": "^6.6.0",
"ocrad.js": "0.0.1",
"ocradjs-browser.js": "^1.0.2",
"prop-types": "^15.6.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router": "^4.3.1",
"react-transition-group": "^1.2.1",
"react-virtualized": "^9.21.0",
"store": "^2.0.12",
"styled-components": "^4.1.2",
"systemjs": "^2.1.1",
"url-parse": "^1.4.3"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-loader": "^7.1.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-import": "^1.6.5",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-styled-components": "^1.4.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-builtin-classes": "^0.6.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
"babel-plugin-transform-es3-property-literals": "^6.22.0",
"babel-plugin-transform-function-bind": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"concurrently": "^4.1.0",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^2.1.0",
"cssnano": "^4.0.3",
"eslint": "^5.9.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-react": "^7.11.1",
"html-webpack-plugin": "^4.0.0-alpha",
"json-loader": "^0.5.7",
"load-grunt-tasks": "^3.5.2",
"merge-jsons-webpack-plugin": "^1.0.18",
"mini-css-extract-plugin": "^0.4.0",
"node-sass": "^4.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.0",
"react-hot-loader": "^4.3.3",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.2.7",
"webpack": "^4.10.2",
"webpack-bundle-analyzer": "^3.1.0",
"webpack-cli": "^3.0.3",
"webpack-dev-server": "^3.1.4",
"write-json-webpack-plugin": "^1.1.0",
"zip-webpack-plugin": "^3.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-beta.49"
},
"scripts": {
"grunt": "grunt",
"watch": "webpack --env.DEBUG=true --config=webpack.config.development.js --watch --progress",
"build": "webpack --production --progress",
"build:test": "webpack --env.DEBUG=true --production --progress"
},
"author": "zacyu & drowsyflesh",
"license": "MIT",
"repository": "https://github.com/zacyu/bilibili-helper",
"readme": "/source/README.md"
}
"name": "bilibili-helper-master",
"version": "1.2.9",
"description": "bilibili-helper",
"main": "index.js",
"dependencies": {
"color": "^3.0.0",
"fetch-progress": "^1.2.0",
"ffmpeg.js": "^3.1.9001",
"history": "^4.7.2",
"jquery": "^3.4.0",
"lodash": "^4.17.10",
"md5": "^2.2.1",
"mobx": "^5.0.3",
"mobx-react": "^5.2.3",
"mobx-react-router": "^4.0.4",
"moment": "^2.22.2",
"npm": "^6.6.0",
"ocrad.js": "0.0.1",
"ocradjs-browser.js": "^1.0.2",
"prop-types": "^15.6.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router": "^4.3.1",
"react-transition-group": "^1.2.1",
"react-virtualized": "^9.21.0",
"store": "^2.0.12",
"styled-components": "^4.1.2",
"systemjs": "^2.1.1",
"url-parse": "^1.4.3"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-eslint": "^10.0.1",
"babel-loader": "^7.1.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-import": "^1.6.5",
"babel-plugin-lodash": "^3.3.2",
"babel-plugin-styled-components": "^1.4.0",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-builtin-classes": "^0.6.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.0",
"babel-plugin-transform-es2015-modules-umd": "^6.24.1",
"babel-plugin-transform-es3-member-expression-literals": "^6.22.0",
"babel-plugin-transform-es3-property-literals": "^6.22.0",
"babel-plugin-transform-function-bind": "^6.22.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"clean-webpack-plugin": "^0.1.19",
"concurrently": "^4.1.0",
"copy-webpack-plugin": "^4.5.1",
"css-loader": "^2.1.0",
"cssnano": "^4.0.3",
"eslint": "^5.9.0",
"eslint-loader": "^2.1.1",
"eslint-plugin-react": "^7.11.1",
"html-webpack-plugin": "^4.0.0-alpha",
"json-loader": "^0.5.7",
"load-grunt-tasks": "^3.5.2",
"merge-jsons-webpack-plugin": "^1.0.18",
"mini-css-extract-plugin": "^0.4.0",
"node-sass": "^4.9.0",
"optimize-css-assets-webpack-plugin": "^5.0.0",
"react-hot-loader": "^4.3.3",
"sass-loader": "^7.0.3",
"style-loader": "^0.21.0",
"uglifyjs-webpack-plugin": "^1.2.7",
"webpack": "^4.10.2",
"webpack-bundle-analyzer": "^3.1.0",
"webpack-cli": "^3.0.3",
"webpack-dev-server": "^3.1.4",
"write-json-webpack-plugin": "^1.1.0",
"zip-webpack-plugin": "^3.0.0"
},
"peerDependencies": {
"@babel/core": "^7.0.0-beta.49"
},
"scripts": {
"grunt": "grunt",
"watch": "webpack --env.DEBUG=true --config=webpack.config.development.js --watch --progress",
"build": "webpack --production --progress",
"build:test": "webpack --env.DEBUG=true --production --progress"
},
"author": "zacyu & drowsyflesh",
"license": "MIT",
"repository": "https://github.com/zacyu/bilibili-helper",
"readme": "/source/README.md"
}
2 changes: 1 addition & 1 deletion src/js/modules/LivePictureInPicture/UI/PIP.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default () => {
class: `bilibili-helper-pip-btn`,
})`
position: absolute;
right: 220px;
right: 230px;
top: 1px;
height: 22px;
line-height: 21px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"livePictureInPicture_name": {
"message": "Picture In Picture",
"message": "PiP",
"description": "Menu: Picture in picture"
},
"livePictureInPicture_UI_buttonTitle": {
Expand Down
4 changes: 2 additions & 2 deletions src/js/modules/liveChatMode/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"message": "在直播间开启网页全屏或全屏模式时以纵向排列的方式显示聊天内容,同时隐藏弹幕"
},
"liveChatMode_UI_buttonON": {
"message": "Turn on Chat Mode"
"message": "Chat Mode ON"
},
"liveChatMode_UI_buttonOFF": {
"message": "Turn off Chat Mode"
"message": "Chat Mode OFF"
}
}
27 changes: 21 additions & 6 deletions src/js/modules/videoDownload/UI/videoDownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,18 +106,18 @@ export default () => {
errorStr: '',
};
this.currentAvid = null;
this.containers = {};
}

componentDidMount() {
this.inited = true;
this.addListener();
_.map(document.scripts, (o) => {
if (/^window.__playinfo__=/.test(o.innerHTML)) {
const playInfo = JSON.parse(o.innerHTML.slice(20));
this.originVideoData = playInfo.data || playInfo;
}
});
this.containers = {};
}

componentDidMount() {
this.inited = true;
chrome.runtime.sendMessage({command: 'videoDownloadDOMInitialized'});
chrome.runtime.sendMessage({
command: 'getSetting',
Expand Down Expand Up @@ -151,7 +151,22 @@ export default () => {
addListener = () => {
const that = this;
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
if (message.command === 'videoDownloadSendVideoRequest') {
if (message.command === 'initVideoDownload' && message.data) {
if (this.originVideoData.from === 'local') {
const {cid, aid} = message.data;
const {quality} = this.originVideoData;
const {videoData} = this.state;
const currentData = {...this.originVideoData};
const cidData = videoData[aid] || {};
cidData[quality] = currentData;
videoData[cid] = cidData;
this.currentAvid = aid;
this.setState({currentCid: cid, videoData, currentQuality: quality}, () => {
this.changeQuality(quality);
});
}
sendResponse();
} else if (message.command === 'videoDownloadSendVideoRequest') {
let {data, url, method, type} = message;
const {cid, avid, qn = ''} = data;
if (type === 'new') {
Expand Down
11 changes: 10 additions & 1 deletion src/js/modules/videoDownload/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class VideoDownload extends Feature {

'*://interface.bilibili.com/player?id=cid:*',
'*://api.bilibili.com/x/player.so?id=cid:*',
'*://api.bilibili.com/x/web-interface/view?*', // 获取cid和aid
],
};
chrome.webRequest.onBeforeSendHeaders.addListener(details => {
Expand All @@ -69,7 +70,15 @@ export class VideoDownload extends Feature {
const url = new Url(details.url, '', true);
const {pathname, query: data} = url;
const tabData = this.messageStore.createData(tabId);
if (pathname === '/v2/playurl' || pathname === '/player/web_api/v2/playurl') { // 旧页面,画质,下载地址
if (pathname === '/x/web-interface/view') {
tabData.queue.push({
command: 'initVideoDownload',
type: 'init',
data,
url: url.origin + url.pathname,
});
this.messageStore.dealWith(tabId); // 处理queue
} else if (pathname === '/v2/playurl' || pathname === '/player/web_api/v2/playurl') { // 旧页面,画质,下载地址
tabData.queue.push({
command: 'videoDownloadSendVideoRequest',
type: 'old',
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.2.8",
"version": "1.2.9",
"update_url": "https://clients2.google.com/service/update2/crx",
"manifest_version": 2,
"minimum_chrome_version": "56.0.0",
Expand Down

0 comments on commit 34d56fd

Please sign in to comment.