Skip to content

Commit

Permalink
Merge pull request #57 from ZyqGitHub1/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ZyqGitHub1 authored Sep 19, 2019
2 parents 0b04a62 + 3c7d711 commit 229308a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 21 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/layouts/Config.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
},
Expand All @@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/Import.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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('/');
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/MiniVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
Expand Down
10 changes: 4 additions & 6 deletions src/pages/Video.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -205,7 +205,7 @@ export default {
},
normalizeUrl(url) {
if (isAbsoluteUrl(url)) {
return normalizeUrl(url);
return normalizeUrl(url, { stripWWW: false });
}
return '';
},
Expand All @@ -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,
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/directVideo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 '';
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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=

[email protected]:
version "21.2.0"
resolved "https://registry.npm.taobao.org/electron-publish/download/electron-publish-21.2.0.tgz#cc225cb46aa62e74b899f2f7299b396c9802387d"
Expand Down

0 comments on commit 229308a

Please sign in to comment.