Files
OpenFlare/atsf_server/web/features/update/api/update.ts
T
ryan f50eb9adee feat: add support for release channels in version upgrade and node agent updates
- 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.
2026-03-12 11:25:13 +08:00

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 }),
});
}