完成Salon小程序合规整改
This commit is contained in:
@@ -20,16 +20,6 @@ const HEADER_SIGNATURE = 'X-Signature'
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const HEADER_SIGNATURE_VERSION = 'X-Sign-Version'
|
||||
/**
|
||||
* Purpose: DEVICE_ID_HEADER supports request-signature.ts by holding or executing the device id header page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const DEVICE_ID_HEADER = 'X-Device-Id'
|
||||
/**
|
||||
* Purpose: DEVICE_ID_STORAGE_KEY supports request-signature.ts by holding or executing the device id storage key page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const DEVICE_ID_STORAGE_KEY = 'jayucloud-salon-device-id'
|
||||
/**
|
||||
* Purpose: SIGNATURE_VERSION supports request-signature.ts by holding or executing the signature version page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -245,20 +235,6 @@ function randomNonce() {
|
||||
* Purpose: getDeviceId supports request-signature.ts by holding or executing the get device id page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export function getDeviceId() {
|
||||
try {
|
||||
const stored = localStorage.getItem(DEVICE_ID_STORAGE_KEY)
|
||||
if (stored) {
|
||||
return stored
|
||||
}
|
||||
const next = `web-${randomNonce()}`
|
||||
localStorage.setItem(DEVICE_ID_STORAGE_KEY, next)
|
||||
return next
|
||||
} catch {
|
||||
return `web-${randomNonce()}`
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: setHeader supports request-signature.ts by holding or executing the set header page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -448,8 +424,6 @@ export async function attachRequestSignature(
|
||||
accessToken?: string | null,
|
||||
options: RequestSignatureOptions = {}
|
||||
) {
|
||||
setHeader(config, DEVICE_ID_HEADER, getDeviceId())
|
||||
|
||||
const method = String(config.method || 'GET').toUpperCase()
|
||||
if (!accessToken || options.authFree || isSafeMethod(method)) {
|
||||
return config
|
||||
|
||||
Reference in New Issue
Block a user