Merge branch 'main' into pr-88
This commit is contained in:
commit
c285c7e477
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "pickle-glass",
|
"name": "pickle-glass",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "pickle-glass",
|
"name": "pickle-glass",
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "pickle-glass",
|
"name": "pickle-glass",
|
||||||
"productName": "Glass",
|
"productName": "Glass",
|
||||||
|
|
||||||
"version": "0.2.2",
|
"version": "0.2.3",
|
||||||
|
|
||||||
"description": "Cl*ely for Free",
|
"description": "Cl*ely for Free",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
|
@ -6,7 +6,8 @@ const LATEST_SCHEMA = {
|
|||||||
{ name: 'email', type: 'TEXT NOT NULL' },
|
{ name: 'email', type: 'TEXT NOT NULL' },
|
||||||
{ name: 'created_at', type: 'INTEGER' },
|
{ name: 'created_at', type: 'INTEGER' },
|
||||||
{ name: 'api_key', type: 'TEXT' },
|
{ name: 'api_key', type: 'TEXT' },
|
||||||
{ name: 'provider', type: 'TEXT DEFAULT \'openai\'' }
|
{ name: 'provider', type: 'TEXT DEFAULT \'openai\'' },
|
||||||
|
{ name: 'auto_update_enabled', type: 'INTEGER DEFAULT 1' }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
sessions: {
|
sessions: {
|
||||||
|
@ -37,56 +37,64 @@ class AuthService {
|
|||||||
this.currentUserMode = 'local'; // 'local' or 'firebase'
|
this.currentUserMode = 'local'; // 'local' or 'firebase'
|
||||||
this.currentUser = null;
|
this.currentUser = null;
|
||||||
this.isInitialized = false;
|
this.isInitialized = false;
|
||||||
|
this.initializationPromise = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
if (this.isInitialized) return;
|
if (this.isInitialized) return this.initializationPromise;
|
||||||
|
|
||||||
const auth = getFirebaseAuth();
|
this.initializationPromise = new Promise((resolve) => {
|
||||||
onAuthStateChanged(auth, async (user) => {
|
const auth = getFirebaseAuth();
|
||||||
const previousUser = this.currentUser;
|
onAuthStateChanged(auth, async (user) => {
|
||||||
|
const previousUser = this.currentUser;
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
// User signed IN
|
// User signed IN
|
||||||
console.log(`[AuthService] Firebase user signed in:`, user.uid);
|
console.log(`[AuthService] Firebase user signed in:`, user.uid);
|
||||||
this.currentUser = user;
|
this.currentUser = user;
|
||||||
this.currentUserId = user.uid;
|
this.currentUserId = user.uid;
|
||||||
this.currentUserMode = 'firebase';
|
this.currentUserMode = 'firebase';
|
||||||
|
|
||||||
// Start background task to fetch and save virtual key
|
// Start background task to fetch and save virtual key
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const idToken = await user.getIdToken(true);
|
const idToken = await user.getIdToken(true);
|
||||||
const virtualKey = await getVirtualKeyByEmail(user.email, idToken);
|
const virtualKey = await getVirtualKeyByEmail(user.email, idToken);
|
||||||
|
|
||||||
if (global.modelStateService) {
|
if (global.modelStateService) {
|
||||||
global.modelStateService.setFirebaseVirtualKey(virtualKey);
|
global.modelStateService.setFirebaseVirtualKey(virtualKey);
|
||||||
|
}
|
||||||
|
console.log(`[AuthService] BG: Virtual key for ${user.email} has been processed.`);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[AuthService] BG: Failed to fetch or save virtual key:', error);
|
||||||
}
|
}
|
||||||
console.log(`[AuthService] BG: Virtual key for ${user.email} has been processed.`);
|
})();
|
||||||
|
|
||||||
} catch (error) {
|
} else {
|
||||||
console.error('[AuthService] BG: Failed to fetch or save virtual key:', error);
|
// User signed OUT
|
||||||
}
|
console.log(`[AuthService] No Firebase user.`);
|
||||||
})();
|
if (previousUser) {
|
||||||
|
console.log(`[AuthService] Clearing API key for logged-out user: ${previousUser.uid}`);
|
||||||
} else {
|
if (global.modelStateService) {
|
||||||
// User signed OUT
|
global.modelStateService.setFirebaseVirtualKey(null);
|
||||||
console.log(`[AuthService] No Firebase user.`);
|
}
|
||||||
if (previousUser) {
|
|
||||||
console.log(`[AuthService] Clearing API key for logged-out user: ${previousUser.uid}`);
|
|
||||||
if (global.modelStateService) {
|
|
||||||
global.modelStateService.setFirebaseVirtualKey(null);
|
|
||||||
}
|
}
|
||||||
|
this.currentUser = null;
|
||||||
|
this.currentUserId = 'default_user';
|
||||||
|
this.currentUserMode = 'local';
|
||||||
}
|
}
|
||||||
this.currentUser = null;
|
this.broadcastUserState();
|
||||||
this.currentUserId = 'default_user';
|
|
||||||
this.currentUserMode = 'local';
|
if (!this.isInitialized) {
|
||||||
}
|
this.isInitialized = true;
|
||||||
this.broadcastUserState();
|
console.log('[AuthService] Initialized and resolved initialization promise.');
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
this.isInitialized = true;
|
return this.initializationPromise;
|
||||||
console.log('[AuthService] Initialized and attached to Firebase Auth state.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async signInWithCustomToken(token) {
|
async signInWithCustomToken(token) {
|
||||||
|
@ -120,6 +120,11 @@ class SmoothMovementManager {
|
|||||||
let targetX = this.headerPosition.x;
|
let targetX = this.headerPosition.x;
|
||||||
let targetY = this.headerPosition.y;
|
let targetY = this.headerPosition.y;
|
||||||
|
|
||||||
|
const windowSize = {
|
||||||
|
width: currentBounds.width,
|
||||||
|
height: currentBounds.height
|
||||||
|
};
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 'left': targetX -= this.stepSize; break;
|
case 'left': targetX -= this.stepSize; break;
|
||||||
case 'right': targetX += this.stepSize; break;
|
case 'right': targetX += this.stepSize; break;
|
||||||
@ -130,22 +135,23 @@ class SmoothMovementManager {
|
|||||||
|
|
||||||
const displays = screen.getAllDisplays();
|
const displays = screen.getAllDisplays();
|
||||||
let validPosition = displays.some(d => (
|
let validPosition = displays.some(d => (
|
||||||
targetX >= d.workArea.x && targetX + currentBounds.width <= d.workArea.x + d.workArea.width &&
|
targetX >= d.workArea.x && targetX + windowSize.width <= d.workArea.x + d.workArea.width &&
|
||||||
targetY >= d.workArea.y && targetY + currentBounds.height <= d.workArea.y + d.workArea.height
|
targetY >= d.workArea.y && targetY + windowSize.height <= d.workArea.y + d.workArea.height
|
||||||
));
|
));
|
||||||
|
|
||||||
if (!validPosition) {
|
if (!validPosition) {
|
||||||
const nearestDisplay = screen.getDisplayNearestPoint({ x: targetX, y: targetY });
|
const nearestDisplay = screen.getDisplayNearestPoint({ x: targetX, y: targetY });
|
||||||
const { x, y, width, height } = nearestDisplay.workArea;
|
const { x, y, width, height } = nearestDisplay.workArea;
|
||||||
targetX = Math.max(x, Math.min(x + width - currentBounds.width, targetX));
|
targetX = Math.max(x, Math.min(x + width - windowSize.width, targetX));
|
||||||
targetY = Math.max(y, Math.min(y + height - currentBounds.height, targetY));
|
targetY = Math.max(y, Math.min(y + height - windowSize.height, targetY));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetX === this.headerPosition.x && targetY === this.headerPosition.y) return;
|
if (targetX === this.headerPosition.x && targetY === this.headerPosition.y) return;
|
||||||
this.animateToPosition(header, targetX, targetY);
|
|
||||||
|
this.animateToPosition(header, targetX, targetY, windowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
animateToPosition(header, targetX, targetY) {
|
animateToPosition(header, targetX, targetY, windowSize) {
|
||||||
if (!this._isWindowValid(header)) return;
|
if (!this._isWindowValid(header)) return;
|
||||||
|
|
||||||
this.isAnimating = true;
|
this.isAnimating = true;
|
||||||
@ -173,7 +179,13 @@ class SmoothMovementManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this._isWindowValid(header)) return;
|
if (!this._isWindowValid(header)) return;
|
||||||
header.setPosition(Math.round(currentX), Math.round(currentY));
|
const { width, height } = windowSize || header.getBounds();
|
||||||
|
header.setBounds({
|
||||||
|
x: Math.round(currentX),
|
||||||
|
y: Math.round(currentY),
|
||||||
|
width,
|
||||||
|
height
|
||||||
|
});
|
||||||
|
|
||||||
if (progress < 1) {
|
if (progress < 1) {
|
||||||
this.animationFrameId = setTimeout(animate, 8);
|
this.animationFrameId = setTimeout(animate, 8);
|
||||||
@ -198,20 +210,40 @@ class SmoothMovementManager {
|
|||||||
const display = this.getCurrentDisplay(header);
|
const display = this.getCurrentDisplay(header);
|
||||||
const { width, height } = display.workAreaSize;
|
const { width, height } = display.workAreaSize;
|
||||||
const { x: workAreaX, y: workAreaY } = display.workArea;
|
const { x: workAreaX, y: workAreaY } = display.workArea;
|
||||||
const headerBounds = header.getBounds();
|
|
||||||
const currentBounds = header.getBounds();
|
const currentBounds = header.getBounds();
|
||||||
|
|
||||||
|
const windowSize = {
|
||||||
|
width: currentBounds.width,
|
||||||
|
height: currentBounds.height
|
||||||
|
};
|
||||||
|
|
||||||
let targetX = currentBounds.x;
|
let targetX = currentBounds.x;
|
||||||
let targetY = currentBounds.y;
|
let targetY = currentBounds.y;
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 'left': targetX = workAreaX; break;
|
case 'left':
|
||||||
case 'right': targetX = workAreaX + width - headerBounds.width; break;
|
targetX = workAreaX;
|
||||||
case 'up': targetY = workAreaY; break;
|
break;
|
||||||
case 'down': targetY = workAreaY + height - headerBounds.height; break;
|
case 'right':
|
||||||
|
targetX = workAreaX + width - windowSize.width;
|
||||||
|
break;
|
||||||
|
case 'up':
|
||||||
|
targetY = workAreaY;
|
||||||
|
break;
|
||||||
|
case 'down':
|
||||||
|
targetY = workAreaY + height - windowSize.height;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.headerPosition = { x: currentBounds.x, y: currentBounds.y };
|
header.setBounds({
|
||||||
this.animateToPosition(header, targetX, targetY);
|
x: Math.round(targetX),
|
||||||
|
y: Math.round(targetY),
|
||||||
|
width: windowSize.width,
|
||||||
|
height: windowSize.height
|
||||||
|
});
|
||||||
|
|
||||||
|
this.headerPosition = { x: targetX, y: targetY };
|
||||||
|
this.updateLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
@ -224,4 +256,4 @@ class SmoothMovementManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = SmoothMovementManager;
|
module.exports = SmoothMovementManager;
|
||||||
|
@ -456,6 +456,8 @@ export class SettingsView extends LitElement {
|
|||||||
presets: { type: Array, state: true },
|
presets: { type: Array, state: true },
|
||||||
selectedPreset: { type: Object, state: true },
|
selectedPreset: { type: Object, state: true },
|
||||||
showPresets: { type: Boolean, state: true },
|
showPresets: { type: Boolean, state: true },
|
||||||
|
autoUpdateEnabled: { type: Boolean, state: true },
|
||||||
|
autoUpdateLoading: { type: Boolean, state: true },
|
||||||
};
|
};
|
||||||
//////// after_modelStateService ////////
|
//////// after_modelStateService ////////
|
||||||
|
|
||||||
@ -479,10 +481,48 @@ export class SettingsView extends LitElement {
|
|||||||
this.selectedPreset = null;
|
this.selectedPreset = null;
|
||||||
this.showPresets = false;
|
this.showPresets = false;
|
||||||
this.handleUsePicklesKey = this.handleUsePicklesKey.bind(this)
|
this.handleUsePicklesKey = this.handleUsePicklesKey.bind(this)
|
||||||
|
this.autoUpdateEnabled = true;
|
||||||
|
this.autoUpdateLoading = true;
|
||||||
this.loadInitialData();
|
this.loadInitialData();
|
||||||
//////// after_modelStateService ////////
|
//////// after_modelStateService ////////
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async loadAutoUpdateSetting() {
|
||||||
|
if (!window.require) return;
|
||||||
|
const { ipcRenderer } = window.require('electron');
|
||||||
|
this.autoUpdateLoading = true;
|
||||||
|
try {
|
||||||
|
const enabled = await ipcRenderer.invoke('settings:get-auto-update');
|
||||||
|
this.autoUpdateEnabled = enabled;
|
||||||
|
console.log('Auto-update setting loaded:', enabled);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error loading auto-update setting:', e);
|
||||||
|
this.autoUpdateEnabled = true; // fallback
|
||||||
|
}
|
||||||
|
this.autoUpdateLoading = false;
|
||||||
|
this.requestUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
async handleToggleAutoUpdate() {
|
||||||
|
if (!window.require || this.autoUpdateLoading) return;
|
||||||
|
const { ipcRenderer } = window.require('electron');
|
||||||
|
this.autoUpdateLoading = true;
|
||||||
|
this.requestUpdate();
|
||||||
|
try {
|
||||||
|
const newValue = !this.autoUpdateEnabled;
|
||||||
|
const result = await ipcRenderer.invoke('settings:set-auto-update', newValue);
|
||||||
|
if (result && result.success) {
|
||||||
|
this.autoUpdateEnabled = newValue;
|
||||||
|
} else {
|
||||||
|
console.error('Failed to update auto-update setting');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Error toggling auto-update:', e);
|
||||||
|
}
|
||||||
|
this.autoUpdateLoading = false;
|
||||||
|
this.requestUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
//////// after_modelStateService ////////
|
//////// after_modelStateService ////////
|
||||||
async loadInitialData() {
|
async loadInitialData() {
|
||||||
if (!window.require) return;
|
if (!window.require) return;
|
||||||
@ -617,6 +657,7 @@ export class SettingsView extends LitElement {
|
|||||||
this.setupEventListeners();
|
this.setupEventListeners();
|
||||||
this.setupIpcListeners();
|
this.setupIpcListeners();
|
||||||
this.setupWindowResize();
|
this.setupWindowResize();
|
||||||
|
this.loadAutoUpdateSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
disconnectedCallback() {
|
||||||
@ -648,6 +689,7 @@ export class SettingsView extends LitElement {
|
|||||||
} else {
|
} else {
|
||||||
this.firebaseUser = null;
|
this.firebaseUser = null;
|
||||||
}
|
}
|
||||||
|
this.loadAutoUpdateSetting();
|
||||||
this.requestUpdate();
|
this.requestUpdate();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1161,6 +1203,9 @@ export class SettingsView extends LitElement {
|
|||||||
<button class="settings-button full-width" @click=${this.handlePersonalize}>
|
<button class="settings-button full-width" @click=${this.handlePersonalize}>
|
||||||
<span>Personalize / Meeting Notes</span>
|
<span>Personalize / Meeting Notes</span>
|
||||||
</button>
|
</button>
|
||||||
|
<button class="settings-button full-width" @click=${this.handleToggleAutoUpdate} ?disabled=${this.autoUpdateLoading}>
|
||||||
|
<span>Automatic Updates: ${this.autoUpdateEnabled ? 'On' : 'Off'}</span>
|
||||||
|
</button>
|
||||||
|
|
||||||
<div class="move-buttons">
|
<div class="move-buttons">
|
||||||
<button class="settings-button half-width" @click=${this.handleMoveLeft}>
|
<button class="settings-button half-width" @click=${this.handleMoveLeft}>
|
||||||
|
@ -18,4 +18,6 @@ module.exports = {
|
|||||||
createPreset: (...args) => getRepository().createPreset(...args),
|
createPreset: (...args) => getRepository().createPreset(...args),
|
||||||
updatePreset: (...args) => getRepository().updatePreset(...args),
|
updatePreset: (...args) => getRepository().updatePreset(...args),
|
||||||
deletePreset: (...args) => getRepository().deletePreset(...args),
|
deletePreset: (...args) => getRepository().deletePreset(...args),
|
||||||
|
getAutoUpdate: (...args) => getRepository().getAutoUpdate(...args),
|
||||||
|
setAutoUpdate: (...args) => getRepository().setAutoUpdate(...args),
|
||||||
};
|
};
|
@ -90,10 +90,57 @@ function deletePreset(id, uid) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAutoUpdate(uid) {
|
||||||
|
const db = sqliteClient.getDb();
|
||||||
|
const targetUid = uid;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const row = db.prepare('SELECT auto_update_enabled FROM users WHERE uid = ?').get(targetUid);
|
||||||
|
|
||||||
|
if (row) {
|
||||||
|
console.log('SQLite: Auto update setting found:', row.auto_update_enabled);
|
||||||
|
return row.auto_update_enabled !== 0;
|
||||||
|
} else {
|
||||||
|
// User doesn't exist, create them with default settings
|
||||||
|
const now = Math.floor(Date.now() / 1000);
|
||||||
|
const stmt = db.prepare(
|
||||||
|
'INSERT OR REPLACE INTO users (uid, display_name, email, created_at, auto_update_enabled) VALUES (?, ?, ?, ?, ?)');
|
||||||
|
stmt.run(targetUid, 'User', 'user@example.com', now, 1);
|
||||||
|
return true; // default to enabled
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('SQLite: Error getting auto_update_enabled setting:', error);
|
||||||
|
return true; // fallback to enabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setAutoUpdate(uid, isEnabled) {
|
||||||
|
const db = sqliteClient.getDb();
|
||||||
|
const targetUid = uid || sqliteClient.defaultUserId;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const result = db.prepare('UPDATE users SET auto_update_enabled = ? WHERE uid = ?').run(isEnabled ? 1 : 0, targetUid);
|
||||||
|
|
||||||
|
// If no rows were updated, the user might not exist, so create them
|
||||||
|
if (result.changes === 0) {
|
||||||
|
const now = Math.floor(Date.now() / 1000);
|
||||||
|
const stmt = db.prepare('INSERT OR REPLACE INTO users (uid, display_name, email, created_at, auto_update_enabled) VALUES (?, ?, ?, ?, ?)');
|
||||||
|
stmt.run(targetUid, 'User', 'user@example.com', now, isEnabled ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { success: true };
|
||||||
|
} catch (error) {
|
||||||
|
console.error('SQLite: Error setting auto-update:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getPresets,
|
getPresets,
|
||||||
getPresetTemplates,
|
getPresetTemplates,
|
||||||
createPreset,
|
createPreset,
|
||||||
updatePreset,
|
updatePreset,
|
||||||
deletePreset
|
deletePreset,
|
||||||
|
getAutoUpdate,
|
||||||
|
setAutoUpdate
|
||||||
};
|
};
|
@ -383,6 +383,29 @@ async function updateContentProtection(enabled) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getAutoUpdateSetting() {
|
||||||
|
try {
|
||||||
|
const uid = authService.getCurrentUserId();
|
||||||
|
// This can be awaited if the repository returns a promise.
|
||||||
|
// Assuming it's synchronous for now based on original structure.
|
||||||
|
return settingsRepository.getAutoUpdate(uid);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[SettingsService] Error getting auto update setting:', error);
|
||||||
|
return true; // Fallback to enabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function setAutoUpdateSetting(isEnabled) {
|
||||||
|
try {
|
||||||
|
const uid = authService.getCurrentUserId();
|
||||||
|
await settingsRepository.setAutoUpdate(uid, isEnabled);
|
||||||
|
return { success: true };
|
||||||
|
} catch (error) {
|
||||||
|
console.error('[SettingsService] Error setting auto update setting:', error);
|
||||||
|
return { success: false, error: error.message };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
// cleanup
|
// cleanup
|
||||||
windowNotificationManager.cleanup();
|
windowNotificationManager.cleanup();
|
||||||
@ -428,6 +451,15 @@ function initialize() {
|
|||||||
ipcMain.handle('settings:updateContentProtection', async (event, enabled) => {
|
ipcMain.handle('settings:updateContentProtection', async (event, enabled) => {
|
||||||
return await updateContentProtection(enabled);
|
return await updateContentProtection(enabled);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle('settings:get-auto-update', async () => {
|
||||||
|
return await getAutoUpdateSetting();
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcMain.handle('settings:set-auto-update', async (event, isEnabled) => {
|
||||||
|
console.log('[SettingsService] Setting auto update setting:', isEnabled);
|
||||||
|
return await setAutoUpdateSetting(isEnabled);
|
||||||
|
});
|
||||||
|
|
||||||
console.log('[SettingsService] Initialized and ready.');
|
console.log('[SettingsService] Initialized and ready.');
|
||||||
}
|
}
|
||||||
@ -459,4 +491,5 @@ module.exports = {
|
|||||||
saveApiKey,
|
saveApiKey,
|
||||||
removeApiKey,
|
removeApiKey,
|
||||||
updateContentProtection,
|
updateContentProtection,
|
||||||
|
getAutoUpdateSetting,
|
||||||
};
|
};
|
11
src/index.js
11
src/index.js
@ -26,6 +26,7 @@ const askService = require('./features/ask/askService');
|
|||||||
const settingsService = require('./features/settings/settingsService');
|
const settingsService = require('./features/settings/settingsService');
|
||||||
const sessionRepository = require('./common/repositories/session');
|
const sessionRepository = require('./common/repositories/session');
|
||||||
const ModelStateService = require('./common/services/modelStateService');
|
const ModelStateService = require('./common/services/modelStateService');
|
||||||
|
const sqliteClient = require('./common/services/sqliteClient');
|
||||||
|
|
||||||
const eventBridge = new EventEmitter();
|
const eventBridge = new EventEmitter();
|
||||||
let WEB_PORT = 3000;
|
let WEB_PORT = 3000;
|
||||||
@ -189,7 +190,7 @@ app.whenReady().then(async () => {
|
|||||||
// Clean up zombie sessions from previous runs first
|
// Clean up zombie sessions from previous runs first
|
||||||
sessionRepository.endAllActiveSessions();
|
sessionRepository.endAllActiveSessions();
|
||||||
|
|
||||||
authService.initialize();
|
await authService.initialize();
|
||||||
|
|
||||||
//////// after_modelStateService ////////
|
//////// after_modelStateService ////////
|
||||||
modelStateService.initialize();
|
modelStateService.initialize();
|
||||||
@ -215,6 +216,7 @@ app.whenReady().then(async () => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initAutoUpdater should be called after auth is initialized
|
||||||
initAutoUpdater();
|
initAutoUpdater();
|
||||||
|
|
||||||
// Process any pending deep link after everything is initialized
|
// Process any pending deep link after everything is initialized
|
||||||
@ -651,8 +653,13 @@ async function startWebStack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto-update initialization
|
// Auto-update initialization
|
||||||
function initAutoUpdater() {
|
async function initAutoUpdater() {
|
||||||
try {
|
try {
|
||||||
|
const autoUpdateEnabled = await settingsService.getAutoUpdateSetting();
|
||||||
|
if (!autoUpdateEnabled) {
|
||||||
|
console.log('[AutoUpdater] Skipped because auto-updates are disabled in settings');
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Skip auto-updater in development mode
|
// Skip auto-updater in development mode
|
||||||
if (!app.isPackaged) {
|
if (!app.isPackaged) {
|
||||||
console.log('[AutoUpdater] Skipped in development (app is not packaged)');
|
console.log('[AutoUpdater] Skipped in development (app is not packaged)');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user