[enhancement]: Support disabling MPV entirely

Supports running Feishin solely using web audio (useful for clients with problems with MPV).
Also moves save/restore queue to utils, as MPV object is now optional
This commit is contained in:
Kendall Garner 2024-02-11 13:56:29 -08:00
parent ae8fc6df13
commit f82da2e76b
No known key found for this signature in database
GPG key ID: 18D2767419676C87
10 changed files with 127 additions and 74 deletions

View file

@ -1,4 +1,4 @@
import { useState, useEffect } from 'react';
import { useMemo } from 'react';
import { Center, Group, Stack } from '@mantine/core';
import isElectron from 'is-electron';
import { useTranslation } from 'react-i18next';
@ -18,23 +18,19 @@ const localSettings = isElectron() ? window.electron.localSettings : null;
const ActionRequiredRoute = () => {
const { t } = useTranslation();
const currentServer = useCurrentServer();
const [isMpvRequired, setIsMpvRequired] = useState(false);
const isServerRequired = !currentServer;
const isCredentialRequired = false;
useEffect(() => {
const getMpvPath = async () => {
if (!localSettings) return setIsMpvRequired(false);
const mpvPath = await localSettings.get('mpv_path');
const isMpvRequired = useMemo(() => {
if (!localSettings) return false;
if (mpvPath) {
return setIsMpvRequired(false);
}
const mpvPath = localSettings.get('mpv_path');
if (mpvPath) {
return false;
}
return setIsMpvRequired(true);
};
getMpvPath();
const mpvDisabled = localSettings.get('disable_mpv');
return !mpvDisabled;
}, []);
const checks = [