respect the minHeight for height setting, dont allow auto-updates for windows portable

This commit is contained in:
lone-cloud 2025-09-20 23:17:06 -07:00
parent 7646c04847
commit 29d55bc387
4 changed files with 54 additions and 8 deletions

View file

@ -53,22 +53,25 @@ export const GITHUB_API = {
GERBIL_REPO: 'lone-cloud/gerbil', GERBIL_REPO: 'lone-cloud/gerbil',
COMFYUI_REPO: 'comfyanonymous/ComfyUI', COMFYUI_REPO: 'comfyanonymous/ComfyUI',
get LATEST_RELEASE_URL() { get LATEST_RELEASE_URL() {
return `${this.BASE_URL}/repos/${this.KOBOLDCPP_REPO}/releases/latest`; return `${this.BASE_URL}/repos/${this.KOBOLDCPP_REPO}/releases/latest` as const;
}, },
get ALL_RELEASES_URL() { get ALL_RELEASES_URL() {
return `${this.BASE_URL}/repos/${this.KOBOLDCPP_REPO}/releases`; return `${this.BASE_URL}/repos/${this.KOBOLDCPP_REPO}/releases` as const;
}, },
get ROCM_LATEST_RELEASE_URL() { get ROCM_LATEST_RELEASE_URL() {
return `${this.BASE_URL}/repos/${this.KOBOLDCPP_ROCM_REPO}/releases/latest`; return `${this.BASE_URL}/repos/${this.KOBOLDCPP_ROCM_REPO}/releases/latest` as const;
}, },
get COMFYUI_DOWNLOAD_URL() { get COMFYUI_DOWNLOAD_URL() {
return `${this.GITHUB_BASE_URL}/${this.COMFYUI_REPO}/archive/refs/heads/master.zip`; return `${this.GITHUB_BASE_URL}/${this.COMFYUI_REPO}/archive/refs/heads/master.zip` as const;
}, },
get COMFYUI_LATEST_COMMIT_URL() { get COMFYUI_LATEST_COMMIT_URL() {
return `${this.BASE_URL}/repos/${this.COMFYUI_REPO}/commits/master`; return `${this.BASE_URL}/repos/${this.COMFYUI_REPO}/commits/master` as const;
}, },
get GERBIL_GITHUB_URL() { get GERBIL_GITHUB_URL() {
return `${this.GITHUB_BASE_URL}/${this.GERBIL_REPO}`; return `${this.GITHUB_BASE_URL}/${this.GERBIL_REPO}` as const;
},
get GERBIL_LATEST_RELEASE_URL() {
return `${this.BASE_URL}/repos/${this.GERBIL_REPO}/releases/latest` as const;
}, },
} as const; } as const;

View file

@ -47,6 +47,7 @@ import {
getUvVersion, getUvVersion,
getSystemNodeVersion, getSystemNodeVersion,
isAURInstallation, isAURInstallation,
isWindowsPortableInstallation,
} from '@/main/modules/dependencies'; } from '@/main/modules/dependencies';
import { parseKoboldConfig } from '@/utils/node/kobold'; import { parseKoboldConfig } from '@/utils/node/kobold';
import { getMainWindow } from '@/main/modules/window'; import { getMainWindow } from '@/main/modules/window';
@ -299,6 +300,10 @@ export function setupIPCHandlers() {
return false; return false;
} }
if (isWindowsPortableInstallation()) {
return false;
}
return ( return (
platform === 'win32' || platform === 'darwin' || platform === 'linux' platform === 'win32' || platform === 'darwin' || platform === 'linux'
); );

View file

@ -3,6 +3,7 @@ import { homedir } from 'os';
import { join } from 'path'; import { join } from 'path';
import { platform, env as processEnv } from 'process'; import { platform, env as processEnv } from 'process';
import { execa } from 'execa'; import { execa } from 'execa';
import { app } from 'electron';
async function executeCommand( async function executeCommand(
command: string, command: string,
@ -188,3 +189,36 @@ function tryAddPathToEnv(
} }
return false; return false;
} }
let windowsPortableInstallationCache: boolean | null = null;
export function isWindowsPortableInstallation() {
if (platform !== 'win32') {
return false;
}
if (windowsPortableInstallationCache !== null) {
return windowsPortableInstallationCache;
}
try {
const execPath = app.getPath('exe');
const isInTemp =
execPath.toLowerCase().includes('\\temp\\') ||
execPath.toLowerCase().includes('\\tmp\\');
const isInProgramFiles = execPath.toLowerCase().includes('program files');
const isInAppDataPrograms = execPath
.toLowerCase()
.includes('appdata\\local\\programs');
windowsPortableInstallationCache =
isInTemp && !isInProgramFiles && !isInAppDataPrograms;
return windowsPortableInstallationCache;
} catch {
windowsPortableInstallationCache = false;
return false;
}
}

View file

@ -14,11 +14,15 @@ export function createMainWindow() {
const savedBounds = getWindowBounds(); const savedBounds = getWindowBounds();
const defaultWidth = 800; const defaultWidth = 800;
const defaultHeight = Math.min(Math.floor(size.height * 0.75), 1000); const minHeight = 600;
const defaultHeight = Math.max(
minHeight,
Math.min(Math.floor(size.height * 0.75), 1000)
);
const windowOptions = { const windowOptions = {
minWidth: 600, minWidth: 600,
minHeight: 600, minHeight,
width: savedBounds?.width || defaultWidth, width: savedBounds?.width || defaultWidth,
height: savedBounds?.height || defaultHeight, height: savedBounds?.height || defaultHeight,
frame: false, frame: false,