mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-03-19 02:22:11 +01:00
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:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user