diff --git a/app.js b/app.js index 7578d83..950179a 100644 --- a/app.js +++ b/app.js @@ -8523,8 +8523,14 @@ items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) => // ---- 插件市场(P2):静态索引 market.maqiart.eu.org/index.json → 下载 → sha256 校验 → 写入 plugins/ ---- const W_MARKET_URL = 'https://market.maqiart.eu.org/index.json' + // 桌面端优先用 Tauri 的原生 HTTP(Rust 侧):WKWebView 在代理/fake-IP 环境下直连会 Load failed + function wMarketFetch(url) { + const T = (typeof window !== 'undefined' && window.__TAURI__ && window.__TAURI__.http) ? window.__TAURI__.http : null + if (T && typeof T.fetch === 'function') return T.fetch(url) + return fetch(url, { cache: 'no-store' }) + } async function wMarketList() { - const resp = await fetch(W_MARKET_URL, { cache: 'no-store' }) + const resp = await wMarketFetch(W_MARKET_URL) if (!resp.ok) throw new Error('市场不可达:HTTP ' + resp.status) const j = await resp.json() return Array.isArray(j && j.plugins) ? j.plugins : [] @@ -8540,7 +8546,7 @@ items.push(el('button', { key: 'bgc', className: 'iwb-ctx-item', onClick: (e) => const item = list.find((p) => p && p.id === id) if (!item) return { ok: false, error: '市场里没有这个插件' } const base = W_MARKET_URL.replace(/index\.json$/, '') - const resp = await fetch(base + item.file, { cache: 'no-store' }) + const resp = await wMarketFetch(base + item.file) if (!resp.ok) throw new Error('下载失败:HTTP ' + resp.status) const text = await resp.text() const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(text)) diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 0f83111..95e06c4 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -47,6 +47,15 @@ }, { "url": "https://*.blob.core.windows.net/**" + }, + { + "url": "https://market.maqiart.eu.org/**" + }, + { + "url": "https://download.maqiart.eu.org/**" + }, + { + "url": "https://git.maqiart.eu.org/**" } ] }