Add auto updater
This commit is contained in:
@@ -10,7 +10,11 @@ import * as fs from 'fs';
|
||||
import * as fsp from 'fs/promises';
|
||||
import * as path from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { getDesktopSettingsSnapshot, updateDesktopSettings } from '../desktop-settings';
|
||||
import {
|
||||
getDesktopSettingsSnapshot,
|
||||
updateDesktopSettings,
|
||||
type DesktopSettings
|
||||
} from '../desktop-settings';
|
||||
import {
|
||||
activateLinuxScreenShareAudioRouting,
|
||||
deactivateLinuxScreenShareAudioRouting,
|
||||
@@ -18,6 +22,14 @@ import {
|
||||
startLinuxScreenShareMonitorCapture,
|
||||
stopLinuxScreenShareMonitorCapture
|
||||
} from '../audio/linux-screen-share-routing';
|
||||
import {
|
||||
checkForDesktopUpdates,
|
||||
configureDesktopUpdaterContext,
|
||||
getDesktopUpdateState,
|
||||
handleDesktopSettingsChanged,
|
||||
restartToApplyUpdate,
|
||||
type DesktopUpdateServerContext
|
||||
} from '../update/desktop-updater';
|
||||
|
||||
const DEFAULT_MIME_TYPE = 'application/octet-stream';
|
||||
const FILE_CLIPBOARD_FORMATS = [
|
||||
@@ -79,14 +91,16 @@ function isSupportedClipboardFileFormat(format: string): boolean {
|
||||
|
||||
function extractClipboardFilePaths(buffer: Buffer, format: string): string[] {
|
||||
const textVariants = new Set<string>();
|
||||
const utf8Text = buffer.toString('utf8').replace(/\0/g, '').trim();
|
||||
const utf8Text = buffer.toString('utf8').replace(/\0/g, '')
|
||||
.trim();
|
||||
|
||||
if (utf8Text) {
|
||||
textVariants.add(utf8Text);
|
||||
}
|
||||
|
||||
if (format.toLowerCase() === 'filenamew') {
|
||||
const utf16Text = buffer.toString('utf16le').replace(/\0/g, '\n').trim();
|
||||
const utf16Text = buffer.toString('utf16le').replace(/\0/g, '\n')
|
||||
.trim();
|
||||
|
||||
if (utf16Text) {
|
||||
textVariants.add(utf16Text);
|
||||
@@ -226,8 +240,23 @@ export function setupSystemHandlers(): void {
|
||||
|
||||
ipcMain.handle('get-desktop-settings', () => getDesktopSettingsSnapshot());
|
||||
|
||||
ipcMain.handle('set-desktop-settings', (_event, patch: { hardwareAcceleration?: boolean }) => {
|
||||
return updateDesktopSettings(patch);
|
||||
ipcMain.handle('get-auto-update-state', () => getDesktopUpdateState());
|
||||
|
||||
ipcMain.handle('configure-auto-update-context', async (_event, context: Partial<DesktopUpdateServerContext>) => {
|
||||
return await configureDesktopUpdaterContext(context);
|
||||
});
|
||||
|
||||
ipcMain.handle('check-for-app-updates', async () => {
|
||||
return await checkForDesktopUpdates();
|
||||
});
|
||||
|
||||
ipcMain.handle('restart-to-apply-update', () => restartToApplyUpdate());
|
||||
|
||||
ipcMain.handle('set-desktop-settings', async (_event, patch: Partial<DesktopSettings>) => {
|
||||
const snapshot = updateDesktopSettings(patch);
|
||||
|
||||
await handleDesktopSettingsChanged();
|
||||
return snapshot;
|
||||
});
|
||||
|
||||
ipcMain.handle('relaunch-app', () => {
|
||||
|
||||
Reference in New Issue
Block a user