mirror of https://github.com/gorhill/uBlock.git
Add visual hint in support information re. differential update
In Support pane's troubleshooting information, a delta sign will be added to list update information when the list was last updated through differential update.
This commit is contained in:
parent
310bfec6a1
commit
7e44db763e
|
@ -985,6 +985,17 @@ assets.get = async function(assetKey, options = {}) {
|
||||||
silent: options.silent === true,
|
silent: options.silent === true,
|
||||||
});
|
});
|
||||||
registerAssetSource(assetKey, { error: undefined });
|
registerAssetSource(assetKey, { error: undefined });
|
||||||
|
if ( assetDetails.content === 'filters' ) {
|
||||||
|
const metadata = extractMetadataFromList(details.content, [
|
||||||
|
'Last-Modified',
|
||||||
|
'Expires',
|
||||||
|
'Diff-Name',
|
||||||
|
'Diff-Path',
|
||||||
|
'Diff-Expires',
|
||||||
|
]);
|
||||||
|
metadata.diffUpdated = undefined;
|
||||||
|
assetCacheSetDetails(assetKey, metadata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return reportBack(details.content, contentURL);
|
return reportBack(details.content, contentURL);
|
||||||
}
|
}
|
||||||
|
@ -1057,6 +1068,7 @@ async function getRemote(assetKey, options = {}) {
|
||||||
'Diff-Path',
|
'Diff-Path',
|
||||||
'Diff-Expires',
|
'Diff-Expires',
|
||||||
]);
|
]);
|
||||||
|
metadata.diffUpdated = undefined;
|
||||||
assetCacheSetDetails(assetKey, metadata);
|
assetCacheSetDetails(assetKey, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1113,6 +1125,9 @@ assets.metadata = async function() {
|
||||||
const obsoleteAfter = cacheEntry.writeTime + getUpdateAfterTime(assetKey);
|
const obsoleteAfter = cacheEntry.writeTime + getUpdateAfterTime(assetKey);
|
||||||
assetEntry.obsolete = obsoleteAfter < now;
|
assetEntry.obsolete = obsoleteAfter < now;
|
||||||
assetEntry.remoteURL = cacheEntry.remoteURL;
|
assetEntry.remoteURL = cacheEntry.remoteURL;
|
||||||
|
if ( cacheEntry.diffUpdated ) {
|
||||||
|
assetEntry.diffUpdated = cacheEntry.diffUpdated;
|
||||||
|
}
|
||||||
} else if (
|
} else if (
|
||||||
assetEntry.contentURL &&
|
assetEntry.contentURL &&
|
||||||
assetEntry.contentURL.length !== 0
|
assetEntry.contentURL.length !== 0
|
||||||
|
@ -1273,6 +1288,7 @@ async function diffUpdater() {
|
||||||
content: data.text,
|
content: data.text,
|
||||||
resourceTime: metadata.lastModified || 0,
|
resourceTime: metadata.lastModified || 0,
|
||||||
});
|
});
|
||||||
|
metadata.diffUpdated = true;
|
||||||
assetCacheSetDetails(data.assetKey, metadata);
|
assetCacheSetDetails(data.assetKey, metadata);
|
||||||
updaterUpdated.push(data.assetKey);
|
updaterUpdated.push(data.assetKey);
|
||||||
} else if ( data.error ) {
|
} else if ( data.error ) {
|
||||||
|
|
|
@ -1447,7 +1447,9 @@ const getSupportData = async function() {
|
||||||
|
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
|
|
||||||
const formatDelayFromNow = time => {
|
const formatDelayFromNow = list => {
|
||||||
|
const time = list.writeTime;
|
||||||
|
if ( typeof time !== 'number' || time === 0 ) { return 'never'; }
|
||||||
if ( (time || 0) === 0 ) { return '?'; }
|
if ( (time || 0) === 0 ) { return '?'; }
|
||||||
const delayInSec = (now - time) / 1000;
|
const delayInSec = (now - time) / 1000;
|
||||||
const days = (delayInSec / 86400) | 0;
|
const days = (delayInSec / 86400) | 0;
|
||||||
|
@ -1458,7 +1460,9 @@ const getSupportData = async function() {
|
||||||
if ( hours > 0 ) { parts.push(`${hours}h`); }
|
if ( hours > 0 ) { parts.push(`${hours}h`); }
|
||||||
if ( minutes > 0 ) { parts.push(`${minutes}m`); }
|
if ( minutes > 0 ) { parts.push(`${minutes}m`); }
|
||||||
if ( parts.length === 0 ) { parts.push('now'); }
|
if ( parts.length === 0 ) { parts.push('now'); }
|
||||||
return parts.join('.');
|
const out = parts.join('.');
|
||||||
|
if ( list.diffUpdated ) { return `${out} Δ`; }
|
||||||
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
const lists = µb.availableFilterLists;
|
const lists = µb.availableFilterLists;
|
||||||
|
@ -1475,11 +1479,7 @@ const getSupportData = async function() {
|
||||||
if ( typeof list.entryCount === 'number' ) {
|
if ( typeof list.entryCount === 'number' ) {
|
||||||
listDetails.push(`${list.entryCount}-${list.entryCount-list.entryUsedCount}`);
|
listDetails.push(`${list.entryCount}-${list.entryCount-list.entryUsedCount}`);
|
||||||
}
|
}
|
||||||
if ( typeof list.writeTime !== 'number' || list.writeTime === 0 ) {
|
listDetails.push(formatDelayFromNow(list));
|
||||||
listDetails.push('never');
|
|
||||||
} else {
|
|
||||||
listDetails.push(formatDelayFromNow(list.writeTime));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( list.isDefault || listKey === µb.userFiltersPath ) {
|
if ( list.isDefault || listKey === µb.userFiltersPath ) {
|
||||||
if ( used ) {
|
if ( used ) {
|
||||||
|
|
Loading…
Reference in New Issue