fixup! deduplicate
This commit is contained in:
parent
509cba0dca
commit
b5be5f9a5a
|
@ -159,11 +159,8 @@ const updateMan = (() => {
|
||||||
let json;
|
let json;
|
||||||
try {
|
try {
|
||||||
json = await tryDownload(style.updateUrl, {responseType: 'json'});
|
json = await tryDownload(style.updateUrl, {responseType: 'json'});
|
||||||
const m = await getUsoEmbeddedMeta(json.css);
|
json = await updateUsercss(json.css) ||
|
||||||
if (m) {
|
(await API.uso.toUsercss(json)).style;
|
||||||
return updateUsercss(m);
|
|
||||||
}
|
|
||||||
json = (await API.uso.toUsercss(json)).style;
|
|
||||||
} finally {
|
} finally {
|
||||||
usoSpooferStop();
|
usoSpooferStop();
|
||||||
}
|
}
|
||||||
|
@ -172,16 +169,17 @@ const updateMan = (() => {
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateUsercss(m2) {
|
async function updateUsercss(css) {
|
||||||
let oldVer = ucd.version;
|
let oldVer = ucd.version;
|
||||||
let {etag: oldEtag, updateUrl} = style;
|
let {etag: oldEtag, updateUrl} = style;
|
||||||
if (!m2) {
|
const m2 = (css || URLS.extractUsoArchiveId(updateUrl)) &&
|
||||||
m2 = (md5Url || URLS.extractUsoArchiveId(updateUrl)) && await getUsoEmbeddedMeta();
|
await getUsoEmbeddedMeta(css);
|
||||||
}
|
|
||||||
if (m2 && m2.updateUrl) {
|
if (m2 && m2.updateUrl) {
|
||||||
updateUrl = m2.updateUrl;
|
updateUrl = m2.updateUrl;
|
||||||
oldVer = m2.usercssData.version || '0';
|
oldVer = m2.usercssData.version || '0';
|
||||||
oldEtag = '';
|
oldEtag = '';
|
||||||
|
} else if (css) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (oldEtag && oldEtag === await downloadEtag()) {
|
if (oldEtag && oldEtag === await downloadEtag()) {
|
||||||
return Promise.reject(STATES.SAME_CODE);
|
return Promise.reject(STATES.SAME_CODE);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user