1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-06-05 21:49:31 +02:00

Show upgrades of frameworks in popup (#68)

This commit is contained in:
nobody
2020-07-30 07:56:48 +02:00
parent cc16cefc36
commit 1830616afe
3 changed files with 22 additions and 9 deletions

View File

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