Remove subdirectory build support, FE_SUBDIRECTORY variable
This commit is contained in:
parent
a80238275f
commit
d861890488
|
@ -9,7 +9,6 @@ import { compareId } from 'soapbox/utils/comparators.ts';
|
||||||
import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features.ts';
|
import { getFeatures, parseVersion, PLEROMA } from 'soapbox/utils/features.ts';
|
||||||
import { unescapeHTML } from 'soapbox/utils/html.ts';
|
import { unescapeHTML } from 'soapbox/utils/html.ts';
|
||||||
import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification.ts';
|
import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification.ts';
|
||||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
|
||||||
|
|
||||||
import { fetchRelationships } from './accounts.ts';
|
import { fetchRelationships } from './accounts.ts';
|
||||||
import { fetchGroupRelationships } from './groups.ts';
|
import { fetchGroupRelationships } from './groups.ts';
|
||||||
|
@ -120,7 +119,7 @@ const updateNotificationsQueue = (notification: APIEntity, intlMessages: Record<
|
||||||
icon: notification.account.avatar,
|
icon: notification.account.avatar,
|
||||||
tag: notification.id,
|
tag: notification.id,
|
||||||
data: {
|
data: {
|
||||||
url: joinPublicPath('/notifications'),
|
url: '/notifications',
|
||||||
},
|
},
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
}).catch(console.error);
|
}).catch(console.error);
|
||||||
|
|
|
@ -3,15 +3,12 @@
|
||||||
* @module soapbox/build-config
|
* @module soapbox/build-config
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// eslint-disable-next-line import/extensions
|
|
||||||
import trim from 'lodash/trim.js';
|
|
||||||
// eslint-disable-next-line import/extensions
|
// eslint-disable-next-line import/extensions
|
||||||
import trimEnd from 'lodash/trimEnd.js';
|
import trimEnd from 'lodash/trimEnd.js';
|
||||||
|
|
||||||
const {
|
const {
|
||||||
NODE_ENV,
|
NODE_ENV,
|
||||||
BACKEND_URL,
|
BACKEND_URL,
|
||||||
FE_SUBDIRECTORY,
|
|
||||||
FE_INSTANCE_SOURCE_DIR,
|
FE_INSTANCE_SOURCE_DIR,
|
||||||
SENTRY_DSN,
|
SENTRY_DSN,
|
||||||
} = process.env;
|
} = process.env;
|
||||||
|
@ -24,14 +21,9 @@ const sanitizeURL = (url: string | undefined = ''): string => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const sanitizeBasename = (path: string | undefined = ''): string => {
|
|
||||||
return `/${trim(path, '/')}`;
|
|
||||||
};
|
|
||||||
|
|
||||||
const env = {
|
const env = {
|
||||||
NODE_ENV: NODE_ENV || 'development',
|
NODE_ENV: NODE_ENV || 'development',
|
||||||
BACKEND_URL: sanitizeURL(BACKEND_URL),
|
BACKEND_URL: sanitizeURL(BACKEND_URL),
|
||||||
FE_SUBDIRECTORY: sanitizeBasename(FE_SUBDIRECTORY),
|
|
||||||
FE_INSTANCE_SOURCE_DIR: FE_INSTANCE_SOURCE_DIR || 'instance',
|
FE_INSTANCE_SOURCE_DIR: FE_INSTANCE_SOURCE_DIR || 'instance',
|
||||||
SENTRY_DSN,
|
SENTRY_DSN,
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,6 @@ import type { SoapboxEnv } from './build-config-compiletime.ts';
|
||||||
export const {
|
export const {
|
||||||
NODE_ENV,
|
NODE_ENV,
|
||||||
BACKEND_URL,
|
BACKEND_URL,
|
||||||
FE_SUBDIRECTORY,
|
|
||||||
FE_INSTANCE_SOURCE_DIR,
|
FE_INSTANCE_SOURCE_DIR,
|
||||||
SENTRY_DSN,
|
SENTRY_DSN,
|
||||||
} = import.meta.compileTime<SoapboxEnv>('./build-config-compiletime.ts');
|
} = import.meta.compileTime<SoapboxEnv>('./build-config-compiletime.ts');
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import unicodeMapping from 'soapbox/features/emoji/mapping.ts';
|
import unicodeMapping from 'soapbox/features/emoji/mapping.ts';
|
||||||
import { useSettings } from 'soapbox/hooks/useSettings.ts';
|
import { useSettings } from 'soapbox/hooks/useSettings.ts';
|
||||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
|
||||||
|
|
||||||
import type { Map as ImmutableMap } from 'immutable';
|
import type { Map as ImmutableMap } from 'immutable';
|
||||||
|
|
||||||
|
@ -25,7 +24,7 @@ const Emoji: React.FC<IEmoji> = ({ emoji, emojiMap, hovered }) => {
|
||||||
className='emojione m-0 block'
|
className='emojione m-0 block'
|
||||||
alt={emoji}
|
alt={emoji}
|
||||||
title={title}
|
title={title}
|
||||||
src={joinPublicPath(`packs/emoji/${filename}.svg`)}
|
src={`/packs/emoji/${filename}.svg`}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else if (emojiMap.get(emoji as any)) {
|
} else if (emojiMap.get(emoji as any)) {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import { isCustomEmoji } from 'soapbox/features/emoji/index.ts';
|
import { isCustomEmoji } from 'soapbox/features/emoji/index.ts';
|
||||||
import unicodeMapping from 'soapbox/features/emoji/mapping.ts';
|
import unicodeMapping from 'soapbox/features/emoji/mapping.ts';
|
||||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
|
||||||
|
|
||||||
import type { Emoji } from 'soapbox/features/emoji/index.ts';
|
import type { Emoji } from 'soapbox/features/emoji/index.ts';
|
||||||
|
|
||||||
|
@ -21,7 +20,7 @@ const AutosuggestEmoji: React.FC<IAutosuggestEmoji> = ({ emoji }) => {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = joinPublicPath(`packs/emoji/${mapping.unified}.svg`);
|
url = `/packs/emoji/${mapping.unified}.svg`;
|
||||||
alt = emoji.native;
|
alt = emoji.native;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import { removeVS16s, toCodePoints } from 'soapbox/utils/emoji.ts';
|
import { removeVS16s, toCodePoints } from 'soapbox/utils/emoji.ts';
|
||||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
|
||||||
|
|
||||||
interface IEmoji extends React.ImgHTMLAttributes<HTMLImageElement> {
|
interface IEmoji extends React.ImgHTMLAttributes<HTMLImageElement> {
|
||||||
/** Unicode emoji character. */
|
/** Unicode emoji character. */
|
||||||
|
@ -23,7 +22,7 @@ const Emoji: React.FC<IEmoji> = (props): JSX.Element | null => {
|
||||||
<img
|
<img
|
||||||
draggable='false'
|
draggable='false'
|
||||||
alt={alt || emoji}
|
alt={alt || emoji}
|
||||||
src={src || joinPublicPath(`packs/emoji/${filename}.svg`)}
|
src={src || `/packs/emoji/${filename}.svg`}
|
||||||
{...rest}
|
{...rest}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,14 +2,12 @@ import spriteSheet from 'emoji-datasource/img/twitter/sheets/32.png';
|
||||||
import { Picker as EmojiPicker } from 'emoji-mart';
|
import { Picker as EmojiPicker } from 'emoji-mart';
|
||||||
import { useRef, useEffect } from 'react';
|
import { useRef, useEffect } from 'react';
|
||||||
|
|
||||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
|
||||||
|
|
||||||
import data from '../data.ts';
|
import data from '../data.ts';
|
||||||
|
|
||||||
const getSpritesheetURL = () => spriteSheet;
|
const getSpritesheetURL = () => spriteSheet;
|
||||||
|
|
||||||
const getImageURL = (set: string, name: string) => {
|
const getImageURL = (_set: string, name: string) => {
|
||||||
return joinPublicPath(`/packs/emoji/${name}.svg`);
|
return `/packs/emoji/${name}.svg`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Picker: React.FC<any> = (props) => {
|
const Picker: React.FC<any> = (props) => {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import { BrowserRouter, Switch, Redirect, Route } from 'react-router-dom';
|
||||||
import { CompatRouter } from 'react-router-dom-v5-compat';
|
import { CompatRouter } from 'react-router-dom-v5-compat';
|
||||||
|
|
||||||
import { openModal } from 'soapbox/actions/modals.ts';
|
import { openModal } from 'soapbox/actions/modals.ts';
|
||||||
import * as BuildConfig from 'soapbox/build-config.ts';
|
|
||||||
import LoadingScreen from 'soapbox/components/loading-screen.tsx';
|
import LoadingScreen from 'soapbox/components/loading-screen.tsx';
|
||||||
import { ScrollContext } from 'soapbox/components/scroll-context.tsx';
|
import { ScrollContext } from 'soapbox/components/scroll-context.tsx';
|
||||||
import SiteErrorBoundary from 'soapbox/components/site-error-boundary.tsx';
|
import SiteErrorBoundary from 'soapbox/components/site-error-boundary.tsx';
|
||||||
|
@ -48,7 +47,7 @@ const SoapboxMount = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SiteErrorBoundary>
|
<SiteErrorBoundary>
|
||||||
<BrowserRouter basename={BuildConfig.FE_SUBDIRECTORY}>
|
<BrowserRouter>
|
||||||
<CompatRouter>
|
<CompatRouter>
|
||||||
<ScrollContext>
|
<ScrollContext>
|
||||||
<Switch>
|
<Switch>
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
/**
|
|
||||||
* Static: functions related to static files.
|
|
||||||
* @module soapbox/utils/static
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { join } from 'path-browserify';
|
|
||||||
|
|
||||||
import * as BuildConfig from 'soapbox/build-config.ts';
|
|
||||||
|
|
||||||
/** Gets the path to a file with build configuration being considered. */
|
|
||||||
export const joinPublicPath = (...paths: string[]): string => {
|
|
||||||
return join(BuildConfig.FE_SUBDIRECTORY, ...paths);
|
|
||||||
};
|
|
Loading…
Reference in New Issue