Skip to content

Commit 8875cdd

Browse files
authored
Merge pull request #39 from ZyqGitHub1/dev
0.8.0
2 parents fe85005 + 441608c commit 8875cdd

File tree

17 files changed

+993
-516
lines changed

17 files changed

+993
-516
lines changed

.travis.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
matrix:
2+
include:
3+
- os: osx
4+
osx_image: xcode10.2
5+
language: node_js
6+
node_js: '10'
7+
env:
8+
- ELECTRON_CACHE=$HOME/.cache/electron
9+
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
10+
11+
- os: linux
12+
services: docker
13+
language: generic
14+
15+
cache:
16+
directories:
17+
- node_modules
18+
- $HOME/.cache/electron
19+
- $HOME/.cache/electron-builder
20+
21+
before_install:
22+
- |
23+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
24+
# download aliyun OSS Linux client
25+
wget -nc http://gosspublic.alicdn.com/ossutil/1.6.5/ossutil64
26+
chmod 755 ossutil64
27+
# config aliyun OSS Linux client https://help.aliyun.com/document_detail/50455.html
28+
./ossutil64 config -e "${OSS_ENDPOINT}" -i "${OSS_AKI}" -k "${OSS_AKS}"
29+
else
30+
# download aliyun OSS Linux client
31+
wget -nc http://gosspublic.alicdn.com/ossutil/1.6.5/ossutilmac64
32+
chmod 755 ossutilmac64
33+
# config aliyun OSS Linux client https://help.aliyun.com/document_detail/50455.html
34+
./ossutilmac64 config -e "${OSS_ENDPOINT}" -i "${OSS_AKI}" -k "${OSS_AKS}"
35+
fi
36+
37+
script:
38+
- |
39+
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
40+
docker run --rm \
41+
--env-file <(env | grep -vE '\r|\n' | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS_TAG|TRAVIS|TRAVIS_REPO_|TRAVIS_BUILD_|TRAVIS_BRANCH|TRAVIS_PULL_REQUEST_|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') \
42+
--env ELECTRON_CACHE="/root/.cache/electron" \
43+
--env ELECTRON_BUILDER_CACHE="/root/.cache/electron-builder" \
44+
-v ${PWD}:/project \
45+
-v ~/.cache/electron:/root/.cache/electron \
46+
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
47+
electronuserland/builder:wine \
48+
/bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn electron:build --bundler builder --target linux"
49+
linux_file=`ls dist/electron/Packaged/ | grep '.AppImage$'`
50+
./ossutil64 cp "dist/electron/Packaged/${linux_file}" "${BUCKET}/${linux_file}" -f
51+
52+
docker run --rm \
53+
--env-file <(env | grep -vE '\r|\n' | grep -iE 'DEBUG|NODE_|ELECTRON_|YARN_|NPM_|CI|CIRCLE|TRAVIS_TAG|TRAVIS|TRAVIS_REPO_|TRAVIS_BUILD_|TRAVIS_BRANCH|TRAVIS_PULL_REQUEST_|APPVEYOR_|CSC_|GH_|GITHUB_|BT_|AWS_|STRIP|BUILD_') \
54+
--env ELECTRON_CACHE="/root/.cache/electron" \
55+
--env ELECTRON_BUILDER_CACHE="/root/.cache/electron-builder" \
56+
-v ${PWD}:/project \
57+
-v ~/.cache/electron:/root/.cache/electron \
58+
-v ~/.cache/electron-builder:/root/.cache/electron-builder \
59+
electronuserland/builder:wine \
60+
/bin/bash -c "yarn --link-duplicates --pure-lockfile && yarn electron:build --bundler builder --target win"
61+
win_file=`ls dist/electron/Packaged/ | grep '.zip$'`
62+
./ossutil64 cp "dist/electron/Packaged/${win_file}" "${BUCKET}/${win_file}" -f
63+
else
64+
yarn electron:build
65+
osx_file=`ls dist/electron/Packaged/ | grep '.dmg$'`
66+
./ossutilmac64 cp "dist/electron/Packaged/${osx_file}" "${BUCKET}/${osx_file}" -f
67+
fi
68+
69+
before_cache:
70+
- rm -rf $HOME/.cache/electron-builder/wine
71+
72+
branches:
73+
except:
74+
- 'master'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "h-player",
3-
"version": "0.7.0",
3+
"version": "0.8.0",
44
"description": "A Quasar Framework app",
55
"productName": "h-player",
66
"cordovaId": "org.cordova.quasar.app",

quasar.conf.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ module.exports = function (ctx) {
173173
},
174174

175175
electron: {
176-
bundler: 'packager', // 'builder' or 'packager'
176+
bundler: 'builder', // 'builder' or 'packager'
177177

178178
extendWebpack(cfg) {
179179
// do something with Electron main process Webpack cfg
@@ -202,7 +202,17 @@ module.exports = function (ctx) {
202202

203203
builder: {
204204
// https://www.electron.build/configuration/configuration
205-
// appId: 'h-player'
205+
appId: 'com.electron.h-player',
206+
mac: {
207+
category: 'public.app-category.video',
208+
target: 'dmg',
209+
},
210+
win: {
211+
target: 'zip',
212+
},
213+
linux: {
214+
target: 'AppImage',
215+
},
206216
},
207217
},
208218
};

src/App.vue

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,29 @@
55
</template>
66

77
<script>
8+
import { mapMutations } from 'vuex';
9+
810
export default {
911
name: 'App',
1012
created() {
13+
const ipc = this.$q.electron.ipcRenderer;
14+
ipc.on('from-mini', (event, message) => {
15+
this.gotoPlayer(message);
16+
});
1117
this.$store.dispatch('getLatestVersion');
1218
this.$store.dispatch('loadSiteList').then((storeSiteList) => {
1319
if (!storeSiteList || storeSiteList.length === 0) {
1420
this.$router.push('/import');
1521
}
1622
});
1723
},
24+
methods: {
25+
...mapMutations(['setCurrentVideo']),
26+
gotoPlayer(video) {
27+
this.setCurrentVideo(video);
28+
this.$router.push('/video');
29+
},
30+
},
1831
};
1932
</script>
2033

src/api/maccms-v10.d.ts

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
export interface getListQuery {
2+
/**
3+
action
4+
Default: list
5+
*/
6+
ac?: string;
7+
8+
/**
9+
返回数据类型
10+
Default: xml
11+
*/
12+
at?: string;
13+
14+
/**
15+
类别ID
16+
*/
17+
t?: string;
18+
19+
/**
20+
页码
21+
*/
22+
pg?: string;
23+
24+
/**
25+
搜索关键字
26+
*/
27+
wd?: string;
28+
29+
/**
30+
几小时内的数据
31+
*/
32+
h?: string;
33+
}
34+
35+
export function getList(apt: string, query: getListQuery): Promise<any>;
36+
37+
export interface getDetailQuery {
38+
/**
39+
action
40+
Default: detail
41+
*/
42+
ac?: string;
43+
44+
/**
45+
返回数据类型
46+
Default: xml
47+
*/
48+
at?: string;
49+
50+
/**
51+
类别ID
52+
*/
53+
t?: string;
54+
55+
/**
56+
页码
57+
*/
58+
pg?: string;
59+
60+
/**
61+
数据ID,多个ID逗号分割
62+
*/
63+
ids?: string;
64+
65+
/**
66+
几小时内的数据
67+
*/
68+
h?: string;
69+
}
70+
71+
export function getDetail(apt: string, query: getDetailQuery): Promise<any>;

src/api/maccms-v10.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import axios from 'axios';
2+
import { stringify } from 'query-string';
3+
4+
export async function getList(api, query) {
5+
const defaultParams = {
6+
ac: 'list',
7+
at: 'xml',
8+
};
9+
const params = Object.assign(defaultParams, query);
10+
const response = await axios.get(api, {
11+
params,
12+
});
13+
return response;
14+
}
15+
16+
export async function getDetail(api, query) {
17+
const defaultParams = {
18+
ac: 'detail',
19+
at: 'xml',
20+
};
21+
const params = Object.assign(defaultParams, query);
22+
const response = await axios.get(api, {
23+
params,
24+
paramsSerializer(qs) {
25+
return stringify(qs, {
26+
arrayFormat: 'comma',
27+
});
28+
},
29+
});
30+
return response;
31+
}

src/api/maccms-v8.d.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
export interface getListQuery {
2+
/**
3+
action
4+
Default: list
5+
*/
6+
ac?: string;
7+
8+
/**
9+
类别ID
10+
*/
11+
t?: string;
12+
13+
/**
14+
页码
15+
*/
16+
pg?: string;
17+
18+
/**
19+
搜索关键字
20+
*/
21+
wd?: string;
22+
23+
/**
24+
几小时内的数据
25+
*/
26+
h?: string;
27+
}
28+
29+
export function getList(apt: string, query: getListQuery): Promise<any>;
30+
31+
export interface getDetailQuery {
32+
/**
33+
action
34+
Default: videolist
35+
*/
36+
ac?: string;
37+
38+
/**
39+
类别ID
40+
*/
41+
t?: string;
42+
43+
/**
44+
页码
45+
*/
46+
pg?: string;
47+
48+
/**
49+
数据ID,多个ID逗号分割
50+
*/
51+
ids?: string;
52+
53+
/**
54+
几小时内的数据
55+
*/
56+
h?: string;
57+
}
58+
59+
export function getDetail(apt: string, query: getDetailQuery): Promise<any>;

src/api/maccms-v8.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import axios from 'axios';
2+
import { stringify } from 'query-string';
3+
4+
export async function getList(api, query) {
5+
const defaultParams = {
6+
ac: 'list',
7+
};
8+
const params = Object.assign(defaultParams, query);
9+
const response = await axios.get(api, {
10+
params,
11+
});
12+
return response;
13+
}
14+
15+
export async function getDetail(api, query) {
16+
const defaultParams = {
17+
ac: 'videolist',
18+
};
19+
const params = Object.assign(defaultParams, query);
20+
const response = await axios.get(api, {
21+
params,
22+
paramsSerializer(qs) {
23+
return stringify(qs, {
24+
arrayFormat: 'comma',
25+
});
26+
},
27+
});
28+
return response;
29+
}

src/layouts/Config.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,14 @@
304304
label="是否使用https"
305305
/>
306306
</div>
307+
<div class="q-ml-sm">
308+
<q-btn
309+
color="primary"
310+
icon="bug_report"
311+
label="打开开发者工具"
312+
@click="toggleDevTools"
313+
/>
314+
</div>
307315
<div class="text-h4 q-pa-sm">软件信息</div>
308316
<q-separator></q-separator>
309317
<div class="q-pa-sm">
@@ -409,7 +417,6 @@ export default {
409417
data: {
410418
handler() {
411419
this.setSiteList(clonedeep(this.data));
412-
this.$electronStore.set('siteList', this.siteList);
413420
},
414421
deep: true,
415422
},
@@ -456,7 +463,6 @@ export default {
456463
});
457464
if (dialogResult) {
458465
const importedFile = await fs.readJSON(dialogResult[0]);
459-
this.$electronStore.set('siteList', importedFile);
460466
this.setSiteList(importedFile);
461467
this.data = clonedeep(this.siteList);
462468
}
@@ -516,6 +522,17 @@ export default {
516522
repo: 'h-player-v2',
517523
});
518524
},
525+
toggleDevTools() {
526+
const win = this.$q.electron.remote.BrowserWindow.getFocusedWindow();
527+
if (win) {
528+
const { webContents } = win;
529+
if (webContents.isDevToolsOpened()) {
530+
webContents.closeDevTools();
531+
} else {
532+
webContents.openDevTools();
533+
}
534+
}
535+
},
519536
},
520537
};
521538
</script>

0 commit comments

Comments
 (0)