diff --git a/src/assets/scss/theme/dark.scss b/src/assets/scss/theme/dark.scss index 5d3b3f8..ecb5c70 100644 --- a/src/assets/scss/theme/dark.scss +++ b/src/assets/scss/theme/dark.scss @@ -169,6 +169,11 @@ box-shadow: var(--d-bsc); .title{ color: var(--d-fc-1); + .right { + svg { + fill: var(--d-fc-1); + } + } } .box{ .more{ @@ -192,6 +197,9 @@ fill: var(--d-c-3); } } + &.last-tip { + color: var(--d-fc-1); + } } } } diff --git a/src/assets/scss/theme/green.scss b/src/assets/scss/theme/green.scss index e3097b4..29916c2 100644 --- a/src/assets/scss/theme/green.scss +++ b/src/assets/scss/theme/green.scss @@ -169,6 +169,11 @@ box-shadow: var(--g-bsc); .title{ color: var(--g-fc-1); + .right { + svg { + fill: var(--g-fc-1); + } + } } .box{ .more{ @@ -192,6 +197,9 @@ fill: var(--g-c-3); } } + &.last-tip { + color: var(--g-fc-1); + } } } } diff --git a/src/assets/scss/theme/light.scss b/src/assets/scss/theme/light.scss index 0f8a984..aa29192 100644 --- a/src/assets/scss/theme/light.scss +++ b/src/assets/scss/theme/light.scss @@ -169,6 +169,11 @@ box-shadow: var(--l-bsc); .title{ color: var(--l-fc-1); + .right { + svg { + fill: var(--l-fc-1); + } + } } .box{ .more{ @@ -192,6 +197,9 @@ fill: var(--l-c-3); } } + &.last-tip { + color: var(--l-fc-1); + } } } } diff --git a/src/assets/scss/theme/pink.scss b/src/assets/scss/theme/pink.scss index a085d88..f45b7b4 100644 --- a/src/assets/scss/theme/pink.scss +++ b/src/assets/scss/theme/pink.scss @@ -169,6 +169,11 @@ box-shadow: var(--p-bsc); .title{ color: var(--p-fc-1); + .right { + svg { + fill: var(--p-fc-1); + } + } } .box{ .more{ @@ -192,6 +197,9 @@ fill: var(--p-c-3); } } + &.last-tip { + color: var(--p-fc-1); + } } } } diff --git a/src/background.js b/src/background.js index a4fc2a3..c53c170 100644 --- a/src/background.js +++ b/src/background.js @@ -6,6 +6,9 @@ import { createProtocol } from 'vue-cli-plugin-electron-builder/lib' import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer' const isDevelopment = process.env.NODE_ENV !== 'production' +// 允许跨域 +app.commandLine.appendSwitch('disable-features', 'OutOfBlinkCors') + let win let mini diff --git a/src/components/Play.vue b/src/components/Play.vue index 5fe27dc..037eaeb 100644 --- a/src/components/Play.vue +++ b/src/components/Play.vue @@ -3,6 +3,11 @@
『第 {{(video.info.index + 1)}} 集』{{name}} + + + + +
@@ -70,6 +75,7 @@ + 上次播放到【{{right.history[0].site}}】{{right.history[0].name}} 第{{right.history[0].index+1}}集
@@ -85,12 +91,12 @@
@@ -106,7 +112,7 @@ import zy from '../lib/site/tools' import Player from 'xgplayer' import Hls from 'xgplayer-hls.js' import mt from 'mousetrap' -const { remote, ipcRenderer } = require('electron') +const { remote, ipcRenderer, clipboard } = require('electron') const VIDEO_DETAIL_CACHE = {} @@ -132,7 +138,6 @@ const addPlayerBtn = function (event, svg, attrs) { const addPlayerView = function (event, tpl, attrs) { const player = this - console.log(player) const util = Player.util const rootEl = player.root const viewConfig = player.config[event] @@ -321,57 +326,6 @@ export default { this.xg.off('ended') }) }) - // const id = this.video.info.id - // zy.detail(this.video.key, id).then(res => { - // this.name = res.name - // const dd = res.dl.dd - // const type = Object.prototype.toString.call(dd) - // let m3u8Txt = [] - // if (type === '[object Array]') { - // for (const i of dd) { - // if (i._t.indexOf('m3u8') >= 0) { - // m3u8Txt = i._t.split('#') - // } - // } - // } else { - // m3u8Txt = dd._t.split('#') - // } - // this.right.list = m3u8Txt - // const m3u8Arr = [] - // for (const i of m3u8Txt) { - // const j = i.split('$') - // if (j.length > 1) { - // for (let m = 0; m < j.length; m++) { - // if (j[m].indexOf('m3u8') >= 0) { - // m3u8Arr.push(j[m]) - // } - // } - // } else { - // m3u8Arr.push(j[0]) - // } - // } - - // this.xg.src = m3u8Arr[index] - // this.showNext = m3u8Arr.length > 1 - - // if (time !== 0) { - // this.xg.play() - // this.xg.once('playing', () => { - // this.xg.currentTime = time - // }) - // } else { - // this.xg.play() - // } - - // this.videoPlaying() - // this.xg.once('ended', () => { - // if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > index)) { - // this.video.info.time = 0 - // this.video.info.index++ - // } - // this.xg.off('ended') - // }) - // }) }, fetchM3u8List () { return new Promise((resolve) => { @@ -401,8 +355,9 @@ export default { const j = i.split('$') if (j.length > 1) { for (let m = 0; m < j.length; m++) { - if (j[m].indexOf('m3u8') >= 0) { + if (j[m].indexOf('.m3u8') >= 0 && j[m].startsWith('http')) { m3u8Arr.push(j[m]) + break } } } else { @@ -497,9 +452,7 @@ export default { this.right.show = true this.right.type = 'history' } - history.all().then(res => { - this.right.history = res.reverse() - }) + this.getAllhistory() }, getAllhistory () { history.all().then(res => { @@ -571,6 +524,18 @@ export default { info: this.video.info } }, + issueEvent () { + const info = { + video: this.video, + list: this.right.list, + m3u8List: VIDEO_DETAIL_CACHE[this.video.key + '@' + this.video.info.id] || [], + playerError: this.xg.error || '', + playerState: this.xg.readyState || '', + networkState: this.xg.networkState || '' + } + clipboard.writeText(JSON.stringify(info, null, 4)) + this.$message.success('视频信息复制成功') + }, checkStar () { star.find({ site: this.video.key, ids: this.video.info.id }).then(res => { if (res) { @@ -595,8 +560,9 @@ export default { let link, name if (j.length > 1) { for (let m = 0; m < j.length; m++) { - if (j[m].indexOf('m3u8') >= 0) { + if (j[m].indexOf('.m3u8') >= 0 && j[m].startsWith('http')) { link = j[m] + break } } name = j[0] @@ -609,15 +575,9 @@ export default { link: link }) } - - console.log(m3u8Arr) - - let m3u8Content = `#EXTM3U -` + let m3u8Content = `#EXTM3U` for (const item of m3u8Arr) { - m3u8Content += `#EXTINF:-1, ${item.name} -${item.link} -` + m3u8Content += `#EXTINF:-1, ${item.name}${item.link}` } const blob = new Blob([m3u8Content], { type: 'application/vnd.apple.mpegurl' }) const downloadElement = document.createElement('a') // 创建下载的链接 @@ -869,6 +829,7 @@ ${item.link} } }, refreshHistory () { + this.getAllhistory() let ul = document.querySelector('xg-btn-showhistory ul') if (!ul) { ul = document.createElement('ul') @@ -945,7 +906,6 @@ ${item.link} this.mtEvent() }, mounted () { - console.log(this) Player.install('playPrev', function () { addPlayerBtn.bind(this, 'playPrev', '', { title: '上一集' })() }) @@ -971,10 +931,6 @@ ${item.link} this.xg = new Hls(this.config) ipcRenderer.on('miniClosed', () => { - // this.xg.destroy() - // this.xg = new Hls(this.config) - // this.bindEvent() - // 同步进度 history.find({ site: this.video.key, ids: this.video.info.id }).then(res => { if (res) { if (this.video.info.index !== res.index) { @@ -1145,6 +1101,13 @@ ${item.link} height: 40px; line-height: 40px; padding: 0 10px; + .right { + float: right; + svg { + margin-top: 8px; + cursor: pointer; + } + } } .player{ width: 100%; diff --git a/src/mini/Mini.vue b/src/mini/Mini.vue index 565c271..cf8d178 100644 --- a/src/mini/Mini.vue +++ b/src/mini/Mini.vue @@ -22,15 +22,15 @@ 播放进度: {{progress}}%
+ + + - - -