Fix Web UI logs in compiled server

This commit is contained in:
Igor Katson 2023-12-09 13:50:56 +00:00
parent 71a425ce66
commit 1331145333
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
8 changed files with 25 additions and 27 deletions

View file

@ -69,10 +69,15 @@ async function readFileAsBase64(file: File): Promise<string> {
export const makeAPI = (configuration: RqbitDesktopConfig): RqbitAPI => {
return {
getHttpBaseUrl: () => {
return configuration.http_api.listen_addr
? `http://${configuration.http_api.listen_addr}`
: null;
getStreamLogsUrl: () => {
if (!configuration.http_api.listen_addr) {
return null;
}
let port = configuration.http_api.listen_addr.split(":")[1];
if (!port) {
return null;
}
return `http://127.0.0.1:${port}/stream_logs`;
},
listTorrents: async function (): Promise<ListTorrentsResponse> {
return await invokeAPI<ListTorrentsResponse>("torrents_list");