2020-02-27 13:45:29 +01:00
|
|
|
/**
|
|
|
|
* Shorthands
|
2020-06-30 18:41:58 +02:00
|
|
|
* Belongs to LocalCDN (since 2020-02-26)
|
|
|
|
* (Origin: Decentraleyes)
|
2020-02-27 13:45:29 +01:00
|
|
|
*
|
|
|
|
* @author Thomas Rientjes
|
|
|
|
* @since 2018-02-24
|
2020-04-14 07:43:25 +02:00
|
|
|
*
|
2020-06-30 18:41:58 +02:00
|
|
|
* @author nobody
|
2020-04-14 07:43:25 +02:00
|
|
|
* @since 2020-02-26
|
|
|
|
*
|
2020-02-27 13:45:29 +01:00
|
|
|
* @license MPL 2.0
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shorthands
|
|
|
|
*/
|
|
|
|
|
2020-08-23 07:35:37 +02:00
|
|
|
var shorthands = {};
|
2020-04-14 07:42:56 +02:00
|
|
|
|
2020-06-27 11:50:50 +02:00
|
|
|
shorthands.specialFiles = function (channelHost, channelPath, searchString) {
|
2020-04-14 07:42:56 +02:00
|
|
|
/*
|
|
|
|
NOTE:
|
|
|
|
jsDelivr allows to load several files in one request
|
|
|
|
This is just a workaround. If there are more websites which use this, we will have to do crazy things here to find and redirect these files.
|
|
|
|
|
|
|
|
It's not possible to respond to a request with multiple redirections
|
|
|
|
https://gitlab.com/nobody42/localcdn/-/issues/45
|
|
|
|
*/
|
2020-08-23 07:30:58 +02:00
|
|
|
|
|
|
|
if (Regex.JSDELIVR_COMBINE.test(channelHost + channelPath)) {
|
2020-04-14 07:42:56 +02:00
|
|
|
return {
|
|
|
|
'source': channelHost,
|
2020-08-23 07:35:37 +02:00
|
|
|
'versionDelivered': 'beta',
|
2020-04-14 07:42:56 +02:00
|
|
|
'path': 'resources/jsdelivr-combine-jquery-hogan-algoliasearch-autocomplete.jsm',
|
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-08-23 07:30:58 +02:00
|
|
|
} else if ((channelHost + channelPath) === 'cdn.jsdelivr.net/g/algoliasearch@3(algoliasearchLite.min.js),algoliasearch.helper@2') {
|
2020-04-14 07:42:56 +02:00
|
|
|
// https://gitlab.com/nobody42/localcdn/-/issues/55
|
|
|
|
return {
|
|
|
|
'source': channelHost,
|
2020-08-23 07:35:37 +02:00
|
|
|
'versionDelivered': 'beta',
|
2020-04-14 07:42:56 +02:00
|
|
|
'path': 'resources/algoliasearch3.33.0_algoliasearchLite_algoliasearchHelper.jsm',
|
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-08-23 07:30:58 +02:00
|
|
|
} else if (Regex.GOOGLE_MATERIAL_ICONS.test(channelHost + channelPath + searchString)) {
|
2020-06-27 11:50:50 +02:00
|
|
|
return {
|
|
|
|
'source': channelHost,
|
2020-08-23 07:35:37 +02:00
|
|
|
'versionDelivered': '3.0.1',
|
2020-06-27 11:50:50 +02:00
|
|
|
'path': 'resources/google-material-design-icons/google-material-design-icons.css',
|
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-08-23 07:30:58 +02:00
|
|
|
} else if (Regex.BOOTSTRAP_DATEPICKER_3.test(channelPath)) {
|
2020-07-13 18:50:13 +02:00
|
|
|
return {
|
|
|
|
'source': channelHost,
|
2020-08-23 07:35:37 +02:00
|
|
|
'versionDelivered': '1.9.0',
|
2020-07-13 18:50:13 +02:00
|
|
|
'path': 'resources/bootstrap-datepicker/1.9.0/bootstrap-datepicker3.standalone.min.css',
|
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-08-23 07:30:58 +02:00
|
|
|
} else if (Regex.BOOTSTRAP_DATEPICKER.test(channelPath)) {
|
2020-07-13 18:50:13 +02:00
|
|
|
return {
|
|
|
|
'source': channelHost,
|
2020-08-23 07:35:37 +02:00
|
|
|
'versionDelivered': '1.9.0',
|
2020-07-13 18:50:13 +02:00
|
|
|
'path': 'resources/bootstrap-datepicker/1.9.0/bootstrap-datepicker.standalone.min.css',
|
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-08-23 07:30:58 +02:00
|
|
|
} else if (Regex.FONT_AWESOME.test(channelHost + channelPath)) {
|
2020-08-03 13:36:13 +02:00
|
|
|
return {
|
|
|
|
'source': channelHost,
|
|
|
|
'versionRequested': '4.6.3',
|
|
|
|
'versionDelivered': '4.7.0',
|
2020-08-19 10:00:26 +02:00
|
|
|
'path': 'resources/webfont/fa-loader.css',
|
2020-08-03 13:36:13 +02:00
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-08-23 07:30:58 +02:00
|
|
|
} else if (Regex.FONT_AWESOME_WITH_CODE.test(channelHost + channelPath)) {
|
2020-08-03 13:36:13 +02:00
|
|
|
return {
|
|
|
|
'source': channelHost,
|
|
|
|
'versionRequested': '4.6.3',
|
|
|
|
'versionDelivered': '4.7.0',
|
2020-08-19 10:00:26 +02:00
|
|
|
'path': 'resources/webfont/fa-loader.jsm',
|
2020-08-03 13:36:13 +02:00
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-08-23 07:36:41 +02:00
|
|
|
} else if ((channelHost + channelPath) === 'cdn.jsdelivr.net/npm/vue') {
|
|
|
|
return {
|
|
|
|
'source': channelHost,
|
|
|
|
'versionRequested': 'latest',
|
|
|
|
'versionDelivered': '2.6.12',
|
|
|
|
'path': 'resources/vue/2.6.12/vue.min.jsm',
|
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-08-30 22:20:31 +02:00
|
|
|
} else if ((channelHost + channelPath) === 'ajax.cloudflare.com/cdn-cgi/scripts/7089c43e/cloudflare-static/rocket-loader.min.js') {
|
|
|
|
return {
|
|
|
|
'source': channelHost,
|
|
|
|
'versionRequested': 'latest',
|
|
|
|
'path': 'resources/rocket-loader/latest/rocket-loader.min.jsm',
|
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-09-20 08:22:37 +02:00
|
|
|
} else if ((channelHost + channelPath) === 'unpkg.com/@umds/object-assign@4.1.1-beta.24/object-assign.min.js') {
|
|
|
|
return {
|
|
|
|
'source': channelHost,
|
|
|
|
'versionRequested': '4.1.1',
|
|
|
|
'path': 'resources/object-assign/4.1.1/object-assign.min.jsm',
|
|
|
|
'bundle': ''
|
|
|
|
};
|
2020-04-14 07:42:56 +02:00
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|