Headless windows installer (#5664)

This commit is contained in:
Anthony Stirling
2026-02-06 18:06:01 +00:00
committed by GitHub
parent 94e517df3c
commit ba72a2a623
21 changed files with 557 additions and 34 deletions
@@ -107,6 +107,9 @@ export function setupApiInterceptors(client: AxiosInstance): void {
// Handle 401 Unauthorized - try to refresh token
if (error.response?.status === 401 && !originalRequest._retry) {
if (typeof window !== 'undefined') {
console.warn('[apiClientSetup] 401 on path:', window.location.pathname, 'url:', originalRequest.url);
}
if (originalRequest.skipAuthRedirect) {
return Promise.reject(error);
}
@@ -17,6 +17,7 @@ export interface ServerConfig {
export interface ConnectionConfig {
mode: ConnectionMode;
server_config: ServerConfig | null;
lock_connection_mode: boolean;
}
export interface DiagnosticResult {
@@ -50,7 +51,7 @@ export class ConnectionModeService {
if (!this.configLoadedOnce) {
await this.loadConfig();
}
return this.currentConfig || { mode: 'saas', server_config: null };
return this.currentConfig || { mode: 'saas', server_config: null, lock_connection_mode: false };
}
async getCurrentMode(): Promise<ConnectionMode> {
@@ -84,12 +85,16 @@ export class ConnectionModeService {
} catch (error) {
console.error('Failed to load connection config:', error);
// Default to SaaS mode on error
this.currentConfig = { mode: 'saas', server_config: null };
this.currentConfig = { mode: 'saas', server_config: null, lock_connection_mode: false };
this.configLoadedOnce = true;
}
}
async switchToSaaS(saasServerUrl: string): Promise<void> {
if (this.currentConfig?.lock_connection_mode) {
throw new Error('Connection mode is locked by provisioning');
}
console.log('Switching to SaaS mode');
const serverConfig: ServerConfig = { url: saasServerUrl };
@@ -99,7 +104,7 @@ export class ConnectionModeService {
serverConfig,
});
this.currentConfig = { mode: 'saas', server_config: serverConfig };
this.currentConfig = { mode: 'saas', server_config: serverConfig, lock_connection_mode: this.currentConfig?.lock_connection_mode ?? false };
this.notifyListeners();
console.log('Switched to SaaS mode successfully');
@@ -113,7 +118,7 @@ export class ConnectionModeService {
serverConfig,
});
this.currentConfig = { mode: 'selfhosted', server_config: serverConfig };
this.currentConfig = { mode: 'selfhosted', server_config: serverConfig, lock_connection_mode: this.currentConfig?.lock_connection_mode ?? false };
this.notifyListeners();
console.log('Switched to self-hosted mode successfully');
@@ -901,6 +906,9 @@ export class ConnectionModeService {
}
async resetSetupCompletion(): Promise<void> {
if (this.currentConfig?.lock_connection_mode) {
return;
}
try {
await invoke('reset_setup_completion');
console.log('Setup completion flag reset successfully');