diff --git a/frontend/animation.ts b/frontend/animation.ts index ea0043c725..ac2c0cc81a 100644 --- a/frontend/animation.ts +++ b/frontend/animation.ts @@ -6,18 +6,19 @@ import $ = require('jquery'); import { trumpAnimation } from './trump_animation'; import { getRandomInt } from './util'; - /** * The image path on AWS is stored under a content hash. * This is injected into the meta tags before upload so we can build the path. */ function getImagePathPrefix() : string { - let environment = $('meta[name=environment]').attr('content'), - contentHash = $('meta[name=content_hash]').attr('content'); + // TODO: Cache the values looked up from the DOM statically. + let environment = $('meta[name=environment]').attr('content'); switch (environment.toLowerCase()) { case 'production': - return `/assets/${contentHash}/images`; + let cdnHost = $('meta[name=cdn_host]').attr('content'), + contentHash = $('meta[name=content_hash]').attr('content'); + return `${cdnHost}/assets/${contentHash}/images`; default: return '/assets/images'; } diff --git a/s3-cors.xml b/s3-cors.xml new file mode 100644 index 0000000000..76340a13d5 --- /dev/null +++ b/s3-cors.xml @@ -0,0 +1,13 @@ + + + + *.jungle.horse + *.junglehorse.com + jungle.horse + junglehorse.com + GET + HEAD + 3000 + * + + diff --git a/s3-deploy.sh b/s3-deploy.sh index 7d96571877..5205af0864 100755 --- a/s3-deploy.sh +++ b/s3-deploy.sh @@ -9,7 +9,7 @@ build_assets() { } echo "> Build artifact." -#build_assets +build_assets # Calculate output directory. echo "> Calculate artifact SHA." @@ -40,12 +40,13 @@ sed -i "s/\/assets/\/\/cdn.junglehorse.com\/assets\/${checksum}/g" index.html sed -i "s/asset_content_hash/${checksum}/g" index.html sed -i "s/DEVELOPMENT/production/g" index.html sed -i "s/API_HOST/http:\/\/jungle.horse/g" index.html +sed -i "s/CDN_HOST/\/\/cdn.junglehorse.com/g" index.html popd > /dev/null echo "> Upload to S3." aws s3 cp $output_dir s3://junglehorse-frontend/assets/${checksum} --recursive -aws s3 cp $output_dir/index.html s3://junglehorse-frontend/index.html -aws s3 cp $output_dir/error.html s3://junglehorse-frontend/error.html +aws s3 cp $output_dir/index.html s3://junglehorse.com/index.html +aws s3 cp $output_dir/error.html s3://junglehorse.com/error.html popd > /dev/null echo "> Done." diff --git a/web/index.html b/web/index.html index 00fe7349b0..3f089e3f52 100644 --- a/web/index.html +++ b/web/index.html @@ -11,6 +11,7 @@ +