[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>
This commit is contained in:
ThibG 2020-10-13 01:19:35 +02:00 committed by Thibaut Girka
parent 5901c4141c
commit 97eadf8dee
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';