Commit b1baf31724592432b9689cc95df6f2e4f51279c5
Merge branch 'fix/edge-get-token' into 'main_dev'
fix: 修复边端生产环境token获取 See merge request yunteng/thingskit-scada!254
Showing
1 changed file
with
2 additions
and
1 deletions
| @@ -3,6 +3,7 @@ import { isProdMode } from '../env' | @@ -3,6 +3,7 @@ import { isProdMode } from '../env' | ||
| 3 | import { cacheCipher } from '@/settings/encryptionSetting' | 3 | import { cacheCipher } from '@/settings/encryptionSetting' |
| 4 | import type { EncryptionParams } from '@/utils/cipher' | 4 | import type { EncryptionParams } from '@/utils/cipher' |
| 5 | import { AesEncryption } from '@/utils/cipher' | 5 | import { AesEncryption } from '@/utils/cipher' |
| 6 | +import { isFromEdge } from '@/core/LoadData/module/useParseParams' | ||
| 6 | 7 | ||
| 7 | export interface CreateStorageParams extends EncryptionParams { | 8 | export interface CreateStorageParams extends EncryptionParams { |
| 8 | prefixKey: string | 9 | prefixKey: string |
| @@ -16,7 +17,7 @@ export const createStorage = ({ | @@ -16,7 +17,7 @@ export const createStorage = ({ | ||
| 16 | key = cacheCipher.key, | 17 | key = cacheCipher.key, |
| 17 | iv = cacheCipher.iv, | 18 | iv = cacheCipher.iv, |
| 18 | timeout = null, | 19 | timeout = null, |
| 19 | - hasEncrypt = isProdMode(), | 20 | + hasEncrypt = !isFromEdge() && isProdMode(), |
| 20 | }: Partial<CreateStorageParams> = {}) => { | 21 | }: Partial<CreateStorageParams> = {}) => { |
| 21 | if (hasEncrypt && [key.length, iv.length].some(item => item !== 16)) | 22 | if (hasEncrypt && [key.length, iv.length].some(item => item !== 16)) |
| 22 | throw new Error('When hasEncrypt is true, the key or iv must be 16 bits!') | 23 | throw new Error('When hasEncrypt is true, the key or iv must be 16 bits!') |