mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
chore(repo): prune dead code and duplicate abstractions (#3413)
This commit is contained in:
1 parent
c17091768c
commit
c9fdf8fead
2937 files changed
+42233
-176793
No files matched your search
@@ -0,0 +1,394 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
export interface LinuxAppearanceSnapshot {
|
||||
colorScheme: 'no-preference' | 'prefer-dark' | 'prefer-light';
|
||||
contrast: 'no-preference' | 'high';
|
||||
accent: {r: number; g: number; b: number} | null;
|
||||
}
|
||||
|
||||
export interface ChromiumRuntimeInfo {
|
||||
enableFeatures: Array<string>;
|
||||
disableFeatures: Array<string>;
|
||||
switches: Array<string>;
|
||||
}
|
||||
|
||||
export interface GpuDeviceInfo {
|
||||
active: boolean;
|
||||
vendorId: number;
|
||||
deviceId: number;
|
||||
vendorName?: string;
|
||||
deviceString?: string;
|
||||
driverVendor?: string;
|
||||
driverVersion?: string;
|
||||
dedicatedVideoMemory?: number;
|
||||
sharedSystemMemory?: number;
|
||||
subsystemVendorId?: number;
|
||||
subsystemDeviceId?: number;
|
||||
registryId?: string;
|
||||
adapterLuid?: string;
|
||||
pciPath?: string;
|
||||
integrated?: boolean;
|
||||
removable?: boolean;
|
||||
headless?: boolean;
|
||||
source?: 'metal' | 'dxgi' | 'linux-sysfs' | 'electron';
|
||||
}
|
||||
|
||||
export interface GpuInfo {
|
||||
devices: ReadonlyArray<GpuDeviceInfo>;
|
||||
glRenderer?: string;
|
||||
glVendor?: string;
|
||||
machineModelName?: string;
|
||||
machineModelVersion?: string;
|
||||
nativeSource?: 'metal' | 'dxgi' | 'linux-sysfs';
|
||||
}
|
||||
|
||||
export type StreamingPriorityDiagnostics = Record<string, unknown>;
|
||||
|
||||
export interface CpuInfo {
|
||||
model: string;
|
||||
speed: number;
|
||||
cores: number;
|
||||
physicalCores: number;
|
||||
}
|
||||
|
||||
export interface ProcessMetrics {
|
||||
cpu: {
|
||||
percentCPUUsage: number;
|
||||
};
|
||||
memory: {
|
||||
workingSetSize: number;
|
||||
peakWorkingSetSize: number;
|
||||
privateBytes?: number;
|
||||
};
|
||||
pid: number;
|
||||
type: string;
|
||||
name?: string;
|
||||
}
|
||||
|
||||
export interface AppMetricsSnapshot {
|
||||
cpuInfo: CpuInfo;
|
||||
processes: Array<ProcessMetrics>;
|
||||
totalMemoryMB: number;
|
||||
freeMemoryMB: number;
|
||||
}
|
||||
|
||||
export interface ThemeLocalFileReference {
|
||||
id: string;
|
||||
name: string;
|
||||
path: string;
|
||||
mimeType: string;
|
||||
size: number;
|
||||
}
|
||||
|
||||
export interface ThemeLocalFileReadResult {
|
||||
path: string;
|
||||
dataUrl?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface ThemeDirectoryCssFile {
|
||||
fileName: string;
|
||||
path: string;
|
||||
css: string;
|
||||
}
|
||||
|
||||
export type ThemeLinkedFileError = 'not_allowed' | 'missing' | 'not_file' | 'too_large' | 'too_many' | 'read_failed';
|
||||
|
||||
export interface ThemeLinkedFileChange {
|
||||
path: string;
|
||||
css?: string;
|
||||
error?: ThemeLinkedFileError;
|
||||
}
|
||||
|
||||
export type VoiceBackgroundMediaKind = 'static' | 'animated' | 'video';
|
||||
|
||||
export interface VoiceBackgroundMediaCacheRequest {
|
||||
id: string;
|
||||
mimeType: string;
|
||||
fileName?: string;
|
||||
data: ArrayBuffer;
|
||||
}
|
||||
|
||||
export interface VoiceBackgroundMediaCacheResult {
|
||||
path: string;
|
||||
mediaKind: VoiceBackgroundMediaKind;
|
||||
}
|
||||
|
||||
export interface VoiceBackgroundMediaReadResult {
|
||||
path: string;
|
||||
mediaKind: VoiceBackgroundMediaKind;
|
||||
dataUrl: string;
|
||||
}
|
||||
|
||||
export interface DesktopTroubleshootingSettings {
|
||||
disableHardwareAcceleration: boolean;
|
||||
}
|
||||
|
||||
export interface SetDesktopTroubleshootingDisableHardwareAccelerationOptions {
|
||||
disable: boolean;
|
||||
restart?: boolean;
|
||||
}
|
||||
|
||||
export interface DesktopVoiceDebugEventSinkEntry {
|
||||
sequence: number;
|
||||
line: string;
|
||||
}
|
||||
|
||||
export type ClipboardWriteFileMediaType = 'image' | 'gif' | 'video' | 'audio';
|
||||
|
||||
export interface ClipboardWriteFileOptions {
|
||||
url: string;
|
||||
suggestedName?: string;
|
||||
mediaType: ClipboardWriteFileMediaType;
|
||||
}
|
||||
|
||||
export interface ClipboardWriteFileResult {
|
||||
success: boolean;
|
||||
path?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export type UpdaterDownloadFormat = 'setup' | 'dmg' | 'zip' | 'appimage' | 'deb' | 'rpm' | 'tar_gz';
|
||||
|
||||
export interface UpdaterDownloadOption {
|
||||
format: UpdaterDownloadFormat;
|
||||
label: string;
|
||||
url: string;
|
||||
suggestedName?: string;
|
||||
sha256?: string | null;
|
||||
}
|
||||
|
||||
export type MediaAccessType = 'microphone' | 'camera' | 'screen' | 'audio-capture';
|
||||
|
||||
export type MediaAccessStatus = 'granted' | 'denied' | 'not-determined' | 'restricted' | 'unknown';
|
||||
|
||||
export type InputMonitoringPermissionStatus = 'granted' | 'denied' | 'not-determined' | 'unsupported';
|
||||
|
||||
export type VirtmicBackend = 'pipewire';
|
||||
|
||||
export type VirtmicNode = Record<string, string>;
|
||||
|
||||
export interface VirtmicLinkOptions {
|
||||
ignoreDevices?: boolean;
|
||||
ignoreInputMedia?: boolean;
|
||||
ignoreVirtual?: boolean;
|
||||
workaround?: boolean;
|
||||
}
|
||||
|
||||
export type NativeAudioBackend = 'macos-sck' | 'macos-coreaudio' | 'windows-wasapi-loopback' | 'linux-pipewire';
|
||||
|
||||
export interface NativeAudioAvailability {
|
||||
available: boolean;
|
||||
backend?: NativeAudioBackend;
|
||||
capabilities?: {
|
||||
process: boolean;
|
||||
system: boolean;
|
||||
systemExcludesSelf?: boolean;
|
||||
processInclude?: boolean;
|
||||
processExclude?: boolean;
|
||||
sessionMixer?: boolean;
|
||||
systemLoopbackMode?: 'process-exclude' | 'session-mixer' | 'unavailable';
|
||||
};
|
||||
reason?:
|
||||
| 'unsupported-platform'
|
||||
| 'addon-not-installed'
|
||||
| 'load-failed'
|
||||
| 'os-version-too-old'
|
||||
| 'permission-denied'
|
||||
| 'no-pipewire'
|
||||
| 'disabled-by-launch';
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
export interface NativeAudioApplication {
|
||||
pid: number;
|
||||
identifier: string;
|
||||
name: string;
|
||||
audible?: boolean;
|
||||
}
|
||||
|
||||
export interface NativeAudioStartOptions {
|
||||
targetPid?: number;
|
||||
includeProcessTree?: boolean;
|
||||
macBackend?: 'sck' | 'coreaudio' | 'auto';
|
||||
macCaptureScope?: 'process' | 'system';
|
||||
winCaptureScope?: 'process' | 'system' | 'session-mixer';
|
||||
linuxRule?: VirtmicLinkOptions & {
|
||||
include?: Array<VirtmicNode>;
|
||||
exclude?: Array<VirtmicNode>;
|
||||
onlySpeakers?: boolean;
|
||||
onlyDefaultSpeakers?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface NativeAudioStartResult {
|
||||
captureId: string;
|
||||
sampleRate: number;
|
||||
channels: number;
|
||||
}
|
||||
|
||||
export interface NativeAudioFrameMessage {
|
||||
captureId: string;
|
||||
sampleRate: number;
|
||||
channels: number;
|
||||
timestampUs: number;
|
||||
samples: ArrayBuffer;
|
||||
}
|
||||
|
||||
export type NativeAudioEndReason = 'stopped' | 'target-exited' | 'addon-error';
|
||||
|
||||
export interface NativeAudioEndMessage {
|
||||
captureId: string;
|
||||
reason: NativeAudioEndReason;
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
export type NativeScreenCaptureLifecycleEventKind = 'error' | 'closed' | 'closed-clean' | 'stalled' | 'diagnostic';
|
||||
|
||||
export type NativeScreenCaptureLifecycleSource = 'delegate' | 'programmatic';
|
||||
|
||||
export interface NativeScreenCaptureLifecycleMessage {
|
||||
captureId: string;
|
||||
kind: NativeScreenCaptureLifecycleEventKind;
|
||||
message: string;
|
||||
source?: NativeScreenCaptureLifecycleSource;
|
||||
}
|
||||
|
||||
export type DisplayMediaPortalSurfacePreference = 'window' | 'monitor';
|
||||
|
||||
export interface StreamerModeCaptureProcess {
|
||||
name: string;
|
||||
pid?: number;
|
||||
}
|
||||
|
||||
export interface StreamerModeCaptureAppStatus {
|
||||
detected: boolean;
|
||||
processes: Array<StreamerModeCaptureProcess>;
|
||||
}
|
||||
|
||||
export type TrayPresenceStatus = 'online' | 'idle' | 'dnd' | 'invisible';
|
||||
|
||||
export interface TrayRuntimeStatePayload {
|
||||
voiceConnected: boolean;
|
||||
voiceChannelLabel: string | null;
|
||||
selfMute: boolean;
|
||||
selfDeaf: boolean;
|
||||
presenceStatus: TrayPresenceStatus | null;
|
||||
buildInfo: string | null;
|
||||
}
|
||||
|
||||
export type GlobalShortcutsBackend = 'portal' | 'x11' | 'evdev' | 'windows' | 'macos' | 'none';
|
||||
|
||||
export type GlobalShortcutsPortalState =
|
||||
| 'unknown'
|
||||
| 'probing'
|
||||
| 'unsupported'
|
||||
| 'not-set-up'
|
||||
| 'binding'
|
||||
| 'bound'
|
||||
| 'declined'
|
||||
| 'error';
|
||||
|
||||
export interface GlobalShortcutsPortalShortcut {
|
||||
action: string;
|
||||
triggerDescription: string | null;
|
||||
}
|
||||
|
||||
export interface GlobalShortcutCombo {
|
||||
code?: string;
|
||||
key: string;
|
||||
ctrl: boolean;
|
||||
alt: boolean;
|
||||
shift: boolean;
|
||||
meta: boolean;
|
||||
mouseButton?: number;
|
||||
modifierOnly?: boolean;
|
||||
bothSides?: boolean;
|
||||
}
|
||||
|
||||
export interface GlobalShortcutBinding {
|
||||
sourceId: string;
|
||||
action: string;
|
||||
combo: GlobalShortcutCombo;
|
||||
}
|
||||
|
||||
export interface GlobalShortcutActionDefinition {
|
||||
action: string;
|
||||
description: string;
|
||||
preferredCombo: GlobalShortcutCombo | null;
|
||||
}
|
||||
|
||||
export interface GlobalShortcutsSyncPayload {
|
||||
bindings: Array<GlobalShortcutBinding>;
|
||||
actions: Array<GlobalShortcutActionDefinition>;
|
||||
}
|
||||
|
||||
export interface GlobalShortcutEvent {
|
||||
action: string;
|
||||
sourceId: string;
|
||||
phase: 'press' | 'release';
|
||||
}
|
||||
|
||||
export interface GlobalShortcutCaptureEvent {
|
||||
type: 'keydown' | 'keyup' | 'mousedown' | 'mouseup';
|
||||
code: string | null;
|
||||
key: string | null;
|
||||
button: number | null;
|
||||
ctrl: boolean;
|
||||
alt: boolean;
|
||||
shift: boolean;
|
||||
meta: boolean;
|
||||
}
|
||||
|
||||
export interface GlobalKeyHookRegisterOptions {
|
||||
id: string;
|
||||
description?: string;
|
||||
keycode?: number;
|
||||
keyName?: string;
|
||||
physicalKeyName?: string;
|
||||
mouseButton?: number;
|
||||
ctrl?: boolean;
|
||||
alt?: boolean;
|
||||
shift?: boolean;
|
||||
meta?: boolean;
|
||||
}
|
||||
|
||||
export interface GlobalKeyEvent {
|
||||
type: 'keydown' | 'keyup';
|
||||
keycode: number;
|
||||
keyName: string;
|
||||
backend?: 'evdev' | 'native' | null;
|
||||
altKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
shiftKey: boolean;
|
||||
metaKey: boolean;
|
||||
}
|
||||
|
||||
export interface GlobalMouseEvent {
|
||||
type: 'mousedown' | 'mouseup';
|
||||
button: number;
|
||||
altKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
shiftKey: boolean;
|
||||
metaKey: boolean;
|
||||
}
|
||||
|
||||
export interface GlobalKeybindTriggeredEvent {
|
||||
id: string;
|
||||
type: 'keydown' | 'keyup';
|
||||
}
|
||||
|
||||
export type SpellcheckEngine = 'auto' | 'hunspell' | 'system';
|
||||
|
||||
export interface SpellcheckBundledDictionary {
|
||||
tag: string;
|
||||
package: string;
|
||||
displayName: string;
|
||||
nativeName: string;
|
||||
}
|
||||
|
||||
export interface SpellcheckResolvedEngineInfo {
|
||||
mode: 'hunspell' | 'system' | 'off';
|
||||
hunspellLangs: Array<string>;
|
||||
systemLangs: Array<string>;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
export function formatReleaseChannelLabel(value: string): string {
|
||||
const normalized = value.trim().toLowerCase();
|
||||
return normalized.charAt(0).toUpperCase() + normalized.slice(1);
|
||||
}
|
||||
|
||||
export const ARCHITECTURE_PATTERNS: ReadonlyArray<{
|
||||
pattern: RegExp;
|
||||
label: string;
|
||||
}> = [
|
||||
{pattern: /\barm64\b|\baarch64\b|\barmv8\b|\barm64e\b/i, label: 'arm64'},
|
||||
{pattern: /\barm\b|\barmv7\b|\barmv6\b/i, label: 'arm'},
|
||||
{pattern: /MacIntel/i, label: 'x64'},
|
||||
{pattern: /\bx86_64\b|\bx64\b|\bamd64\b|\bwin64\b|\bwow64\b/i, label: 'x64'},
|
||||
{pattern: /\bx86\b|\bi[3-6]86\b/i, label: 'x86'},
|
||||
];
|
||||
|
||||
export function normalizeArchitectureValue(value: string | null | undefined): string | undefined {
|
||||
if (!value) {
|
||||
return undefined;
|
||||
}
|
||||
const trimmed = value.trim();
|
||||
for (const entry of ARCHITECTURE_PATTERNS) {
|
||||
if (entry.pattern.test(trimmed)) {
|
||||
return entry.label;
|
||||
}
|
||||
}
|
||||
return trimmed || undefined;
|
||||
}
|
||||
|
||||
export function getWindowsVersionName(osVersion: string): string {
|
||||
const parts = osVersion.split('.');
|
||||
const majorVersion = parseInt(parts[0], 10);
|
||||
const buildNumber = parseInt(parts[2], 10);
|
||||
if (majorVersion === 10) {
|
||||
if (buildNumber >= 22000) {
|
||||
return 'Windows 11';
|
||||
}
|
||||
return 'Windows 10';
|
||||
}
|
||||
return 'Windows';
|
||||
}
|
||||
|
||||
export function formatDesktopOsName(desktopInfo: {os: string; osVersion?: string}): string {
|
||||
switch (desktopInfo.os) {
|
||||
case 'darwin':
|
||||
return 'macOS';
|
||||
case 'win32':
|
||||
return desktopInfo.osVersion ? getWindowsVersionName(desktopInfo.osVersion) : 'Windows';
|
||||
case 'linux':
|
||||
return 'Linux';
|
||||
default:
|
||||
return desktopInfo.os;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
export const PUNCTUATION_KEY_CODES: Readonly<Record<string, string>> = {
|
||||
' ': 'Space',
|
||||
'-': 'Minus',
|
||||
_: 'Minus',
|
||||
'=': 'Equal',
|
||||
'+': 'Equal',
|
||||
',': 'Comma',
|
||||
'<': 'Comma',
|
||||
'.': 'Period',
|
||||
'>': 'Period',
|
||||
';': 'Semicolon',
|
||||
':': 'Semicolon',
|
||||
"'": 'Quote',
|
||||
'"': 'Quote',
|
||||
'/': 'Slash',
|
||||
'?': 'Slash',
|
||||
'\\': 'Backslash',
|
||||
'|': 'Backslash',
|
||||
'[': 'BracketLeft',
|
||||
'{': 'BracketLeft',
|
||||
']': 'BracketRight',
|
||||
'}': 'BracketRight',
|
||||
'`': 'Backquote',
|
||||
'~': 'Backquote',
|
||||
};
|
||||
|
||||
export function isPrintableShortcutKey(key: string | null | undefined): key is string {
|
||||
if (!key) return false;
|
||||
if (key === 'Dead' || key === 'Unidentified' || key === 'Process') return false;
|
||||
return key.length === 1;
|
||||
}
|
||||
|
||||
export function shouldPreferLayoutKey(combo: {key?: string | null; code?: string}): boolean {
|
||||
if (!isPrintableShortcutKey(combo.key)) return false;
|
||||
return !(combo.code && /^Numpad/.test(combo.code));
|
||||
}
|
||||
|
||||
export function hookKeyNameForLayoutKey(key: string): string | null {
|
||||
if (key.length !== 1) return null;
|
||||
const punctuation = PUNCTUATION_KEY_CODES[key];
|
||||
if (punctuation) return punctuation;
|
||||
const upper = key.toUpperCase();
|
||||
return /^[A-Z0-9]$/.test(upper) ? upper : null;
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import {isRecord} from '@fluxer/record_utils/src/RecordGuards';
|
||||
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
const LEGACY_SKELETON_LAYOUT_MEMORY_KEY = 'SkeletonLayoutMemory';
|
||||
@@ -59,10 +61,6 @@ const MAX_SIDEBAR_WIDTH_PX = 480;
|
||||
const MAX_ACCOUNT_KEY_LENGTH = 256;
|
||||
const NO_SELECTED_ROW_INDEX = -1;
|
||||
|
||||
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
||||
}
|
||||
|
||||
function parseRecord(value: unknown): Record<string, unknown> | null {
|
||||
if (typeof value !== 'string') return null;
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user