feat: Made ffmpeg select button work

This commit is contained in:
Misa Liu 2024-03-05 00:15:48 +08:00
parent 7d36e49bb2
commit 9ff851ebb4
No known key found for this signature in database
GPG Key ID: F70B23D0A4FED791

View File

@ -90,9 +90,8 @@ async function onSettingWindowCreated(view: Element) {
], 'ob11.messagePostFormat', config.ob11.messagePostFormat),
),
SettingItem(
'ffmpeg 路径', `<span id="config-ffmpeg-path">${!isEmpty(config.ffmpeg) ? config.ffmpeg : '未指定'}</span>`,
'ffmpeg 路径', `<span id="config-ffmpeg-path-text">${!isEmpty(config.ffmpeg) ? config.ffmpeg : '未指定'}</span>`,
SettingButton('选择', 'config-ffmpeg-select'),
'config-ffmpeg-path',
),
SettingItem(
'', null,
@ -202,6 +201,16 @@ async function onSettingWindowCreated(view: Element) {
doc.querySelector('#config-ob11-httpHosts-add').addEventListener('click', () => addReverseHost('httpHosts'));
doc.querySelector('#config-ob11-wsHosts-add').addEventListener('click', () => addReverseHost('wsHosts'));
doc.querySelector('#config-ffmpeg-select').addEventListener('click', () => {
window.llonebot.selectFile()
.then(path => {
if (!isEmpty(path)) {
setConfig('ffmpeg', path);
document.querySelector('#config-ffmpeg-path-text').innerHTML = path;
}
})
});
// 开关
doc.querySelectorAll('setting-switch[data-config-key]').forEach((dom: HTMLElement) => {
dom.addEventListener('click', () => {