This commit is contained in:
tophf 2021-08-22 20:30:09 +03:00
parent 8ac43fca31
commit bfd0d03871
2 changed files with 12 additions and 3 deletions

View File

@ -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;
}

View File

@ -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`,