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,
|
||||
});
|
||||
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);
|
||||
}
|
||||
|
@ -1057,6 +1068,7 @@ async function getRemote(assetKey, options = {}) {
|
|||
'Diff-Path',
|
||||
'Diff-Expires',
|
||||
]);
|
||||
metadata.diffUpdated = undefined;
|
||||
assetCacheSetDetails(assetKey, metadata);
|
||||
}
|
||||
|
||||
|
@ -1113,6 +1125,9 @@ assets.metadata = async function() {
|
|||
const obsoleteAfter = cacheEntry.writeTime + getUpdateAfterTime(assetKey);
|
||||
assetEntry.obsolete = obsoleteAfter < now;
|
||||
assetEntry.remoteURL = cacheEntry.remoteURL;
|
||||
if ( cacheEntry.diffUpdated ) {
|
||||
assetEntry.diffUpdated = cacheEntry.diffUpdated;
|
||||
}
|
||||
} else if (
|
||||
assetEntry.contentURL &&
|
||||
assetEntry.contentURL.length !== 0
|
||||
|
@ -1273,6 +1288,7 @@ async function diffUpdater() {
|
|||
content: data.text,
|
||||
resourceTime: metadata.lastModified || 0,
|
||||
});
|
||||
metadata.diffUpdated = true;
|
||||
assetCacheSetDetails(data.assetKey, metadata);
|
||||
updaterUpdated.push(data.assetKey);
|
||||
} else if ( data.error ) {
|
||||
|
|
|
@ -1447,7 +1447,9 @@ const getSupportData = async function() {
|
|||
|
||||
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 '?'; }
|
||||
const delayInSec = (now - time) / 1000;
|
||||
const days = (delayInSec / 86400) | 0;
|
||||
|
@ -1458,7 +1460,9 @@ const getSupportData = async function() {
|
|||
if ( hours > 0 ) { parts.push(`${hours}h`); }
|
||||
if ( minutes > 0 ) { parts.push(`${minutes}m`); }
|
||||
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;
|
||||
|
@ -1475,11 +1479,7 @@ const getSupportData = async function() {
|
|||
if ( typeof list.entryCount === 'number' ) {
|
||||
listDetails.push(`${list.entryCount}-${list.entryCount-list.entryUsedCount}`);
|
||||
}
|
||||
if ( typeof list.writeTime !== 'number' || list.writeTime === 0 ) {
|
||||
listDetails.push('never');
|
||||
} else {
|
||||
listDetails.push(formatDelayFromNow(list.writeTime));
|
||||
}
|
||||
listDetails.push(formatDelayFromNow(list));
|
||||
}
|
||||
if ( list.isDefault || listKey === µb.userFiltersPath ) {
|
||||
if ( used ) {
|
||||
|
|
Loading…
Reference in New Issue