use new s3 bucket behind cloudflare cdn

This commit is contained in:
Kevin Ngo
2018-11-08 12:10:01 +08:00
parent b4046b8fd6
commit 9e223722ce
3 changed files with 7 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
import utils from '../utils';
AFRAME.registerComponent('menu-selected-challenge-image', {
schema: {
selectedChallengeId: {type: 'string'}
@@ -8,6 +10,6 @@ AFRAME.registerComponent('menu-selected-challenge-image', {
if (!this.data.selectedChallengeId) { return; }
el.setAttribute(
'material', 'src',
`https://s3-us-west-2.amazonaws.com/supersaber/${this.data.selectedChallengeId}-image.jpg`);
utils.getS3FileUrl(this.data.selectedChallengeId, 'image.jpg'));
}
});

View File

@@ -1,3 +1,5 @@
import utils from '../utils';
var CANVAS_HEIGHT = 512; // Power-of-two.
var HEIGHT = 64;
var NUM_PER_PAGE = 6;
@@ -49,7 +51,7 @@ AFRAME.registerComponent('search-thumbnail-atlas', {
for (let i = 0; i < results.length; i++) {
let img = this.images[i] = this.images[i] || document.createElement('img');
img.crossOrigin = 'anonymous';
img.src = `https://s3-us-west-2.amazonaws.com/supersaber/${results[i].id}-image.jpg`;
img.src = utils.getS3FileUrl(results[i].id, 'image.jpg');
if (img.complete) {
this.draw(img, i);
} else {

View File

@@ -1,4 +1,4 @@
var BASE_URL = 'https://s3-us-west-2.amazonaws.com/supersaber';
const BASE_URL = 'https://saber.supermedium.com';
function getS3FileUrl (id, name) {
return `${BASE_URL}/${id}-${name}`;