Chore: fix bugs & update dependencies

This commit is contained in:
Dreamacro 2018-11-19 00:26:07 +08:00
parent aec5b72987
commit ac6bac65aa
9 changed files with 2950 additions and 2334 deletions

5180
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -28,41 +28,41 @@
"contributors:generate": "all-contributors generate"
},
"devDependencies": {
"@babel/cli": "^7.1.2",
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@babel/cli": "^7.1.5",
"@babel/core": "^7.1.6",
"@babel/preset-env": "^7.1.6",
"@babel/preset-react": "^7.0.0",
"@types/node": "^10.12.0",
"@types/react": "^16.4.18",
"@types/node": "^10.12.9",
"@types/react": "^16.7.6",
"@types/react-dom": "^16.0.9",
"@types/react-i18next": "^7.8.3",
"@types/react-router-dom": "^4.3.1",
"@types/react-sortable-hoc": "^0.6.4",
"@types/yaml": "^1.0.0",
"autoprefixer": "^9.2.1",
"@types/yaml": "^1.0.1",
"autoprefixer": "^9.3.1",
"awesome-typescript-loader": "^5.2.1",
"babel-loader": "^8.0.4",
"css-loader": "^1.0.0",
"css-loader": "^1.0.1",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^3.2.0",
"image-webpack-loader": "^4.4.0",
"offline-plugin": "^5.0.5",
"image-webpack-loader": "^4.5.0",
"offline-plugin": "^5.0.6",
"postcss-loader": "^3.0.0",
"react-addons-test-utils": "^15.6.2",
"react-hot-loader": "^4.3.11",
"react-hot-loader": "^4.3.12",
"sass-loader": "^7.1.0",
"style-loader": "^0.23.1",
"stylelint": "^9.6.0",
"stylelint": "^9.8.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-webpack-plugin": "^0.10.5",
"tslint": "^5.11.0",
"tslint-config-standard": "^8.0.1",
"tslint-loader": "^3.6.0",
"uglifyjs-webpack-plugin": "^2.0.1",
"webpack": "^4.22.0",
"webpack": "^4.25.1",
"webpack-cli": "^3.1.2",
"webpack-dev-middleware": "^3.4.0",
"webpack-dev-server": "^3.1.9",
"webpack-dev-server": "^3.1.10",
"webpack-merge": "^4.1.4",
"webpack-pwa-manifest": "^3.7.1"
},
@ -72,19 +72,19 @@
"dayjs": "^1.7.7",
"eventemitter3": "^3.1.0",
"i18next": "^11.10.0",
"i18next-browser-languagedetector": "^2.2.3",
"immer": "^1.7.2",
"i18next-browser-languagedetector": "^2.2.4",
"immer": "^1.7.4",
"ini": "^1.3.5",
"mobx": "^5.5.1",
"mobx-react": "^5.3.4",
"mobx": "^5.6.0",
"mobx-react": "^5.3.6",
"mobx-react-router": "^4.0.5",
"node-sass": "^4.9.4",
"react": "^16.5.2",
"react-dom": "^16.5.2",
"node-sass": "^4.10.0",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react-i18next": "^7.12.0",
"react-router-dom": "^4.3.1",
"react-sortable-hoc": "^0.8.3",
"typescript": "^3.1.3",
"yaml": "^1.0.0"
"typescript": "^3.1.6",
"yaml": "^1.0.2"
}
}

View File

