refactor: update os check conditional altUrl param

This commit is contained in:
Zack Spear
2024-01-30 13:29:18 -08:00
committed by Zack Spear
parent 639eb08291
commit ce3ba7d070
+12 -4
View File
@@ -95,15 +95,23 @@ export const WebguiNotify = async (payload: NotifyPostParameters) => {
}
};
interface WebguiCheckForUpdatePayload {
json?: boolean;
altUrl?: string;
}
export const WebguiCheckForUpdate = async (): Promise<ServerUpdateOsResponse | unknown> => {
console.debug('[WebguiCheckForUpdate]');
try {
const params: WebguiCheckForUpdatePayload = {
json: true,
};
// conditionally add altUrl if OS_RELEASES.toString() is not 'https://releases.unraid.net/os'
if (OS_RELEASES.toString() !== 'https://releases.unraid.net/os') {
params.altUrl = OS_RELEASES.toString();
}
const response = await request
.url('/plugins/dynamix.plugin.manager/include/UnraidCheck.php')
.query({
altUrl: OS_RELEASES.toString(),
json: true,
})
.query(params)
.get()
.json((json) => {
return json as ServerUpdateOsResponse;