mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 22:06:38 +08:00
f50eb9adee
- Introduced ReleaseChannel type to manage stable and preview releases. - Updated DashboardTopbar to handle version upgrades based on selected release channel. - Enhanced node detail page to allow manual checks for agent updates on stable and preview channels. - Modified API endpoints to support fetching and upgrading based on release channels. - Updated UI components to reflect changes in version checking and upgrade processes. - Added tests for new functionality related to preview releases and agent updates.
38 lines
999 B
TypeScript
38 lines
999 B
TypeScript
import { apiRequest } from '@/lib/api/client';
|
|
|
|
import type {
|
|
LatestReleaseInfo,
|
|
ReleaseChannel,
|
|
UploadedServerBinaryInfo,
|
|
} from '@/features/update/types';
|
|
|
|
export function getLatestRelease(channel: ReleaseChannel = 'stable') {
|
|
return apiRequest<LatestReleaseInfo>(
|
|
`/update/latest-release?channel=${channel}`,
|
|
);
|
|
}
|
|
|
|
export function upgradeServer(channel: ReleaseChannel = 'stable') {
|
|
return apiRequest<LatestReleaseInfo>('/update/upgrade', {
|
|
method: 'POST',
|
|
body: JSON.stringify({ channel }),
|
|
});
|
|
}
|
|
|
|
export function uploadServerBinary(binary: File) {
|
|
const formData = new FormData();
|
|
formData.append('binary', binary);
|
|
|
|
return apiRequest<UploadedServerBinaryInfo>('/update/manual-upload', {
|
|
method: 'POST',
|
|
body: formData,
|
|
});
|
|
}
|
|
|
|
export function confirmManualServerUpgrade(uploadToken: string) {
|
|
return apiRequest<UploadedServerBinaryInfo>('/update/manual-upgrade', {
|
|
method: 'POST',
|
|
body: JSON.stringify({ upload_token: uploadToken }),
|
|
});
|
|
}
|