mirror of
https://github.com/wassname/talk.git
synced 2026-07-13 17:45:56 +08:00
feat: support static uri's with paths (#2399)
This commit is contained in:
@@ -499,6 +499,11 @@ export default function createWebpackConfig(
|
||||
exclude: [/\.(js|ts|tsx)$/, /\.html$/, /\.json$/],
|
||||
loader: require.resolve("file-loader"),
|
||||
options: {
|
||||
// Because the resources loaded via CSS can sometimes be loaded
|
||||
// directly from a CSS file, this will ensure that they are
|
||||
// relative to those referencing files.
|
||||
publicPath: (loaderPublicPath: string) =>
|
||||
"../../" + loaderPublicPath,
|
||||
name: isProduction
|
||||
? "assets/media/[name].[hash:8].[ext]"
|
||||
: "assets/media/[name].[ext]",
|
||||
|
||||
@@ -70,11 +70,7 @@ export default class Entrypoints {
|
||||
|
||||
// Check to see if the asset is a match.
|
||||
if (asset.src === src) {
|
||||
entrypoint[extension].push({
|
||||
integrity: asset.integrity,
|
||||
// Prefix all the sources with a `/`.
|
||||
src: "/" + asset.src,
|
||||
});
|
||||
entrypoint[extension].push(asset);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,9 @@ export function createRouter(app: AppOptions, options: RouterOptions) {
|
||||
|
||||
if (!options.disableClientRoutes) {
|
||||
mountClientRoutes(router, {
|
||||
staticURI: app.config.get("static_uri"),
|
||||
// When mounting client routes, we need to provide a staticURI even when
|
||||
// not provided to the default current domain relative "/".
|
||||
staticURI: app.config.get("static_uri") || "/",
|
||||
tenantCache: app.tenantCache,
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { parseConnectionString } from "mongodb-core";
|
||||
import os from "os";
|
||||
|
||||
import { LOCALES } from "coral-common/helpers/i18n/locales";
|
||||
import { ensureEndSlash } from "coral-common/utils";
|
||||
|
||||
import { InternalError } from "./errors";
|
||||
|
||||
@@ -32,7 +33,7 @@ convict.addFormat({
|
||||
},
|
||||
});
|
||||
|
||||
// Add a custom format for the optional-url.
|
||||
// Add a custom format for the optional-url that includes a trailing slash.
|
||||
convict.addFormat({
|
||||
name: "optional-url",
|
||||
validate: (url: string) => {
|
||||
@@ -40,10 +41,8 @@ convict.addFormat({
|
||||
Joi.assert(url, Joi.string().uri());
|
||||
}
|
||||
},
|
||||
// Ensure that there is no ending slash.
|
||||
coerce: (url: string) => {
|
||||
return url.replace(/\/$/, "");
|
||||
},
|
||||
// Ensure that there is an ending slash.
|
||||
coerce: (url: string) => (url ? ensureEndSlash(url) : url),
|
||||
});
|
||||
|
||||
const config = convict({
|
||||
|
||||
Reference in New Issue
Block a user