mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-01 06:36:38 +08:00
93e43fb3b0
- Implemented UploadManualServerBinary endpoint for uploading server binaries and checking their versions. - Added ConfirmManualServerUpgrade endpoint to confirm the upgrade with the uploaded binary. - Updated API routes to include manual upload and upgrade confirmation. - Enhanced service layer to handle manual binary uploads, version detection, and upgrade execution. - Introduced new types for handling uploaded binary information. - Updated frontend components to support manual binary upload and confirmation, including UI feedback for users. - Modified documentation to reflect new manual upload and upgrade features.
34 lines
846 B
TypeScript
34 lines
846 B
TypeScript
import { apiRequest } from '@/lib/api/client';
|
|
|
|
import type {
|
|
LatestReleaseInfo,
|
|
UploadedServerBinaryInfo,
|
|
} from '@/features/update/types';
|
|
|
|
export function getLatestRelease() {
|
|
return apiRequest<LatestReleaseInfo>('/update/latest-release');
|
|
}
|
|
|
|
export function upgradeServer() {
|
|
return apiRequest<LatestReleaseInfo>('/update/upgrade', {
|
|
method: 'POST',
|
|
});
|
|
}
|
|
|
|
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 }),
|
|
});
|
|
}
|