@ -445,10 +445,22 @@ export const PlatformServiceMixin = {
fallback : Settings | null = null ,
) : Promise < Settings | null > {
try {
const result = await this . $dbQuery (
"SELECT * FROM settings WHERE id = ? OR accountDid = ?" ,
[ key , key ] ,
) ;
// FIXED: Use specific queries instead of ambiguous OR condition
let result ;
// Check if this is a master settings key (numeric or "1")
if ( key === MASTER_SETTINGS_KEY || key === "1" || ! isNaN ( Number ( key ) ) ) {
// Master settings: query by id
result = await this . $dbQuery ( "SELECT * FROM settings WHERE id = ?" , [
key ,
] ) ;
} else {
// Account settings: query by accountDid
result = await this . $dbQuery (
"SELECT * FROM settings WHERE accountDid = ?" ,
[ key ] ,
) ;
}
if ( ! result ? . values ? . length ) {
return fallback ;
@ -763,13 +775,14 @@ export const PlatformServiceMixin = {
return defaults ;
}
// **ELECTRON-SPECIFIC FIX**: Apply platform-specific API server override
// This ensures Electron always uses production endpoints regardless of cached setting s
if ( process . env . VITE_PLATFORM === "electron" ) {
// FIXED: Remove forced override - respect user preferences
// Only set default if no user preference exist s
if ( ! settings . apiServer && process . env . VITE_PLATFORM === "electron" ) {
// Import constants dynamically to get platform-specific values
const { DEFAULT_ENDORSER_API_SERVER } = await import (
"../constants/app"
) ;
// Only set if user hasn't specified a preference
settings . apiServer = DEFAULT_ENDORSER_API_SERVER ;
}
@ -813,14 +826,17 @@ export const PlatformServiceMixin = {
defaultSettings ,
) ;
// **ELECTRON-SPECIFIC FIX**: Force production API endpoints for Electron
// This ensures Electron doesn't use localhost development servers that might be saved in user settings
if ( process . env . VITE_PLATFORM === "electron" ) {
// FIXED: Remove forced override - respect user preferences
// Only set default if no user preference exists
if (
! mergedSettings . apiServer &&
process . env . VITE_PLATFORM === "electron"
) {
// Import constants dynamically to get platform-specific values
const { DEFAULT_ENDORSER_API_SERVER } = await import (
"../constants/app"
) ;
// Only set if user hasn't specified a preference
mergedSettings . apiServer = DEFAULT_ENDORSER_API_SERVER ;
}