mirror of
https://github.com/unraid/api.git
synced 2026-02-17 13:38:29 -06:00
feat: WebguiCheckForUpdate using server-side check
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user