use unpacked in dev
This commit is contained in:
		
							parent
							
								
									94a0c4dc10
								
							
						
					
					
						commit
						ac28db6c4d
					
				
					 4 changed files with 11 additions and 13 deletions
				
			
		|  | @ -47,11 +47,9 @@ export const VENCORD_THEMES_DIR = join(DATA_DIR, "themes"); | ||||||
| 
 | 
 | ||||||
| // needs to be inline require because of circular dependency
 | // needs to be inline require because of circular dependency
 | ||||||
| // as otherwise "DATA_DIR" (which is used by ./settings) will be uninitialised
 | // as otherwise "DATA_DIR" (which is used by ./settings) will be uninitialised
 | ||||||
| export const VENCORD_ASAR_FILE = (() => { | export const VENCORD_DIR = (() => { | ||||||
|     const { State } = require("./settings") as typeof import("./settings"); |     const { State } = require("./settings") as typeof import("./settings"); | ||||||
|     return State.store.vencordDir |     return State.store.vencordDir ? join(State.store.vencordDir, "vesktop") : join(SESSION_DATA_DIR, "vencord.asar"); | ||||||
|         ? join(State.store.vencordDir, "vesktop.asar") |  | ||||||
|         : join(SESSION_DATA_DIR, "vencord.asar"); |  | ||||||
| })(); | })(); | ||||||
| 
 | 
 | ||||||
| export const USER_AGENT = `Vesktop/${app.getVersion()} (https://github.com/Vencord/Vesktop)`; | export const USER_AGENT = `Vesktop/${app.getVersion()} (https://github.com/Vencord/Vesktop)`; | ||||||
|  |  | ||||||
|  | @ -17,7 +17,7 @@ import { debounce } from "shared/utils/debounce"; | ||||||
| import { IpcEvents } from "../shared/IpcEvents"; | import { IpcEvents } from "../shared/IpcEvents"; | ||||||
| import { setBadgeCount } from "./appBadge"; | import { setBadgeCount } from "./appBadge"; | ||||||
| import { autoStart } from "./autoStart"; | import { autoStart } from "./autoStart"; | ||||||
| import { VENCORD_ASAR_FILE, VENCORD_QUICKCSS_FILE, VENCORD_THEMES_DIR } from "./constants"; | import { VENCORD_DIR, VENCORD_QUICKCSS_FILE, VENCORD_THEMES_DIR } from "./constants"; | ||||||
| import { mainWin } from "./mainWindow"; | import { mainWin } from "./mainWindow"; | ||||||
| import { Settings, State } from "./settings"; | import { Settings, State } from "./settings"; | ||||||
| import { handle, handleSync } from "./utils/ipcWrappers"; | import { handle, handleSync } from "./utils/ipcWrappers"; | ||||||
|  | @ -25,8 +25,8 @@ import { PopoutWindows } from "./utils/popout"; | ||||||
| import { isDeckGameMode, showGamePage } from "./utils/steamOS"; | import { isDeckGameMode, showGamePage } from "./utils/steamOS"; | ||||||
| import { isValidVencordInstall } from "./utils/vencordLoader"; | import { isValidVencordInstall } from "./utils/vencordLoader"; | ||||||
| 
 | 
 | ||||||
| handleSync(IpcEvents.GET_VENCORD_PRELOAD_FILE, () => join(VENCORD_ASAR_FILE, "preload.js")); | handleSync(IpcEvents.GET_VENCORD_PRELOAD_FILE, () => join(VENCORD_DIR, "preload.js")); | ||||||
| handleSync(IpcEvents.GET_VENCORD_RENDERER_SCRIPT, () => readFileSync(join(VENCORD_ASAR_FILE, "renderer.js"), "utf-8")); | handleSync(IpcEvents.GET_VENCORD_RENDERER_SCRIPT, () => readFileSync(join(VENCORD_DIR, "renderer.js"), "utf-8")); | ||||||
| 
 | 
 | ||||||
| handleSync(IpcEvents.GET_RENDERER_SCRIPT, () => readFileSync(join(__dirname, "renderer.js"), "utf-8")); | handleSync(IpcEvents.GET_RENDERER_SCRIPT, () => readFileSync(join(__dirname, "renderer.js"), "utf-8")); | ||||||
| handleSync(IpcEvents.GET_RENDERER_CSS_FILE, () => join(__dirname, "renderer.css")); | handleSync(IpcEvents.GET_RENDERER_CSS_FILE, () => join(__dirname, "renderer.css")); | ||||||
|  |  | ||||||
|  | @ -34,7 +34,7 @@ import { | ||||||
|     MessageBoxChoice, |     MessageBoxChoice, | ||||||
|     MIN_HEIGHT, |     MIN_HEIGHT, | ||||||
|     MIN_WIDTH, |     MIN_WIDTH, | ||||||
|     VENCORD_ASAR_FILE |     VENCORD_DIR | ||||||
| } from "./constants"; | } from "./constants"; | ||||||
| import { Settings, State, VencordSettings } from "./settings"; | import { Settings, State, VencordSettings } from "./settings"; | ||||||
| import { createSplashWindow } from "./splash"; | import { createSplashWindow } from "./splash"; | ||||||
|  | @ -465,7 +465,7 @@ function createMainWindow() { | ||||||
|     return win; |     return win; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const runVencordMain = once(() => require(VENCORD_ASAR_FILE)); | const runVencordMain = once(() => require(VENCORD_DIR)); | ||||||
| 
 | 
 | ||||||
| export async function createWindows() { | export async function createWindows() { | ||||||
|     const startMinimized = process.argv.includes("--start-minimized"); |     const startMinimized = process.argv.includes("--start-minimized"); | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ | ||||||
| import { existsSync } from "fs"; | import { existsSync } from "fs"; | ||||||
| import { join } from "path"; | import { join } from "path"; | ||||||
| 
 | 
 | ||||||
| import { USER_AGENT, VENCORD_ASAR_FILE } from "../constants"; | import { USER_AGENT, VENCORD_DIR } from "../constants"; | ||||||
| import { downloadFile, fetchie } from "./http"; | import { downloadFile, fetchie } from "./http"; | ||||||
| 
 | 
 | ||||||
| const API_BASE = "https://api.github.com"; | const API_BASE = "https://api.github.com"; | ||||||
|  | @ -38,18 +38,18 @@ export async function githubGet(endpoint: string) { | ||||||
| export async function downloadVencordAsar() { | export async function downloadVencordAsar() { | ||||||
|     await downloadFile( |     await downloadFile( | ||||||
|         "https://github.com/Vendicated/Vencord/releases/latest/download/vesktop.asar", |         "https://github.com/Vendicated/Vencord/releases/latest/download/vesktop.asar", | ||||||
|         VENCORD_ASAR_FILE, |         VENCORD_DIR, | ||||||
|         {}, |         {}, | ||||||
|         { retryOnNetworkError: true } |         { retryOnNetworkError: true } | ||||||
|     ); |     ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export function isValidVencordInstall(dir: string) { | export function isValidVencordInstall(dir: string) { | ||||||
|     return existsSync(join(dir, "vesktop.asar")); |     return existsSync(join(dir, "vesktop/main.js")); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function ensureVencordFiles() { | export async function ensureVencordFiles() { | ||||||
|     if (existsSync(VENCORD_ASAR_FILE)) return; |     if (existsSync(VENCORD_DIR)) return; | ||||||
| 
 | 
 | ||||||
|     await downloadVencordAsar(); |     await downloadVencordAsar(); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Vendicated
						Vendicated