Commit 7bfc9a688f125096bfa069920921ecd1117bdfc2

Authored by ww
1 parent bb4b81c8

fix: 修复边端生产环境token获取

@@ -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!')