fix(server): no longer working subdir due to assets (fixes #2098)

This commit is contained in:
Elian Doran 2025-06-06 22:57:00 +03:00
parent 68d094d119
commit c18451a378
No known key found for this signature in database
4 changed files with 19 additions and 3 deletions

View File

@ -133,7 +133,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
// currently required by excalidraw, in order to allows self-hosting fonts locally. // currently required by excalidraw, in order to allows self-hosting fonts locally.
// this avoids making excalidraw load the fonts from an external CDN. // this avoids making excalidraw load the fonts from an external CDN.
(window as any).EXCALIDRAW_ASSET_PATH = `${new URL(import.meta.url).origin}/node_modules/@excalidraw/excalidraw/dist/prod`; (window as any).EXCALIDRAW_ASSET_PATH = `${window.location.pathname}/node_modules/@excalidraw/excalidraw/dist/prod`;
// temporary vars // temporary vars
this.currentNoteId = ""; this.currentNoteId = "";

View File

@ -102,7 +102,7 @@ export function buildConfig(): EditorConfig {
allowedProtocols: ALLOWED_PROTOCOLS allowedProtocols: ALLOWED_PROTOCOLS
}, },
emoji: { emoji: {
definitionsUrl: new URL(import.meta.url).origin + emojiDefinitionsUrl definitionsUrl: emojiDefinitionsUrl
}, },
syntaxHighlighting: { syntaxHighlighting: {
loadHighlightJs: async () => { loadHighlightJs: async () => {

View File

@ -9,7 +9,7 @@ const assets = [ "assets", "stylesheets", "libraries", "fonts", "translations" ]
export default defineConfig(() => ({ export default defineConfig(() => ({
root: __dirname, root: __dirname,
cacheDir: '../../node_modules/.vite/apps/client', cacheDir: '../../node_modules/.vite/apps/client',
base: "/" + asset_path, base: process.env.NODE_ENV === "production" ? "" : asset_path,
server: { server: {
port: 4200, port: 4200,
host: 'localhost', host: 'localhost',

View File

@ -0,0 +1,16 @@
server {
listen 8090;
location /trilium/ {
rewrite ^/trilium(/.*)$ $1 break;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://host.docker.internal:8082; # change it to a different port if non-default is used
proxy_cookie_path / /trilium/;
proxy_read_timeout 90;
}
}