feat: build licensed desktop image processor
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
export type OutputFormat = 'file' | 'file-jpg'
|
||||
export type ImageStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'cancelled'
|
||||
|
||||
export interface ImageFileItem {
|
||||
id: string
|
||||
path: string
|
||||
name: string
|
||||
size: number
|
||||
width: number | null
|
||||
height: number | null
|
||||
status: ImageStatus
|
||||
outputPath?: string
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface ProcessOptions {
|
||||
paths: string[]
|
||||
useSourceDirectory: boolean
|
||||
outputDirectory?: string
|
||||
outputFormat: OutputFormat
|
||||
junkSizeMb: number
|
||||
}
|
||||
|
||||
export interface ProcessProgress {
|
||||
current: number
|
||||
total: number
|
||||
percent: number
|
||||
item: ImageFileItem
|
||||
cancelled: boolean
|
||||
}
|
||||
|
||||
export interface ProcessSummary {
|
||||
total: number
|
||||
completed: number
|
||||
failed: number
|
||||
cancelled: boolean
|
||||
}
|
||||
|
||||
export interface VersionInfo {
|
||||
updateAvailable: boolean
|
||||
latestVersion?: string
|
||||
releaseNotes?: string
|
||||
downloadUrl?: string
|
||||
enforce: boolean
|
||||
}
|
||||
|
||||
export interface LicenseSession {
|
||||
token?: string
|
||||
licenseCodeMask: string
|
||||
deviceMask: string
|
||||
expiresAt?: string
|
||||
maxDevices: number
|
||||
version?: VersionInfo
|
||||
}
|
||||
|
||||
export type LicenseStatus = 'checking' | 'unlicensed' | 'active' | 'invalid' | 'network-error'
|
||||
|
||||
export interface LicenseViewState {
|
||||
status: LicenseStatus
|
||||
message: string
|
||||
offline: boolean
|
||||
session?: LicenseSession
|
||||
version?: VersionInfo
|
||||
}
|
||||
|
||||
export interface AppInfo {
|
||||
name: string
|
||||
version: string
|
||||
platform: string
|
||||
deviceName: string
|
||||
}
|
||||
|
||||
export interface DesktopBridge {
|
||||
getAppInfo(): Promise<AppInfo>
|
||||
getLicenseState(): Promise<LicenseViewState>
|
||||
activate(activationCode: string): Promise<LicenseViewState>
|
||||
validateLicense(): Promise<LicenseViewState>
|
||||
clearLicense(): Promise<LicenseViewState>
|
||||
checkVersion(): Promise<VersionInfo>
|
||||
downloadUpdate(downloadUrl: string, latestVersion?: string): Promise<void>
|
||||
selectImages(): Promise<string[]>
|
||||
selectFolder(): Promise<string[]>
|
||||
selectOutputDirectory(): Promise<string | null>
|
||||
pathsForFiles(files: File[]): string[]
|
||||
inspectImages(paths: string[]): Promise<ImageFileItem[]>
|
||||
processImages(options: ProcessOptions): Promise<ProcessSummary>
|
||||
cancelProcessing(): Promise<void>
|
||||
revealItem(filePath: string): Promise<void>
|
||||
onProcessProgress(callback: (progress: ProcessProgress) => void): () => void
|
||||
}
|
||||
Reference in New Issue
Block a user