Skip to content

Commit

Permalink
Improve resource timeout issue
Browse files Browse the repository at this point in the history
As a stopgap measure, this PR adds a seconds CDN fallback URL.  For the
time-being removes SRI for external links.
Also improves app loading messages
  • Loading branch information
thostetler committed Jan 23, 2022
1 parent 039b623 commit 6f79f25
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 162 deletions.
11 changes: 11 additions & 0 deletions grunt/aliases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,14 @@ release:
- htmlmin
- imagemin
- uglify

release:quick:
tasks:
- env:prod
- clean:release
- copy:release
- string-replace:production
- check-release-version
- string-replace:latest_version
- optimize-build
- string-replace:final
9 changes: 2 additions & 7 deletions src/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,8 @@
<head>
<link rel="preload" href="./styles/css/styles.css" as="style" />
<link rel="stylesheet" href="./styles/css/styles.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script>
<script>
!window.requirejs &&
document.write(
'<script src="./libs/requirejs/require.js">\x3C/script>'
);
</script>
<link rel="preload" href="./libs/require.js" as="script" />
<script src="./libs/require.js"></script>
<script>
require.config({
paths: {
Expand Down
8 changes: 2 additions & 6 deletions src/500.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@
<html>
<head>
<link rel="preload" href="./styles/css/styles.css" as="style" />
<link
rel="preload"
href="//cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"
as="script"
/>
<link rel="preload" href="./libs/require.js" as="script" />
<link rel="stylesheet" href="./styles/css/styles.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.3.5/require.min.js"></script>
<script src="./libs/require.js"></script>
<script>
!window.requirejs &&
document.write(
Expand Down
195 changes: 76 additions & 119 deletions src/config/discovery.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,158 +199,199 @@ require.config({
// *******************************
// *** production dependencies ***
// *******************************

underscore: [
// 'https://unpkg.com/lodash@2.4.2/dist/lodash.compat.min',
'https://cdn.jsdelivr.net/npm/lodash@2.4.2/dist/lodash.compat.min',
'https://unpkg.com/lodash@2.4.2/dist/lodash.compat.min',
'libs/lodash',
],
backbone: [
'https://cdn.jsdelivr.net/npm/backbone@1.1.2/backbone-min',
'https://unpkg.com/backbone@1.1.2/backbone-min',
'libs/backbone',
],
'backbone-validation': [
// 'https://unpkg.com/backbone-validation@0.11.3/dist/backbone-validation-amd-min',
'https://cdn.jsdelivr.net/npm/backbone-validation@0.11.3/dist/backbone-validation-amd-min',
'https://unpkg.com/backbone-validation@0.11.3/dist/backbone-validation-amd-min',
'libs/backbone-validation',
],
'backbone.stickit': [
// 'https://unpkg.com/backbone.stickit@0.9.2/backbone.stickit',
'https://cdn.jsdelivr.net/npm/backbone.stickit@0.9.2/backbone.stickit',
'https://unpkg.com/backbone.stickit@0.9.2/backbone.stickit',
'libs/backbone.stickit',
],
'backbone.wreqr': [
// 'https://unpkg.com/backbone.wreqr@1.4.0/lib/backbone.wreqr.min',
'https://cdn.jsdelivr.net/npm/backbone.wreqr@1.4.0/lib/backbone.wreqr.min',
'https://unpkg.com/backbone.wreqr@1.4.0/lib/backbone.wreqr.min',
'libs/backbone.wreqr',
],
bootstrap: [
// 'https://unpkg.com/bootstrap@3.3.7/dist/js/bootstrap.min',
'https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/js/bootstrap.min',
'https://unpkg.com/bootstrap@3.3.7/dist/js/bootstrap.min',
'libs/bootstrap/bootstrap',
],
bowser: [
// 'https://unpkg.com/bowser@2.11.0/es5',
'https://cdn.jsdelivr.net/npm/bowser@2.11.0/es5',
'https://unpkg.com/bowser@2.11.0/es5',
'libs/bowser',
],
clipboard: [
// 'https://unpkg.com/clipboard@1.7.1/dist/clipboard.min',
'https://cdn.jsdelivr.net/npm/clipboard@1.7.1/dist/clipboard.min',
'https://unpkg.com/clipboard@1.7.1/dist/clipboard.min',
'libs/clipboard',
],
d3: [
// 'https://unpkg.com/d3@3.5.17/d3.min',
'https://cdn.jsdelivr.net/npm/d3@3.5.17/d3.min',
'https://unpkg.com/d3@3.5.17/d3.min',
'libs/d3',
],
'd3-cloud': [
// 'https://unpkg.com/d3-cloud@1.2.5/build/d3.layout.cloud',
'https://cdn.jsdelivr.net/npm/d3-cloud@1.2.5/build/d3.layout.cloud',
'https://unpkg.com/d3-cloud@1.2.5/build/d3.layout.cloud',
'libs/d3-cloud',
],
filesaver: [
// 'https://unpkg.com/file-saver@1.3.8/FileSaver.min',
'https://cdn.jsdelivr.net/npm/file-saver@1.3.8/FileSaver.min',
'https://unpkg.com/file-saver@1.3.8/FileSaver.min',
'libs/file-saver',
],
hotkeys: [
// 'https://unpkg.com/hotkeys-js@3.8.7/dist/hotkeys.min',
'https://cdn.jsdelivr.net/npm/hotkeys-js@3.8.7/dist/hotkeys.min',
'https://unpkg.com/hotkeys-js@3.8.7/dist/hotkeys.min',
'libs/hotkeys',
],
jquery: [
// 'https://unpkg.com/jquery@2.2.4/dist/jquery.min',
'https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min',
'https://unpkg.com/jquery@2.2.4/dist/jquery.min',
'libs/jquery',
],
'jquery-ui': [
'https://code.jquery.com/ui/1.12.1/jquery-ui.min',
'https://code.jquery.com/ui/1.12.1/jquery-ui.min',
'libs/jquery-ui',
],
jsonpath: [
// 'https://unpkg.com/jsonpath@0.2.12/jsonpath.min',
'https://cdn.jsdelivr.net/npm/jsonpath@0.2.12/jsonpath.min',
'https://unpkg.com/jsonpath@0.2.12/jsonpath.min',
'libs/jsonpath',
],
marionette: [
// 'https://unpkg.com/backbone.marionette@2.4.5/lib/backbone.marionette.min',
'https://cdn.jsdelivr.net/npm/backbone.marionette@2.4.5/lib/backbone.marionette.min',
'https://unpkg.com/backbone.marionette@2.4.5/lib/backbone.marionette.min',
'libs/backbone.marionette',
],
mathjax: [
'https://cdn.jsdelivr.net/npm/mathjax@2.7.4/MathJax.js?config=TeX-AMS_HTML&amp;delayStartupUntil=configured',
'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/MathJax.js?config=TeX-AMS_HTML&amp;delayStartupUntil=configured',
'libs/mathjax/mathjax',
],
moment: [
// 'https://unpkg.com/moment@2.22.2/min/moment.min',
'https://cdn.jsdelivr.net/npm/moment@2.22.2/min/moment.min',
'https://unpkg.com/moment@2.22.2/min/moment.min',
'libs/moment',
],
'persist-js': [
// 'https://unpkg.com/persist-js@0.3.1/persist-min',
'https://cdn.jsdelivr.net/npm/persist-js@0.3.1/persist-min',
'https://unpkg.com/persist-js@0.3.1/persist-min',
'libs/persist-js',
],
react: [
// 'https://unpkg.com/react@16/umd/react.development',
'https://cdn.jsdelivr.net/npm/react@16/umd/react.development',
'https://unpkg.com/react@16/umd/react.development',
'libs/react',
],
'react-bootstrap': [
// 'https://unpkg.com/react-bootstrap@0.33.0/dist/react-bootstrap.min',
'https://cdn.jsdelivr.net/npm/react-bootstrap@0.33.0/dist/react-bootstrap.min',
'https://unpkg.com/react-bootstrap@0.33.0/dist/react-bootstrap.min',
'libs/react-bootstrap',
],
'react-dom': [
// 'https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min',
'https://cdn.jsdelivr.net/npm/react-dom@17.0.2/umd/react-dom.production.min',
'https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min',
'libs/react-dom',
],
'prop-types': [
// 'https://unpkg.com/prop-types@15.6/prop-types.min',
'https://cdn.jsdelivr.net/npm/prop-types@15.6/prop-types.min',
'https://unpkg.com/prop-types@15.6/prop-types.min',
'libs/prop-types',
],
'react-redux': [
// 'https://unpkg.com/react-redux@7.2.4/dist/react-redux.min',
'https://cdn.jsdelivr.net/npm/react-redux@7.2.4/dist/react-redux.min',
'https://unpkg.com/react-redux@7.2.4/dist/react-redux.min',
'libs/react-redux',
],
'react-transition-group': [
// 'https://unpkg.com/react-transition-group@2.4.0/dist/react-transition-group.min',
'https://cdn.jsdelivr.net/npm/react-transition-group@2.4.0/dist/react-transition-group.min',
'https://unpkg.com/react-transition-group@2.4.0/dist/react-transition-group.min',
'libs/react-transition-group',
],
redux: [
// 'https://unpkg.com/redux@4.0.5/dist/redux.min',
'https://cdn.jsdelivr.net/npm/redux@4.0.5/dist/redux.min',
'https://unpkg.com/redux@4.0.5/dist/redux.min',
'libs/redux',
],
'redux-thunk': [
// 'https://unpkg.com/redux-thunk@2.3.0/dist/redux-thunk.min',
'https://cdn.jsdelivr.net/npm/redux-thunk@2.3.0/dist/redux-thunk.min',
'https://unpkg.com/redux-thunk@2.3.0/dist/redux-thunk.min',
'libs/redux-thunk',
],
select2: [
// 'https://unpkg.com/select2@4.0.3/dist/js/select2.min',
'https://cdn.jsdelivr.net/npm/select2@4.0.3/dist/js/select2.min',
'https://unpkg.com/select2@4.0.3/dist/js/select2.min',
'libs/select2/select2',
],
'react-aria-menubutton': [
// 'https://unpkg.com/react-aria-menubutton@7.0.3/umd/ReactAriaMenuButton',
'https://cdn.jsdelivr.net/npm/react-aria-menubutton@7.0.3/umd/ReactAriaMenuButton',
'https://unpkg.com/react-aria-menubutton@7.0.3/umd/ReactAriaMenuButton',
'libs/react-aria-menubutton',
],
'react-hook-form': [
// 'https://unpkg.com/react-hook-form@6.11.0/dist/index.umd.production.min',
'https://cdn.jsdelivr.net/npm/react-hook-form@6.11.0/dist/index.umd.production.min',
'https://unpkg.com/react-hook-form@6.11.0/dist/index.umd.production.min',
'libs/react-hook-form',
],
'react-is': [
// 'https://unpkg.com/react-is@17.0.2/umd/react-is.production.min',
'https://cdn.jsdelivr.net/npm/react-is@17.0.2/umd/react-is.production.min',
'https://unpkg.com/react-is@17.0.2/umd/react-is.production.min',
'libs/react-is',
],
'react-data-table-component': [
// 'https://unpkg.com/react-data-table-component@6.11.7/dist/react-data-table-component.umd',
'https://cdn.jsdelivr.net/npm/react-data-table-component@6.11.7/dist/react-data-table-component.umd',
'https://unpkg.com/react-data-table-component@6.11.7/dist/react-data-table-component.umd',
'libs/react-data-table-component',
],
'react-window': [
// 'https://unpkg.com/react-window@1.8.6/dist/index-prod.umd',
'https://cdn.jsdelivr.net/npm/react-window@1.8.6/dist/index-prod.umd',
'https://unpkg.com/react-window@1.8.6/dist/index-prod.umd',
'libs/react-window',
],
'react-async': [
// 'https://unpkg.com/react-async@10.0.1/dist-umd/index',
'https://cdn.jsdelivr.net/npm/react-async@10.0.1/dist-umd/index',
'https://unpkg.com/react-async@10.0.1/dist-umd/index',
'libs/react-async',
],
'regenerator-runtime': [
// 'https://unpkg.com/regenerator-runtime@0.13.9/runtime',
'https://cdn.jsdelivr.net/npm/regenerator-runtime@0.13.9/runtime',
'https://unpkg.com/regenerator-runtime@0.13.9/runtime',
'libs/regenerator-runtime',
],
diff: [
// 'https://unpkg.com/diff@4.0.2/dist/diff.min',
'https://cdn.jsdelivr.net/npm/diff@4.0.2/dist/diff.min',
'https://unpkg.com/diff@4.0.2/dist/diff.min',
'libs/diff',
],
'styled-components': [
// 'https://unpkg.com/styled-components@5.1.0/dist/styled-components.min',
'https://cdn.jsdelivr.net/npm/styled-components@5.1.0/dist/styled-components.min',
'https://unpkg.com/styled-components@5.1.0/dist/styled-components.min',
'libs/styled-components',
],
'@hookform/resolvers': [
// 'https://unpkg.com/@hookform/resolvers@0.1.0/dist/index.umd.production.min',
'https://cdn.jsdelivr.net/npm/@hookform/resolvers@0.1.0/dist/index.umd.production.min',
'https://unpkg.com/@hookform/resolvers@0.1.0/dist/index.umd.production.min',
'libs/hookform',
],

// Google analytics loaded locally only
'google-analytics': [
// to activate local tunnel (for us to collect all analytics data)
// uncomment this; k12 should have ingress-nginx-proxy image deployed
Expand Down Expand Up @@ -446,88 +487,4 @@ require.config({
exports: 'Persist',
},
},
onNodeCreated: function(node, config, module, path) {
// SRIs for the CDNs used in the paths above
const sri = {
underscore:
'sha384-qDQQphxk4GGOzXrYWcGvL65XEe3wWt0lpN1IWIttQvQvewLpET6XzmQiKr3kew5R',
backbone: 'sha256-ddKDRLG4O1+xU/xZOb3BC0BKdU2T9498HIqLgd43aCU=',
'backbone-validation':
'sha384-fpdyr8ISauDi3YRemFSS/fadDnGzGiz2QdiRavwVGgPr2dd8f9VEaubnO5XhWZGr',
'backbone.stickit':
'sha384-LnepiBNV2LUVxUIF/sLNzcLmusDbfFnOVijtZFrhooeopW0037kRRfZD/xIZWXoC',
'backbone.wreqr':
'sha384-IzfqdomcRie+VgR5xKLxPJABpi9TADoX+rb7/w2Ao1up49TbjdBZXaIpoagGW20t',
bootstrap:
'sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa',
bowser:
'sha384-Z0KxlcdLj4l74yAkZm1zrXtmCVWpuBPQ2MbDARb3dgtIwzTfG95hDk53DYVunmKL',
clipboard:
'sha384-cV+rhyOuRHc9Ub/91rihWcGmMmCXDeksTtCihMupQHSsi8GIIRDG0ThDc3HGQFJ3',
d3:
'sha384-N8EP0Yml0jN7e0DcXlZ6rt+iqKU9Ck6f1ZQ+j2puxatnBq4k9E8Q6vqBcY34LNbn',
'd3-cloud':
'sha384-6RmikqUV3J90YjNQ6j3aGUYxrYRgPnpfL+iGR7riVJSMgSaUxq12B9bYc7xgk29E',
filesaver:
'sha384-VgWGwiEJnh9P379lbU8DxPcfRuFkfLl0uPuL9tolOHtm2tx8Qy8d/KtvovfM0Udh',
hotkeys:
'sha384-a9EmIZ/DK+uZtwt6PYXWQnJ5HVwJ9a8klNTM9UizXmEdYbVAfuhoERwcC9MDTrLU',
jquery:
'sha384-rY/jv8mMhqDabXSo+UCggqKtdmBfd3qC2/KvyTDNQ6PcUJXaxK1tMepoQda4g5vB',
jsonpath:
'sha384-87Cywb3gQWq5tkmzcpOPCT5fkfEMexH1yQUBGx0xrr/BvXqwulIHsB8JSg06h6mV',
marionette:
'sha384-Vhqh90N6FKyphb9enak5e49Ty9xD2dHphudmx93Y1ZgxShTXxiNsUliAbMsyOsQ0',
moment:
'sha384-sIzeKWIAHvT0Vm8QbfLCqZwBG0WMCkWVAOYd/330YSNeeQ1Y57N3T9lQz5Ry/EHH',
'persist-js':
'sha384-IQ8LQBnxRLItFm2zBR7ehQAjX2c5kAvrnmQUDQCDhl5whNOy/Qrt4OkNPBPZqrgE',
react:
'sha384-ZHBAhj6mPF2wke1Ie6UN+ozxCHBXIuRrcszqkblgAqCrZtYGI3zZYn4SsU+ozss4',
'react-bootstrap':
'sha384-9Cmt0BSVYuRFR8JkyWNFQ7b58m8/zLVP3u9etA7xRzOTmv9v6dk0exj5ZVr/US/7',
'react-dom':
'sha384-vj2XpC1SOa8PHrb0YlBqKN7CQzJYO72jz4CkDQ+ePL1pwOV4+dn05rPrbLGUuvCv',
'prop-types':
'sha384-9Fq52URRAaPlKGhu0AzshypUBBQa7Q8Rz1ze2svcZNUHGb/PlxTygZmtyYeqEHOK',
'react-redux':
'sha384-ZcmZKz11wjrgTJINgsPUjE81MDefPp3T3yXjqwmOfWs3mOrXiNJp8tuDDGIL4SBh',
'react-transition-group':
'sha384-WabrKyNVsCPcBkbcgLk2GI5B9r3bcu7AS+xIjuNWXpiEG2YFbGYKxIMH30PZ8ppV',
redux:
'sha384-9HbrkMEA4yvYaxArVwUh+buL6aVxBnmvot0vCxX8eUFaa1U/iT5eb51kaT7X4q+j',
'redux-thunk':
'sha384-clksQEsrkq4U3jNhSd+pCTsDFvPnSxN2xr0WUy2LOXFxC8KvqinvNJJ3656K5Tkf',
select2:
'sha384-222hzbb8Z8ZKe6pzP18nTSltQM3PdcAwxWKzGOKOIF+Y3bROr5n9zdQ8yTRHgQkQ',
'react-aria-menubutton':
'sha384-sAiCfhNvllSt31QXulF/DbYmp8k6C5WIdSygBF7QC7wK5h8mnwxrN1fsEV0K8H+Z',
'react-hook-form':
'sha384-o00KobsI/OBvRsqSR+XM/cniIcEZDOEDS+fEtCVrU4fdh90ysgmIQZZ3TXBGEw/H',
'react-is':
'sha384-SrjF4gb2WbeLH6ACmw6dLWBMHqfhwqgZe9F/N1TPzAyFjFESpC/3OGcG6fGVFmk7',
'react-data-table-component':
'sha384-VyrMwF3/DjWtRddANOUdwGMV7031w/5cVZqzVwvGUbbulGSJsybNgmS2D8QBUOK5',
'react-window':
'sha384-Z5ne52XzIcFV98V/UeunHiOluolr3PBTKThF1pmLrbAMod3centtxqggBRdbxyyE',
'react-async':
'sha384-pe0YbZ0dk7ipNViDks2le1j8l9T6jhcuzbc9MLfv8TwNe8BwdwE0/h0BcKL07khI',
'regenerator-runtime':
'sha384-jMSVkO5iDhd7A6dfEXFuT++7Gvv/f6T8bq3ZRHA9KE/kpyE/GL8B7NLfGSONzAym',
mathjax:
'sha512-xAWI9i8WMRLdgksuhaMCYMTw9D+MEc2cYVBApWwGRJ0cdcywTjMovOfJnlGt9LlEQj6QzyMzpIZLMYujetPcQg==',
'jquery-ui': 'sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=',
'styled-components':
'sha384-BJn7wepCcL8YGN8QnwJVmNKvnmPJD2zhlTLhZu5bNAJPs8OcbR38EctHcBG9KkF5',
'@hookform/resolvers':
'sha384-S8X/bKV7Zk250Ypfl+DfV8dUbSy1ZxD1pumo0pibFWGpFmGyAZ8+Zj3cz2EGup6g',
diff:
'sha384-dt7nA4/ksfhWiEl0OCs7aTXG5NkDyqzERlkfaGZ2kwmEn58sz6Yo9d+mF8XgA+H/',
};

if (sri[module] && /^https?/.exec(path)) {
node.setAttribute('integrity', sri[module]);
node.setAttribute('crossorigin', 'anonymous');
}
},
});
7 changes: 6 additions & 1 deletion src/config/shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
// sometimes requirejs isn't ready yet, this will wait for it
if (window.requirejs) {
window.requirejs.config({
waitSeconds: 7,
waitSeconds: 0,
urlArgs: version,
});

Expand All @@ -80,6 +80,11 @@
(function checkIfProxied() {
const canonicalUrlPattern = /^(ui|qa|dev|devui|demo)\.adsabs\.harvard\.edu$/;

// ignore for localhost (development)
if (/^localhost$/.exec(window.location.hostname)) {
return;
}

// if test fails, it is proxied url, set a class on body element
if (!canonicalUrlPattern.test(window.location.hostname)) {
const [bodyEl] = document.getElementsByTagName('body');
Expand Down
Loading

0 comments on commit 6f79f25

Please sign in to comment.