[Glitch] Change how CDN_HOST is passed down to make assets build reproducible

Port ce87767572 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
th-downstream
ThibG 4 years ago committed by Thibaut Girka
parent 5901c4141c
commit 97eadf8dee

@ -1,6 +1,6 @@
// This file will be loaded on admin pages, regardless of theme. // This file will be loaded on admin pages, regardless of theme.
import './public-path'; import 'packs/public-path';
import { delegate } from '@rails/ujs'; import { delegate } from '@rails/ujs';
import ready from '../mastodon/ready'; import ready from '../mastodon/ready';

@ -1,2 +1,3 @@
import 'packs/public-path';
import './settings'; import './settings';
import './two_factor_authentication'; import './two_factor_authentication';

@ -1,5 +1,6 @@
// This file will be loaded on all pages, regardless of theme. // This file will be loaded on all pages, regardless of theme.
import 'packs/public-path';
import 'font-awesome/css/font-awesome.css'; import 'font-awesome/css/font-awesome.css';
require.context('../images/', true); require.context('../images/', true);

@ -1,5 +1,7 @@
// This file will be loaded on embed pages, regardless of theme. // This file will be loaded on embed pages, regardless of theme.
import 'packs/public-path';
window.addEventListener('message', e => { window.addEventListener('message', e => {
const data = e.data || {}; const data = e.data || {};

@ -1,5 +1,6 @@
// This file will be loaded on public pages, regardless of theme. // This file will be loaded on public pages, regardless of theme.
import 'packs/public-path';
import ready from '../mastodon/ready'; import ready from '../mastodon/ready';
const { delegate } = require('@rails/ujs'); const { delegate } = require('@rails/ujs');

@ -1,5 +1,6 @@
// This file will be loaded on settings pages, regardless of theme. // This file will be loaded on settings pages, regardless of theme.
import 'packs/public-path';
import escapeTextContentForBrowser from 'escape-html'; import escapeTextContentForBrowser from 'escape-html';
const { delegate } = require('@rails/ujs'); const { delegate } = require('@rails/ujs');
import emojify from '../mastodon/features/emoji/emoji'; import emojify from '../mastodon/features/emoji/emoji';

@ -1,3 +1,4 @@
import 'packs/public-path';
import axios from 'axios'; import axios from 'axios';
import * as WebAuthnJSON from '@github/webauthn-json'; import * as WebAuthnJSON from '@github/webauthn-json';
import ready from '../mastodon/ready'; import ready from '../mastodon/ready';

@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import unicodeMapping from 'flavours/glitch/util/emoji/emoji_unicode_mapping_light'; import unicodeMapping from 'flavours/glitch/util/emoji/emoji_unicode_mapping_light';
const assetHost = process.env.CDN_HOST || ''; import { assetHost } from 'flavours/glitch/util/config';
export default class AutosuggestEmoji extends React.PureComponent { export default class AutosuggestEmoji extends React.PureComponent {

@ -13,6 +13,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import detectPassiveEvents from 'detect-passive-events'; import detectPassiveEvents from 'detect-passive-events';
import { buildCustomEmojis, categoriesFromEmojis } from 'flavours/glitch/util/emoji'; import { buildCustomEmojis, categoriesFromEmojis } from 'flavours/glitch/util/emoji';
import { useSystemEmojiFont } from 'flavours/glitch/util/initial_state'; import { useSystemEmojiFont } from 'flavours/glitch/util/initial_state';
import { assetHost } from 'flavours/glitch/util/config';
const messages = defineMessages({ const messages = defineMessages({
emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' }, emoji: { id: 'emoji_button.label', defaultMessage: 'Insert emoji' },
@ -105,7 +106,6 @@ const mapDispatchToProps = (dispatch, { onPickEmoji }) => ({
}, },
}); });
const assetHost = process.env.CDN_HOST || '';
let EmojiPicker, Emoji; // load asynchronously let EmojiPicker, Emoji; // load asynchronously
const backgroundImageFn = () => `${assetHost}/emoji/sheet_10.png`; const backgroundImageFn = () => `${assetHost}/emoji/sheet_10.png`;

@ -15,6 +15,7 @@ import EmojiPickerDropdown from 'flavours/glitch/features/emoji_picker';
import AnimatedNumber from 'flavours/glitch/components/animated_number'; import AnimatedNumber from 'flavours/glitch/components/animated_number';
import TransitionMotion from 'react-motion/lib/TransitionMotion'; import TransitionMotion from 'react-motion/lib/TransitionMotion';
import spring from 'react-motion/lib/spring'; import spring from 'react-motion/lib/spring';
import { assetHost } from 'flavours/glitch/util/config';
const messages = defineMessages({ const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' }, close: { id: 'lightbox.close', defaultMessage: 'Close' },
@ -153,8 +154,6 @@ class Content extends ImmutablePureComponent {
} }
const assetHost = process.env.CDN_HOST || '';
class Emoji extends React.PureComponent { class Emoji extends React.PureComponent {
static propTypes = { static propTypes = {

@ -20,6 +20,7 @@ import GIFV from 'flavours/glitch/components/gifv';
import { me } from 'flavours/glitch/util/initial_state'; import { me } from 'flavours/glitch/util/initial_state';
import tesseractCorePath from 'tesseract.js-core/tesseract-core.wasm.js'; import tesseractCorePath from 'tesseract.js-core/tesseract-core.wasm.js';
import tesseractWorkerPath from 'tesseract.js/dist/worker.min.js'; import tesseractWorkerPath from 'tesseract.js/dist/worker.min.js';
import { assetHost } from 'flavours/glitch/util/config';
const messages = defineMessages({ const messages = defineMessages({
close: { id: 'lightbox.close', defaultMessage: 'Close' }, close: { id: 'lightbox.close', defaultMessage: 'Close' },
@ -50,8 +51,6 @@ const removeExtraLineBreaks = str => str.replace(/\n\n/g, '******')
.replace(/\n/g, ' ') .replace(/\n/g, ' ')
.replace(/\*\*\*\*\*\*/g, '\n\n'); .replace(/\*\*\*\*\*\*/g, '\n\n');
const assetHost = process.env.CDN_HOST || '';
class ImageLoader extends React.PureComponent { class ImageLoader extends React.PureComponent {
static propTypes = { static propTypes = {

@ -1,3 +1,4 @@
import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/util/load_polyfills'; import loadPolyfills from 'flavours/glitch/util/load_polyfills';
function loaded() { function loaded() {

@ -1,3 +1,4 @@
import 'packs/public-path';
import { start } from '@rails/ujs'; import { start } from '@rails/ujs';
start(); start();

@ -1,3 +1,4 @@
import 'packs/public-path';
import ready from 'flavours/glitch/util/ready'; import ready from 'flavours/glitch/util/ready';
ready(() => { ready(() => {

@ -1,3 +1,4 @@
import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/util/load_polyfills'; import loadPolyfills from 'flavours/glitch/util/load_polyfills';
loadPolyfills().then(() => { loadPolyfills().then(() => {

@ -1,3 +1,4 @@
import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/util/load_polyfills'; import loadPolyfills from 'flavours/glitch/util/load_polyfills';
import ready from 'flavours/glitch/util/ready'; import ready from 'flavours/glitch/util/ready';
import loadKeyboardExtensions from 'flavours/glitch/util/load_keyboard_extensions'; import loadKeyboardExtensions from 'flavours/glitch/util/load_keyboard_extensions';

@ -1,3 +1,4 @@
import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/util/load_polyfills'; import loadPolyfills from 'flavours/glitch/util/load_polyfills';
import ready from 'flavours/glitch/util/ready'; import ready from 'flavours/glitch/util/ready';
import loadKeyboardExtensions from 'flavours/glitch/util/load_keyboard_extensions'; import loadKeyboardExtensions from 'flavours/glitch/util/load_keyboard_extensions';

@ -1,3 +1,4 @@
import 'packs/public-path';
import loadPolyfills from 'flavours/glitch/util/load_polyfills'; import loadPolyfills from 'flavours/glitch/util/load_polyfills';
function loaded() { function loaded() {

@ -0,0 +1,10 @@
import ready from './ready';
export let assetHost = '';
ready(() => {
const cdnHost = document.querySelector('meta[name=cdn-host]');
if (cdnHost) {
assetHost = cdnHost.content || '';
}
});

@ -1,11 +1,10 @@
import { autoPlayGif, useSystemEmojiFont } from 'flavours/glitch/util/initial_state'; import { autoPlayGif, useSystemEmojiFont } from 'flavours/glitch/util/initial_state';
import unicodeMapping from './emoji_unicode_mapping_light'; import unicodeMapping from './emoji_unicode_mapping_light';
import { assetHost } from 'flavours/glitch/util/config';
import Trie from 'substring-trie'; import Trie from 'substring-trie';
const trie = new Trie(Object.keys(unicodeMapping)); const trie = new Trie(Object.keys(unicodeMapping));
const assetHost = process.env.CDN_HOST || '';
// Convert to file names from emojis. (For different variation selector emojis) // Convert to file names from emojis. (For different variation selector emojis)
const emojiFilenames = (emojis) => { const emojiFilenames = (emojis) => {
return emojis.map(v => unicodeMapping[v].filename); return emojis.map(v => unicodeMapping[v].filename);

@ -1 +1,2 @@
import './public-path';
import 'styles/application.scss'; import 'styles/application.scss';

Loading…
Cancel
Save