2024-02-22 02:12:01 +00:00
|
|
|
import { WEBUI_BASE_URL } from '$lib/constants';
|
2023-12-26 19:32:22 +00:00
|
|
|
|
|
|
|
export const getBackendConfig = async () => {
|
2023-12-26 11:28:30 +00:00
|
|
|
let error = null;
|
|
|
|
|
2024-02-22 02:12:01 +00:00
|
|
|
const res = await fetch(`${WEBUI_BASE_URL}/api/config`, {
|
2023-12-26 11:28:30 +00:00
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
2023-12-26 19:32:22 +00:00
|
|
|
'Content-Type': 'application/json'
|
2023-12-26 11:28:30 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(async (res) => {
|
|
|
|
if (!res.ok) throw await res.json();
|
|
|
|
return res.json();
|
|
|
|
})
|
2023-12-26 19:32:22 +00:00
|
|
|
.catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
error = err;
|
2023-12-26 11:28:30 +00:00
|
|
|
return null;
|
|
|
|
});
|
|
|
|
|
2024-02-25 19:55:15 +00:00
|
|
|
if (error) {
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
|
2023-12-26 19:32:22 +00:00
|
|
|
return res;
|
2023-12-26 11:28:30 +00:00
|
|
|
};
|
2024-02-23 08:30:26 +00:00
|
|
|
|
|
|
|
export const getChangelog = async () => {
|
|
|
|
let error = null;
|
|
|
|
|
|
|
|
const res = await fetch(`${WEBUI_BASE_URL}/api/changelog`, {
|
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(async (res) => {
|
|
|
|
if (!res.ok) throw await res.json();
|
|
|
|
return res.json();
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
error = err;
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
|
2024-02-25 19:55:15 +00:00
|
|
|
if (error) {
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getVersionUpdates = async () => {
|
|
|
|
let error = null;
|
|
|
|
|
|
|
|
const res = await fetch(`${WEBUI_BASE_URL}/api/version/updates`, {
|
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(async (res) => {
|
|
|
|
if (!res.ok) throw await res.json();
|
|
|
|
return res.json();
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.log(err);
|
|
|
|
error = err;
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
throw error;
|
|
|
|
}
|
|
|
|
|
2024-02-23 08:30:26 +00:00
|
|
|
return res;
|
|
|
|
};
|