This commit is contained in:
2026-10-19 00:11:20 +07:00
parent f74b2a8a41
commit 0f948b316a
8 changed files with 176 additions and 3 deletions
+20
View File
@@ -26,6 +26,7 @@ import { PackageStore } from './package-store.js'
import { packageMediaResponse } from './package-media.js'
import { prepareFetchHeaders } from './response-headers.js'
import { fetchNetwork } from './network-fetch.js'
import { playSoundCheck, soundCheckWav } from './sound-check.js'
import type { HostInfo } from '../src/types/screen.js'
// Ozone выбирается до main.js; поздний appendSwitch смешивает Wayland и X11.
@@ -421,6 +422,8 @@ app
'X-Content-Type-Options': 'nosniff',
}
if (url.host !== 'app' || request.method !== 'GET') return new Response(null, { status: 404 })
if (url.pathname === '/sound-check.wav')
return new Response(soundCheckWav, { headers: { ...headers, 'Content-Type': 'audio/wav' } })
if (url.pathname.startsWith('/packages/')) return packageMediaResponse(packages, request)
if (url.pathname.startsWith('/media/')) {
const media =
@@ -554,8 +557,25 @@ app
control.on('unmaximize', scheduleSave)
control.on('close', saveWindowSettings)
secure(control)
let checkingSound = false
ipcMain.handle('check-sound', async (event) => {
requireControl(event)
if (checkingSound) throw new Error('Проверка звука уже выполняется')
checkingSound = true
try {
await audioOutput.prepare(async (id) => {
const window = audioDevicesWindow
if (!window || window.isDestroyed()) throw new Error('Проверка звука недоступна')
await setAudioSink(window, id)
await window.webContents.executeJavaScript(`(${playSoundCheck.toString()})()`)
})
} finally {
checkingSound = false
}
})
ipcMain.handle('select-audio-output', (event, id: unknown) => {
requireControl(event)
if (checkingSound) throw new Error('Подождите завершения проверки звука')
return audioOutput.select(id)
})
ipcMain.handle('prepare-audio-output', async (event) => {