feat(native): 图片取字节统一走 Rust(P1 全部 + P2 顺序/320 原生)
Verify (Gitea) / gate (build · unit · facts) (push) Failing after 47s

This commit is contained in:
qiqi committed 2026-12-04 10:54:41 +08:00
1 parent 330bd455e4
commit a7430bb5f2
10 files changed
+129 -29

No files matched your search

+14 -6
View File
@@ -27,9 +27,13 @@
try {
const url = String((n.data && n.data.url) || '')
if (!url) continue
const resp = await fetch(url, { credentials: 'omit' })
if (!resp || !resp.ok) continue
const blob = await resp.blob()
// 2026-12-04(审计 P1):优先用宿主注入的 Rust 取字节(不受 CORS/白名单限制)
let blob = (typeof o.fetchBlob === 'function') ? await o.fetchBlob(url) : null
if (!blob || !blob.size) {
const resp = await fetch(url, { credentials: 'omit' })
if (!resp || !resp.ok) continue
blob = await resp.blob()
}
if (!blob || !blob.size) continue
const dataUrl = await new Promise((res, rej) => {
const rd = new FileReader()
@@ -64,9 +68,13 @@
if (!url) return
;(async () => {
try {
const resp = await fetch(url, { credentials: 'omit' })
if (!resp || !resp.ok) return
const blob = await resp.blob()
// 2026-12-04(审计 P1):优先 Rust 取字节;失败再回退 WebView fetch
let blob = (typeof o.fetchBlob === 'function') ? await o.fetchBlob(url) : null
if (!blob || !blob.size) {
const resp = await fetch(url, { credentials: 'omit' })
if (!resp || !resp.ok) return
blob = await resp.blob()
}
if (!blob || !blob.size) return
const dataUrl = await new Promise((res, rej) => {
const rd = new FileReader()