diff --git a/apps/client/vite.config.ts b/apps/client/vite.config.ts index e22f9e184..83bc0a6fc 100644 --- a/apps/client/vite.config.ts +++ b/apps/client/vite.config.ts @@ -7,7 +7,6 @@ const assets = [ "assets", "stylesheets", "libraries", "fonts", "translations" ] export default defineConfig(() => ({ root: __dirname, - base: "/assets/v0.94.0/app/", cacheDir: '../../node_modules/.vite/apps/client', server: { port: 4200, diff --git a/apps/server/src/routes/assets.ts b/apps/server/src/routes/assets.ts index 8c7ee4248..4b32ce5d9 100644 --- a/apps/server/src/routes/assets.ts +++ b/apps/server/src/routes/assets.ts @@ -28,36 +28,6 @@ async function register(app: express.Application) { if (!publicUrl) { throw new Error("Missing TRILIUM_PUBLIC_SERVER"); } - - const clientProxy = proxy(publicUrl, { - proxyReqPathResolver: (req) => { - let url = req.url; - url = url.replace(/^\/src/, ""); - if (!url.startsWith("/@")) { - if (!url.startsWith("/package.json")) { - url = "/src" + url; - } - url = url.replace(/\.js$/, ".ts"); - } - url = `/${assetPath}/app${url}`; - return url; - } - }); - - function buildAssetProxy(name: string) { - return proxy(publicUrl!, { - proxyReqPathResolver: (req) => `/${assetPath}/app/src/${name}/${req.url}` - }); - } - - app.use(`/${assetPath}/app/doc_notes`, persistentCacheStatic(path.join(srcRoot, "assets", "doc_notes"))); - app.use(`/${assetPath}/app`, clientProxy); - app.use(`/${assetPath}/app-dist`, clientProxy); - app.use(`/${assetPath}/stylesheets`, buildAssetProxy("stylesheets")); - app.use(`/${assetPath}/libraries`, buildAssetProxy("libraries")); - app.use(`/${assetPath}/fonts`, buildAssetProxy("fonts")); - app.use(`/${assetPath}/translations`, buildAssetProxy("translations")); - app.use(`/${assetPath}/images`, persistentCacheStatic(path.join(srcRoot, "assets", "images"))); } else { const clientStaticCache = persistentCacheStatic(path.join(resourceDir, "public")); app.use(`/${assetPath}/app`, clientStaticCache); diff --git a/apps/server/src/services/app_path.ts b/apps/server/src/services/app_path.ts index c0a651a0f..5e14722bf 100644 --- a/apps/server/src/services/app_path.ts +++ b/apps/server/src/services/app_path.ts @@ -1,4 +1,4 @@ import assetPath from "./asset_path.js"; import { isDev } from "./utils.js"; -export default isDev ? assetPath + "/app" : assetPath + "/app-dist"; +export default isDev ? assetPath + "/src" : assetPath + "/app-dist"; diff --git a/apps/server/src/services/asset_path.ts b/apps/server/src/services/asset_path.ts index dd81506cd..014f04f84 100644 --- a/apps/server/src/services/asset_path.ts +++ b/apps/server/src/services/asset_path.ts @@ -1,3 +1,6 @@ import packageJson from "../../package.json" with { type: "json" }; +import { isDev } from "./utils"; -export default `assets/v${packageJson.version}`; +const assetPath = isDev ? `http://localhost:4200` : `assets/v${packageJson.version}`; + +export default assetPath;