Files
ESH-Media/src/shared/types.ts
eshmeshek 571404ca94 feat: switch to electron-updater for auto-updates
Replaces the custom server-poll updater (which depended on a placeholder
serverUrl 'https://your-server.com/api' and never fired in practice) with
electron-updater. Now a banner appears automatically when a new release is
published — auto-download in background, in-place install via quitAndInstall,
delta updates via blockmap.

Changes:
- Add electron-updater dep, build.publish (provider: generic, placeholder URL)
- Rewrite UpdaterManager around autoUpdater events (available/progress/
  downloaded/error), forwarded to renderer via window.webContents.send
- Drop hardcoded APP_VERSION constant; main uses app.getVersion(), renderer
  fetches via new GET_APP_VERSION IPC channel
- IPC: drop DOWNLOAD_UPDATE (autoDownload handles it), add INSTALL_UPDATE
  + GET_APP_VERSION
- VersionInfo reshaped (currentVersion field, no downloadUrl/mandatory);
  add UpdateProgress and UpdateCheckResult types
- UpdateNotification: 3-phase UI (downloading with progress bar,
  ready with restart-and-install, hidden); App.tsx tracks phase state

TODO before first real release:
- Replace build.publish.url placeholder with the actual generic host
- Bump version, run package:win, upload latest.yml + .exe + .blockmap to host

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 00:13:19 +03:00

133 lines
2.6 KiB
TypeScript

// Site Configuration Types
export interface SiteConfig {
id: string;
name: string;
url: string;
logo: string;
enabled: boolean;
useProxy: boolean;
searchScript: string; // Path to custom search script file
}
export interface ConfigData {
version: string;
lastUpdated: string;
sites: SiteConfig[];
}
// Search Results
export interface SearchResult {
name: string; // Movie/Series name
url: string; // Link to the movie page
image?: string; // Poster image
year?: string;
description?: string;
rating?: string;
}
export interface SearchResultWithSource extends SearchResult {
source: string; // Site ID
sourceName: string; // Site Name
}
// Bookmark Types
export interface Bookmark {
id: string;
title: string;
url: string;
image?: string;
siteId: string;
siteName: string;
createdAt: string;
metadata?: {
year?: string;
description?: string;
rating?: string;
};
}
// Active Tab Types
export interface ActiveTab {
id: string;
title: string;
url: string;
favicon?: string;
isActive: boolean;
createdAt: string;
}
// Version Check Types
export interface VersionInfo {
latestVersion: string;
currentVersion: string;
releaseDate: string;
changelog: string;
}
export interface UpdateProgress {
percent: number;
bytesPerSecond: number;
transferred: number;
total: number;
}
export interface UpdateCheckResult {
updateAvailable: boolean;
latestVersion: string;
}
// Proxy Types
export interface ProxyStatus {
isRunning: boolean;
port?: number;
error?: string;
}
// Settings Types
export interface AppSettings {
configServerUrl: string;
lastConfigUpdate?: string;
proxyAutoStart: boolean;
theme: 'light' | 'dark';
language: 'ru' | 'en';
downloadFolder?: string;
}
// IPC Channels
export enum IPC_CHANNELS {
// Config
GET_CONFIG = 'config:get',
UPDATE_CONFIG = 'config:update',
SAVE_CONFIG = 'config:save',
// Search
SEARCH_ALL_SITES = 'search:all',
SEARCH_SITE = 'search:site',
// Bookmarks
GET_BOOKMARKS = 'bookmarks:get',
ADD_BOOKMARK = 'bookmarks:add',
REMOVE_BOOKMARK = 'bookmarks:remove',
// Tabs
GET_TABS = 'tabs:get',
CREATE_TAB = 'tabs:create',
CLOSE_TAB = 'tabs:close',
ACTIVATE_TAB = 'tabs:activate',
HIDE_ACTIVE_TAB = 'tabs:hide',
// Proxy
GET_PROXY_STATUS = 'proxy:status',
START_PROXY = 'proxy:start',
STOP_PROXY = 'proxy:stop',
// Version
CHECK_VERSION = 'version:check',
INSTALL_UPDATE = 'version:install',
GET_APP_VERSION = 'app:version',
// Settings
GET_SETTINGS = 'settings:get',
SAVE_SETTINGS = 'settings:save',
}