diff --git a/background/style-manager.js b/background/style-manager.js index c62f601d..936800aa 100644 --- a/background/style-manager.js +++ b/background/style-manager.js @@ -473,7 +473,7 @@ const styleMan = (() => { async function init() { const styles = await db.exec('getAll') || []; - const updated = styles.filter(fixOldStyleProps); + const updated = styles.filter(fixKnownProblems); if (updated.length) { await db.exec('putMany', updated); } @@ -486,7 +486,7 @@ const styleMan = (() => { bgReady._resolveStyles(); } - function fixOldStyleProps(style) { + function fixKnownProblems(style) { let res = 0; for (const key in MISSING_PROPS) { if (!style[key]) { @@ -504,6 +504,15 @@ const styleMan = (() => { delete style.originalName; res = 1; } + /* wrong homepage url in 1.5.20-1.5.21 due to commit 1e5f118d */ + for (const key of ['url', 'installationUrl']) { + const url = style[key]; + const fixedUrl = url && url.replace(/([^:]\/)\//, '$1'); + if (fixedUrl !== url) { + res = 1; + style[key] = fixedUrl; + } + } return res; } diff --git a/js/toolbox.js b/js/toolbox.js index dc3ddbb7..a5966342 100644 --- a/js/toolbox.js +++ b/js/toolbox.js @@ -91,7 +91,7 @@ const URLS = { Number(url.match(/\/(\d+)\.user\.css|$/)[1]), extractUsoArchiveInstallUrl: url => { const id = URLS.extractUsoArchiveId(url); - return id ? `${URLS.usoArchive}/style/${id}` : ''; + return id ? `${URLS.usoArchive}style/${id}` : ''; }, makeUsoArchiveCodeUrl: id => `${URLS.usoArchiveRaw[0]}usercss/${id}.user.css`,