forked from jsnbuchanan/crowd-funder-for-time-pwa
Clean up console logging and fix platform detection issues
- Reduce migration/platform logging verbosity in development mode (~80-90% less noise) - Fix AbsurdSQL platform check to support 'development' alongside 'web' - Add missing WebPlatformService methods (isWorker, initSharedArrayBuffer) - Fix Electron API endpoint resolution to prevent JSON parsing errors - Prevent circular database logging that caused [DB-PREVENTED-INFO] spam Console now shows only essential information while preserving all errors/warnings
This commit is contained in:
@@ -70,11 +70,13 @@ class AbsurdSqlDatabaseService implements DatabaseService {
|
||||
return;
|
||||
}
|
||||
|
||||
// **PLATFORM CHECK**: AbsurdSqlDatabaseService should only run on web platform
|
||||
// **PLATFORM CHECK**: AbsurdSqlDatabaseService should only run on web-based platforms
|
||||
// This prevents SharedArrayBuffer checks and web-specific initialization on Electron/Capacitor
|
||||
if (process.env.VITE_PLATFORM !== "web") {
|
||||
// Allow both 'web' (production) and 'development' (dev server) platforms
|
||||
const webBasedPlatforms = ["web", "development"];
|
||||
if (!webBasedPlatforms.includes(process.env.VITE_PLATFORM || "")) {
|
||||
throw new Error(
|
||||
`AbsurdSqlDatabaseService is only supported on web platform. Current platform: ${process.env.VITE_PLATFORM}`,
|
||||
`AbsurdSqlDatabaseService is only supported on web-based platforms (web, development). Current platform: ${process.env.VITE_PLATFORM}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -97,12 +99,16 @@ class AbsurdSqlDatabaseService implements DatabaseService {
|
||||
// **SHARED ARRAY BUFFER FALLBACK**: Only needed for web platform
|
||||
// This check handles Safari and other browsers without SharedArrayBuffer support
|
||||
if (typeof SharedArrayBuffer === "undefined") {
|
||||
logger.debug("[AbsurdSqlDatabaseService] SharedArrayBuffer not available, using fallback mode");
|
||||
logger.debug(
|
||||
"[AbsurdSqlDatabaseService] SharedArrayBuffer not available, using fallback mode",
|
||||
);
|
||||
const stream = SQL.FS.open(path, "a+");
|
||||
await stream.node.contents.readIfFallback();
|
||||
SQL.FS.close(stream);
|
||||
} else {
|
||||
logger.debug("[AbsurdSqlDatabaseService] SharedArrayBuffer available, using optimized mode");
|
||||
logger.debug(
|
||||
"[AbsurdSqlDatabaseService] SharedArrayBuffer available, using optimized mode",
|
||||
);
|
||||
}
|
||||
|
||||
this.db = new SQL.Database(path, { filename: true });
|
||||
|
||||
Reference in New Issue
Block a user