优化方法

This commit is contained in:
aixianling
2024-04-23 14:02:12 +08:00
parent 845ceae3cd
commit 482391d6d3
2 changed files with 155 additions and 150 deletions

View File

@@ -131,11 +131,13 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
headers['Content-Type'] = 'text/html';
headers.cookie = getAliexpressCookie();
const {_m_h5_c, _m_h5_tk} = cookie2Obj(headers.cookie)
const {appKey, t, formData} = request
const sign = getSign(_m_h5_c || _m_h5_tk, appKey, t, formData)
const {mtopConfig = {appKey: "12574478"}} = window
const {appKey = mtopConfig.appKey, formData} = request
const {sign, t} = getSign(_m_h5_c || _m_h5_tk, appKey, formData)
const url = new URL(request.url)
let params = new URLSearchParams(url.search);
params.append('sign', sign)
params.append('t', t)
url.search = params.toString()
Promise.resolve().then(() => fetch(url.toString(), {
'headers': headers, 'method': 'POST', 'referrerPolicy': 'no-referrer', 'credentials': 'include', 'mode': 'cors'