release/v1.3.3 #10
@@ -99,7 +99,14 @@ const createTray = () => {
|
|||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
mainWindow.focus();
|
mainWindow.focus();
|
||||||
} });
|
} });
|
||||||
updateTrayMenu();
|
// Load initial themed icon
|
||||||
|
const config = store.get('serverConfig');
|
||||||
|
if (config?.theme) {
|
||||||
|
setAppIcon(config.theme);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
updateTrayMenu(); // Fallback to refresh menu
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (e) { }
|
catch (e) { }
|
||||||
};
|
};
|
||||||
@@ -127,6 +134,21 @@ const updateTrayMenu = () => {
|
|||||||
]);
|
]);
|
||||||
tray.setContextMenu(contextMenu);
|
tray.setContextMenu(contextMenu);
|
||||||
};
|
};
|
||||||
|
const setAppIcon = (themeName = 'steam') => {
|
||||||
|
const assetsDir = path_1.default.join(__dirname, '..', 'assets-build', 'icons');
|
||||||
|
const iconPath = path_1.default.join(assetsDir, `${themeName}.svg`);
|
||||||
|
if (!fs_1.default.existsSync(iconPath))
|
||||||
|
return;
|
||||||
|
const icon = electron_1.nativeImage.createFromPath(iconPath);
|
||||||
|
// Update Tray
|
||||||
|
if (tray) {
|
||||||
|
tray.setImage(icon.resize({ width: 16, height: 16 }));
|
||||||
|
}
|
||||||
|
// Update Main Window
|
||||||
|
if (mainWindow) {
|
||||||
|
mainWindow.setIcon(icon);
|
||||||
|
}
|
||||||
|
};
|
||||||
// --- Steam Logic ---
|
// --- Steam Logic ---
|
||||||
const killSteam = async () => {
|
const killSteam = async () => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
@@ -588,6 +610,11 @@ electron_1.ipcMain.handle('admin-delete-user', async (event, userId) => { initBa
|
|||||||
electron_1.ipcMain.handle('admin-get-accounts', async () => { initBackend(); return backend ? await backend.getAdminAccounts() : []; });
|
electron_1.ipcMain.handle('admin-get-accounts', async () => { initBackend(); return backend ? await backend.getAdminAccounts() : []; });
|
||||||
electron_1.ipcMain.handle('admin-remove-account', async (event, steamId) => { initBackend(); if (backend)
|
electron_1.ipcMain.handle('admin-remove-account', async (event, steamId) => { initBackend(); if (backend)
|
||||||
await backend.forceRemoveAccount(steamId); return true; });
|
await backend.forceRemoveAccount(steamId); return true; });
|
||||||
|
electron_1.ipcMain.handle('force-sync', async () => { await syncAccounts(true); return true; });
|
||||||
|
electron_1.ipcMain.handle('update-app-icon', (event, themeName) => {
|
||||||
|
setAppIcon(themeName);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
electron_1.ipcMain.handle('switch-account', async (event, loginName) => {
|
electron_1.ipcMain.handle('switch-account', async (event, loginName) => {
|
||||||
if (!loginName)
|
if (!loginName)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ electron_1.contextBridge.exposeInMainWorld('electronAPI', {
|
|||||||
revokeAccountAccess: (steamId, targetSteamId) => electron_1.ipcRenderer.invoke('revoke-account-access', steamId, targetSteamId),
|
revokeAccountAccess: (steamId, targetSteamId) => electron_1.ipcRenderer.invoke('revoke-account-access', steamId, targetSteamId),
|
||||||
revokeAllAccountAccess: (steamId) => electron_1.ipcRenderer.invoke('revoke-all-account-access', steamId),
|
revokeAllAccountAccess: (steamId) => electron_1.ipcRenderer.invoke('revoke-all-account-access', steamId),
|
||||||
openExternal: (url) => electron_1.ipcRenderer.invoke('open-external', url),
|
openExternal: (url) => electron_1.ipcRenderer.invoke('open-external', url),
|
||||||
|
updateAppIcon: (theme) => electron_1.ipcRenderer.invoke('update-app-icon', theme),
|
||||||
openSteamAppLogin: () => electron_1.ipcRenderer.invoke('open-steam-app-login'),
|
openSteamAppLogin: () => electron_1.ipcRenderer.invoke('open-steam-app-login'),
|
||||||
openSteamLogin: (steamId) => electron_1.ipcRenderer.invoke('open-steam-login', steamId),
|
openSteamLogin: (steamId) => electron_1.ipcRenderer.invoke('open-steam-login', steamId),
|
||||||
// Server Config & Auth
|
// Server Config & Auth
|
||||||
|
|||||||
@@ -32,15 +32,24 @@ export const AppThemeProvider: React.FC<{ children: React.ReactNode }> = ({ chil
|
|||||||
await api.updateServerConfig({ theme });
|
await api.updateServerConfig({ theme });
|
||||||
}
|
}
|
||||||
if (api?.updateAppIcon) {
|
if (api?.updateAppIcon) {
|
||||||
|
try {
|
||||||
await api.updateAppIcon(theme);
|
await api.updateAppIcon(theme);
|
||||||
|
} catch (e) { }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const updateIcon = async () => {
|
||||||
const api = (window as any).electronAPI;
|
const api = (window as any).electronAPI;
|
||||||
if (api?.updateAppIcon && currentTheme) {
|
if (api?.updateAppIcon && currentTheme) {
|
||||||
api.updateAppIcon(currentTheme);
|
try {
|
||||||
|
await api.updateAppIcon(currentTheme);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn("[ThemeContext] updateAppIcon failed (likely not registered yet)");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
updateIcon();
|
||||||
}, [currentTheme]);
|
}, [currentTheme]);
|
||||||
|
|
||||||
const theme = useMemo(() => getTheme(currentTheme), [currentTheme]);
|
const theme = useMemo(() => getTheme(currentTheme), [currentTheme]);
|
||||||
|
|||||||
Reference in New Issue
Block a user