Compare commits
5 Commits
e4da2510cc
...
e727529b89
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e727529b89 | ||
|
|
786d5428f8 | ||
|
|
f997581c23 | ||
|
|
1333eb40ce | ||
|
|
57be4631f2 |
@@ -42,7 +42,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p dist/builds/linux/${{ matrix.out_dir }}
|
mkdir -p dist/builds/linux/${{ matrix.out_dir }}
|
||||||
npx electron-vite build
|
npx electron-vite build
|
||||||
npx electron-builder --linux --${{ matrix.arch }}
|
npx electron-builder --linux --$ARCH
|
||||||
|
|
||||||
- name: Check if files exist
|
- name: Check if files exist
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
@@ -19,26 +19,6 @@ jobs:
|
|||||||
node-version: '22'
|
node-version: '22'
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
# Кэш npm (тарифы грузятся из ~/.npm-cache на macOS)
|
|
||||||
- name: Cache npm cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: ${{ env.HOME }}/.npm-cache
|
|
||||||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package.json') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-npm-
|
|
||||||
if-no-files-found: ignore
|
|
||||||
# Кэш для electron-builder (Linux)
|
|
||||||
- name: Cache electron-builder (Linux)
|
|
||||||
uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ env.HOME }}/.cache/electron-builder
|
|
||||||
${{ env.HOME }}/.cache/electron
|
|
||||||
key: ${{ runner.os }}-electron-builder-${{ hashFiles('**/electron-builder.yml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-electron-builder-
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
- name: NPM offline setup
|
- name: NPM offline setup
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -103,8 +103,9 @@ export function usePrepareAttachment() {
|
|||||||
const attachment : Attachment = attachments[i];
|
const attachment : Attachment = attachments[i];
|
||||||
if(attachment.type == AttachmentType.CALL){
|
if(attachment.type == AttachmentType.CALL){
|
||||||
/**
|
/**
|
||||||
* Звонок загружать не надо
|
* Звонк загружать не надо, по этому просто отправляем его как есть, там нет blob
|
||||||
*/
|
*/
|
||||||
|
prepared.push(attachment);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(attachment.type == AttachmentType.MESSAGES){
|
if(attachment.type == AttachmentType.MESSAGES){
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
export const APP_VERSION = "1.1.3";
|
export const APP_VERSION = "1.1.4";
|
||||||
export const CORE_MIN_REQUIRED_VERSION = "1.5.3";
|
export const CORE_MIN_REQUIRED_VERSION = "1.5.4";
|
||||||
|
|
||||||
export const RELEASE_NOTICE = `
|
export const RELEASE_NOTICE = `
|
||||||
**Обновление v1.1.3** :emoji_1f631:
|
**Обновление v1.1.4** :emoji_1f631:
|
||||||
- Улучшено отображение вложения звонка
|
- Улучшено отображение звонка
|
||||||
- Теперь unicode emoji отображаются корректно
|
- Убрана возможность зума в окне приложения
|
||||||
`;
|
`;
|
||||||
@@ -33,7 +33,7 @@ export function createAppWindow(preloaderWindow?: BrowserWindow): void {
|
|||||||
minWidth: 385,
|
minWidth: 385,
|
||||||
minHeight: 555,
|
minHeight: 555,
|
||||||
show: false,
|
show: false,
|
||||||
title: 'Rosetta Messager',
|
title: 'Rosetta Messager',
|
||||||
icon: join(__dirname, '../../resources/R.png'),
|
icon: join(__dirname, '../../resources/R.png'),
|
||||||
frame: false,
|
frame: false,
|
||||||
autoHideMenuBar: true,
|
autoHideMenuBar: true,
|
||||||
@@ -92,7 +92,7 @@ export function foundationIpcRegistration(mainWindow: BrowserWindow) {
|
|||||||
ipcMain.removeHandler('window-priority-normal');
|
ipcMain.removeHandler('window-priority-normal');
|
||||||
|
|
||||||
ipcMain.handle('window-top', () => {
|
ipcMain.handle('window-top', () => {
|
||||||
if (mainWindow.isMinimized()){
|
if (mainWindow.isMinimized()) {
|
||||||
mainWindow.restore();
|
mainWindow.restore();
|
||||||
}
|
}
|
||||||
mainWindow.setAlwaysOnTop(true, "screen-saver"); // самый высокий уровень
|
mainWindow.setAlwaysOnTop(true, "screen-saver"); // самый высокий уровень
|
||||||
@@ -112,7 +112,7 @@ export function foundationIpcRegistration(mainWindow: BrowserWindow) {
|
|||||||
ipcMain.handle('window-priority-normal', () => {
|
ipcMain.handle('window-priority-normal', () => {
|
||||||
mainWindow.setAlwaysOnTop(false);
|
mainWindow.setAlwaysOnTop(false);
|
||||||
mainWindow.setVisibleOnAllWorkspaces(false);
|
mainWindow.setVisibleOnAllWorkspaces(false);
|
||||||
if(process.platform === "darwin" && bounceId !== null){
|
if (process.platform === "darwin" && bounceId !== null) {
|
||||||
/**
|
/**
|
||||||
* Только в macos! Отмена подпрыгивания иконки в Dock
|
* Только в macos! Отмена подпрыгивания иконки в Dock
|
||||||
*/
|
*/
|
||||||
|
|||||||
152
lib/main/main.ts
152
lib/main/main.ts
@@ -1,4 +1,4 @@
|
|||||||
import { app, BrowserWindow, Menu, nativeImage } from 'electron'
|
import { app, BrowserWindow, Menu, Tray, nativeImage } from 'electron'
|
||||||
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
import { electronApp, optimizer } from '@electron-toolkit/utils'
|
||||||
import { createAppWindow, startApplication } from './app'
|
import { createAppWindow, startApplication } from './app'
|
||||||
import './ipcs/ipcDatabase'
|
import './ipcs/ipcDatabase'
|
||||||
@@ -9,96 +9,118 @@ import './ipcs/ipcNotification'
|
|||||||
import './ipcs/ipcDevice'
|
import './ipcs/ipcDevice'
|
||||||
import './ipcs/ipcCore'
|
import './ipcs/ipcCore'
|
||||||
import './ipcs/ipcRuntime'
|
import './ipcs/ipcRuntime'
|
||||||
import { Tray } from 'electron/main'
|
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { Logger } from './logger'
|
import { Logger } from './logger'
|
||||||
|
|
||||||
let lockInstance = app.requestSingleInstanceLock();
|
const lockInstance = app.requestSingleInstanceLock()
|
||||||
let tray : Tray | null = null;
|
let tray: Tray | null = null
|
||||||
const size = process.platform === 'darwin' ? 18 : 22;
|
const size = process.platform === 'darwin' ? 18 : 22
|
||||||
const logger = Logger('main');
|
const logger = Logger('main')
|
||||||
|
|
||||||
|
const icon = nativeImage
|
||||||
|
.createFromPath(join(__dirname, '../../resources/R.png'))
|
||||||
|
.resize({ width: size, height: size })
|
||||||
|
|
||||||
const icon = nativeImage.createFromPath(
|
if (!lockInstance) {
|
||||||
join(__dirname, '../../resources/R.png')
|
app.quit()
|
||||||
).resize({ width: size, height: size });
|
process.exit(0)
|
||||||
|
|
||||||
if(!lockInstance){
|
|
||||||
app.quit();
|
|
||||||
process.exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process.on('unhandledRejection', (reason) => {
|
process.on('unhandledRejection', (reason) => {
|
||||||
logger.log(`main thread error, reason: ${reason}`);
|
logger.log(`main thread error, reason: ${reason}`)
|
||||||
});
|
})
|
||||||
|
|
||||||
app.disableHardwareAcceleration();
|
app.disableHardwareAcceleration()
|
||||||
|
|
||||||
app.on('second-instance', () => {
|
app.on('second-instance', () => {
|
||||||
// Someone tried to run a second instance, we should focus our window.
|
const allWindows = BrowserWindow.getAllWindows()
|
||||||
const allWindows = BrowserWindow.getAllWindows();
|
|
||||||
if (allWindows.length) {
|
if (allWindows.length) {
|
||||||
const mainWindow = allWindows[0];
|
const mainWindow = allWindows[0]
|
||||||
if (mainWindow.isMinimized()) mainWindow.restore();
|
if (mainWindow.isMinimized()) mainWindow.restore()
|
||||||
if (mainWindow.isVisible() === false) mainWindow.show();
|
if (!mainWindow.isVisible()) mainWindow.show()
|
||||||
mainWindow.focus();
|
mainWindow.focus()
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
|
|
||||||
export const restoreApplicationAfterClickOnTrayOrDock = () => {
|
export const restoreApplicationAfterClickOnTrayOrDock = () => {
|
||||||
const allWindows = BrowserWindow.getAllWindows();
|
const allWindows = BrowserWindow.getAllWindows()
|
||||||
if (allWindows.length > 0) {
|
if (allWindows.length > 0) {
|
||||||
const mainWindow = allWindows[0];
|
const mainWindow = allWindows[0]
|
||||||
if (mainWindow.isMinimized()){
|
if (mainWindow.isMinimized()) {
|
||||||
mainWindow.restore();
|
mainWindow.restore()
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
if(mainWindow.isVisible() === false){
|
if (!mainWindow.isVisible()) {
|
||||||
mainWindow.show();
|
mainWindow.show()
|
||||||
}
|
}
|
||||||
mainWindow.focus();
|
mainWindow.focus()
|
||||||
} else {
|
} else {
|
||||||
createAppWindow();
|
createAppWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Menu.setApplicationMenu(null);
|
|
||||||
// This method will be called when Electron has finished
|
|
||||||
// initialization and is ready to create browser windows.
|
|
||||||
// Some APIs can only be used after this event occurs.
|
|
||||||
app.whenReady().then(async () => {
|
app.whenReady().then(async () => {
|
||||||
electronApp.setAppUserModelId('Rosetta');
|
electronApp.setAppUserModelId('Rosetta')
|
||||||
tray = new Tray(icon);
|
|
||||||
|
// Убираем File/View и оставляем только app + минимальный Edit (roles)
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
const minimalMenu = Menu.buildFromTemplate([
|
||||||
|
{
|
||||||
|
label: app.name,
|
||||||
|
submenu: [
|
||||||
|
{ role: 'about' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'hide' },
|
||||||
|
{ role: 'hideOthers' },
|
||||||
|
{ role: 'unhide' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'quit' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Edit',
|
||||||
|
submenu: [
|
||||||
|
{ role: 'undo' },
|
||||||
|
{ role: 'redo' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'cut' },
|
||||||
|
{ role: 'copy' },
|
||||||
|
{ role: 'paste' },
|
||||||
|
{ role: 'pasteAndMatchStyle' },
|
||||||
|
{ role: 'delete' },
|
||||||
|
{ role: 'selectAll' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
Menu.setApplicationMenu(minimalMenu)
|
||||||
|
} else {
|
||||||
|
Menu.setApplicationMenu(null)
|
||||||
|
}
|
||||||
|
|
||||||
|
tray = new Tray(icon)
|
||||||
const contextMenu = Menu.buildFromTemplate([
|
const contextMenu = Menu.buildFromTemplate([
|
||||||
{ label: 'Open App', click: () => restoreApplicationAfterClickOnTrayOrDock() },
|
{ label: 'Open App', click: () => restoreApplicationAfterClickOnTrayOrDock() },
|
||||||
{ label: 'Quit', click: () => app.quit() }
|
{ label: 'Quit', click: () => app.quit() }
|
||||||
]);
|
])
|
||||||
tray.setContextMenu(contextMenu);
|
tray.setContextMenu(contextMenu)
|
||||||
tray.setToolTip('Rosetta');
|
tray.setToolTip('Rosetta')
|
||||||
tray.on('click', () => {
|
tray.on('click', () => {
|
||||||
restoreApplicationAfterClickOnTrayOrDock();
|
restoreApplicationAfterClickOnTrayOrDock()
|
||||||
});
|
})
|
||||||
startApplication();
|
|
||||||
|
startApplication()
|
||||||
|
|
||||||
// Default open or close DevTools by F12 in development
|
|
||||||
// and ignore CommandOrControl + R in production.
|
|
||||||
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
|
|
||||||
app.on('browser-window-created', (_, window) => {
|
app.on('browser-window-created', (_, window) => {
|
||||||
optimizer.watchWindowShortcuts(window)
|
optimizer.watchWindowShortcuts(window)
|
||||||
})
|
})
|
||||||
|
|
||||||
app.on('activate', function () {
|
app.on('activate', () => {
|
||||||
restoreApplicationAfterClickOnTrayOrDock();
|
restoreApplicationAfterClickOnTrayOrDock()
|
||||||
});
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// Quit when all windows are closed, except on macOS. There, it's common
|
|
||||||
// for applications and their menu bar to stay active until the user quits
|
|
||||||
// explicitly with Cmd + Q.
|
|
||||||
app.on('window-all-closed', () => {
|
app.on('window-all-closed', () => {
|
||||||
if (process.platform == 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
app.hide();
|
app.hide()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// In this file, you can include the rest of your app's specific main process
|
|
||||||
// code. You can also put them in separate files and import them here.
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Rosetta",
|
"name": "Rosetta",
|
||||||
"version": "1.5.3",
|
"version": "1.5.4",
|
||||||
"description": "Rosetta Messenger",
|
"description": "Rosetta Messenger",
|
||||||
"main": "./out/main/main.js",
|
"main": "./out/main/main.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
Reference in New Issue
Block a user