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 { unescapeHTML } from 'soapbox/utils/html.ts';
|
||||
import { EXCLUDE_TYPES, NOTIFICATION_TYPES } from 'soapbox/utils/notification.ts';
|
||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
||||
|
||||
import { fetchRelationships } from './accounts.ts';
|
||||
import { fetchGroupRelationships } from './groups.ts';
|
||||
|
@ -120,7 +119,7 @@ const updateNotificationsQueue = (notification: APIEntity, intlMessages: Record<
|
|||
icon: notification.account.avatar,
|
||||
tag: notification.id,
|
||||
data: {
|
||||
url: joinPublicPath('/notifications'),
|
||||
url: '/notifications',
|
||||
},
|
||||
}).catch(console.error);
|
||||
}).catch(console.error);
|
||||
|
|
|
@ -3,15 +3,12 @@
|
|||
* @module soapbox/build-config
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line import/extensions
|
||||
import trim from 'lodash/trim.js';
|
||||
// eslint-disable-next-line import/extensions
|
||||
import trimEnd from 'lodash/trimEnd.js';
|
||||
|
||||
const {
|
||||
NODE_ENV,
|
||||
BACKEND_URL,
|
||||
FE_SUBDIRECTORY,
|
||||
FE_INSTANCE_SOURCE_DIR,
|
||||
SENTRY_DSN,
|
||||
} = process.env;
|
||||
|
@ -24,14 +21,9 @@ const sanitizeURL = (url: string | undefined = ''): string => {
|
|||
}
|
||||
};
|
||||
|
||||
const sanitizeBasename = (path: string | undefined = ''): string => {
|
||||
return `/${trim(path, '/')}`;
|
||||
};
|
||||
|
||||
const env = {
|
||||
NODE_ENV: NODE_ENV || 'development',
|
||||
BACKEND_URL: sanitizeURL(BACKEND_URL),
|
||||
FE_SUBDIRECTORY: sanitizeBasename(FE_SUBDIRECTORY),
|
||||
FE_INSTANCE_SOURCE_DIR: FE_INSTANCE_SOURCE_DIR || 'instance',
|
||||
SENTRY_DSN,
|
||||
};
|
||||
|
|
|
@ -3,7 +3,6 @@ import type { SoapboxEnv } from './build-config-compiletime.ts';
|
|||
export const {
|
||||
NODE_ENV,
|
||||
BACKEND_URL,
|
||||
FE_SUBDIRECTORY,
|
||||
FE_INSTANCE_SOURCE_DIR,
|
||||
SENTRY_DSN,
|
||||
} = import.meta.compileTime<SoapboxEnv>('./build-config-compiletime.ts');
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import unicodeMapping from 'soapbox/features/emoji/mapping.ts';
|
||||
import { useSettings } from 'soapbox/hooks/useSettings.ts';
|
||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
||||
|
||||
import type { Map as ImmutableMap } from 'immutable';
|
||||
|
||||
|
@ -25,7 +24,7 @@ const Emoji: React.FC<IEmoji> = ({ emoji, emojiMap, hovered }) => {
|
|||
className='emojione m-0 block'
|
||||
alt={emoji}
|
||||
title={title}
|
||||
src={joinPublicPath(`packs/emoji/${filename}.svg`)}
|
||||
src={`/packs/emoji/${filename}.svg`}
|
||||
/>
|
||||
);
|
||||
} else if (emojiMap.get(emoji as any)) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { isCustomEmoji } from 'soapbox/features/emoji/index.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';
|
||||
|
||||
|
@ -21,7 +20,7 @@ const AutosuggestEmoji: React.FC<IAutosuggestEmoji> = ({ emoji }) => {
|
|||
return null;
|
||||
}
|
||||
|
||||
url = joinPublicPath(`packs/emoji/${mapping.unified}.svg`);
|
||||
url = `/packs/emoji/${mapping.unified}.svg`;
|
||||
alt = emoji.native;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { removeVS16s, toCodePoints } from 'soapbox/utils/emoji.ts';
|
||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
||||
|
||||
interface IEmoji extends React.ImgHTMLAttributes<HTMLImageElement> {
|
||||
/** Unicode emoji character. */
|
||||
|
@ -23,7 +22,7 @@ const Emoji: React.FC<IEmoji> = (props): JSX.Element | null => {
|
|||
<img
|
||||
draggable='false'
|
||||
alt={alt || emoji}
|
||||
src={src || joinPublicPath(`packs/emoji/${filename}.svg`)}
|
||||
src={src || `/packs/emoji/${filename}.svg`}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -2,14 +2,12 @@ import spriteSheet from 'emoji-datasource/img/twitter/sheets/32.png';
|
|||
import { Picker as EmojiPicker } from 'emoji-mart';
|
||||
import { useRef, useEffect } from 'react';
|
||||
|
||||
import { joinPublicPath } from 'soapbox/utils/static.ts';
|
||||
|
||||
import data from '../data.ts';
|
||||
|
||||
const getSpritesheetURL = () => spriteSheet;
|
||||
|
||||
const getImageURL = (set: string, name: string) => {
|
||||
return joinPublicPath(`/packs/emoji/${name}.svg`);
|
||||
const getImageURL = (_set: string, name: string) => {
|
||||
return `/packs/emoji/${name}.svg`;
|
||||
};
|
||||
|
||||
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 { openModal } from 'soapbox/actions/modals.ts';
|
||||
import * as BuildConfig from 'soapbox/build-config.ts';
|
||||
import LoadingScreen from 'soapbox/components/loading-screen.tsx';
|
||||
import { ScrollContext } from 'soapbox/components/scroll-context.tsx';
|
||||
import SiteErrorBoundary from 'soapbox/components/site-error-boundary.tsx';
|
||||
|
@ -48,7 +47,7 @@ const SoapboxMount = () => {
|
|||
|
||||
return (
|
||||
<SiteErrorBoundary>
|
||||
<BrowserRouter basename={BuildConfig.FE_SUBDIRECTORY}>
|
||||
<BrowserRouter>
|
||||
<CompatRouter>
|
||||
<ScrollContext>
|
||||
<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