diff --git a/desktop/assets/neotrax.otf b/desktop/assets/fonts/neotrax.otf
similarity index 100%
rename from desktop/assets/neotrax.otf
rename to desktop/assets/fonts/neotrax.otf
diff --git a/desktop/assets/icons.svg b/desktop/assets/icons/sprite.svg
similarity index 100%
rename from desktop/assets/icons.svg
rename to desktop/assets/icons/sprite.svg
diff --git a/desktop/forge.config.ts b/desktop/forge.config.ts
index 1ab9f7e9..36dc75e1 100644
--- a/desktop/forge.config.ts
+++ b/desktop/forge.config.ts
@@ -10,9 +10,28 @@ import { FuseV1Options, FuseVersion } from '@electron/fuses';
const config: ForgeConfig = {
packagerConfig: {
asar: true,
+ ignore: [
+ /^\/src/,
+ /^\/test/,
+ /^\/tools/,
+ /^\/release/,
+ /^\/docs/,
+ /\.git/,
+ /\.vscode/,
+ /\.idea/,
+ /^\/\.env/,
+ // Don't ignore node_modules
+ // /^\/node_modules/
+ ],
+ extraResource: ['assets'],
},
rebuildConfig: {},
- makers: [new MakerSquirrel({}), new MakerZIP({}, ['darwin']), new MakerRpm({}), new MakerDeb({})],
+ makers: [
+ new MakerSquirrel({}),
+ new MakerZIP({}, ['darwin']),
+ new MakerRpm({}),
+ new MakerDeb({}),
+ ],
plugins: [
new VitePlugin({
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
diff --git a/desktop/index.html b/desktop/index.html
index c18ba997..ad89e1b2 100644
--- a/desktop/index.html
+++ b/desktop/index.html
@@ -5,7 +5,7 @@
Neuron
diff --git a/desktop/src/lib/emojis.ts b/desktop/src/lib/emojis.ts
index c4b0ba34..41c838a8 100644
--- a/desktop/src/lib/emojis.ts
+++ b/desktop/src/lib/emojis.ts
@@ -30,7 +30,7 @@ export const getEmojiById = (id: string): Emoji | undefined => {
};
export const getEmojiUrl = (id: string): string => {
- return `/assets/emojis/${id}.svg`;
+ return `asset://emojis/${id}.svg`;
};
export const searchEmojis = (query: string): Emoji[] => {
diff --git a/desktop/src/lib/icons.ts b/desktop/src/lib/icons.ts
index 8f32fdd2..f53d2b19 100644
--- a/desktop/src/lib/icons.ts
+++ b/desktop/src/lib/icons.ts
@@ -17,7 +17,7 @@ type IconPickerEmojiRow = {
};
export const getIconUrl = (id: string): string => {
- return `/assets/icons/${id}.svg`;
+ return `asset://icons/${id}.svg`;
};
export const searchIcons = (query: string): Icon[] => {
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index c4d0d726..2271caf6 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -1,4 +1,4 @@
-import { app, ipcMain, BrowserWindow, protocol, dialog } from 'electron';
+import { app, ipcMain, BrowserWindow, protocol, dialog, net } from 'electron';
import path from 'path';
import { eventBus } from '@/lib/event-bus';
import { MutationInput, MutationMap } from '@/operations/mutations';
@@ -53,6 +53,20 @@ const createWindow = async () => {
protocol.handle('local-file', (request) => {
return fileManager.handleFileRequest(request);
});
+
+ protocol.handle('asset', (request) => {
+ const url = request.url.replace('asset://', '');
+ if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {
+ return net.fetch(`${MAIN_WINDOW_VITE_DEV_SERVER_URL}/assets/${url}`);
+ }
+
+ const localFileUrl = `file://${path.join(
+ process.resourcesPath,
+ 'assets',
+ url,
+ )}`;
+ return net.fetch(localFileUrl);
+ });
};
// This method will be called when Electron has finished
diff --git a/desktop/src/renderer/components/ui/icon.tsx b/desktop/src/renderer/components/ui/icon.tsx
index e0d8244c..cffbe4d8 100644
--- a/desktop/src/renderer/components/ui/icon.tsx
+++ b/desktop/src/renderer/components/ui/icon.tsx
@@ -18,7 +18,7 @@ const Icon = React.forwardRef((props, ref) => {
width={computedSize}
{...props}
>
-
+
);
});
diff --git a/desktop/src/renderer/styles/index.css b/desktop/src/renderer/styles/index.css
index b4a445ad..a9158e7f 100644
--- a/desktop/src/renderer/styles/index.css
+++ b/desktop/src/renderer/styles/index.css
@@ -86,7 +86,7 @@
@font-face {
font-family: 'neotrax';
- src: url('/assets/neotrax.otf') format('truetype');
+ src: url('asset://fonts/neotrax.otf') format('truetype');
font-weight: normal;
font-style: normal;
}