vue-json-editor 替换为 vue-json-editor-fix-cn,解决中文输入问题。
parent
40d7f47bdc
commit
7c4fac6ced
|
@ -143,7 +143,7 @@ module.exports = {
|
||||||
proxy: 'avatars.githubusercontent.com',
|
proxy: 'avatars.githubusercontent.com',
|
||||||
sni: 'baidu.com'
|
sni: 'baidu.com'
|
||||||
},
|
},
|
||||||
'^/u/\\d+.*$': {
|
'^/u/\\d+(\\?.*)?$': {
|
||||||
cacheDays: 365,
|
cacheDays: 365,
|
||||||
desc: '用户头像,缓存1年'
|
desc: '用户头像,缓存1年'
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
"sass-loader": "^10.0.4",
|
"sass-loader": "^10.0.4",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-json-editor": "^1.4.2",
|
"vue-json-editor": "^1.4.2",
|
||||||
|
"vue-json-editor-fix-cn": "^1.4.3",
|
||||||
"vue-router": "^3.4.8"
|
"vue-router": "^3.4.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
:style="{ height: '100%' }"
|
:style="{ height: '100%' }"
|
||||||
>
|
>
|
||||||
<a-tab-pane tab="拦截设置" key="1" >
|
<a-tab-pane tab="拦截设置" key="1" >
|
||||||
<vue-json-editor style="height:100%;" ref="editor" v-model="targetConfig.intercepts" mode="code" :show-btns="false" :expandedOnStart="true" @json-change="onJsonChange" ></vue-json-editor>
|
<vue-json-editor style="height:100%;" ref="editor" v-model="targetConfig.intercepts" mode="code" :show-btns="false" :expandedOnStart="true" @json-change="onJsonChange" ></vue-json-editor>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane tab="DNS设置" key="2">
|
<a-tab-pane tab="DNS设置" key="2">
|
||||||
<div>
|
<div>
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import vueJsonEditor from 'vue-json-editor'
|
import vueJsonEditor from 'vue-json-editor-fix-cn'
|
||||||
import lodash from 'lodash'
|
import lodash from 'lodash'
|
||||||
import api from '../api'
|
import api from '../api'
|
||||||
export default {
|
export default {
|
||||||
|
|
|
@ -217,7 +217,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import vueJsonEditor from 'vue-json-editor'
|
import vueJsonEditor from 'vue-json-editor-fix-cn'
|
||||||
import Plugin from '../mixins/plugin'
|
import Plugin from '../mixins/plugin'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
requestIntercept (context, interceptOpt) {
|
requestIntercept (context, interceptOpt) {
|
||||||
const { rOptions } = context
|
const { rOptions, log } = context
|
||||||
if (interceptOpt.sni != null) {
|
if (interceptOpt.sni != null) {
|
||||||
rOptions.servername = interceptOpt.sni
|
rOptions.servername = interceptOpt.sni
|
||||||
console.log('sni replace', rOptions.hostname, rOptions.servername)
|
log.info('sni intercept: sni replace servername:', rOptions.hostname, '➜', rOptions.servername)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
is (interceptOpt) {
|
is (interceptOpt) {
|
||||||
return !!interceptOpt.sni
|
return !!interceptOpt.sni && !interceptOpt.proxy // proxy生效时,sni不需要生效,因为proxy中也会使用sni覆盖 rOptions.servername
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ const cacheReq = require('../req/cacheReq')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
responseIntercept (context, interceptOpt, req, res, proxyReq, proxyRes, ssl, next) {
|
responseIntercept (context, interceptOpt, req, res, proxyReq, proxyRes, ssl, next) {
|
||||||
const { rOptions } = context
|
const { rOptions, log } = context
|
||||||
|
|
||||||
// 只有GET请求,且响应码为2xx时才进行缓存
|
// 只有GET请求,且响应码为2xx时才进行缓存
|
||||||
if (rOptions.method !== 'GET' || proxyRes.statusCode < 200 || proxyRes.statusCode >= 300) {
|
if (rOptions.method !== 'GET' || proxyRes.statusCode < 200 || proxyRes.statusCode >= 300) {
|
||||||
|
@ -81,6 +81,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
res.setHeader('Dev-Sidecar-Cache-Response-Interceptor', 'cacheRes:maxAge=' + maxAge)
|
res.setHeader('Dev-Sidecar-Cache-Response-Interceptor', 'cacheRes:maxAge=' + maxAge)
|
||||||
|
log.info('[cacheRes]', 'maxAge=' + maxAge)
|
||||||
},
|
},
|
||||||
is (interceptOpt) {
|
is (interceptOpt) {
|
||||||
const maxAge = cacheReq.getMaxAge(interceptOpt)
|
const maxAge = cacheReq.getMaxAge(interceptOpt)
|
||||||
|
|
Loading…
Reference in New Issue