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

Updated shorthands.js

This commit is contained in:
nobody
2020-08-23 07:35:37 +02:00
parent f2a1eddd85
commit 4e9f5f4c6a
2 changed files with 8 additions and 77 deletions

View File

@@ -130,7 +130,7 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
for (let resourceMold of Object.keys(resourceMappings)) { for (let resourceMold of Object.keys(resourceMappings)) {
if (resourcePattern.startsWith(resourceMold)) { if (resourcePattern.startsWith(resourceMold)) {
let targetPath, hostShorthands, versionDelivered, versionRequested; let targetPath, versionDelivered, versionRequested;
targetPath = resourceMappings[resourceMold].path; targetPath = resourceMappings[resourceMold].path;
targetPath = targetPath.replace(Resource.VERSION_PLACEHOLDER, versionNumber); targetPath = targetPath.replace(Resource.VERSION_PLACEHOLDER, versionNumber);
@@ -140,14 +140,7 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
versionRequested = versionNumber === null ? 'latest' : versionNumber[0]; versionRequested = versionNumber === null ? 'latest' : versionNumber[0];
hostShorthands = shorthands[channelHost]; if (versionNumber === null) {
if (hostShorthands && hostShorthands[targetPath]) {
let shorthand = hostShorthands[targetPath];
targetPath = shorthand.path;
versionDelivered = shorthand.version;
} else if (versionNumber === null) {
versionDelivered = targetPath.match(Resource.VERSION_EXPRESSION).toString(); versionDelivered = targetPath.match(Resource.VERSION_EXPRESSION).toString();
} }

View File

@@ -22,69 +22,7 @@
* Shorthands * Shorthands
*/ */
var 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'];
shorthands.specialFiles = function (channelHost, channelPath, searchString) { shorthands.specialFiles = function (channelHost, channelPath, searchString) {
/* /*
@@ -99,7 +37,7 @@ shorthands.specialFiles = function (channelHost, channelPath, searchString) {
if (Regex.JSDELIVR_COMBINE.test(channelHost + channelPath)) { if (Regex.JSDELIVR_COMBINE.test(channelHost + channelPath)) {
return { return {
'source': channelHost, 'source': channelHost,
'version': 'beta', 'versionDelivered': 'beta',
'path': 'resources/jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm', 'path': 'resources/jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm',
'bundle': '' 'bundle': ''
}; };
@@ -107,28 +45,28 @@ shorthands.specialFiles = function (channelHost, channelPath, searchString) {
// https://gitlab.com/nobody42/localcdn/-/issues/55 // https://gitlab.com/nobody42/localcdn/-/issues/55
return { return {
'source': channelHost, 'source': channelHost,
'version': 'beta', 'versionDelivered': 'beta',
'path': 'resources/algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm', 'path': 'resources/algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm',
'bundle': '' 'bundle': ''
}; };
} else if (Regex.GOOGLE_MATERIAL_ICONS.test(channelHost + channelPath + searchString)) { } else if (Regex.GOOGLE_MATERIAL_ICONS.test(channelHost + channelPath + searchString)) {
return { return {
'source': channelHost, 'source': channelHost,
'version': '3.0.1', 'versionDelivered': '3.0.1',
'path': 'resources/google-material-design-icons/google-material-design-icons.css', 'path': 'resources/google-material-design-icons/google-material-design-icons.css',
'bundle': '' 'bundle': ''
}; };
} else if (Regex.BOOTSTRAP_DATEPICKER_3.test(channelPath)) { } else if (Regex.BOOTSTRAP_DATEPICKER_3.test(channelPath)) {
return { return {
'source': channelHost, 'source': channelHost,
'version': '1.9.0', 'versionDelivered': '1.9.0',
'path': 'resources/bootstrap-datepicker/1.9.0/bootstrap-datepicker3.standalone.min.css', 'path': 'resources/bootstrap-datepicker/1.9.0/bootstrap-datepicker3.standalone.min.css',
'bundle': '' 'bundle': ''
}; };
} else if (Regex.BOOTSTRAP_DATEPICKER.test(channelPath)) { } else if (Regex.BOOTSTRAP_DATEPICKER.test(channelPath)) {
return { return {
'source': channelHost, 'source': channelHost,
'version': '1.9.0', 'versionDelivered': '1.9.0',
'path': 'resources/bootstrap-datepicker/1.9.0/bootstrap-datepicker.standalone.min.css', 'path': 'resources/bootstrap-datepicker/1.9.0/bootstrap-datepicker.standalone.min.css',
'bundle': '' 'bundle': ''
}; };