Browse Source

[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>
closed-social-glitch-2
ThibG 4 years ago
committed by Thibaut Girka
parent
commit
813c84cd6c
21 changed files with 31 additions and 9 deletions
  1. +1
    -1
      app/javascript/core/admin.js
  2. +1
    -0
      app/javascript/core/auth.js
  3. +1
    -0
      app/javascript/core/common.js
  4. +2
    -0
      app/javascript/core/embed.js
  5. +1
    -0
      app/javascript/core/public.js
  6. +1
    -0
      app/javascript/core/settings.js
  7. +1
    -0
      app/javascript/core/two_factor_authentication.js
  8. +1
    -1
      app/javascript/flavours/glitch/components/autosuggest_emoji.js
  9. +1
    -1
      app/javascript/flavours/glitch/features/emoji_picker/index.js
  10. +1
    -2
      app/javascript/flavours/glitch/features/getting_started/components/announcements.js
  11. +1
    -2
      app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js
  12. +1
    -0
      app/javascript/flavours/glitch/packs/about.js
  13. +1
    -0
      app/javascript/flavours/glitch/packs/common.js
  14. +1
    -0
      app/javascript/flavours/glitch/packs/error.js
  15. +1
    -0
      app/javascript/flavours/glitch/packs/home.js
  16. +1
    -0
      app/javascript/flavours/glitch/packs/public.js
  17. +1
    -0
      app/javascript/flavours/glitch/packs/settings.js
  18. +1
    -0
      app/javascript/flavours/glitch/packs/share.js
  19. +10
    -0
      app/javascript/flavours/glitch/util/config.js
  20. +1
    -2
      app/javascript/flavours/glitch/util/emoji/index.js
  21. +1
    -0
      app/javascript/packs/common.js

+ 1
- 1
app/javascript/core/admin.js 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';

+ 1
- 0
app/javascript/core/auth.js View File

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

+ 1
- 0
app/javascript/core/common.js 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);

+ 2
- 0
app/javascript/core/embed.js 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 || {};

+ 1
- 0
app/javascript/core/public.js 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');

+ 1
- 0
app/javascript/core/settings.js 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';

+ 1
- 0
app/javascript/core/two_factor_authentication.js 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';

+ 1
- 1
app/javascript/flavours/glitch/components/autosuggest_emoji.js 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 {

+ 1
- 1
app/javascript/flavours/glitch/features/emoji_picker/index.js 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`;

+ 1
- 2
app/javascript/flavours/glitch/features/getting_started/components/announcements.js 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 = {

+ 1
- 2
app/javascript/flavours/glitch/features/ui/components/focal_point_modal.js 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 = {

+ 1
- 0
app/javascript/flavours/glitch/packs/about.js View File

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

+ 1
- 0
app/javascript/flavours/glitch/packs/common.js View File

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

+ 1
- 0
app/javascript/flavours/glitch/packs/error.js View File

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

+ 1
- 0
app/javascript/flavours/glitch/packs/home.js View File

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

+ 1
- 0
app/javascript/flavours/glitch/packs/public.js 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';

+ 1
- 0
app/javascript/flavours/glitch/packs/settings.js 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';

+ 1
- 0
app/javascript/flavours/glitch/packs/share.js View File

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

+ 10
- 0
app/javascript/flavours/glitch/util/config.js 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 || '';
}
});

+ 1
- 2
app/javascript/flavours/glitch/util/emoji/index.js 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);

+ 1
- 0
app/javascript/packs/common.js View File

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

Loading…
Cancel
Save