Skip to content

Commit 09375b8

Browse files
author
xVanTuring
authored
Merge pull request shadowsocksrr#70 from xVanTuring/v0.3.0
0.3.0-alpha.4
2 parents c073053 + dd543ff commit 09375b8

File tree

17 files changed

+62
-49
lines changed

17 files changed

+62
-49
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "electron-ssr",
3-
"version": "0.3.0-alpha.3",
3+
"version": "0.3.0-alpha.4",
44
"description": "Cross platform ShadowsocksR GUI client built with electron",
55
"author": {
66
"name": "The Electron-SSR Authors",
@@ -43,7 +43,7 @@
4343
"chalk": "^3.0.0",
4444
"cli-progress": "^3.6.0",
4545
"devtron": "^1.4.0",
46-
"electron": "^6.1.7",
46+
"electron": "^6.1.9",
4747
"eslint": "^5.16.0",
4848
"eslint-plugin-vue": "^5.0.0",
4949
"request": "^2.88.2",

src/main/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ if (!isPrimaryInstance) {
5555
if (changed.length === 0) {
5656
// if there is no config, or ssrPath is not set, show window
5757
// 初始化时没有配置则打开页面,有配置则不显示主页面
58-
if (appConfig.configs.length === 0 || !appConfig.ssrPath) {
58+
if (!appConfig.hideWindow || appConfig.configs.length === 0 || !appConfig.ssrPath) {
5959
showWindow()
6060
}
6161
} else if (changed.indexOf('autoLaunch') > -1) {

src/main/tray.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ async function generateMenus (appConfig) {
7272
handler.toggleProxy(appConfig.sysProxyMode)
7373
}
7474
},
75+
{ label: $t('MENU_SUB_COPY_HTTP_PROXY'), click: handler.copyHttpProxyCode },
7576
{
7677
label: $t('MENU_PAC'),
7778
submenu: [

src/main/window.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import logger from './logger'
44
import {
55
createProtocol
66
} from 'vue-cli-plugin-electron-builder/lib'
7-
import { isLinux } from '@/shared/env'
87

98
let mainWindow
109
let readyPromise
@@ -19,7 +18,7 @@ export function createWindow () {
1918
resizable: false,
2019
minimizable: false,
2120
maximizable: false,
22-
show: isLinux,
21+
show: false,
2322
webPreferences: { webSecurity: process.env.NODE_ENV === 'production', nodeIntegration: true }
2423
})
2524
if (process.platform === 'darwin') { app.dock.show() }

src/renderer/views/panel/SSRNode.vue renamed to src/renderer/components/node/SSRNode.vue

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
<template>
2-
<div
3-
class="node-root"
4-
:class="{selected:selected,activated:activated}"
5-
>
6-
<span class="active-indicator"/>
7-
<div class="node-selection-area"
8-
@click="click"
9-
@dblclick="dblclick">
2+
<div class="node-root" :class="{selected:selected,activated:activated,disabled:disabled}">
3+
<span class="active-indicator" />
4+
<div class="node-selection-area" @click="click" @dblclick="dblclick">
105
<span class="node-name">{{trimmedTitle}}</span>
116
<span class="latency-block">
127
<span class="latency-value" :class="latencyClass">{{latencyText}}</span>
@@ -32,6 +27,10 @@ export default {
3227
type: Boolean,
3328
required: true
3429
},
30+
disabled: {
31+
type: Boolean,
32+
require: true
33+
},
3534
latency: {
3635
type: Number,
3736
default: 0
@@ -45,10 +44,6 @@ export default {
4544
default: 23
4645
}
4746
},
48-
data () {
49-
return {
50-
}
51-
},
5247
computed: {
5348
latencyText () {
5449
if (this.latency > 0) {
@@ -67,7 +62,9 @@ export default {
6762
}
6863
},
6964
trimmedTitle () {
70-
if (this.name.length <= this.maxNameCount) { return this.name }
65+
if (this.name.length <= this.maxNameCount) {
66+
return this.name
67+
}
7168
// eslint-disable-next-line no-useless-escape
7269
let letterRegex = /[a-zA-Z0-9\[\]\-\/. ]/
7370
let titleArr = []
@@ -76,7 +73,10 @@ export default {
7673
while (maxCount > 0 && rawIndex < this.name.length) {
7774
titleArr.push(this.name[rawIndex])
7875
rawIndex++
79-
if (rawIndex + 1 < this.name.length && this.name[rawIndex].match(letterRegex)) {
76+
if (
77+
rawIndex + 1 < this.name.length &&
78+
this.name[rawIndex].match(letterRegex)
79+
) {
8080
titleArr.push(this.name[rawIndex])
8181
rawIndex++
8282
}
@@ -129,10 +129,13 @@ export default {
129129
.node-root.activated .active-indicator {
130130
background-color: #34c3f0;
131131
}
132+
.node-root.activated.disabled .active-indicator {
133+
background-color: #929292;
134+
}
132135
133136
.node-root.selected .node-selection-area {
134-
background-color: #CDE8F0;
135-
border-color: #34C3F0;
137+
background-color: #cde8f0;
138+
border-color: #34c3f0;
136139
}
137140
.latency-block {
138141
line-height: 28px;
@@ -152,13 +155,13 @@ export default {
152155
transition: all 200ms linear;
153156
}
154157
.latency-value.low {
155-
color: #67C23A;
158+
color: #67c23a;
156159
}
157160
.latency-value.med {
158-
color: #E6A23C;
161+
color: #e6a23c;
159162
}
160163
.latency-value.high {
161-
color: #F56C6C;
164+
color: #f56c6c;
162165
}
163166
.latency-value.no-data {
164167
color: #909399;

src/renderer/views/panel/NodeList.vue renamed to src/renderer/components/node/SSRNodeGroup.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
:id="node.id"
1515
:activated="node.id===activatedConfigId"
1616
:name="node.title"
17+
:disabled="disabled"
1718
@nodeSelected="nodeSelected"
1819
@nodeActivated="nodeActivated"/>
1920
</div>
@@ -31,7 +32,8 @@ export default {
3132
node: Object,
3233
selectedConfigId: String,
3334
activatedConfigId: String,
34-
selectedGroupName: String
35+
selectedGroupName: String,
36+
disabled: Boolean
3537
},
3638
data () {
3739
return {

src/renderer/locales/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"UI_SETTING_SSR_PYTHON_DIR": "SSR python Dir",
2626
"UI_SETTING_SELECT_SSR_PYTHON_DIR": "Select SSR Dir",
2727
"UI_SETTING_AUTO_START": "Auto Start",
28+
"UI_SETTING_HIDE_WINDOW": "Hide Window",
2829
"UI_SETTING_PAC_PORT": "Pac Port",
2930
"UI_SETTING_SHARE_LAN": "Share LAN",
3031
"UI_SETTING_LOCAL_LISTEN_PORT": "Local Listen Port",

src/renderer/locales/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"UI_SETTING_SSR_PYTHON_DIR": "ssr python 目录",
2525
"UI_SETTING_SELECT_SSR_PYTHON_DIR": "选择ssr目录",
2626
"UI_SETTING_AUTO_START": "自动启动",
27+
"UI_SETTING_HIDE_WINDOW": "隐藏窗口",
2728
"UI_SETTING_PAC_PORT": "Pac 端口",
2829
"UI_SETTING_SHARE_LAN": "局域网共享",
2930
"UI_SETTING_LOCAL_LISTEN_PORT": "本地监听端口",

src/renderer/views/ManagePanel.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<template>
22
<app-view name="panel" class="px-2 py-2" row>
3-
<node-list-panel></node-list-panel>
4-
<info-panel></info-panel>
3+
<SSRNodePanel/>
4+
<InfoPanel/>
55
</app-view>
66
</template>
77
<script>
8-
import NodeListPanel from './panel/SSRNodeListPanel'
8+
import SSRNodePanel from './panel/SSRNodePanel'
99
import InfoPanel from './panel/InfoPanel'
1010
export default {
1111
components: {
12-
NodeListPanel,
12+
SSRNodePanel,
1313
InfoPanel
1414
}
1515
}

src/renderer/views/option/Common.vue

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
<i-form-item class="flex-1" :label="$t('UI_SETTING_AUTO_START')">
1515
<i-checkbox v-model="form.autoLaunch" @on-change="update('autoLaunch')" />
1616
</i-form-item>
17+
<i-form-item class="flex-1" :label="$t('UI_SETTING_HIDE_WINDOW')">
18+
<i-checkbox v-model="form.hideWindow" @on-change="update('hideWindow')" />
19+
</i-form-item>
1720
<i-form-item class="flex-1" :label="$t('UI_SETTING_SHARE_LAN')">
1821
<i-checkbox v-model="form.shareOverLan" @on-change="update('shareOverLan')" />
1922
</i-form-item>
@@ -48,10 +51,10 @@
4851
</i-form-item>
4952
</div>
5053
<i-form-item prop="lang" label="Language" :label-width="120">
51-
<i-select v-model="form.lang" class="language-selector-view" @input="update('lang')">
52-
<i-option value="zh-CN">简体中文</i-option>
53-
<i-option value="en-US">English</i-option>
54-
</i-select>
54+
<i-select v-model="form.lang" class="language-selector-view" @input="update('lang')">
55+
<i-option value="zh-CN">简体中文</i-option>
56+
<i-option value="en-US">English</i-option>
57+
</i-select>
5558
</i-form-item>
5659
</i-form>
5760
</div>
@@ -68,6 +71,7 @@ export default {
6871
form: {
6972
ssrPath: appConfig.ssrPath,
7073
autoLaunch: appConfig.autoLaunch,
74+
hideWindow: appConfig.hideWindow,
7175
shareOverLan: appConfig.shareOverLan,
7276
localPort: appConfig.localPort,
7377
pacPort: appConfig.pacPort,
@@ -83,7 +87,9 @@ export default {
8387
if (exists) {
8488
return Promise.resolve()
8589
}
86-
return Promise.reject(new Error(this.$t('UI_INCORRECT_FOLDER')))
90+
return Promise.reject(
91+
new Error(this.$t('UI_INCORRECT_FOLDER'))
92+
)
8793
})
8894
}
8995
}
@@ -143,7 +149,7 @@ export default {
143149
}
144150
</script>
145151
<style lang="stylus" scoped>
146-
.language-selector-view{
147-
width 180px;
152+
.language-selector-view {
153+
width: 180px;
148154
}
149155
</style>

src/renderer/views/panel/InfoPanel.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
<ssr-qrcode v-show="displaySSR&&!inGroupNode"/>
66
<div class="control-panel">
77
<i-button class="w-6r" type="error" @click="removeClick" :disabled="buttonState">{{$t('UI_DELETE')}}</i-button>
8-
<i-button class="w-6r ml-3" type="primary" @click="save" :disabled="buttonState">{{$t('UI_SAVE')}}</i-button>
8+
<i-button class="w-6r ml-3" type="primary" @click="save">{{$t('UI_SAVE')}}</i-button>
99
<i-checkbox class="ml-3" v-model="displaySSR">{{$t('UI_DISPLAY_QRCODE')}}</i-checkbox>
1010
</div>
1111
</div>
1212
</template>
1313

1414
<script>
15-
import SSRNodeForm from './SSRNodeForm'
16-
import SsrGroup from './SSRGroupForm'
17-
import SsrQrcode from './SSRQrcode'
15+
import SSRNodeForm from '@/renderer/components/form/SSRNodeForm'
16+
import SsrGroup from '@/renderer/components/form/SSRGroupForm'
17+
import SsrQrcode from '@/renderer/components/node/SSRQrcode'
1818
import { mapState, mapGetters, mapActions } from 'vuex'
19-
// import { clone } from '@/shared/utils'
2019
import { isValidSSRConfig } from '@/shared/ssr'
2120
2221
export default {

src/renderer/views/panel/SSRNodeListPanel.vue renamed to src/renderer/views/panel/SSRNodePanel.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
<div class="panel-nodes flex flex-column h-100">
33
<div class="node-group" ref="nodeGroup">
44
<div class="wrapper" v-if="groupedNodes&&groupedNodes.length !== 0">
5-
<node-group
5+
<SSRNodeGroup
66
v-for="group in groupedNodes"
77
:activatedConfigId="activatedConfigId"
88
:selectedConfigId="selectedConfigId"
99
:selectedGroupName="selectedConfigId || selectedGroupName"
1010
:key="group.id"
1111
:node="group"
12+
:disabled="!appConfig.enable"
1213
@nodeSelected="nodeSelected"
1314
@nodeActivated="nodeActivated"
1415
/>
@@ -18,15 +19,14 @@
1819
</div>
1920
</template>
2021
<script>
21-
/* eslint-disable vue/no-unused-components */
2222
import { mapActions, mapGetters, mapMutations, mapState } from 'vuex'
2323
import { groupConfigs } from '@/shared/utils'
2424
25-
import NodeGroup from './NodeList'
25+
import SSRNodeGroup from '@/renderer/components/node/SSRNodeGroup'
2626
2727
export default {
2828
components: {
29-
NodeGroup
29+
SSRNodeGroup
3030
},
3131
data () {
3232
return {

src/shared/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const defaultConfig = {
99
enable: false,
1010
// 开机自启
1111
autoLaunch: false,
12+
hideWindow: !isLinux,
1213
// 是否局域网共享
1314
shareOverLan: false,
1415
// 本地socks端口

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3735,10 +3735,10 @@ electron-to-chromium@^1.3.349:
37353735
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.361.tgz#a820bf52da171c0024314745462cfe0dc944373e"
37363736
integrity sha512-OzSVjWpsRhJyr9PSAXkeloSe6e9viU2ToGt1wXlXFsGcxuI9vlsnalL+V/AM59Z2pEo3wRxIddtOGsT7Y6x/sQ==
37373737

3738-
electron@^6.1.7:
3739-
version "6.1.8"
3740-
resolved "https://registry.yarnpkg.com/electron/-/electron-6.1.8.tgz#5bc8e4db4f860526f9a98db00597a6fc7c57ecea"
3741-
integrity sha512-crrWUBTfGbNYh7riijx+SYLOj6j6R1M+OnP0p5tGhb4bUFBt3Xaf2oATTLIeJlCRD8CRRMUgxwsVkHVqBKmP2Q==
3738+
electron@^6.1.9:
3739+
version "6.1.9"
3740+
resolved "https://registry.yarnpkg.com/electron/-/electron-6.1.9.tgz#4f28c4bdd0cdfd427ea98ce6ad02f303638f7b1f"
3741+
integrity sha512-Sm6pIR9yr9oBnIzwWnwSyTiZwj3fdp3X0pBDWDmw2wf/RtZlKH4PEkEu622AZLyXyhBKUiD2Jajkr5c4MelRxw==
37423742
dependencies:
37433743
"@types/node" "^10.12.18"
37443744
electron-download "^4.1.0"

0 commit comments

Comments
 (0)