MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / initializeDefaultSettings

Function initializeDefaultSettings

main.js:1896–1943  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1894 dialog.showErrorBox('Browser Extension Server', `Could not start server on port ${extPort}: ${err.message}\n\nOn macOS, the app needs the "Allow incoming network connections" entitlement. Rebuild the app after adding com.apple.security.network.server to build/entitlements.mac.plist.`);
1895 }
1896 });
1897 }
1898 // Normal mode: create window (UI served over localhost HTTP for Puter.js compatibility)
1899 await createWindow();
1900
1901 app.on('activate', () => {
1902 if (BrowserWindow.getAllWindows().length === 0) {
1903 createWindow().catch((err) => {
1904 console.error('Failed to recreate main window:', err);
1905 });
1906 }
1907 });
1908
1909 createApplicationMenu();
1910
1911 // Version check after first window paint (HTTPS can block for seconds)
1912 setImmediate(() => {
1913 checkForUpdates().catch((updateError) => {
1914 console.error('Error checking version on startup:', updateError);
1915 });
1916 });
1917
1918 // PRAGMA integrity_check + orphan cleanup can be slow on huge DBs — defer past cold start
1919 setTimeout(() => {
1920 try {
1921 verifyDatabaseIntegrity();
1922 } catch (e) {
1923 console.error('Deferred database integrity check failed:', e);
1924 }
1925 }, 3000);
1926 scheduleBackgroundThumbnailCompression('startup');
1927 }
1928
1929 // Track application usage after initialization (skip in server mode; do not block ready)
1930 if (!isServerMode) {
1931 setImmediate(() => {
1932 trackAppUsage().catch((e) => console.error('trackAppUsage:', e));
1933 });
1934 }
1935 } catch (error) {
1936 console.error('Error during app initialization:', error);
1937 if (isServerMode) {
1938 console.error('Startup Error: Failed to start application properly.');
1939 } else {
1940 dialog.showErrorBox('Startup Error', 'Failed to start application properly.');
1941 }
1942 app.quit();
1943 }
1944 });
1945
1946 app.on('window-all-closed', () => {

Callers 1

initializeDatabaseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected