Skip to content

Commit

Permalink
Merge pull request #70 from xVanTuring/v0.3.0
Browse files Browse the repository at this point in the history
0.3.0-alpha.4
  • Loading branch information
xVanTuring authored Mar 11, 2020
2 parents c073053 + dd543ff commit 09375b8
Show file tree
Hide file tree
Showing 17 changed files with 62 additions and 49 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "electron-ssr",
"version": "0.3.0-alpha.3",
"version": "0.3.0-alpha.4",
"description": "Cross platform ShadowsocksR GUI client built with electron",
"author": {
"name": "The Electron-SSR Authors",
Expand Down Expand Up @@ -43,7 +43,7 @@
"chalk": "^3.0.0",
"cli-progress": "^3.6.0",
"devtron": "^1.4.0",
"electron": "^6.1.7",
"electron": "^6.1.9",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"request": "^2.88.2",
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if (!isPrimaryInstance) {
if (changed.length === 0) {
// if there is no config, or ssrPath is not set, show window
// 初始化时没有配置则打开页面,有配置则不显示主页面
if (appConfig.configs.length === 0 || !appConfig.ssrPath) {
if (!appConfig.hideWindow || appConfig.configs.length === 0 || !appConfig.ssrPath) {
showWindow()
}
} else if (changed.indexOf('autoLaunch') > -1) {
Expand Down
1 change: 1 addition & 0 deletions src/main/tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ async function generateMenus (appConfig) {
handler.toggleProxy(appConfig.sysProxyMode)
}
},
{ label: $t('MENU_SUB_COPY_HTTP_PROXY'), click: handler.copyHttpProxyCode },
{
label: $t('MENU_PAC'),
submenu: [
Expand Down
3 changes: 1 addition & 2 deletions src/main/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import logger from './logger'
import {
createProtocol
} from 'vue-cli-plugin-electron-builder/lib'
import { isLinux } from '@/shared/env'

let mainWindow
let readyPromise
Expand All @@ -19,7 +18,7 @@ export function createWindow () {
resizable: false,
minimizable: false,
maximizable: false,
show: isLinux,
show: false,
webPreferences: { webSecurity: process.env.NODE_ENV === 'production', nodeIntegration: true }
})
if (process.platform === 'darwin') { app.dock.show() }
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<template>
<div
class="node-root"
:class="{selected:selected,activated:activated}"
>
<span class="active-indicator"/>
<div class="node-selection-area"
@click="click"
@dblclick="dblclick">
<div class="node-root" :class="{selected:selected,activated:activated,disabled:disabled}">
<span class="active-indicator" />
<div class="node-selection-area" @click="click" @dblclick="dblclick">
<span class="node-name">{{trimmedTitle}}</span>
<span class="latency-block">
<span class="latency-value" :class="latencyClass">{{latencyText}}</span>
Expand All @@ -32,6 +27,10 @@ export default {
type: Boolean,
required: true
},
disabled: {
type: Boolean,
require: true
},
latency: {
type: Number,
default: 0
Expand All @@ -45,10 +44,6 @@ export default {
default: 23
}
},
data () {
return {
}
},
computed: {
latencyText () {
if (this.latency > 0) {
Expand All @@ -67,7 +62,9 @@ export default {
}
},
trimmedTitle () {
if (this.name.length <= this.maxNameCount) { return this.name }
if (this.name.length <= this.maxNameCount) {
return this.name
}
// eslint-disable-next-line no-useless-escape
let letterRegex = /[a-zA-Z0-9\[\]\-\/. ]/
let titleArr = []
Expand All @@ -76,7 +73,10 @@ export default {
while (maxCount > 0 && rawIndex < this.name.length) {
titleArr.push(this.name[rawIndex])
rawIndex++
if (rawIndex + 1 < this.name.length && this.name[rawIndex].match(letterRegex)) {
if (
rawIndex + 1 < this.name.length &&
this.name[rawIndex].match(letterRegex)
) {
titleArr.push(this.name[rawIndex])
rawIndex++
}
Expand Down Expand Up @@ -129,10 +129,13 @@ export default {
.node-root.activated .active-indicator {
background-color: #34c3f0;
}
.node-root.activated.disabled .active-indicator {
background-color: #929292;
}
.node-root.selected .node-selection-area {
background-color: #CDE8F0;
border-color: #34C3F0;
background-color: #cde8f0;
border-color: #34c3f0;
}
.latency-block {
line-height: 28px;
Expand All @@ -152,13 +155,13 @@ export default {
transition: all 200ms linear;
}
.latency-value.low {
color: #67C23A;
color: #67c23a;
}
.latency-value.med {
color: #E6A23C;
color: #e6a23c;
}
.latency-value.high {
color: #F56C6C;
color: #f56c6c;
}
.latency-value.no-data {
color: #909399;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
:id="node.id"
:activated="node.id===activatedConfigId"
:name="node.title"
:disabled="disabled"
@nodeSelected="nodeSelected"
@nodeActivated="nodeActivated"/>
</div>
Expand All @@ -31,7 +32,8 @@ export default {
node: Object,
selectedConfigId: String,
activatedConfigId: String,
selectedGroupName: String
selectedGroupName: String,
disabled: Boolean
},
data () {
return {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/renderer/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"UI_SETTING_SSR_PYTHON_DIR": "SSR python Dir",
"UI_SETTING_SELECT_SSR_PYTHON_DIR": "Select SSR Dir",
"UI_SETTING_AUTO_START": "Auto Start",
"UI_SETTING_HIDE_WINDOW": "Hide Window",
"UI_SETTING_PAC_PORT": "Pac Port",
"UI_SETTING_SHARE_LAN": "Share LAN",
"UI_SETTING_LOCAL_LISTEN_PORT": "Local Listen Port",
Expand Down
1 change: 1 addition & 0 deletions src/renderer/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"UI_SETTING_SSR_PYTHON_DIR": "ssr python 目录",
"UI_SETTING_SELECT_SSR_PYTHON_DIR": "选择ssr目录",
"UI_SETTING_AUTO_START": "自动启动",
"UI_SETTING_HIDE_WINDOW": "隐藏窗口",
"UI_SETTING_PAC_PORT": "Pac 端口",
"UI_SETTING_SHARE_LAN": "局域网共享",
"UI_SETTING_LOCAL_LISTEN_PORT": "本地监听端口",
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/views/ManagePanel.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<template>
<app-view name="panel" class="px-2 py-2" row>
<node-list-panel></node-list-panel>
<info-panel></info-panel>
<SSRNodePanel/>
<InfoPanel/>
</app-view>
</template>
<script>
import NodeListPanel from './panel/SSRNodeListPanel'
import SSRNodePanel from './panel/SSRNodePanel'
import InfoPanel from './panel/InfoPanel'
export default {
components: {
NodeListPanel,
SSRNodePanel,
InfoPanel
}
}
Expand Down
20 changes: 13 additions & 7 deletions src/renderer/views/option/Common.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<i-form-item class="flex-1" :label="$t('UI_SETTING_AUTO_START')">
<i-checkbox v-model="form.autoLaunch" @on-change="update('autoLaunch')" />
</i-form-item>
<i-form-item class="flex-1" :label="$t('UI_SETTING_HIDE_WINDOW')">
<i-checkbox v-model="form.hideWindow" @on-change="update('hideWindow')" />
</i-form-item>
<i-form-item class="flex-1" :label="$t('UI_SETTING_SHARE_LAN')">
<i-checkbox v-model="form.shareOverLan" @on-change="update('shareOverLan')" />
</i-form-item>
Expand Down Expand Up @@ -48,10 +51,10 @@
</i-form-item>
</div>
<i-form-item prop="lang" label="Language" :label-width="120">
<i-select v-model="form.lang" class="language-selector-view" @input="update('lang')">
<i-option value="zh-CN">简体中文</i-option>
<i-option value="en-US">English</i-option>
</i-select>
<i-select v-model="form.lang" class="language-selector-view" @input="update('lang')">
<i-option value="zh-CN">简体中文</i-option>
<i-option value="en-US">English</i-option>
</i-select>
</i-form-item>
</i-form>
</div>
Expand All @@ -68,6 +71,7 @@ export default {
form: {
ssrPath: appConfig.ssrPath,
autoLaunch: appConfig.autoLaunch,
hideWindow: appConfig.hideWindow,
shareOverLan: appConfig.shareOverLan,
localPort: appConfig.localPort,
pacPort: appConfig.pacPort,
Expand All @@ -83,7 +87,9 @@ export default {
if (exists) {
return Promise.resolve()
}
return Promise.reject(new Error(this.$t('UI_INCORRECT_FOLDER')))
return Promise.reject(
new Error(this.$t('UI_INCORRECT_FOLDER'))
)
})
}
}
Expand Down Expand Up @@ -143,7 +149,7 @@ export default {
}
</script>
<style lang="stylus" scoped>
.language-selector-view{
width 180px;
.language-selector-view {
width: 180px;
}
</style>
9 changes: 4 additions & 5 deletions src/renderer/views/panel/InfoPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
<ssr-qrcode v-show="displaySSR&&!inGroupNode"/>
<div class="control-panel">
<i-button class="w-6r" type="error" @click="removeClick" :disabled="buttonState">{{$t('UI_DELETE')}}</i-button>
<i-button class="w-6r ml-3" type="primary" @click="save" :disabled="buttonState">{{$t('UI_SAVE')}}</i-button>
<i-button class="w-6r ml-3" type="primary" @click="save">{{$t('UI_SAVE')}}</i-button>
<i-checkbox class="ml-3" v-model="displaySSR">{{$t('UI_DISPLAY_QRCODE')}}</i-checkbox>
</div>
</div>
</template>

<script>
import SSRNodeForm from './SSRNodeForm'
import SsrGroup from './SSRGroupForm'
import SsrQrcode from './SSRQrcode'
import SSRNodeForm from '@/renderer/components/form/SSRNodeForm'
import SsrGroup from '@/renderer/components/form/SSRGroupForm'
import SsrQrcode from '@/renderer/components/node/SSRQrcode'
import { mapState, mapGetters, mapActions } from 'vuex'
// import { clone } from '@/shared/utils'
import { isValidSSRConfig } from '@/shared/ssr'
export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
<div class="panel-nodes flex flex-column h-100">
<div class="node-group" ref="nodeGroup">
<div class="wrapper" v-if="groupedNodes&&groupedNodes.length !== 0">
<node-group
<SSRNodeGroup
v-for="group in groupedNodes"
:activatedConfigId="activatedConfigId"
:selectedConfigId="selectedConfigId"
:selectedGroupName="selectedConfigId || selectedGroupName"
:key="group.id"
:node="group"
:disabled="!appConfig.enable"
@nodeSelected="nodeSelected"
@nodeActivated="nodeActivated"
/>
Expand All @@ -18,15 +19,14 @@
</div>
</template>
<script>
/* eslint-disable vue/no-unused-components */
import { mapActions, mapGetters, mapMutations, mapState } from 'vuex'
import { groupConfigs } from '@/shared/utils'
import NodeGroup from './NodeList'
import SSRNodeGroup from '@/renderer/components/node/SSRNodeGroup'
export default {
components: {
NodeGroup
SSRNodeGroup
},
data () {
return {
Expand Down
1 change: 1 addition & 0 deletions src/shared/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const defaultConfig = {
enable: false,
// 开机自启
autoLaunch: false,
hideWindow: !isLinux,
// 是否局域网共享
shareOverLan: false,
// 本地socks端口
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3735,10 +3735,10 @@ electron-to-chromium@^1.3.349:
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.361.tgz#a820bf52da171c0024314745462cfe0dc944373e"
integrity sha512-OzSVjWpsRhJyr9PSAXkeloSe6e9viU2ToGt1wXlXFsGcxuI9vlsnalL+V/AM59Z2pEo3wRxIddtOGsT7Y6x/sQ==

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

0 comments on commit 09375b8

Please sign in to comment.