diff --git a/core/request-analyzer.js b/core/request-analyzer.js index 54ae265b..f22f9810 100644 --- a/core/request-analyzer.js +++ b/core/request-analyzer.js @@ -137,14 +137,16 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel if (resourcePattern.startsWith(resourceMold)) { - let targetPath, hostShorthands, version; + let targetPath, hostShorthands, versionDelivered, versionRequested; targetPath = resourceMappings[resourceMold].path; targetPath = targetPath.replace(Resource.VERSION_PLACEHOLDER, versionNumber); // Replace the requested version with the latest depending on major version - version = helpers.setLastVersion(targetPath, versionNumber).toString(); - targetPath = targetPath.replace(versionNumber, version); + versionDelivered = helpers.setLastVersion(targetPath, versionNumber).toString(); + targetPath = targetPath.replace(versionNumber, versionDelivered); + + versionRequested = versionNumber === null ? false : versionNumber[0]; hostShorthands = shorthands[channelHost]; @@ -153,10 +155,10 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel let shorthand = hostShorthands[targetPath]; targetPath = shorthand.path; - version = shorthand.version; + versionDelivered = shorthand.version; - } else { - version = versionNumber && versionNumber[0] || targetPath.match(Resource.VERSION_EXPRESSION); + } else if (versionNumber === null) { + versionDelivered = targetPath.match(Resource.VERSION_EXPRESSION).toString(); } // Get bundle name @@ -172,7 +174,8 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel // Prepare and return a local target. return { 'source': channelHost, - 'version': version, + 'versionRequested': versionRequested, + 'versionDelivered': versionDelivered, 'path': targetPath, 'bundle': bundle }; diff --git a/pages/popup/popup.js b/pages/popup/popup.js index bab6ab49..01950598 100644 --- a/pages/popup/popup.js +++ b/pages/popup/popup.js @@ -381,10 +381,19 @@ popup._createInjectionElement = function (injection) { nameTextNode = document.createTextNode(`- ${name}`); injectionElement.appendChild(nameTextNode); - if (injection.version !== null) { + if (injection.versionRequested !== null) { noteElement = document.createElement('span'); noteElement.setAttribute('class', 'side-note'); - let versionNode = (injection.version === 'beta') ? ` ${injection.version}` : ` v${injection.version}`; + + let versionNode = ''; + console.log(injection); + if (injection.versionRequested === injection.versionDelivered) { + versionNode = ` v${injection.versionRequested}`; + } else if (injection.versionRequested === 'beta') { + versionNode = ` ${injection.versionRequested}`; + } else if (injection.versionRequested !== false){ + versionNode = ` (v${injection.versionRequested} 🡢 v${injection.versionDelivered})`; + } noteTextNode = document.createTextNode(versionNode); noteElement.appendChild(noteTextNode); injectionElement.appendChild(noteElement); diff --git a/pages/updates/updates.html b/pages/updates/updates.html index 854edf38..6c5a32bf 100644 --- a/pages/updates/updates.html +++ b/pages/updates/updates.html @@ -29,6 +29,7 @@