From 4e9f5f4c6aa129f1232ab3fc42d94a1e81c204e1 Mon Sep 17 00:00:00 2001 From: nobody Date: Sun, 23 Aug 2020 07:35:37 +0200 Subject: [PATCH] Updated shorthands.js --- core/request-analyzer.js | 11 ++---- core/shorthands.js | 74 ++++------------------------------------ 2 files changed, 8 insertions(+), 77 deletions(-) diff --git a/core/request-analyzer.js b/core/request-analyzer.js index 98055222..9ddf3df5 100644 --- a/core/request-analyzer.js +++ b/core/request-analyzer.js @@ -130,7 +130,7 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel for (let resourceMold of Object.keys(resourceMappings)) { if (resourcePattern.startsWith(resourceMold)) { - let targetPath, hostShorthands, versionDelivered, versionRequested; + let targetPath, versionDelivered, versionRequested; targetPath = resourceMappings[resourceMold].path; targetPath = targetPath.replace(Resource.VERSION_PLACEHOLDER, versionNumber); @@ -140,14 +140,7 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel versionRequested = versionNumber === null ? 'latest' : versionNumber[0]; - hostShorthands = shorthands[channelHost]; - - if (hostShorthands && hostShorthands[targetPath]) { - let shorthand = hostShorthands[targetPath]; - - targetPath = shorthand.path; - versionDelivered = shorthand.version; - } else if (versionNumber === null) { + if (versionNumber === null) { versionDelivered = targetPath.match(Resource.VERSION_EXPRESSION).toString(); } diff --git a/core/shorthands.js b/core/shorthands.js index 040276ce..b8ddab9c 100644 --- a/core/shorthands.js +++ b/core/shorthands.js @@ -22,69 +22,7 @@ * Shorthands */ -var shorthands = { - - // Google Hosted Libraries [Deprecated] - 'ajax.googleapis.com': { - 'resources/jquery/1.8/jquery.min.jsm': { - 'path': 'resources/jquery/1.8.3/jquery.min.jsm', - 'version': '1.8.3' - }, - 'resources/jquery/1.7/jquery.min.jsm': { - 'path': 'resources/jquery/1.7.2/jquery.min.jsm', - 'version': '1.7.2' - }, - 'resources/jquery/1.6/jquery.min.jsm': { - 'path': 'resources/jquery/1.6.4/jquery.min.jsm', - 'version': '1.6.4' - }, - 'resources/jquery/1.5/jquery.min.jsm': { - 'path': 'resources/jquery/1.5.2/jquery.min.jsm', - 'version': '1.5.2' - }, - 'resources/jquery/1.4/jquery.min.jsm': { - 'path': 'resources/jquery/1.4.4/jquery.min.jsm', - 'version': '1.4.4' - }, - 'resources/jquery/1.3/jquery.min.jsm': { - 'path': 'resources/jquery/1.3.2/jquery.min.jsm', - 'version': '1.3.2' - }, - 'resources/jquery/1.2/jquery.min.jsm': { - 'path': 'resources/jquery/1.2.6/jquery.min.jsm', - 'version': '1.2.6' - } - }, - // jQuery CDN [Deprecated] - 'code.jquery.com': { - 'resources/jquery/1.7/jquery.min.jsm': { - 'path': 'resources/jquery/1.7.0/jquery.min.jsm', - 'version': '1.7.0' - }, - 'resources/jquery/1.6/jquery.min.jsm': { - 'path': 'resources/jquery/1.6.0/jquery.min.jsm', - 'version': '1.6.0' - }, - 'resources/jquery/1.5/jquery.min.jsm': { - 'path': 'resources/jquery/1.5.0/jquery.min.jsm', - 'version': '1.5.0' - }, - 'resources/jquery/1.4/jquery.min.jsm': { - 'path': 'resources/jquery/1.4.0/jquery.min.jsm', - 'version': '1.4.0' - }, - 'resources/jquery/1.3/jquery.min.jsm': { - 'path': 'resources/jquery/1.3.0/jquery.min.jsm', - 'version': '1.3.0' - } - } -}; - -// Geekzu Public Service [Mirror] -shorthands['sdn.geekzu.org'] = shorthands['ajax.googleapis.com']; - -// USTC Linux User Group [Mirror] -shorthands['ajax.proxy.ustclug.org'] = shorthands['ajax.googleapis.com']; +var shorthands = {}; shorthands.specialFiles = function (channelHost, channelPath, searchString) { /* @@ -99,7 +37,7 @@ shorthands.specialFiles = function (channelHost, channelPath, searchString) { if (Regex.JSDELIVR_COMBINE.test(channelHost + channelPath)) { return { 'source': channelHost, - 'version': 'beta', + 'versionDelivered': 'beta', 'path': 'resources/jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm', 'bundle': '' }; @@ -107,28 +45,28 @@ shorthands.specialFiles = function (channelHost, channelPath, searchString) { // https://gitlab.com/nobody42/localcdn/-/issues/55 return { 'source': channelHost, - 'version': 'beta', + 'versionDelivered': 'beta', 'path': 'resources/algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm', 'bundle': '' }; } else if (Regex.GOOGLE_MATERIAL_ICONS.test(channelHost + channelPath + searchString)) { return { 'source': channelHost, - 'version': '3.0.1', + 'versionDelivered': '3.0.1', 'path': 'resources/google-material-design-icons/google-material-design-icons.css', 'bundle': '' }; } else if (Regex.BOOTSTRAP_DATEPICKER_3.test(channelPath)) { return { 'source': channelHost, - 'version': '1.9.0', + 'versionDelivered': '1.9.0', 'path': 'resources/bootstrap-datepicker/1.9.0/bootstrap-datepicker3.standalone.min.css', 'bundle': '' }; } else if (Regex.BOOTSTRAP_DATEPICKER.test(channelPath)) { return { 'source': channelHost, - 'version': '1.9.0', + 'versionDelivered': '1.9.0', 'path': 'resources/bootstrap-datepicker/1.9.0/bootstrap-datepicker.standalone.min.css', 'bundle': '' };