0.16.1-5 Ebcode Fix / presets
This commit is contained in:
+33
-5
@@ -13,7 +13,6 @@ import HistoryPage from './pages/HistoryPage';
|
||||
import DatabasePage from './pages/DatabasePage';
|
||||
import DownloadsPage from './pages/DownloadsPage';
|
||||
import ConverterPage from './pages/ConverterPage';
|
||||
import JobsInboxPage from './pages/JobsInboxPage';
|
||||
import AudiobooksPage from './pages/AudiobooksPage';
|
||||
|
||||
function normalizeJobId(value) {
|
||||
@@ -150,6 +149,14 @@ function App() {
|
||||
const navigate = useNavigate();
|
||||
const globalToastRef = useRef(null);
|
||||
const prevCdDrivesRef = useRef({});
|
||||
const hardwareWarmupRef = useRef({ timer: null, attempts: 0 });
|
||||
|
||||
const clearHardwareWarmupRetry = () => {
|
||||
if (hardwareWarmupRef.current?.timer) {
|
||||
clearTimeout(hardwareWarmupRef.current.timer);
|
||||
hardwareWarmupRef.current.timer = null;
|
||||
}
|
||||
};
|
||||
|
||||
// When a virtual CD drive is removed (CD encode/rip finished or failed),
|
||||
// or when a CD drive transitions away from an active job, force both
|
||||
@@ -194,7 +201,23 @@ function App() {
|
||||
const refreshPipeline = async () => {
|
||||
const response = await api.getPipelineState();
|
||||
setPipeline(response.pipeline);
|
||||
setHardwareMonitoring(response?.hardwareMonitoring || null);
|
||||
const monitoringPayload = response?.hardwareMonitoring || null;
|
||||
setHardwareMonitoring(monitoringPayload);
|
||||
const monitoringEnabled = Boolean(monitoringPayload?.enabled);
|
||||
const hasSample = Boolean(monitoringPayload?.sample && typeof monitoringPayload.sample === 'object');
|
||||
if (monitoringEnabled && !hasSample) {
|
||||
const nextAttempts = Number(hardwareWarmupRef.current?.attempts || 0) + 1;
|
||||
hardwareWarmupRef.current.attempts = nextAttempts;
|
||||
if (nextAttempts <= 10 && !hardwareWarmupRef.current.timer) {
|
||||
hardwareWarmupRef.current.timer = setTimeout(() => {
|
||||
hardwareWarmupRef.current.timer = null;
|
||||
refreshPipeline().catch(() => null);
|
||||
}, 1000);
|
||||
}
|
||||
} else {
|
||||
hardwareWarmupRef.current.attempts = 0;
|
||||
clearHardwareWarmupRetry();
|
||||
}
|
||||
return response;
|
||||
};
|
||||
|
||||
@@ -310,10 +333,17 @@ function App() {
|
||||
setExpertMode(val === 'true' || val === true);
|
||||
})
|
||||
.catch(() => null);
|
||||
return () => {
|
||||
clearHardwareWarmupRetry();
|
||||
};
|
||||
}, []);
|
||||
|
||||
useWebSocket({
|
||||
onMessage: (message) => {
|
||||
if (message.type === 'WS_CONNECTED') {
|
||||
refreshPipeline().catch(() => null);
|
||||
}
|
||||
|
||||
if (message.type === 'PIPELINE_STATE_CHANGED') {
|
||||
setPipeline(message.payload);
|
||||
}
|
||||
@@ -575,7 +605,6 @@ function App() {
|
||||
});
|
||||
|
||||
const nav = [
|
||||
{ label: 'Jobs', path: '/jobs' },
|
||||
{ label: 'Ripper', path: '/ripper' },
|
||||
{ label: 'Converter', path: '/converter' },
|
||||
{ label: 'Audiobooks', path: '/audiobooks' },
|
||||
@@ -705,13 +734,12 @@ function App() {
|
||||
</RipperPage>
|
||||
}
|
||||
>
|
||||
<Route index element={<Navigate to="jobs" replace />} />
|
||||
<Route index element={<Navigate to="ripper" replace />} />
|
||||
<Route path="ripper" element={null} />
|
||||
<Route path="settings" element={<SettingsPage />} />
|
||||
<Route path="history" element={<HistoryPage refreshToken={historyJobsRefreshToken} />} />
|
||||
<Route path="downloads" element={<DownloadsPage refreshToken={downloadsRefreshToken} />} />
|
||||
<Route path="database" element={<DatabasePage />} />
|
||||
<Route path="jobs" element={<JobsInboxPage />} />
|
||||
<Route path="converter" element={<ConverterPage />} />
|
||||
<Route
|
||||
path="audiobooks"
|
||||
|
||||
Reference in New Issue
Block a user