mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-16 03:20:46 +02:00
Headless windows installer (#5664)
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user