Commit 15e0dc391b24ba245a69ad63338211bb3eff208c
1 parent
625fd627
perf: format camera streaming app secret
Showing
1 changed file
with
18 additions
and
1 deletions
| @@ -16,6 +16,17 @@ export const streamingMediaSSLMapping = { | @@ -16,6 +16,17 @@ export const streamingMediaSSLMapping = { | ||
| 16 | 1: 'https', | 16 | 1: 'https', |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | +export const formatSecret = (string: string) => { | ||
| 20 | + if (string.length < 6) { | ||
| 21 | + return string; | ||
| 22 | + } else { | ||
| 23 | + const reg = /(^\S{2}).*(\S{4}$)/; | ||
| 24 | + const prefix = string.match(reg)?.at(1); | ||
| 25 | + const suffix = string.match(reg)?.at(2); | ||
| 26 | + return `${prefix}${''.padStart(string.length - 6, '*')}${suffix}`; | ||
| 27 | + } | ||
| 28 | +}; | ||
| 29 | + | ||
| 19 | export const columnSchema: BasicColumn[] = [ | 30 | export const columnSchema: BasicColumn[] = [ |
| 20 | { | 31 | { |
| 21 | title: '平台地址', | 32 | title: '平台地址', |
| @@ -31,6 +42,9 @@ export const columnSchema: BasicColumn[] = [ | @@ -31,6 +42,9 @@ export const columnSchema: BasicColumn[] = [ | ||
| 31 | title: '用户密钥', | 42 | title: '用户密钥', |
| 32 | dataIndex: 'appSecret', | 43 | dataIndex: 'appSecret', |
| 33 | width: 80, | 44 | width: 80, |
| 45 | + format(text) { | ||
| 46 | + return formatSecret(text); | ||
| 47 | + }, | ||
| 34 | }, | 48 | }, |
| 35 | { | 49 | { |
| 36 | title: '平台类型', | 50 | title: '平台类型', |
| @@ -103,7 +117,10 @@ export const formDetailSchema: FormSchema[] = [ | @@ -103,7 +117,10 @@ export const formDetailSchema: FormSchema[] = [ | ||
| 103 | label: '用户密钥', | 117 | label: '用户密钥', |
| 104 | field: 'appSecret', | 118 | field: 'appSecret', |
| 105 | component: 'Input', | 119 | component: 'Input', |
| 106 | - rules: [{ required: true, message: '用户密钥为必填项' }], | 120 | + rules: [ |
| 121 | + { required: true, message: '用户密钥为必填项' }, | ||
| 122 | + { required: true, min: 20, message: '用户密钥不能少于20位字符' }, | ||
| 123 | + ], | ||
| 107 | componentProps: { | 124 | componentProps: { |
| 108 | placeholder: '请输入用户密钥', | 125 | placeholder: '请输入用户密钥', |
| 109 | }, | 126 | }, |