mirror of
				https://github.com/open-webui/desktop
				synced 2025-06-26 18:15:59 +00:00 
			
		
		
		
	init
This commit is contained in:
		
						commit
						1b885cab0e
					
				
							
								
								
									
										54
									
								
								forge.config.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								forge.config.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,54 @@ | ||||
| import type { ForgeConfig } from '@electron-forge/shared-types'; | ||||
| import { MakerSquirrel } from '@electron-forge/maker-squirrel'; | ||||
| import { MakerZIP } from '@electron-forge/maker-zip'; | ||||
| import { MakerDeb } from '@electron-forge/maker-deb'; | ||||
| import { MakerRpm } from '@electron-forge/maker-rpm'; | ||||
| import { VitePlugin } from '@electron-forge/plugin-vite'; | ||||
| import { FusesPlugin } from '@electron-forge/plugin-fuses'; | ||||
| import { FuseV1Options, FuseVersion } from '@electron/fuses'; | ||||
| 
 | ||||
| const config: ForgeConfig = { | ||||
|   packagerConfig: { | ||||
|     asar: true, | ||||
|   }, | ||||
|   rebuildConfig: {}, | ||||
|   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.
 | ||||
|       // If you are familiar with Vite configuration, it will look really familiar.
 | ||||
|       build: [ | ||||
|         { | ||||
|           // `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
 | ||||
|           entry: 'src/main.ts', | ||||
|           config: 'vite.main.config.ts', | ||||
|           target: 'main', | ||||
|         }, | ||||
|         { | ||||
|           entry: 'src/preload.ts', | ||||
|           config: 'vite.preload.config.ts', | ||||
|           target: 'preload', | ||||
|         }, | ||||
|       ], | ||||
|       renderer: [ | ||||
|         { | ||||
|           name: 'main_window', | ||||
|           config: 'vite.renderer.config.ts', | ||||
|         }, | ||||
|       ], | ||||
|     }), | ||||
|     // Fuses are used to enable/disable various Electron functionality
 | ||||
|     // at package time, before code signing the application
 | ||||
|     new FusesPlugin({ | ||||
|       version: FuseVersion.V1, | ||||
|       [FuseV1Options.RunAsNode]: false, | ||||
|       [FuseV1Options.EnableCookieEncryption]: true, | ||||
|       [FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false, | ||||
|       [FuseV1Options.EnableNodeCliInspectArguments]: false, | ||||
|       [FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true, | ||||
|       [FuseV1Options.OnlyLoadAppFromAsar]: true, | ||||
|     }), | ||||
|   ], | ||||
| }; | ||||
| 
 | ||||
| export default config; | ||||
							
								
								
									
										1
									
								
								forge.env.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								forge.env.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| /// <reference types="@electron-forge/plugin-vite/forge-vite-env" />
 | ||||
							
								
								
									
										13
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								index.html
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,13 @@ | ||||
| <!DOCTYPE html> | ||||
| <html> | ||||
|   <head> | ||||
|     <meta charset="UTF-8" /> | ||||
|     <title>Hello World!</title> | ||||
| 
 | ||||
|   </head> | ||||
|   <body> | ||||
|     <h1>💖 Hello World!</h1> | ||||
|     <p>Welcome to your Electron application.</p> | ||||
|     <script type="module" src="/src/renderer.ts"></script> | ||||
|   </body> | ||||
| </html> | ||||
							
								
								
									
										10271
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										10271
									
								
								package-lock.json
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										42
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								package.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,42 @@ | ||||
| { | ||||
|   "name": "app", | ||||
|   "productName": "app", | ||||
|   "version": "1.0.0", | ||||
|   "description": "My Electron application description", | ||||
|   "main": ".vite/build/main.js", | ||||
|   "scripts": { | ||||
|     "start": "electron-forge start", | ||||
|     "package": "electron-forge package", | ||||
|     "make": "electron-forge make", | ||||
|     "publish": "electron-forge publish", | ||||
|     "lint": "eslint --ext .ts,.tsx ." | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "@electron-forge/cli": "^7.6.0", | ||||
|     "@electron-forge/maker-deb": "^7.6.0", | ||||
|     "@electron-forge/maker-rpm": "^7.6.0", | ||||
|     "@electron-forge/maker-squirrel": "^7.6.0", | ||||
|     "@electron-forge/maker-zip": "^7.6.0", | ||||
|     "@electron-forge/plugin-auto-unpack-natives": "^7.6.0", | ||||
|     "@electron-forge/plugin-fuses": "^7.6.0", | ||||
|     "@electron-forge/plugin-vite": "^7.6.0", | ||||
|     "@electron/fuses": "^1.8.0", | ||||
|     "@typescript-eslint/eslint-plugin": "^5.62.0", | ||||
|     "@typescript-eslint/parser": "^5.62.0", | ||||
|     "electron": "33.3.1", | ||||
|     "eslint": "^8.57.1", | ||||
|     "eslint-plugin-import": "^2.31.0", | ||||
|     "ts-node": "^10.9.2", | ||||
|     "typescript": "~4.5.4", | ||||
|     "vite": "^5.4.11" | ||||
|   }, | ||||
|   "keywords": [], | ||||
|   "author": { | ||||
|     "name": "Timothy Jaeryang Baek", | ||||
|     "email": "tim@openwebui.com" | ||||
|   }, | ||||
|   "license": "MIT", | ||||
|   "dependencies": { | ||||
|     "electron-squirrel-startup": "^1.0.1" | ||||
|   } | ||||
| } | ||||
							
								
								
									
										7
									
								
								src/index.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/index.css
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| body { | ||||
|   font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, | ||||
|     Arial, sans-serif; | ||||
|   margin: auto; | ||||
|   max-width: 38rem; | ||||
|   padding: 2rem; | ||||
| } | ||||
							
								
								
									
										54
									
								
								src/main.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										54
									
								
								src/main.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,54 @@ | ||||
