vue-json-editor 替换为 vue-json-editor-fix-cn,解决中文输入问题。

pull/278/head
王良 2024-03-26 10:13:28 +08:00
parent 40d7f47bdc
commit 7c4fac6ced
6 changed files with 10 additions and 8 deletions

View File

@ -143,7 +143,7 @@ module.exports = {
proxy: 'avatars.githubusercontent.com',
sni: 'baidu.com'
},
'^/u/\\d+.*$': {
'^/u/\\d+(\\?.*)?$': {
cacheDays: 365,
desc: '用户头像缓存1年'
}

View File

@ -43,6 +43,7 @@
"sass-loader": "^10.0.4",
"vue": "^2.6.11",
"vue-json-editor": "^1.4.2",
"vue-json-editor-fix-cn": "^1.4.3",
"vue-router": "^3.4.8"
},
"devDependencies": {

View File

@ -17,7 +17,7 @@
:style="{ height: '100%' }"
>
<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 tab="DNS设置" key="2">
<div>
@ -98,7 +98,7 @@
</template>
<script>
import vueJsonEditor from 'vue-json-editor'
import vueJsonEditor from 'vue-json-editor-fix-cn'
import lodash from 'lodash'
import api from '../api'
export default {

View File

@ -217,7 +217,7 @@
</template>
<script>
import vueJsonEditor from 'vue-json-editor'
import vueJsonEditor from 'vue-json-editor-fix-cn'
import Plugin from '../mixins/plugin'
import _ from 'lodash'

View File

@ -1,13 +1,13 @@
module.exports = {
requestIntercept (context, interceptOpt) {
const { rOptions } = context
const { rOptions, log } = context
if (interceptOpt.sni != null) {
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
},
is (interceptOpt) {
return !!interceptOpt.sni
return !!interceptOpt.sni && !interceptOpt.proxy // proxy生效时sni不需要生效因为proxy中也会使用sni覆盖 rOptions.servername
}
}

View File

@ -2,7 +2,7 @@ const cacheReq = require('../req/cacheReq')
module.exports = {
responseIntercept (context, interceptOpt, req, res, proxyReq, proxyRes, ssl, next) {
const { rOptions } = context
const { rOptions, log } = context
// 只有GET请求且响应码为2xx时才进行缓存
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)
log.info('[cacheRes]', 'maxAge=' + maxAge)
},
is (interceptOpt) {
const maxAge = cacheReq.getMaxAge(interceptOpt)