1
0
mirror of https://codeberg.org/nobody/LocalCDN.git synced 2025-02-17 04:10:53 +01:00

Merge branch 'bowser' into develop

This commit is contained in:
nobody 2021-04-29 06:30:53 +02:00
commit 23650a1eb3
No known key found for this signature in database
GPG Key ID: 8F6DE3D614FCFD7A
10 changed files with 41 additions and 10 deletions

View File

@ -229,6 +229,8 @@ https://cdnjs.cloudflare.com/ajax/libs/bootstrap-toggle/2.2.2/js/bootstrap2-togg
https://cdnjs.cloudflare.com/ajax/libs/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js
https://cdnjs.cloudflare.com/ajax/libs/bootstrap-vue/2.21.2/bootstrap-vue.min.css
https://cdnjs.cloudflare.com/ajax/libs/bootstrap-vue/2.21.2/bootstrap-vue.min.js
https://cdnjs.cloudflare.com/ajax/libs/bowser/1.9.4/bowser.min.js
https://cdnjs.cloudflare.com/ajax/libs/bowser/2.11.0/bundled.min.js
https://cdnjs.cloudflare.com/ajax/libs/bulma/0.9.2/css/bulma.min.css
https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.bundle.min.js
https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.min.css

View File

@ -296,8 +296,8 @@ function check_resource() {
fi
# Random sleep if the CDN rejects connections (DoS)
# sleep 0.1s - 0.9s per request
# sleep 0.$(( (RANDOM % 10) + 1 ))s
# sleeps 0.1s - 0.9s per request
#sleep 0.$(( (RANDOM % 10) + 1 ))s
# Use Tor Proxy if set
if [ "$USE_TOR" = true ]; then
@ -402,6 +402,12 @@ function create_url() {
else
url="$CLOUDFLARE/$folder/$version/locales/$jfile"
fi
elif [ "$folder" = "bowser" ]; then
if [ "${version::1}" = "2" ]; then
url="$CLOUDFLARE/bowser/$version/bundled.min.js"
else
url="$CLOUDFLARE/bowser/$version/bowser.min.js"
fi
elif [ "$folder" = "select2" ]; then
if [[ $subfile =~ (select2\.min\.js|select2\.full\.min\.js)$ ]]; then
url="$CLOUDFLARE/$folder/$version/js/$subfile"

View File

@ -241,6 +241,7 @@ mappings.cdn = {
'bootstrap-vue/{version}/bootstrap-vue.min.css': resources.bootstrapVueCSS,
'bootstrap-vue/{version}/bootstrap-vue.css': resources.bootstrapVueCSS,
'bootstrap-3-typeahead/{version}/bootstrap3-typeahead.': resources.bootstrap3Typeahead,
'bowser/{version}/': resources.bowserJS,
'bulma/{version}/css/bulma.': resources.bulma,
'Chart.js/{version}/Chart.bundle.': resources.chartJs,
'Chart.js/{version}/Chart.min.js': resources.chartJs,
@ -472,6 +473,7 @@ mappings.cdn = {
'bootstrap-vue@{version}/dist/bootstrap-vue.css': resources.bootstrapVueCSS,
'bootstrap-vue@{version}/dist/bootstrap-vue.min.js': resources.bootstrapVueJS,
'bootstrap-vue@{version}/dist/bootstrap-vue.js': resources.bootstrapVueJS,
'bowser@{version}/': resources.bowserJS,
'bulma@{version}/css/bulma.': resources.bulma,
'chart.js@{version}': resources.chartJs,
'clipboard@{version}/dist/clipboard.': resources.clipboardJS,

View File

@ -125,12 +125,18 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
});
resourcePath = channelPath.replace(basePath, '');
if (Resource.SINGLE_NUMBER_EXPRESSION.test(channelPath)) {
versionNumber = channelPath.match(/\d/);
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
versionNumber = [`${versionNumber}.0`];
// Evaluate first in case of version 'latest' and numerals in resource
versionNumber = resourcePath.match(Resource.VERSION_EXPRESSION);
// Handle weird version expressions
if (!versionNumber) {
if (Resource.SINGLE_NUMBER_EXPRESSION.test(channelPath)) {
versionNumber = channelPath.match(/\d/);
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
versionNumber = [`${versionNumber}.0`];
}
} else {
versionNumber = resourcePath.match(Resource.VERSION_EXPRESSION);
resourcePattern = resourcePath.replace(versionNumber, Resource.VERSION_PLACEHOLDER);
}
@ -146,7 +152,6 @@ requestAnalyzer._findLocalTarget = function (resourceMappings, basePath, channel
for (let resourceMold of Object.keys(resourceMappings)) {
if (resourcePattern.startsWith(resourceMold)) {
let targetPath, versionDelivered, versionRequested, bundle;
targetPath = resourceMappings[resourceMold].path;
targetPath = targetPath.replace(Resource.VERSION_PLACEHOLDER, versionNumber);
// Replace the requested version with the latest depending on major version

View File

@ -252,6 +252,10 @@ var resources = {
'bootstrapVueCSS': {
'path': 'resources/bootstrap-vue/{version}/bootstrap-vue.min.css'
},
// Bowser.js
'bowserJS': {
'path': 'resources/bowser/{version}/bowser.min.jsm'
},
// Bulma
'bulma': {
'path': 'resources/bulma/{version}/css/bulma.min.css'

View File

@ -227,8 +227,8 @@ helpers.formatFilename = function (targetPath) {
helpers.compareVersion = function (v1, v2) {
/**
* compareVersion( '1.5.7' , '1.5.8' ) is TRUE
* compareVersion( '1.5.8' , '1.5.7' ) is FALSE
* compareVersion( '1.5.7' , '1.5.8' ) is FALSE
* compareVersion( '1.5.8' , '1.5.7' ) is TRUE
* compareVersion( '1.5.7' , '1.5.7' ) is TRUE
*/
v1 = v1.split('.');

View File

@ -205,6 +205,9 @@ targets.setLastVersion = function (type, version) {
return '2.21.2';
} else if (type.startsWith('/bootstrap-3-typeahead/4.')) {
return '4.0.2';
} else if (type.startsWith('/bowser/')) {
if (version !== 'latest' && helpers.compareVersion('1.9.4', version)) return '1.9.4';
return '2.11.0';
} else if (type.startsWith('/bulma/0.')) {
return '0.9.2';
} else if (type.startsWith('/Chart.js/2.')) {
@ -610,6 +613,7 @@ const ListOfFiles = {
'ajax-bootstrap-select.min.jsm': 'Ajax Bootstrap Select',
'bootstrap-vue.min.jsm': 'BootstrapVue (JS)',
'bootstrap-vue.min.css': 'BootstrapVue (CSS)',
'bowser.min.jsm': 'Bowser',
'mirage2.min.jsm': 'mirage2',
'chosen.jquery.min.jsm': 'chosen',
'nouislider.min.jsm': 'noUiSlider (JS)',

View File

@ -26,6 +26,7 @@
</div>
<ul>
<li>Added: Snowplow v2.17.3 (<a href="https://codeberg.org/nobody/LocalCDN/issues/419">#419</a>)</li>
<li>Added: Bowser v1.9.4 and v2.11.0 (<a href="https://codeberg.org/nobody/LocalCDN/issues/427">#427</a>)</li>
</ul>
<div id="generator-section">
<div class="topic-label">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long