mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
chore(repo): remove dead code and useless tests (#3375)
This commit is contained in:
1 parent
7e177a1c90
commit
1cd62eb661
1391 files changed
+783
-120415
No files matched your search
@@ -7,12 +7,10 @@ import type {
|
||||
NativeAudioApplication,
|
||||
NativeAudioAvailability,
|
||||
NativeAudioEndReason,
|
||||
NativeAudioRoutingGraphResult,
|
||||
NativeAudioStartOptions,
|
||||
NativeAudioStartResult,
|
||||
VirtmicLinkOptions,
|
||||
VirtmicNode,
|
||||
VirtmicRoutingGraph,
|
||||
} from '@electron/common/Types';
|
||||
import {buildFluxerAudioExcludePatterns, isKnownFluxerAudioProcessPid} from '@electron/main/FluxerAudioIdentity';
|
||||
import {getNativeAudioMode} from '@electron/main/LaunchOptions';
|
||||
@@ -41,7 +39,6 @@ interface NativeCaptureInstance {
|
||||
start(): Promise<void> | void;
|
||||
stop(): Promise<void> | void;
|
||||
setRoutingRule?: (target: {linuxRule: NonNullable<NativeAudioStartOptions['linuxRule']>}) => boolean;
|
||||
routingGraph?: () => VirtmicRoutingGraph | null;
|
||||
}
|
||||
|
||||
interface WindowsNativeAudioModule {
|
||||
@@ -860,32 +857,6 @@ async function startNativeAudioCapture(
|
||||
};
|
||||
}
|
||||
|
||||
function getNativeAudioRoutingGraph(sender: Electron.WebContents, captureId?: string): NativeAudioRoutingGraphResult {
|
||||
const loadResult = loadNativeAudioAddon();
|
||||
const availability = loadResult.availability;
|
||||
if (loadResult.platform !== 'linux' || !availability.available) {
|
||||
return {ok: false, graphs: [], availability};
|
||||
}
|
||||
const ownedIds = activeSessionIdsBySenderId.get(sender.id);
|
||||
const candidateIds =
|
||||
typeof captureId === 'string' && captureId
|
||||
? ownedIds?.has(captureId)
|
||||
? [captureId]
|
||||
: []
|
||||
: Array.from(ownedIds ?? []);
|
||||
const graphs = candidateIds
|
||||
.map((id) => {
|
||||
const session = activeSessions.get(id);
|
||||
if (!session || session.sender.id !== sender.id) return null;
|
||||
return {
|
||||
captureId: id,
|
||||
graph: session.capture.routingGraph?.() ?? null,
|
||||
};
|
||||
})
|
||||
.filter((entry): entry is {captureId: string; graph: VirtmicRoutingGraph | null} => entry !== null);
|
||||
return {ok: true, graphs, availability};
|
||||
}
|
||||
|
||||
export function registerNativeAudioHandlers(): void {
|
||||
if (handlersRegistered) return;
|
||||
handlersRegistered = true;
|
||||
@@ -919,10 +890,6 @@ export function registerNativeAudioHandlers(): void {
|
||||
}
|
||||
await stopActiveSession(session, 'stopped');
|
||||
});
|
||||
ipcMain.handle(
|
||||
'native-audio:get-routing-graph',
|
||||
(event, captureId?: string): NativeAudioRoutingGraphResult => getNativeAudioRoutingGraph(event.sender, captureId),
|
||||
);
|
||||
}
|
||||
|
||||
export function cleanupNativeAudio(): void {
|
||||
@@ -933,7 +900,6 @@ export function cleanupNativeAudio(): void {
|
||||
ipcMain.removeHandler('native-audio:start');
|
||||
ipcMain.removeHandler('native-audio:set-rule');
|
||||
ipcMain.removeHandler('native-audio:stop');
|
||||
ipcMain.removeHandler('native-audio:get-routing-graph');
|
||||
handlersRegistered = false;
|
||||
for (const session of [...activeSessions.values()]) {
|
||||
stopActiveSession(session, 'stopped').catch((error) =>
|
||||
|
||||
Reference in new issue
Block a user