| import { app, BrowserWindow } from 'electron'; | ||||
| import path from 'path'; | ||||
| import started from 'electron-squirrel-startup'; | ||||
| 
 | ||||
| // Handle creating/removing shortcuts on Windows when installing/uninstalling.
 | ||||
| if (started) { | ||||
|   app.quit(); | ||||
| } | ||||
| 
 | ||||
| const createWindow = () => { | ||||
|   // Create the browser window.
 | ||||
|   const mainWindow = new BrowserWindow({ | ||||
|     width: 800, | ||||
|     height: 600, | ||||
|     webPreferences: { | ||||
|       preload: path.join(__dirname, 'preload.js'), | ||||
|     }, | ||||
|   }); | ||||
| 
 | ||||
|   // and load the index.html of the app.
 | ||||
|   if (MAIN_WINDOW_VITE_DEV_SERVER_URL) { | ||||
|     mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL); | ||||
|   } else { | ||||
|     mainWindow.loadFile(path.join(__dirname, `../renderer/${MAIN_WINDOW_VITE_NAME}/index.html`)); | ||||
|   } | ||||
| 
 | ||||
|   // Open the DevTools.
 | ||||
|   mainWindow.webContents.openDevTools(); | ||||
| }; | ||||
| 
 | ||||
| // This method will be called when Electron has finished
 | ||||
| // initialization and is ready to create browser windows.
 | ||||
| // Some APIs can only be used after this event occurs.
 | ||||
| app.on('ready', createWindow); | ||||
| 
 | ||||
| // Quit when all windows are closed, except on macOS. There, it's common
 | ||||
| // for applications and their menu bar to stay active until the user quits
 | ||||
| // explicitly with Cmd + Q.
 | ||||
| app.on('window-all-closed', () => { | ||||
|   if (process.platform !== 'darwin') { | ||||
|     app.quit(); | ||||
|   } | ||||
| }); | ||||
| 
 | ||||
| app.on('activate', () => { | ||||
|   // On OS X it's common to re-create a window in the app when the
 | ||||
|   // dock icon is clicked and there are no other windows open.
 | ||||
|   if (BrowserWindow.getAllWindows().length === 0) { | ||||
|     createWindow(); | ||||
|   } | ||||
| }); | ||||
| 
 | ||||
| // In this file you can include the rest of your app's specific main process
 | ||||
| // code. You can also put them in separate files and import them here.
 | ||||
							
								
								
									
										2
									
								
								src/preload.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/preload.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | ||||
| // See the Electron documentation for details on how to use preload scripts:
 | ||||
| // https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts
 | ||||
							
								
								
									
										31
									
								
								src/renderer.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/renderer.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
| /** | ||||
|  * This file will automatically be loaded by vite and run in the "renderer" context. | ||||
|  * To learn more about the differences between the "main" and the "renderer" context in | ||||
|  * Electron, visit: | ||||
|  * | ||||
|  * https://electronjs.org/docs/tutorial/application-architecture#main-and-renderer-processes
 | ||||
|  * | ||||
|  * By default, Node.js integration in this file is disabled. When enabling Node.js integration | ||||
|  * in a renderer process, please be aware of potential security implications. You can read | ||||
|  * more about security risks here: | ||||
|  * | ||||
|  * https://electronjs.org/docs/tutorial/security
 | ||||
|  * | ||||
|  * To enable Node.js integration in this file, open up `main.ts` and enable the `nodeIntegration` | ||||
|  * flag: | ||||
|  * | ||||
|  * ``` | ||||
|  *  // Create the browser window.
 | ||||
|  *  mainWindow = new BrowserWindow({ | ||||
|  *    width: 800, | ||||
|  *    height: 600, | ||||
|  *    webPreferences: { | ||||
|  *      nodeIntegration: true | ||||
|  *    } | ||||
|  *  }); | ||||
|  * ``` | ||||
|  */ | ||||
| 
 | ||||
| import './index.css'; | ||||
| 
 | ||||
| console.log('👋 This message is being logged by "renderer.ts", included via Vite'); | ||||
							
								
								
									
										15
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								tsconfig.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,15 @@ | ||||
| { | ||||
|   "compilerOptions": { | ||||
|     "target": "ESNext", | ||||
|     "module": "commonjs", | ||||
|     "allowJs": true, | ||||
|     "skipLibCheck": true, | ||||
|     "esModuleInterop": true, | ||||
|     "noImplicitAny": true, | ||||
|     "sourceMap": true, | ||||
|     "baseUrl": ".", | ||||
|     "outDir": "dist", | ||||
|     "moduleResolution": "node", | ||||
|     "resolveJsonModule": true | ||||
|   } | ||||
| } | ||||
							
								
								
									
										4
									
								
								vite.main.config.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								vite.main.config.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| import { defineConfig } from 'vite'; | ||||
| 
 | ||||
| // https://vitejs.dev/config
 | ||||
| export default defineConfig({}); | ||||
							
								
								
									
										4
									
								
								vite.preload.config.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								vite.preload.config.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| import { defineConfig } from 'vite'; | ||||
| 
 | ||||
| // https://vitejs.dev/config
 | ||||
| export default defineConfig({}); | ||||
							
								
								
									
										4
									
								
								vite.renderer.config.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								vite.renderer.config.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,4 @@ | ||||
| import { defineConfig } from 'vite'; | ||||
| 
 | ||||
| // https://vitejs.dev/config
 | ||||
| export default defineConfig({}); | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user