mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 07:50:22 +08:00
fix: 清洗不再写坏 YAML,检测更新失败能看见结果
Apply 会清掉 personaPrefix 空值后的缩进残段,避免 dsh 起不来;#5/#11 在官方已改句式时不再挡应用。检测更新改走带超时的接口,结果显示在按钮旁。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8b001c5803
commit
0d2a126205
4 files changed
+218
-49
No files matched your search
+17
-7
@@ -77,13 +77,23 @@ function gitHead(dir) {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchText(url) {
|
||||
const res = await fetch(url, {
|
||||
headers: { "user-agent": "dsh-purge-update", accept: "*/*" },
|
||||
redirect: "follow",
|
||||
});
|
||||
if (!res.ok) throw new Error(`http ${res.status}`);
|
||||
return res.text();
|
||||
async function fetchText(url, ms = 10000) {
|
||||
const ctrl = new AbortController();
|
||||
const timer = setTimeout(() => ctrl.abort(), ms);
|
||||
try {
|
||||
const res = await fetch(url, {
|
||||
headers: { "user-agent": "dsh-purge-update", accept: "*/*" },
|
||||
redirect: "follow",
|
||||
signal: ctrl.signal,
|
||||
});
|
||||
if (!res.ok) throw new Error(`http ${res.status}`);
|
||||
return res.text();
|
||||
} catch (e) {
|
||||
if (e && e.name === "AbortError") throw new Error("GitHub 超时");
|
||||
throw e;
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchJson(url) {
|
||||
|
||||
Reference in new issue
Block a user