fix #1321
This commit is contained in:
parent
8ac43fca31
commit
bfd0d03871
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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`,
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user