Fix: doo many indents

This commit is contained in:
eight 2018-10-14 00:56:04 +08:00
parent 14e321d258
commit fc53bed3de

View File

@ -153,27 +153,25 @@
function maybeUpdateUsercss() { function maybeUpdateUsercss() {
// TODO: when sourceCode is > 100kB use http range request(s) for version check // TODO: when sourceCode is > 100kB use http range request(s) for version check
return download(style.updateUrl) return download(style.updateUrl).then(text =>
.then(text => usercss.buildMeta(text).then(json => {
usercss.buildMeta(text) const {usercssData: {version}} = style;
.then(json => { const {usercssData: {version: newVersion}} = json;
const {usercssData: {version}} = style; switch (Math.sign(semverCompare(version, newVersion))) {
const {usercssData: {version: newVersion}} = json; case 0:
switch (Math.sign(semverCompare(version, newVersion))) { // re-install is invalid in a soft upgrade
case 0: if (!ignoreDigest) {
// re-install is invalid in a soft upgrade const sameCode = text === style.sourceCode;
if (!ignoreDigest) { return Promise.reject(sameCode ? STATES.SAME_CODE : STATES.SAME_VERSION);
const sameCode = text === style.sourceCode;
return Promise.reject(sameCode ? STATES.SAME_CODE : STATES.SAME_VERSION);
}
break;
case 1:
// downgrade is always invalid
return Promise.reject(STATES.ERROR_VERSION);
} }
return usercss.buildCode(json); break;
}) case 1:
); // downgrade is always invalid
return Promise.reject(STATES.ERROR_VERSION);
}
return usercss.buildCode(json);
})
);
} }
function maybeSave(json = {}) { function maybeSave(json = {}) {