feat: 试用过程中的细节优化
This commit is contained in:
@@ -47,11 +47,11 @@ export default defineBackground(() => {
|
||||
|
||||
// 通用文本代理:采集引擎拉跨域资源(1688 详情 CDN / mtop API)
|
||||
if (msg?.action === 'fetchText') {
|
||||
const headers: Record<string, string> = {};
|
||||
if (msg.referer) headers['Referer'] = msg.referer;
|
||||
fetch(msg.url, {
|
||||
headers,
|
||||
credentials: msg.credentials ? 'include' : 'omit',
|
||||
// Referer 是受保护请求头,不能通过 headers 设置;使用 Fetch 的标准选项。
|
||||
referrer: typeof msg.referer === 'string' ? msg.referer : undefined,
|
||||
referrerPolicy: 'strict-origin-when-cross-origin',
|
||||
})
|
||||
.then(async (res) => {
|
||||
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
||||
|
||||
Reference in New Issue
Block a user