Added file endpoint for license files and easy upload in admin UI (#5055)

<img width="698" height="240" alt="image"
src="https://github.com/user-attachments/assets/f0161e5f-e2ed-44c1-bdd1-93fab46f756b"
/>

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
ConnorYoh
2025-11-29 19:35:50 +00:00
committed by GitHub
parent 959d14f075
commit 1e72416d55
5 changed files with 389 additions and 35 deletions

View File

@@ -80,6 +80,10 @@ export interface LicenseInfo {
export interface LicenseSaveResponse {
success: boolean;
licenseType?: string;
filename?: string;
filePath?: string;
enabled?: boolean;
maxUsers?: number;
message?: string;
error?: string;
}
@@ -419,6 +423,29 @@ const licenseService = {
}
},
/**
* Upload license certificate file for offline activation
* @param file - The .lic or .cert file to upload
* @returns Promise with upload result
*/
async saveLicenseFile(file: File): Promise<LicenseSaveResponse> {
try {
const formData = new FormData();
formData.append('file', file);
const response = await apiClient.post('/api/v1/admin/license-file', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
return response.data;
} catch (error) {
console.error('Error uploading license file:', error);
throw error;
}
},
/**
* Get current license information from backend
*/