feat: WebguiCheckForUpdate using server-side check

This commit is contained in:
Zack Spear
2024-01-11 13:56:53 -06:00
committed by Zack Spear
parent e8d15c7dbb
commit e29f5e1adf

View File

@@ -1,4 +1,6 @@
import { request } from '~/composables/services/request';
import { OS_RELEASES } from '~/helpers/urls';
import type { ServerUpdateOsResponse } from '~/types/server';
/**
* @name WebguiInstallKey
* @description used to auto install key urls
@@ -92,3 +94,27 @@ export const WebguiNotify = async (payload: NotifyPostParameters) => {
return error;
}
};
export const WebguiCheckForUpdate = async (): Promise<ServerUpdateOsResponse | unknown> => {
console.debug('[WebguiCheckForUpdate]');
try {
const response: ServerUpdateOsResponse = await request
.url('/plugins/dynamix.plugin.manager/include/UnraidCheck.php')
.query({
altUrl: OS_RELEASES.toString(),
json: true,
})
.get()
.json((json) => {
return json;
})
.catch((error) => {
console.error('[WebguiCheckForUpdate] catch failed to execute UpdateCheck', error);
return error;
});
return response;
} catch (error) {
console.error('[WebguiCheckForUpdate] catch failed to execute UpdateCheck', error);
return error;
}
};