Skip to content

Commit 5b48959

Browse files
committed
extensions now hosted on another domain
1 parent bfa4593 commit 5b48959

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/containers/extension-library.jsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import React from 'react';
44
import VM from 'scratch-vm';
55
import {defineMessages, injectIntl, intlShape} from 'react-intl';
66
import log from '../lib/log';
7-
const {API_HOST} = require('../lib/brand');
7+
// eslint-disable-next-line import/no-commonjs
8+
const {EXTENSION_HOST} = require('../lib/brand');
89

910
import extensionLibraryContent, {
1011
galleryError,
@@ -43,7 +44,7 @@ const translateGalleryItem = (extension, locale) => ({
4344
let cachedGallery = null;
4445

4546
const fetchLibrary = async () => {
46-
const res = await fetch(API_HOST+'/extensions/extensions.json');
47+
const res = await fetch(`${EXTENSION_HOST}/extensions.json`);
4748
if (!res.ok) {
4849
throw new Error(`HTTP status ${res.status}`);
4950
}
@@ -54,8 +55,8 @@ const fetchLibrary = async () => {
5455
description: extension.description,
5556
descriptionTranslations: extension.descriptionTranslations || {},
5657
extensionId: extension.id,
57-
extensionURL: API_HOST+ `/extensions/extensions/${extension.slug}.js`,
58-
iconURL: API_HOST +`/extensions/${extension.image || 'images/unknown.svg'}`,
58+
extensionURL: `${EXTENSION_HOST}/extensions/${extension.slug}.js`,
59+
iconURL: `${EXTENSION_HOST}/${extension.image || 'images/unknown.svg'}`,
5960
tags: ['tw'],
6061
credits: [
6162
...(extension.original || []),
@@ -77,7 +78,8 @@ const fetchLibrary = async () => {
7778
}),
7879
docsURI: extension.docs ? `https://extensions.turbowarp.org/${extension.slug}` : null,
7980
samples: extension.samples ? extension.samples.map(sample => ({
80-
href: `https://turbowarp.org/editor?project_url=https://extensions.turbowarp.org/samples/${encodeURIComponent(sample)}.sb3`, //force to go to turbowarp as parent doesn't nessarily support ?project_url
81+
// force to go to turbowarp as parent doesn't nessarily support ?project_url
82+
href: `https://turbowarp.org/editor?project_url=https://extensions.turbowarp.org/samples/${encodeURIComponent(sample)}.sb3`,
8183
text: sample
8284
})) : null,
8385
incompatibleWithScratch: !extension.scratchCompatible,

src/containers/tw-security-manager.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const isTrustedExtension = url => (
2929
// Always trust our official extension repostiory.
3030
url.startsWith('https://extensions.turbowarp.org/') ||
3131
url.startsWith('https://blockcompiler.codetorch.net/') ||
32+
url.startsWith('https://blockextensions.codetorch.net/') ||
3233
url.startsWith('https://codetorch.net/') ||
3334
url.startsWith(API_HOST) ||
3435
// For development.

src/lib/brand.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ module.exports = {
44
APP_NAME: 'CodeTorch',
55
APP_DOMAIN: 'http://localhost:8080',
66
API_HOST: 'http://localhost:8000',
7-
ASSET_HOST: 'https://localhost:8000',
7+
ASSET_HOST: 'http://localhost:8000',
8+
EXTENSION_HOST: 'http://localhost:8002',
89
DEFAULT_CLOUD_HOST: 'ws://localhost:8001',
910
enableGenerate: false
1011
};

0 commit comments

Comments
 (0)