Add an HTTP API endpoint + UI widgets to stream logs (#49)

* Added JSON logs to Desktop

* Move logging config into librqbit for reuse

* Log printer now available in both Desktop and Web UI

* Fix JS type error
This commit is contained in:
Igor Katson 2023-12-09 00:26:14 +00:00 committed by GitHub
parent 9385524a1a
commit 2017c5ec94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 462 additions and 333 deletions

View file

@ -18,27 +18,25 @@ export const RqbitDesktop: React.FC<{
currentState.config ?? defaultConfig
);
let [configurationOpened, setConfigurationOpened] = useState<boolean>(false);
let [logsOpened, setLogsOpened] = useState<boolean>(false);
const configButton = (
<IconButton
className="p-3 text-primary"
onClick={() => {
setConfigurationOpened(true);
}}
>
<BsSliders2 />
</IconButton>
);
return (
<APIContext.Provider value={makeAPI(config)}>
{configured && (
<RqbitWebUI title={`Rqbit Desktop v${version}`}></RqbitWebUI>
)}
{configured && (
<div className="position-absolute top-0 start-0">
<IconButton
className="p-3 text-primary"
onClick={() => {
setConfigurationOpened(true);
}}
>
<BsSliders2 />
</IconButton>
<IconButton onClick={() => setLogsOpened(true)}>
<BsBodyText />
</IconButton>
</div>
<RqbitWebUI
title={`Rqbit Desktop v${version}`}
menuButtons={[configButton]}
></RqbitWebUI>
)}
<ConfigModal
show={!configured || configurationOpened}
@ -56,7 +54,6 @@ export const RqbitDesktop: React.FC<{
initialConfig={config}
defaultConfig={defaultConfig}
/>
<LogStreamModal show={logsOpened} onClose={() => setLogsOpened(false)} />
</APIContext.Provider>
);
};