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

Port 4c45b43cb8 to glitch-soc

Signed-off-by: Thibaut Girka <thib@sitedethib.com>
rebase/4.0.0rc2
ThibG 2020-10-13 01:19:35 +02:00 committed by Thibaut Girka
parent 842c048c6b
commit 813c84cd6c
21 changed files with 31 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
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 {

View File

@ -13,6 +13,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import detectPassiveEvents from 'detect-passive-events';
import { buildCustomEmojis, categoriesFromEmojis } from 'flavours/glitch/util/emoji';
import { useSystemEmojiFont } from 'flavours/glitch/util/initial_state';
import { assetHost } from 'flavours/glitch/util/config';
const messages = defineMessages({
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
const backgroundImageFn = () => `${assetHost}/emoji/sheet_10.png`;

View File

@ -15,6 +15,7 @@ import EmojiPickerDropdown from 'flavours/glitch/features/emoji_picker';
import AnimatedNumber from 'flavours/glitch/components/animated_number';
import TransitionMotion from 'react-motion/lib/TransitionMotion';
import spring from 'react-motion/lib/spring';
import { assetHost } from 'flavours/glitch/util/config';
const messages = defineMessages({
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 {
static propTypes = {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 || '';
}
});

View File

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

View File

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