Merge branch 'master' of https://github.com/openstyles/stylus into dev-refactor
This commit is contained in:
commit
a76ec7c311
|
@ -253,6 +253,7 @@ const styleManager = (() => {
|
|||
if (style.id == null) {
|
||||
delete style.id;
|
||||
}
|
||||
fixUsoMd5Issue(style);
|
||||
return db.exec('put', style)
|
||||
.then(event => {
|
||||
if (style.id == null) {
|
||||
|
@ -380,6 +381,7 @@ const styleManager = (() => {
|
|||
return;
|
||||
}
|
||||
for (const style of styleList) {
|
||||
fixUsoMd5Issue(style);
|
||||
styles.set(style.id, {
|
||||
appliesTo: new Set(),
|
||||
data: style
|
||||
|
@ -479,4 +481,12 @@ const styleManager = (() => {
|
|||
function getUrlNoHash(url) {
|
||||
return url.split('#')[0];
|
||||
}
|
||||
|
||||
// The md5Url provided by USO includes a duplicate "update" subdomain (see #523),
|
||||
// This fixes any already installed styles containing this error
|
||||
function fixUsoMd5Issue(style) {
|
||||
if (style && style.md5Url && style.md5Url.includes('update.update.userstyles')) {
|
||||
style.md5Url = style.md5Url.replace('update.update.userstyles', 'update.userstyles');
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
|
|
@ -159,7 +159,7 @@ API_METHODS.styleViaAPI = !CHROME && (() => {
|
|||
return;
|
||||
}
|
||||
const tabFrames = cache.get(tabId);
|
||||
if (frameId in tabFrames) {
|
||||
if (tabFrames && frameId in tabFrames) {
|
||||
delete tabFrames[frameId];
|
||||
if (isEmpty(tabFrames)) {
|
||||
onTabRemoved(tabId);
|
||||
|
|
|
@ -218,6 +218,14 @@
|
|||
});
|
||||
}
|
||||
|
||||
// USO providing md5Url as "https://update.update.userstyles.org/#####.md5"
|
||||
// instead of "https://update.userstyles.org/#####.md5"
|
||||
function tryFixMd5(style) {
|
||||
if (style && style.md5Url && style.md5Url.includes('update.update')) {
|
||||
style.md5Url = style.md5Url.replace('update.update', 'update');
|
||||
}
|
||||
return style;
|
||||
}
|
||||
|
||||
function getStyleJson() {
|
||||
return getResource(getStyleURL(), {responseType: 'json'})
|
||||
|
@ -236,6 +244,7 @@
|
|||
return style;
|
||||
});
|
||||
})
|
||||
.then(tryFixMd5)
|
||||
.catch(() => null);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user