Backend moved to a separate repository

This commit is contained in:
2026-07-14 09:59:03 +03:00
Unverified
parent 1cc5294d52
commit 5f9d9a78d3
340 changed files with 198 additions and 21988 deletions
+25
View File
@@ -0,0 +1,25 @@
export type Platform = "win32" | "darwin" | "linux"
export interface NotificationShowOptions {
title: string;
body: string;
icon?: string;
tag?: string;
}
export interface ElectronNotifications {
requestPermission: () => Promise<NotificationPermission>;
show: (options: NotificationShowOptions) => Promise<boolean>;
}
export interface ElectronInterface {
desktop: true,
platform: Platform,
notifications: ElectronNotifications
}
declare global {
interface Window {
electronInterface: ElectronInterface
}
}
+45
View File
@@ -0,0 +1,45 @@
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';
import type { ForgeConfig } from '@electron-forge/shared-types';
export default {
packagerConfig: {
asar: true,
},
outDir: "build/electron/forge",
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-zip',
config: {},
platforms: ['win32', 'darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
platforms: ['linux'],
},
{
name: '@electron-forge/maker-rpm',
config: {},
platforms: ['linux'],
},
],
plugins: [
{
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
} satisfies ForgeConfig;
+65
View File
@@ -0,0 +1,65 @@
import { app, BrowserWindow, Notification, ipcMain } from 'electron';
import path from "path";
import type { NotificationShowOptions } from "./electron.d.ts";
let mainWindow: BrowserWindow | null = null;
app.whenReady().then(() => {
mainWindow = new BrowserWindow({
title: 'Main window',
minWidth: 800,
minHeight: 420,
webPreferences: {
preload: path.join(import.meta.dirname, "preload.mjs")
},
titleBarStyle: "hidden",
trafficLightPosition: {
x: 16 - 4,
y: 16 - 4
},
titleBarOverlay: process.platform !== "darwin"
});
if (process.env.VITE_DEV_SERVER_URL) {
mainWindow.loadURL(process.env.VITE_DEV_SERVER_URL);
} else {
mainWindow.loadFile('build/electron/dist/index.html');
}
// Handle notification permission requests
ipcMain.handle('request-notification-permission', async () => {
if (Notification.isSupported()) {
return 'granted';
}
return 'denied';
});
// Handle showing notifications
ipcMain.handle("show-notification", async (_event, options: NotificationShowOptions) => {
if (Notification.isSupported()) {
try {
const notification = new Notification({
title: options.title,
body: options.body,
icon: options.icon,
silent: false,
urgency: 'normal'
});
notification.on('click', () => {
if (mainWindow) {
mainWindow.show();
mainWindow.focus();
}
});
notification.show();
return true;
} catch (error) {
console.error('Error creating notification:', error);
return false;
}
}
return false;
});
});
+11
View File
@@ -0,0 +1,11 @@
import { contextBridge, ipcRenderer } from "electron";
import type { ElectronInterface, NotificationShowOptions, Platform } from "./electron.d.ts";
contextBridge.exposeInMainWorld("electronInterface", {
desktop: true,
platform: process.platform as Platform,
notifications: {
requestPermission: () => ipcRenderer.invoke("request-notification-permission"),
show: (options: NotificationShowOptions) => ipcRenderer.invoke("show-notification", options)
}
} satisfies ElectronInterface);