Release v0.2.10: Update package-lock.json and CI config

This commit is contained in:
Joan
2025-12-30 18:51:21 +01:00
parent 8b31011334
commit 592f38827e
108 changed files with 2755 additions and 1112 deletions

View File

@@ -0,0 +1,41 @@
/**
* Asset Path Utility
*
* Resolves asset paths based on runtime environment:
* - Electron: Returns local path (assets bundled with app)
* - Browser: Returns full server URL
*/
// Detect if running in Electron
const isElectron = !!(window as any).electronAPI?.isElectron
// Base URL for remote assets (browser mode)
const ASSET_BASE_URL = import.meta.env.VITE_ASSET_URL ||
(import.meta.env.PROD ? 'https://api-staging.echoesoftheash.com' : '')
/**
* Resolves an asset path for the current environment
* @param path - The asset path (e.g., "images/items/knife.webp" or "/images/items/knife.webp")
* @returns The resolved path for the current environment
*/
export function getAssetPath(path: string): string {
if (!path) return ''
// Normalize path (ensure leading slash)
const normalizedPath = path.startsWith('/') ? path : `/${path}`
if (isElectron) {
// In Electron, assets are served relative to the app
return normalizedPath
}
// In browser, prepend the server URL
return `${ASSET_BASE_URL}${normalizedPath}`
}
/**
* Check if we're running in Electron
*/
export function isElectronApp(): boolean {
return isElectron
}