From ed38f2de8bf8f270c353158695958a0093eee6b8 Mon Sep 17 00:00:00 2001 From: zyq Date: Wed, 18 Sep 2019 17:24:54 +0800 Subject: [PATCH 1/3] change normalizeUrl parameter --- src/pages/MiniVideo.vue | 2 +- src/pages/Video.vue | 2 +- src/pages/directVideo.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/MiniVideo.vue b/src/pages/MiniVideo.vue index f803575..6b37df3 100644 --- a/src/pages/MiniVideo.vue +++ b/src/pages/MiniVideo.vue @@ -62,7 +62,7 @@ export default { normalizeUrl(url) { if (isAbsoluteUrl(url)) { const pureUrl = url.replace(/(.*?)\$/, '').replace(/\$(.*)/, ''); - return normalizeUrl(pureUrl); + return normalizeUrl(pureUrl, { stripWWW: false }); } return ''; diff --git a/src/pages/Video.vue b/src/pages/Video.vue index 9e7191f..f79eb29 100644 --- a/src/pages/Video.vue +++ b/src/pages/Video.vue @@ -205,7 +205,7 @@ export default { }, normalizeUrl(url) { if (isAbsoluteUrl(url)) { - return normalizeUrl(url); + return normalizeUrl(url, { stripWWW: false }); } return ''; }, diff --git a/src/pages/directVideo.vue b/src/pages/directVideo.vue index 0573d28..646ba1e 100644 --- a/src/pages/directVideo.vue +++ b/src/pages/directVideo.vue @@ -50,7 +50,7 @@ export default { normalizeUrl(url) { if (isAbsoluteUrl(url)) { const pureUrl = url.replace(/(.*?)\$/, '').replace(/\$(.*)/, ''); - return normalizeUrl(pureUrl); + return normalizeUrl(pureUrl, { stripWWW: false }); } return ''; From ec920de8a77ff641b1c7fde7079a049aeb791d96 Mon Sep 17 00:00:00 2001 From: zyq Date: Thu, 19 Sep 2019 11:44:51 +0800 Subject: [PATCH 2/3] fix showSaveDialog api --- src/layouts/Config.vue | 8 ++++---- src/layouts/Import.vue | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/layouts/Config.vue b/src/layouts/Config.vue index a19191f..a3e73d9 100644 --- a/src/layouts/Config.vue +++ b/src/layouts/Config.vue @@ -476,8 +476,8 @@ export default { properties: ['openFile'], filters: [{ name: 'JSON', extensions: ['json'] }], }); - if (dialogResult) { - const importedFile = await fs.readJSON(dialogResult[0]); + if (!dialogResult.canceled && dialogResult.filePaths) { + const importedFile = await fs.readJSON(dialogResult.filePaths[0]); this.data = clonedeep(importedFile); } }, @@ -486,8 +486,8 @@ export default { const dialogResult = await dialog.showSaveDialog({ defaultPath: 'source.json', }); - if (dialogResult) { - await fs.writeJson(dialogResult, this.siteList); + if (!dialogResult.canceled && dialogResult.filePath) { + await fs.writeJson(dialogResult.filePath, this.siteList); } }, closeConfig() { diff --git a/src/layouts/Import.vue b/src/layouts/Import.vue index 9c1d336..e8d5329 100644 --- a/src/layouts/Import.vue +++ b/src/layouts/Import.vue @@ -51,12 +51,12 @@ export default { ...mapMutations(['setSiteList']), async openDialog() { const { dialog } = this.$q.electron.remote; - const dialogResult = dialog.showOpenDialog({ + const dialogResult = await dialog.showOpenDialog({ properties: ['openFile'], filters: [{ name: 'JSON', extensions: ['json'] }], }); - if (dialogResult) { - const importedFile = await fs.readJSON(dialogResult[0]); + if (!dialogResult.canceled && dialogResult.filePaths) { + const importedFile = await fs.readJSON(dialogResult.filePaths[0]); this.setSiteList(importedFile); this.$router.push('/'); } From 3c7d71174b8892b905f9d4e7a481d65907cdfb09 Mon Sep 17 00:00:00 2001 From: zyq Date: Thu, 19 Sep 2019 11:52:11 +0800 Subject: [PATCH 3/3] remove electron-positioner --- package.json | 1 - src/pages/Video.vue | 8 +++----- yarn.lock | 5 ----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index d076296..86e104a 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "dependencies": { "@quasar/extras": "^1.3.1", "axios": "^0.19.0", - "electron-positioner": "^4.1.0", "electron-store": "^5.0.0", "electron-util": "^0.12.1", "fs-extra": "^8.1.0", diff --git a/src/pages/Video.vue b/src/pages/Video.vue index f79eb29..17dfc22 100644 --- a/src/pages/Video.vue +++ b/src/pages/Video.vue @@ -105,7 +105,7 @@ import normalizeUrl from 'normalize-url'; import isAbsoluteUrl from 'is-absolute-url'; import { mapState } from 'vuex'; import { stringify } from 'query-string'; -import Positioner from 'electron-positioner'; + import _find from 'lodash/find'; import _get from 'lodash/get'; @@ -227,8 +227,8 @@ export default { const encodeUrl = stringify({ video: videoInfo, episode: episodeInfo }); const parentWindow = getCurrentWindow(); const win = new BrowserWindow({ - width: 800, - height: 600, + width: 400, + height: 300, useContentSize: true, webPreferences: { nodeIntegration: true, @@ -237,8 +237,6 @@ export default { parent: parentWindow, }); win.removeMenu(); - const positioner = new Positioner(win); - positioner.move('bottomRight'); win.loadURL(`${process.env.APP_URL}#/mini-video?${encodeUrl}`); }, errorHandler(event, data) { diff --git a/yarn.lock b/yarn.lock index 93c2031..e6bb640 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3436,11 +3436,6 @@ electron-packager@^14.0.6: semver "^6.0.0" yargs-parser "^13.0.0" -electron-positioner@^4.1.0: - version "4.1.0" - resolved "https://registry.npm.taobao.org/electron-positioner/download/electron-positioner-4.1.0.tgz#e158f8f6aabd6725a8a9b4f2279b9504bcbea1b0" - integrity sha1-4Vj49qq9ZyWoqbTyJ5uVBLy+obA= - electron-publish@21.2.0: version "21.2.0" resolved "https://registry.npm.taobao.org/electron-publish/download/electron-publish-21.2.0.tgz#cc225cb46aa62e74b899f2f7299b396c9802387d"