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

View File

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

View File

@ -1,6 +1,6 @@
import * as React from 'react' import * as React from 'react'
import classnames from 'classnames' 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' import { noop } from '@lib/helper'
// type selector // 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 // password form
export class ProxyPasswordForm extends React.Component<{ export class ProxyPasswordForm extends React.Component<{
label: string, label: string,
@ -87,12 +103,11 @@ export class ProxyPasswordForm extends React.Component<{
const { label, value, onChange } = this.props const { label, value, onChange } = this.props
const { showPassword } = this.state const { showPassword } = this.state
const type = showPassword ? 'text' : 'password' const type = showPassword ? 'text' : 'password'
return ( return (
<Row gutter={24} className="proxy-editor-row"> <Row gutter={24} className="proxy-editor-row">
<Col span={6} className="proxy-editor-label">{label}</Col> <Col span={6} className="proxy-editor-label">{label}</Col>
<Col span={18} className="proxy-editor-value"> <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 <Icon
className="proxy-editor-passsword-icon" className="proxy-editor-passsword-icon"
type={showPassword ? 'hide' : 'show'} type={showPassword ? 'hide' : 'show'}

View File

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

View File

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

View File

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

View File

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

View File

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