mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-07 19:22:14 +09:00
chore(desktop): upgrade Electron to 44.1.1 (#2430)
This commit is contained in:
@@ -23,7 +23,7 @@ const rpmBuildIdLinkFpmArgs = [
|
||||
'--rpm-rpmbuild-define',
|
||||
'_missing_build_ids_terminate_build 0',
|
||||
];
|
||||
const macOSMinimumSystemVersion = '12.0';
|
||||
const macOSMinimumSystemVersion = '13.0';
|
||||
const isLinuxBuild = process.argv.includes('--linux');
|
||||
const isMacBuild = process.argv.includes('--mac');
|
||||
const isWindowsBuild = process.argv.includes('--win');
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "24.10.9",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260130.1",
|
||||
"electron": "42.10.0",
|
||||
"electron": "44.1.1",
|
||||
"electron-builder": "27.0.0-alpha.7",
|
||||
"electron-builder-squirrel-windows": "27.0.0-alpha.7",
|
||||
"esbuild": "0.27.2",
|
||||
|
||||
@@ -79,7 +79,6 @@ const AUTOSTART_LAUNCH_ARG = '--autostart';
|
||||
interface AutoLaunchConfig {
|
||||
name: string;
|
||||
path: string;
|
||||
isHidden: boolean;
|
||||
args: Array<string>;
|
||||
}
|
||||
|
||||
@@ -152,7 +151,6 @@ function getAutoLaunchConfig(): AutoLaunchConfig {
|
||||
return {
|
||||
name: isWindows ? WINDOWS_APP_USER_MODEL_ID : APP_NAME,
|
||||
path: isWindows ? getWindowsLoginItemPath() : isLinux ? getStableLinuxLaunchPath() : process.execPath,
|
||||
isHidden: false,
|
||||
args: [AUTOSTART_LAUNCH_ARG],
|
||||
};
|
||||
}
|
||||
@@ -174,13 +172,11 @@ function getWindowsAutoLaunchConfigs(): Array<AutoLaunchConfig> {
|
||||
configs.push({
|
||||
name,
|
||||
path: launchPath,
|
||||
isHidden: false,
|
||||
args: [AUTOSTART_LAUNCH_ARG],
|
||||
});
|
||||
configs.push({
|
||||
name,
|
||||
path: launchPath,
|
||||
isHidden: false,
|
||||
args: [],
|
||||
});
|
||||
}
|
||||
@@ -289,7 +285,7 @@ export function isAutostartLaunch(): boolean {
|
||||
}
|
||||
if (isMac) {
|
||||
const settings = app.getLoginItemSettings();
|
||||
return Boolean(settings.wasOpenedAtLogin || settings.wasOpenedAsHidden);
|
||||
return Boolean(settings.wasOpenedAtLogin);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -502,7 +498,6 @@ async function enableAutostart(): Promise<void> {
|
||||
if (isMac) {
|
||||
app.setLoginItemSettings({
|
||||
openAtLogin: true,
|
||||
openAsHidden: config.isHidden,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -383,7 +383,9 @@ function buildTrayMenu(): Menu {
|
||||
label: t('desktop.tray.copyBuildInfo'),
|
||||
click: () => {
|
||||
runTrayMenuAction(() => {
|
||||
clipboard.writeText(trayState.buildInfo ?? '');
|
||||
void clipboard.writeText(trayState.buildInfo ?? '').catch((error) => {
|
||||
logger.error('Failed to copy build info to the clipboard', {error});
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
@@ -342,10 +342,10 @@ export function registerIpcHandlers(): void {
|
||||
}
|
||||
await openExternalDeduped(url);
|
||||
});
|
||||
ipcMain.handle('clipboard-write-text', (_event, text: string): void => {
|
||||
clipboard.writeText(text);
|
||||
ipcMain.handle('clipboard-write-text', async (_event, text: string): Promise<void> => {
|
||||
await clipboard.writeText(text);
|
||||
});
|
||||
ipcMain.handle('clipboard-read-text', (): string => {
|
||||
ipcMain.handle('clipboard-read-text', (): Promise<string> => {
|
||||
return clipboard.readText();
|
||||
});
|
||||
ipcMain.handle('clipboard-write-file', async (event, rawOptions: unknown): Promise<ClipboardWriteFileResult> => {
|
||||
|
||||
@@ -13,7 +13,7 @@ import type {
|
||||
ClipboardWriteFileResult,
|
||||
} from '@electron/common/Types';
|
||||
import {downloadFile} from '@electron/main/FileDownloads';
|
||||
import {app, clipboard} from 'electron';
|
||||
import {app, ClipboardItem, clipboard} from 'electron';
|
||||
|
||||
const requireModule = createRequire(import.meta.url);
|
||||
|
||||
@@ -73,6 +73,8 @@ function loadWinClipboardModule(): WinClipboardModule {
|
||||
|
||||
const logger = createChildLogger('MediaClipboard');
|
||||
const CACHE_DIR_NAME = 'clipboard-media';
|
||||
const WINDOWS_FILE_NAME_W_FORMAT = 'electron application/osclipboard;format="FileNameW"';
|
||||
const GNOME_COPIED_FILES_FORMAT = 'electron application/osclipboard;format="x-special/gnome-copied-files"';
|
||||
const MAX_CACHE_AGE_MS = 24 * 60 * 60 * 1000;
|
||||
const MAX_CACHE_ITEMS = 25;
|
||||
const CACHE_SLOW_TRIM_INTERVAL_MS = 30 * 60 * 1000;
|
||||
@@ -153,7 +155,7 @@ async function writeMacFileReference(filePath: string): Promise<void> {
|
||||
return;
|
||||
}
|
||||
const fileUrl = pathToFileURL(filePath).toString();
|
||||
clipboard.writeText(fileUrl);
|
||||
await clipboard.writeText(fileUrl);
|
||||
}
|
||||
|
||||
async function writeWindowsFileReference(filePath: string): Promise<void> {
|
||||
@@ -168,19 +170,23 @@ async function writeWindowsFileReference(filePath: string): Promise<void> {
|
||||
logger.warn('Native win-clipboard write failed; falling back to FileNameW buffer', {error});
|
||||
}
|
||||
}
|
||||
clipboard.writeBuffer('FileNameW', Buffer.concat([Buffer.from(filePath, 'ucs2'), Buffer.from([0, 0])]));
|
||||
await clipboard.write([
|
||||
new ClipboardItem({
|
||||
[WINDOWS_FILE_NAME_W_FORMAT]: new Blob([Buffer.concat([Buffer.from(filePath, 'ucs2'), Buffer.from([0, 0])])]),
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
function writeLinuxFileReference(filePath: string): void {
|
||||
async function writeLinuxFileReference(filePath: string): Promise<void> {
|
||||
const fileUrl = pathToFileURL(filePath).toString();
|
||||
const desktop = `${process.env.XDG_CURRENT_DESKTOP ?? ''} ${process.env.DESKTOP_SESSION ?? ''}`.toLowerCase();
|
||||
const isGnomeLike =
|
||||
desktop.includes('gnome') || desktop.includes('unity') || desktop.includes('cinnamon') || desktop.includes('xfce');
|
||||
if (isGnomeLike) {
|
||||
clipboard.writeBuffer('x-special/gnome-copied-files', Buffer.from(`copy\n${fileUrl}\n`, 'utf8'));
|
||||
await clipboard.write([new ClipboardItem({[GNOME_COPIED_FILES_FORMAT]: `copy\n${fileUrl}\n`})]);
|
||||
return;
|
||||
}
|
||||
clipboard.writeBuffer('text/uri-list', Buffer.from(`${fileUrl}\n`, 'utf8'));
|
||||
await clipboard.write([new ClipboardItem({'text/uri-list': `${fileUrl}\n`})]);
|
||||
}
|
||||
|
||||
async function writeFileReferenceToClipboard(filePath: string): Promise<void> {
|
||||
@@ -192,7 +198,7 @@ async function writeFileReferenceToClipboard(filePath: string): Promise<void> {
|
||||
await writeWindowsFileReference(filePath);
|
||||
return;
|
||||
case 'linux':
|
||||
writeLinuxFileReference(filePath);
|
||||
await writeLinuxFileReference(filePath);
|
||||
return;
|
||||
default:
|
||||
throw new Error(`Unsupported clipboard file platform: ${process.platform}`);
|
||||
|
||||
Reference in New Issue
Block a user