@ -11,8 +11,8 @@ $height: 30px;
color: $color-primary-darken;
border-radius: 3px;
border: 1px solid $color-primary-lightly;
line-height: $height;
transition: all 0.3s;
transition-property: border-color, color, box-shadow;
&:focus {
outline: 0;

View File

@ -1,6 +1,6 @@
import * as React from 'react'
import classnames from 'classnames'
import { Row, Col, Input, Icon, Select, Option } from '@components'
import { Row, Col, Input, Icon, Select, Option, Switch } from '@components'
import { noop } from '@lib/helper'
// type selector
@ -72,6 +72,22 @@ export function ProxyInputForm ({ label, value, onChange = noop }: {
)
}
// switch form
export function ProxySwitch ({ label, value, onChange = noop }: {
label: string,
value: boolean,
onChange?: (value: boolean) => void
}) {
return (
<Row gutter={24} align="middle" className="proxy-editor-row">
<Col span={6} className="proxy-editor-label">{label}</Col>
<Col span={18}>
<Switch checked={value} onChange={onChange} />
</Col>
</Row>
)
}
// password form
export class ProxyPasswordForm extends React.Component<{
label: string,
@ -87,12 +103,11 @@ export class ProxyPasswordForm extends React.Component<{
const { label, value, onChange } = this.props
const { showPassword } = this.state
const type = showPassword ? 'text' : 'password'
return (
<Row gutter={24} className="proxy-editor-row">
<Col span={6} className="proxy-editor-label">{label}</Col>
<Col span={18} className="proxy-editor-value">
<Input type={type} value={value} onChange={onChange} align="left"/>
<Input style={{ paddingRight: '32px' }} type={type} value={value} onChange={onChange} align="left" />
<Icon
className="proxy-editor-passsword-icon"
type={showPassword ? 'hide' : 'show'}

View File

@ -16,6 +16,7 @@ import {
import {
ProxyInputForm,
ProxySwitch,
ProxyColorSelector,
ProxyTypeSelector,
ProxyPasswordForm,
@ -150,6 +151,7 @@ class RawDialog extends React.Component<ModifyProxyDialogProps, ModifyProxyDialo
case 'obfs':
return (
<ProxyInputForm
key={key}
label={t('editDialog.obfs')}
value={config.obfs}
onChange={value => this.handleConfigChange('obfs', value)}
@ -166,28 +168,28 @@ class RawDialog extends React.Component<ModifyProxyDialogProps, ModifyProxyDialo
)
case 'uuid':
return (
<ProxyInputForm
<ProxyPasswordForm
key={key}
label={t('editDialog.uuid')}
value={config.uuid}
onChange={value => this.handleConfigChange('uuid', value)}
/>
)
case 'alterid':
case 'alterId':
return (
<ProxyInputForm
key={key}
label={t('editDialog.alterid')}
value={config.alterid ? config.alterid.toString() : ''}
onChange={value => this.handleConfigChange('alterid', +value)}
label={t('editDialog.alterId')}
value={config.alterId ? config.alterId.toString() : ''}
onChange={value => this.handleConfigChange('alterId', +value)}
/>
)
case 'tls':
return (
<ProxyInputForm
<ProxySwitch
key={key}
label={t('editDialog.tls')}
value={config.tls ? config.tls.toString() : ''}
value={!!config.tls}
onChange={value => this.handleConfigChange('tls', !!value)}
/>
)

View File

@ -18,6 +18,7 @@ interface ProxyState {
}
export class Proxy extends React.Component<ProxyProps , ProxyState> {
private mount = true
constructor (props) {
super(props)
@ -48,10 +49,18 @@ export class Proxy extends React.Component<ProxyProps , ProxyState> {
}
}
componentWillUnmount () {
this.mount = false
}
async componentDidMount () {
const { config } = this.props
const [res, err] = await to(getProxyDelay(config.name))
if (!this.mount) {
return
}
if (err) {
return this.setState({ hasError: true })
}

View File

@ -54,8 +54,8 @@ export default {
cipher: 'Cipher',
obfs: 'Obfs',
'obfs-host': 'Obfs-host',
uuid: 'Uuid',
alterid: 'Alterid',
uuid: 'UUID',
alterId: 'AlterId',
tls: 'TLS'
},
groupTitle: 'Policy Group'

View File

@ -54,8 +54,8 @@ export default {
cipher: '加密方式',
obfs: 'Obfs',
'obfs-host': 'Obfs-host',
uuid: 'Uuid',
alterid: 'Alterid',
uuid: 'UUID',
alterId: 'AlterId',
tls: 'TLS'
},
groupTitle: '策略组'

View File

@ -46,7 +46,7 @@ export interface VmessProxy {
uuid?: string
alterid?: number
alterId?: number
cipher?: string