mirror of
https://framagit.org/tykayn/mastodon.git
synced 2023-08-25 08:33:12 +02:00
[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>
This commit is contained in:
parent
842c048c6b
commit
813c84cd6c
@ -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';
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
import 'packs/public-path';
|
||||
import './settings';
|
||||
import './two_factor_authentication';
|
||||
|
@ -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);
|
||||
|
@ -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 || {};
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'packs/public-path';
|
||||
import axios from 'axios';
|
||||
import * as WebAuthnJSON from '@github/webauthn-json';
|
||||
import ready from '../mastodon/ready';
|
||||
|
@ -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 {
|
||||
|
||||
|
@ -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`;
|
||||
|
@ -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 = {
|
||||
|
@ -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 = {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/util/load_polyfills';
|
||||
|
||||
function loaded() {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'packs/public-path';
|
||||
import { start } from '@rails/ujs';
|
||||
|
||||
start();
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'packs/public-path';
|
||||
import ready from 'flavours/glitch/util/ready';
|
||||
|
||||
ready(() => {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/util/load_polyfills';
|
||||
|
||||
loadPolyfills().then(() => {
|
||||
|
@ -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';
|
||||
|
@ -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';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'packs/public-path';
|
||||
import loadPolyfills from 'flavours/glitch/util/load_polyfills';
|
||||
|
||||
function loaded() {
|
||||
|
10
app/javascript/flavours/glitch/util/config.js
Normal file
10
app/javascript/flavours/glitch/util/config.js
Normal 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 || '';
|
||||
}
|
||||
});
|
@ -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);
|
||||
|
@ -1 +1,2 @@
|
||||
import './public-path';
|
||||
import 'styles/application.scss';
|
||||
|
Loading…
Reference in New Issue
Block a user