CLOSES #1275, CLOSES #1295, CLOSES #1384, CLOSES #1628, CLOSES #1677, CLOSES #1682, CLOSES #1691, CLOSES #1813, CLOSES #1822, CLOSES #1861, CLOSES #1867, CLOSES #1868, CLOSES #1869, CLOSES #1870, CLOSES #1871, CLOSES #1872, CLOSES #1874, CLOSES #1876, CLOSES #1878, CLOSES #1880, CLOSES #1881, CLOSES #1882, CLOSES #1884, CLOSES #1885, CLOSES #1886, CLOSES #1887, CLOSES #1888, CLOSES #1889, CLOSES #1890, CLOSES #1891, CLOSES #1892, CLOSES #1893, CLOSES #1894, CLOSES #1895, CLOSES #1896, CLOSES #1899, CLOSES #1900, CLOSES #1901

CLOSES #1275, CLOSES #1295, CLOSES #1384, CLOSES #1628, CLOSES #1677, CLOSES #1682, CLOSES #1691, CLOSES #1813, CLOSES #1822, CLOSES #1861, CLOSES #1867, CLOSES #1868, CLOSES #1869, CLOSES #1870, CLOSES #1871, CLOSES #1872, CLOSES #1874, CLOSES #1876, CLOSES #1878, CLOSES #1880, CLOSES #1881, CLOSES #1882, CLOSES #1884, CLOSES #1885, CLOSES #1886, CLOSES #1887, CLOSES #1888, CLOSES #1889, CLOSES #1890, CLOSES #1891, CLOSES #1892, CLOSES #1893, CLOSES #1894, CLOSES #1895, CLOSES #1896, CLOSES #1899, CLOSES #1900, CLOSES #1901
This commit is contained in:
bryanthaboi
2026-08-28 12:15:36 -04:00
parent 4849a5c9f6
commit a9ce423bdc
142 changed files with 7348 additions and 682 deletions
+36
View File
@@ -880,6 +880,42 @@ function ModIndex.fetchText(url)
return ModIndex.httpGet(url)
end
function ModIndex.beginFetchText(url)
local h = { url = url, stage = "start" }
if type(url) ~= "string" or url == "" then
h.stage, h.err = "done", "no description"
end
return h
end
function ModIndex.pumpFetchText(h)
if not h then return true, nil, "no handle" end
if h.stage == "done" then return true, h.body, h.err end
local Fetch = require("src.net.Fetch")
if h.stage == "start" then
h.job = Fetch.get(h.url, { userAgent = "gen1recomp-mod-index" })
h.stage = "fetching"
return false
end
local st = Fetch.poll(h.job)
if st.status == "pending" then return false end
Fetch.release(h.job)
h.job, h.stage = nil, "done"
if st.status == "ok" and type(st.body) == "string" and st.body ~= "" then
h.body = st.body
return true, h.body
end
h.err = st.err or "description fetch failed"
return true, nil, h.err
end
function ModIndex.cancelFetchText(h)
if not h or not h.job then return end
local Fetch = require("src.net.Fetch")
pcall(Fetch.cancel, h.job)
h.job, h.stage = nil, "done"
end
-- Download a thumbnail into the save directory and return the love.filesystem
-- relative path. Reuses ModUpdate.downloadZip, which is a plain curl -o with
-- a non-empty-file check -- nothing in it is zip-specific.